Backed out changeset 921e9f7f8924 (bug 849723) for mochitest-other failures on a CLOSED TREE.

This commit is contained in:
Ryan VanderMeulen 2013-03-15 15:44:38 -04:00
parent 64c588e2f9
commit 492c34576a
2 changed files with 8 additions and 22 deletions

View File

@ -29,7 +29,13 @@ var mainWindow = window.QueryInterface(Ci.nsIInterfaceRequestor)
// We need to wait for the hidden window to load, but can't access
// an event target for a regular event listener.
var hidden = mainWindow.Services.appShell.hiddenPrivateDOMWindow;
mainWindow.PrivateBrowsingUtils.whenHiddenPrivateWindowReady(function(hidden) {
var tmp = setTimeout(function poll() {
if (hidden.location.href != "resource://gre-resources/hiddenWindow.html" ||
!hidden.document.body) {
setTimeout(poll, 100);
return;
}
var iframe = hidden.document.createElement('iframe');
iframe.src = 'generic.html';
hidden.document.body.appendChild(iframe);
@ -40,7 +46,7 @@ mainWindow.PrivateBrowsingUtils.whenHiddenPrivateWindowReady(function(hidden) {
win.close();
win = null;
}, false);
});
}, 100);
function observer(aSubject, aTopic, aData) {
is(aTopic, "last-pb-context-exited", "Unexpected observer topic");

View File

@ -42,26 +42,6 @@ this.PrivateBrowsingUtils = {
},
get isInTemporaryAutoStartMode() {
return gTemporaryAutoStartMode;
},
whenHiddenPrivateWindowReady: function pbu_whenHiddenPrivateWindowReady(cb) {
Components.utils.import("resource://gre/modules/Timer.jsm", Timer);
let win = Services.appShell.hiddenPrivateDOMWindow;
function isNotLoaded() {
return ["complete", "interactive"].indexOf(win.document.readyState) == -1;
}
if (isNotLoaded()) {
setTimeout(function poll() {
if (isNotLoaded()) {
setTimeout(poll, 100);
return;
}
cb(Services.appShell.hiddenPrivateDOMWindow);
}, 4);
} else {
cb(Services.appShell.hiddenPrivateDOMWindow);
}
}
};