Commit 851615d5 authored by Wandenberg Peixoto's avatar Wandenberg Peixoto

removing old iframe elements on stream wrapper

parent 5e7f6af6
...@@ -27,6 +27,6 @@ ...@@ -27,6 +27,6 @@
#define NGX_HTTP_PUSH_STREAM_MODULE_VERSION_H_ #define NGX_HTTP_PUSH_STREAM_MODULE_VERSION_H_
static const ngx_str_t NGX_HTTP_PUSH_STREAM_TAG = ngx_string("0.3.3"); static const ngx_str_t NGX_HTTP_PUSH_STREAM_TAG = ngx_string("0.3.3");
static const ngx_str_t NGX_HTTP_PUSH_STREAM_COMMIT = ngx_string("d0fe86d4193ffd6797a3fa63011d511b45dde97c"); static const ngx_str_t NGX_HTTP_PUSH_STREAM_COMMIT = ngx_string("5e7f6af68a133967b8476b75a9d562bb6672174c");
#endif /* NGX_HTTP_PUSH_STREAM_MODULE_VERSION_H_ */ #endif /* NGX_HTTP_PUSH_STREAM_MODULE_VERSION_H_ */
...@@ -493,6 +493,7 @@ ...@@ -493,6 +493,7 @@
this.url = null; this.url = null;
this.frameloadtimer = null; this.frameloadtimer = null;
this.pingtimer = null; this.pingtimer = null;
this.iframeId = "PushStreamManager_" + pushstream.id;
}; };
StreamWrapper.TYPE = "Stream"; StreamWrapper.TYPE = "Stream";
...@@ -520,9 +521,17 @@ ...@@ -520,9 +521,17 @@
} }
}, },
_clear_iframe: function() {
var oldIframe = document.getElementById(this.iframeId);
if (oldIframe) {
oldIframe.onload = null;
if (oldIframe.parentNode) oldIframe.parentNode.removeChild(oldIframe);
}
},
_closeCurrentConnection: function() { _closeCurrentConnection: function() {
this._clear_iframe();
if (this.connection) { if (this.connection) {
try { this.connection.onload = null; this.connection.setAttribute("src", ""); } catch (e) { /* ignore error on closing */ }
this.pingtimer = clearTimer(this.pingtimer); this.pingtimer = clearTimer(this.pingtimer);
this.frameloadtimer = clearTimer(this.frameloadtimer); this.frameloadtimer = clearTimer(this.frameloadtimer);
this.connection = null; this.connection = null;
...@@ -532,6 +541,7 @@ ...@@ -532,6 +541,7 @@
}, },
loadFrame: function(url) { loadFrame: function(url) {
this._clear_iframe();
try { try {
var transferDoc = new window.ActiveXObject("htmlfile"); var transferDoc = new window.ActiveXObject("htmlfile");
transferDoc.open(); transferDoc.open();
...@@ -559,6 +569,7 @@ ...@@ -559,6 +569,7 @@
ifr.onload = linker(onerrorCallback, this); ifr.onload = linker(onerrorCallback, this);
this.connection = ifr; this.connection = ifr;
} }
this.connection.setAttribute("id", this.iframeId);
this.frameloadtimer = window.setTimeout(linker(onerrorCallback, this), this.pushstream.timeout); this.frameloadtimer = window.setTimeout(linker(onerrorCallback, this), this.pushstream.timeout);
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment