},
ctx_new_getchar: function(idx) { /* public */
+ return (this.ctx_new[idx]);
},
ctx_old_len_is_set: function () { /* public */
this.xynt_streaming = xynt_streaming;
this.transfdoc = new ActiveXObject("htmlfile");
this.transfdoc.open();
- /*this.transfdoc.write("<html><head><script>");
- this.transfdoc.write("document.domain=\""+(doc.domain)+"\";");
- this.transfdoc.write("</"+"script></"+"head>"); */
this.transfdoc.write("<html><body><iframe id='iframe'></iframe></body></html>");
this.transfdoc.close();
this.ifra = this.transfdoc.getElementById("iframe");
this.ifra.contentWindow.location.href = page;
+ this.stopped = false;
}
transport_htmlfile.prototype = {
doc: null,
xynt_streaming: null,
+ stopped: true,
ifra: null,
tradoc: null,
return (typeof(this.ifra.contentWindow.xynt_streaming) != 'undefined');
},
+ /* only after a successfull is_initialized call */
+ xstr_is_ready: function () { /* public */
+ return (this.ifra.contentWindow.xynt_streaming == "ready");
+ },
+
/* only after a successfull is_initialized call */
xstr_set: function () { /* public */
if (this.ifra.contentWindow.xynt_streaming == "ready") {
this.ifra.contentWindow.script_clean = step;
},
- postproc: function () {
+ postproc: function () { /* public */
+ if (this.stopped && !this.xstr_is_ready()) {
+ this.xynt_streaming.reload();
+ }
}
}
this.ifra.style.visibility = "hidden";
doc.body.appendChild(this.ifra);
this.ifra.contentWindow.location.href = page;
+ this.stopped = false;
}
transport_iframe.prototype = {
doc: null,
xynt_streaming: null,
+ stopped: true,
ifra: null,
destroy: function () { /* public */
- if (this.ifra != null) {
- this.doc.body.removeChild(this.ifra);
- delete this.ifra;
- this.ifra = null;
+ try {
+ if (this.ifra != null) {
+ // NOTE: on Opera this remove child crash js if called from
+ // inside of the iframe, on IE on Windows without
+ // it stream abort fails.
+ // the problem is fixed setting into the iframe's onload
+ // function the stopped attribute to true and delegate
+ // postproc() fired by xynt_streaming watchdog()
+ this.doc.body.removeChild(this.ifra);
+ delete this.ifra;
+ this.ifra = null;
+ }
+ } catch (b) {
+ alert("destroy exception catched");
}
},
this.ifra.contentWindow.script_clean = step;
},
- postproc: function () {
+ postproc: function () { /* public */
+ if (this.stopped && !this.xstr_is_ready()) {
+ this.xynt_streaming.reload();
+ }
}
}
this.page = page;
this.cmdproc = cmdproc;
// this.cmdproc = function(com){/* console.log("COM: "+com); */ eval(com);}
-
this.doc = win.document;
this.keepalive_old = -1;
this.keepalive_new = -1;
page: null,
cmdproc: null,
+ start_time: 0,
+ restart_wait: 5000, // wait restart_wait millisec before begin to check if restart is needed
+
doc: null,
cookiepath: "/brisk/",
watchdog_hdl: null,
keepalive_new: -1,
keepalives_equal: 0,
/* NOTE: right watch_timeout value to 100, for devel reasons use 1000 or more */
- /* restart after 3 * 40 * 100 millisec if server ping is missing => 12secs */
- keepalives_eq_max: 3,
+ /* restart after 4 * 40 * 100 millisec if server ping is missing => 16secs */
+ keepalives_eq_max: 4,
watchdog_checktm: 40,
- // FIXME watchdog_timeout: 100,
watchdog_timeout: 100,
watchdog_ct: 0,
watchable: false,
// transport instantiation
if (this.transp_type == "xhr") {
+ this.page = url_append_args(this.page, "transp", "xhr");
this.transp = new transport_xhr(this.doc, this, this.page);
}
else if (this.transp_type == "iframe") {
+ this.page = url_append_args(this.page, "transp", "iframe");
this.transp = new transport_iframe(this.doc, this, this.page);
}
else if (this.transp_type == "htmlfile") {
+ this.page = url_append_args(this.page, "transp", "htmlfile");
this.transp = new transport_htmlfile(this.doc, this, this.page);
}
else
if (!this.the_end) {
this.watchdog_hdl = setTimeout(function(obj) { obj.log("tout1"); obj.watchdog(); }, this.watchdog_timeout, this);
}
+
+ var date = new Date();
+ this.start_time = date.getTime();
},
stop: function() {
this.keepalives_equal = 0;
}
- if (this.keepalives_equal > this.keepalives_eq_max) {
+ if (this.keepalives_equal >= this.keepalives_eq_max) {
this.log("hs::watchdog: MAX ACHIEVED "+this.keepalives_equal);
this.reload();
// alert("watchdog return reload");
} while (again);
this.watchdog_ct++;
if (!this.the_end) {
- this.transp.postproc();
+ var date = new Date();
+ if (date.getTime() > (this.start_time + this.restart_wait)) {
+ this.transp.postproc();
+ }
this.watchdog_hdl = setTimeout(function(obj) { /* obj.log("tout2"); */ obj.watchdog(); }, this.watchdog_timeout, this);
}
// alert("watchdog return normal");