Author: nbelaevski
Date: 2010-11-04 13:47:38 -0400 (Thu, 04 Nov 2010)
New Revision: 19936
Modified:
trunk/core/impl/src/main/resources/META-INF/resources/richfaces.js
trunk/core/impl/src/test/resources/javascript/4_0_0.html
Log:
https://jira.jboss.org/browse/RF-7817
Modified: trunk/core/impl/src/main/resources/META-INF/resources/richfaces.js
===================================================================
--- trunk/core/impl/src/main/resources/META-INF/resources/richfaces.js 2010-11-04 17:46:06
UTC (rev 19935)
+++ trunk/core/impl/src/main/resources/META-INF/resources/richfaces.js 2010-11-04 17:47:38
UTC (rev 19936)
@@ -308,61 +308,6 @@
}
};
- var pushTracker = {};
-
- richfaces.startPush = function(options) {
- var clientId = options.clientId;
- var pushResourceUrl = options.pushResourceUrl;
- var pushId = options.pushId;
- var interval = options.interval;
- var ondataavailable = options.ondataavailable;
- richfaces.setZeroRequestDelay(options);
-
- richfaces.stopPush(pushId);
-
- pushTracker[pushId] = setTimeout(function() { // TODO: define this function in
richfaces object to avoid definition every time when call startPush
- var ajaxOptions = {
- type: "HEAD",
- //TODO - encodeURIComponent; URL sessionId handling check
- //TODO - add pushUri supports
- url: pushResourceUrl + "?id=" + pushId,
- dataType: "text",
- complete: function(xhr) {
- var isPushActive = !!pushTracker[pushId];
-
- //TODO may someone wish to stop push from dataavailable handler?
- delete pushTracker[pushId];
-
- if (xhr.status == 200 && xhr.getResponseHeader("Ajax-Push-Status")
== "READY") {
- var pushElement = document.getElementById(clientId);
- try {
- ondataavailable.call(pushElement || window);
- } catch (e) {
- // TODO: handle exception
- }
- }
-
- if (isPushActive) {
- richfaces.startPush(options);
- }
- }
- };
-
- if (options.timeout) {
- ajaxOptions.timeout = options.timeout;
- }
-
- jQuery.ajax(ajaxOptions);
- }, interval);
- };
-
- richfaces.stopPush = function(id) {
- if (pushTracker[id]){
- window.clearTimeout(pushTracker[id]);
- delete pushTracker[id];
- }
- };
-
var jsfEventsAdapterEventNames = {
event: {
'begin': ['begin'],
@@ -517,6 +462,7 @@
};
return {
+ 'error': null,
'begin': null,
'complete': serverEventHandler,
'beforedomupdate': serverEventHandler
Modified: trunk/core/impl/src/test/resources/javascript/4_0_0.html
===================================================================
--- trunk/core/impl/src/test/resources/javascript/4_0_0.html 2010-11-04 17:46:06 UTC (rev
19935)
+++ trunk/core/impl/src/test/resources/javascript/4_0_0.html 2010-11-04 17:47:38 UTC (rev
19936)
@@ -85,36 +85,6 @@
equals(RichFaces.interpolate("{prop1} {prop2} {prop3}", context),
"value1 value2 {prop3}");
});
- test("RichFaces.startPush and RichFaces.stopPush test", function() {
- var timeoutFakeObject = {id:"timeoutFakeObject"};
- expect(1);
- var options = {
- pushId : "pushId",
- clientId: "pushElt",
- interval : 700,
- ondataavailable : function() {
- ok(true, "Function 'ondataavailable' has been called");
- }
- };
- var xhr = {
- status : 200,
- getResponseHeader : function() { return "READY" }
- };
- var ajax = jQuery.ajax;
- jQuery.ajax = function(ajaxOptions) {
- RichFaces.stopPush(options.pushId);
- ajaxOptions.complete(xhr);
- };
- var setTimeout = window.setTimeout;
- window.setTimeout = function(func, delay) {
- func();
- return timeoutFakeObject;
- };
- RichFaces.startPush(options);
- jQuery.ajax = ajax;
- window.setTimeout = setTimeout;
- });
-
test("RichFaces.createJSFEventsAdapter test", function() {
expect(2);
var eventData = {