Bug 1125958 - test_bug_461710_perwindowpb.html fails when run as a standalone directory. r=ehsan

This commit is contained in:
Joel Maher 2015-01-26 16:12:24 -05:00
parent 901d7fce7f
commit 5795147374

View File

@ -157,31 +157,36 @@ function handleLoad() {
}
}
var mainWindow = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShellTreeItem)
.rootTreeItem
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindow);
var contentPage = "http://mochi.test:8888/tests/toolkit/components/places/tests/mochitest/bug_461710/iframe.html";
function testOnWindow(aIsPrivate, aCallback) {
var win = mainWindow.OpenBrowserWindow({private: aIsPrivate});
win.addEventListener("load", function onLoad() {
win.removeEventListener("load", onLoad, false);
win.addEventListener("DOMContentLoaded", function onInnerLoad() {
if (win.content.location.href != contentPage) {
win.gBrowser.loadURI(contentPage);
return;
}
win.removeEventListener("DOMContentLoaded", onInnerLoad, true);
win.gBrowser.selectedBrowser.focus();
SimpleTest.executeSoon(function() { aCallback(win); });
}, true);
SimpleTest.executeSoon(function() { win.gBrowser.loadURI(contentPage); });
}, true);
function whenDelayedStartupFinished(aWindow, aCallback) {
Services.obs.addObserver(function observer(aSubject, aTopic) {
if (aWindow == aSubject) {
Services.obs.removeObserver(observer, aTopic);
}
if (aWindow.content == null || aWindow.content.location.href != contentPage) {
aWindow.addEventListener("DOMContentLoaded", function onInnerLoad() {
aWindow.removeEventListener("DOMContentLoaded", onInnerLoad, true);
SimpleTest.executeSoon(function() { aCallback(aWindow); });
}, true);
aWindow.gBrowser.loadURI(contentPage);
}
}, "browser-delayed-startup-finished", false);
}
function testOnWindow(aIsPrivate, callback) {
var mainWindow = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShellTreeItem)
.rootTreeItem
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindow);
var win = mainWindow.OpenBrowserWindow({private: aIsPrivate});
whenDelayedStartupFinished(win, function() { callback(win); });
};
const URI_VISITED_RESOLUTION_TOPIC = "visited-status-resolution";
var observer = {
uri: null,