projects
/
xynt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
clean of string stream added (we still need <script> objects clean)
[xynt.git]
/
web
/
xynt
/
xynt-http-streaming.js
diff --git
a/web/xynt/xynt-http-streaming.js
b/web/xynt/xynt-http-streaming.js
index
d671d8f
..
130af82
100644
(file)
--- a/
web/xynt/xynt-http-streaming.js
+++ b/
web/xynt/xynt-http-streaming.js
@@
-27,14
+27,15
@@
globst.prototype = {
}
}
}
}
-function http_streaming(win, cons)
+function http_streaming(win,
gst, sess,
cons)
{
this.console = cons;
this.win = win;
{
this.console = cons;
this.win = win;
+ this.sess = sess;
this.doc = win.document;
this.keepalive_old = -1;
this.keepalive_new = -1;
this.doc = win.document;
this.keepalive_old = -1;
this.keepalive_new = -1;
- this.gst =
new globst()
;
+ this.gst =
gst
;
this.cmdproc = function(com){eval(com);}
}
this.cmdproc = function(com){eval(com);}
}
@@
-42,6
+43,7
@@
http_streaming.prototype = {
console: null,
win: null,
doc: null,
console: null,
win: null,
doc: null,
+ sess: null,
ifra: null,
page: null,
watchdog_hdl: null,
ifra: null,
page: null,
watchdog_hdl: null,
@@
-58,10
+60,6
@@
http_streaming.prototype = {
cmdproc: null,
comm_match: /_*@BEGIN@(.*?)@END@/g,
comm_clean: /_*@BEGIN@(.*?)@END@/,
cmdproc: null,
comm_match: /_*@BEGIN@(.*?)@END@/g,
comm_clean: /_*@BEGIN@(.*?)@END@/,
- ctx_old: "",
- ctx_old_len: 0,
- // ctx_new: "",
- ctx_new_len: 0,
stream: "",
start: function(page) {
stream: "",
start: function(page) {
@@
-71,7
+69,10
@@
http_streaming.prototype = {
this.ifra.style.visibility = "hidden";
this.doc.body.appendChild(this.ifra);
if (page != null)
this.ifra.style.visibility = "hidden";
this.doc.body.appendChild(this.ifra);
if (page != null)
- this.page = page;
+ this.page = url_complete(this.win.location.href, page);
+ this.page = url_append_args(this.page, "sess", this.sess, "st", this.gst.st);
+ this.log(this.page);
+
// this.log(this.ifra);
this.ifra.contentWindow.location.href = this.page;
this.watchdog_ct = 0;
// this.log(this.ifra);
this.ifra.contentWindow.location.href = this.page;
this.watchdog_ct = 0;
@@
-81,10
+82,11
@@
http_streaming.prototype = {
watchdog: function () {
var i, again;
var comm_newpart, comm_len, comm_arr;
watchdog: function () {
var i, again;
var comm_newpart, comm_len, comm_arr;
+ var ctx_new_len;
// WATCHDOGING THE CONNECTION
// WATCHDOGING THE CONNECTION
+ this.log("hs::watchdog: start, cur equal times: "+this.keepalives_equal);
if ( (this.watchdog_ct % this.watchdog_checktm) == 0 || !this.watchable) {
if ( (this.watchdog_ct % this.watchdog_checktm) == 0 || !this.watchable) {
- this.log("hs::watchdog: start, cur equal times: "+this.keepalives_equal);
if (!this.watchable) {
do {
if (typeof(this.ifra.contentWindow.http_streaming) == 'undefined')
if (!this.watchable) {
do {
if (typeof(this.ifra.contentWindow.http_streaming) == 'undefined')
@@
-120,24
+122,34
@@
http_streaming.prototype = {
do {
// CHECK: maybe again here isn't needed
again = 0;
do {
// CHECK: maybe again here isn't needed
again = 0;
- if (typeof(this.ifra.contentWindow.ctx_new) == 'undefined')
+ if (typeof(this.ifra.contentWindow.ctx_new) == 'undefined' ||
+ typeof(this.ifra.contentWindow.ctx_old_len) == 'undefined')
break;
break;
- if (this.ifra.contentWindow.ctx_new.length == this.ctx_old_len) {
-
// this.ctx_new = this.ctx_old = ""
;
- // FIXME find a more robust clean method
+
+
ctx_new_len = this.ifra.contentWindow.ctx_new.length
;
+ if (ctx_new_len <= this.ifra.contentWindow.ctx_old_len) {
break;
}
break;
}
- this.log("new: "+
this.ifra.contentWindow.ctx_new.length + " old: "+this
.ctx_old_len);
+ this.log("new: "+
ctx_new_len + " old: "+this.ifra.contentWindow
.ctx_old_len);
this.keepalive_new++;
this.keepalive_new++;
- for (i = this.ctx_old_len ; i < this.ifra.contentWindow.ctx_new.length ; i++) {
- if (this.ifra.contentWindow.ctx_new[i] != '_')
+ for (i = this.ifra.contentWindow.ctx_old_len ; i < ctx_new_len ; i++) {
+ if (this.ifra.contentWindow.ctx_new.charAt(i) != '_') {
+ this.log("ctx_new.char(i) != '_' ["+this.ifra.contentWindow.ctx_new.charAt(i)+"]");
break;
break;
+ }
+ else {
+ this.log("ctx_new.charAt(i) == '_'");
+ }
}
}
- if (i == this.ifra.contentWindow.ctx_new.length) {
- this.ctx_old_len = i;
+ this.ifra.contentWindow.ctx_old_len = i;
+ if (i == ctx_new_len) {
+ this.log("old_len == i");
break;
}
break;
}
- comm_newpart = this.ifra.contentWindow.ctx_new.substr(this.ctx_old_len);
+ else {
+ this.log("old_len != i: "+i);
+ }
+ comm_newpart = this.ifra.contentWindow.ctx_new.substr(this.ifra.contentWindow.ctx_old_len);
comm_len = 0;
comm_arr = comm_newpart.match(this.comm_match);
comm_len = 0;
comm_arr = comm_newpart.match(this.comm_match);
@@
-149,10
+161,9
@@
http_streaming.prototype = {
// XX alert("COMM_ARR["+i+"]: "+comm_arr[i]+" LEN:"+comm_arr[i].length);
comm_len += comm_arr[i].length;
}
// XX alert("COMM_ARR["+i+"]: "+comm_arr[i]+" LEN:"+comm_arr[i].length);
comm_len += comm_arr[i].length;
}
- this.ctx_old += comm_newpart.substr(0,comm_len);
again = 1;
}
again = 1;
}
-
this.ctx_old_len = this.ctx_old.length
;
+
this.ifra.contentWindow.ctx_old_len += comm_len
;
} while (again);
} while (again);
@@
-197,6
+208,8
@@
http_streaming.prototype = {
},
abort: function () {
},
abort: function () {
+ // this.log("PATH: "+this.ifra.contentWindow.location.protocol + "://" + this.ifra.contentWindow.location.host + "/" + this.ifra.contentWindow.location.pathname);
+
this.gst.abort();
if (this.watchdog_hdl != null) {
clearTimeout(this.watchdog_hdl);
this.gst.abort();
if (this.watchdog_hdl != null) {
clearTimeout(this.watchdog_hdl);
@@
-211,8
+224,6
@@
http_streaming.prototype = {
delete this.ifra;
this.ifra = null;
}
delete this.ifra;
this.ifra = null;
}
- this.ctx_old = "";
- this.ctx_old_len = 0;
},
reload: function () {
},
reload: function () {