Skip to content

Commit

Permalink
Make sure to only destroy if the _iframe was created
Browse files Browse the repository at this point in the history
  • Loading branch information
rauchg committed Nov 1, 2010
1 parent 9fb0b3e commit 7a5197c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
14 changes: 8 additions & 6 deletions lib/transports/htmlfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@
var script = doc.getElementsByTagName('script')[0];
script.parentNode.removeChild(script);
};

HTMLFile.prototype._destroy = function(){
this._iframe.src = 'about:blank';
this._doc = null;
CollectGarbage();
};

HTMLFile.prototype._destroy = function(){
if (this._iframe){
this._iframe.src = 'about:blank';
this._doc = null;
CollectGarbage();
}
};

HTMLFile.prototype.disconnect = function(){
this._destroy();
Expand Down
14 changes: 8 additions & 6 deletions socket.io.js
Original file line number Diff line number Diff line change
Expand Up @@ -511,12 +511,14 @@ if (typeof window != 'undefined'){
var script = doc.getElementsByTagName('script')[0];
script.parentNode.removeChild(script);
};

HTMLFile.prototype._destroy = function(){
this._iframe.src = 'about:blank';
this._doc = null;
CollectGarbage();
};

HTMLFile.prototype._destroy = function(){
if (this._iframe){
this._iframe.src = 'about:blank';
this._doc = null;
CollectGarbage();
}
};

HTMLFile.prototype.disconnect = function(){
this._destroy();
Expand Down

0 comments on commit 7a5197c

Please sign in to comment.