Skip to content

Commit

Permalink
jorge ventura found a window leak in frames. when a window is closed …
Browse files Browse the repository at this point in the history
…it should close all of its frames ownerWindows
  • Loading branch information
thatcher committed Aug 13, 2010
1 parent c5cbb1d commit 2350330
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build.properties
Expand Up @@ -2,7 +2,7 @@
PROJECT: env-js
BUILD_MAJOR: 1
BUILD_MINOR: 2
BUILD_ID: 26
BUILD_ID: 27
BUILD_VERSION: ${BUILD_MAJOR}.${BUILD_MINOR}.${BUILD_ID}
BUILD: ${PROJECT}.${BUILD_VERSION}
VERSION: ${BUILD} ${DSTAMP}
Expand Down
8 changes: 4 additions & 4 deletions src/platform/core/window.js
Expand Up @@ -45,16 +45,16 @@ Envjs.windows = function(uuid, scope){
Envjs.loadFrame = function(frame, url){
try {
//console.log('loading frame %s', url);
if(frame.contentWindow){
if(frame.contentWindow && frame.contentWindow.close){
//mark for garbage collection
frame.contentWindow = null;
frame.contentWindow.close();
}

//create a new scope for the window proxy
//platforms will need to override this function
//to make sure the scope is global-like
frame.contentWindow = Envjs.proxy();
new Window(frame.contentWindow, window);
frame.contentWindow = Envjs.proxy({});
new Window(frame.contentWindow, window);

//I dont think frames load asynchronously in firefox
//and I think the tests have verified this but for
Expand Down
9 changes: 9 additions & 0 deletions src/window/window.js
Expand Up @@ -278,6 +278,15 @@ Window = function(scope, parent, opener){
},
close: function(){
//console.log('closing window %s', __windows__[$uuid]);
var frames = $document.getElementsByTagName('frame'),
iframes = $document.getElementsByTagName('iframe'),
i;
for(i=0;i<frames.length;i++){
Envjs.unloadFrame(frame[i]);
}
for(i=0;i<iframes.length;i++){
Envjs.unloadFrame(frame[i]);
}
try{
Envjs.windows($uuid, null);
}catch(e){
Expand Down

0 comments on commit 2350330

Please sign in to comment.