mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 658738 - remove event listeners in browser chrome tests
This commit is contained in:
parent
21bdb098e2
commit
4e4ac318f3
@ -61,6 +61,7 @@ function nextAsyncText(tab) {
|
||||
var gotCloseEvent = false;
|
||||
|
||||
tab.addEventListener("TabClose", function () {
|
||||
tab.removeEventListener("TabClose", arguments.callee, false);
|
||||
info("got TabClose event");
|
||||
gotCloseEvent = true;
|
||||
|
||||
|
@ -52,9 +52,9 @@ function test() {
|
||||
tabToDetach.linkedBrowser.contentDocument != event.target)
|
||||
return;
|
||||
|
||||
if (!newWindow) {
|
||||
gBrowser.removeEventListener("pageshow", onPageShow, false);
|
||||
event.currentTarget.removeEventListener("pageshow", onPageShow, false);
|
||||
|
||||
if (!newWindow) {
|
||||
// prepare the tab (set icon and busy state)
|
||||
// we have to set these only after onState* notification, otherwise
|
||||
// they're overriden
|
||||
@ -65,12 +65,10 @@ function test() {
|
||||
// detach and set the listener on the new window
|
||||
newWindow = gBrowser.replaceTabWithWindow(tabToDetach);
|
||||
// wait for gBrowser to come along
|
||||
function onLoad(event) {
|
||||
newWindow.gBrowser
|
||||
.addEventListener("pageshow", onPageShow, false);
|
||||
newWindow.addEventListener("load", function () {
|
||||
newWindow.removeEventListener("load", arguments.callee, false);
|
||||
}
|
||||
newWindow.addEventListener("load", onLoad, false);
|
||||
newWindow.gBrowser.addEventListener("pageshow", onPageShow, false);
|
||||
}, false);
|
||||
}, 0);
|
||||
return;
|
||||
}
|
||||
|
@ -9,14 +9,18 @@ function test() {
|
||||
win.content.addEventListener("focus", function () {
|
||||
win.content.removeEventListener("focus", arguments.callee, false);
|
||||
|
||||
win.gBrowser.selectedTab.addEventListener("TabClose", function () {
|
||||
function onTabClose() {
|
||||
ok(false, "shouldn't have gotten the TabClose event for the last tab");
|
||||
}, false);
|
||||
}
|
||||
var tab = win.gBrowser.selectedTab;
|
||||
tab.addEventListener("TabClose", onTabClose, false);
|
||||
|
||||
EventUtils.synthesizeKey("w", { accelKey: true }, win);
|
||||
|
||||
ok(win.closed, "accel+w closed the window immediately");
|
||||
|
||||
tab.removeEventListener("TabClose", onTabClose, false);
|
||||
|
||||
finish();
|
||||
}, false);
|
||||
}, false);
|
||||
|
@ -13,6 +13,7 @@ function test() {
|
||||
var pageInfo = BrowserPageInfo(doc, "mediaTab", testImg);
|
||||
|
||||
pageInfo.addEventListener("load", function () {
|
||||
pageInfo.removeEventListener("load", arguments.callee, true);
|
||||
pageInfo.onFinished.push(function () {
|
||||
executeSoon(function () {
|
||||
var pageInfoImg = pageInfo.document.getElementById("thepreviewimage");
|
||||
|
@ -5,7 +5,9 @@ function test() {
|
||||
|
||||
let tab = gBrowser.addTab(testPath + "file_bug550565_popup.html");
|
||||
|
||||
tab.linkedBrowser.addEventListener('DOMContentLoaded', function() {
|
||||
tab.linkedBrowser.addEventListener("DOMContentLoaded", function() {
|
||||
tab.linkedBrowser.removeEventListener("DOMContentLoaded", arguments.callee, true);
|
||||
|
||||
let expectedIcon = testPath + "file_bug550565_favicon.ico";
|
||||
|
||||
is(gBrowser.getIcon(tab), expectedIcon, "Correct icon before pushState.");
|
||||
|
@ -16,8 +16,11 @@ function test() {
|
||||
|
||||
waitForExplicitFinish();
|
||||
gBrowser.selectedBrowser.addEventListener("load", function () {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
|
||||
is(gBrowser.userTypedValue, null, "userTypedValue is null as the page has loaded");
|
||||
is(gURLBar.value, URI, "location bar value matches test URI as the page has loaded");
|
||||
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
}, true);
|
||||
|
@ -20,8 +20,11 @@ function test() {
|
||||
var tab = gBrowser.addTab("http://mochi.test:8888/");
|
||||
var browser = gBrowser.getBrowserForTab(tab);
|
||||
browser.addEventListener("load", function() {
|
||||
browser.removeEventListener("load", arguments.callee, true);
|
||||
|
||||
gBrowser.removeTab(tab);
|
||||
ok(isUndoCloseEnabled(), "Undo Close Tab should be enabled.");
|
||||
|
||||
finish();
|
||||
}, true);
|
||||
}
|
||||
|
@ -27,10 +27,12 @@ function checkAnimationState() {
|
||||
info("tab didn't close immediately, so the tab opening animation must have started moving");
|
||||
info("waiting for the tab to close asynchronously");
|
||||
tab.addEventListener("transitionend", function (event) {
|
||||
if (event.propertyName == "max-width")
|
||||
if (event.propertyName == "max-width") {
|
||||
tab.removeEventListener("transitionend", arguments.callee, false);
|
||||
executeSoon(function () {
|
||||
ok(!tab.parentNode, "tab removed asynchronously");
|
||||
finish();
|
||||
});
|
||||
}
|
||||
}, false);
|
||||
}
|
||||
|
@ -43,6 +43,8 @@ function test() {
|
||||
Services.prefs.setBoolPref(backgroundPref, true);
|
||||
|
||||
function mainPart() {
|
||||
newTab.linkedBrowser.removeEventListener("load", mainPart, true);
|
||||
|
||||
gBrowser.pinTab(newTab);
|
||||
gBrowser.selectedTab = newTab;
|
||||
|
||||
|
@ -5,16 +5,22 @@ function test() {
|
||||
var gotTabAttrModified = false;
|
||||
var gotTabClose = false;
|
||||
|
||||
tab.addEventListener("TabClose", function () {
|
||||
function onTabClose() {
|
||||
gotTabClose = true;
|
||||
tab.addEventListener("TabAttrModified", onTabAttrModified, false);
|
||||
}
|
||||
|
||||
tab.addEventListener("TabAttrModified", function () {
|
||||
gotTabAttrModified = true;
|
||||
}, false);
|
||||
}, false);
|
||||
function onTabAttrModified() {
|
||||
gotTabAttrModified = true;
|
||||
}
|
||||
|
||||
tab.addEventListener("TabClose", onTabClose, false);
|
||||
|
||||
gBrowser.removeTab(tab);
|
||||
|
||||
ok(gotTabClose, "should have got the TabClose event");
|
||||
ok(!gotTabAttrModified, "shouldn't have got the TabAttrModified event after TabClose");
|
||||
|
||||
tab.removeEventListener("TabClose", onTabClose, false);
|
||||
tab.removeEventListener("TabAttrModified", onTabAttrModified, false);
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ function test() {
|
||||
ok(true, "duplicateTabIn opened a new window");
|
||||
|
||||
aSubject.addEventListener("load", function () {
|
||||
aSubject.removeEventListener("load", arguments.callee, false);
|
||||
executeSoon(function () {
|
||||
aSubject.close();
|
||||
finish();
|
||||
|
@ -10,6 +10,8 @@ function test() {
|
||||
newWin.close();
|
||||
});
|
||||
newWin.addEventListener("load", function test_win_onLoad() {
|
||||
newWin.removeEventListener("load", test_win_onLoad, false);
|
||||
|
||||
// Remove the URL bar
|
||||
newWin.gURLBar.parentNode.removeChild(newWin.gURLBar);
|
||||
|
||||
|
@ -3,7 +3,10 @@ function test() {
|
||||
|
||||
var tab = gBrowser.addTab();
|
||||
gBrowser.selectedTab = tab;
|
||||
tab.linkedBrowser.addEventListener("load", checkPageStyleMenu, true);
|
||||
tab.linkedBrowser.addEventListener("load", function () {
|
||||
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
checkPageStyleMenu();
|
||||
}, true);
|
||||
let rootDir = getRootDirectory(gTestPath);
|
||||
content.location = rootDir + "page_style_sample.html";
|
||||
}
|
||||
|
@ -24,6 +24,9 @@ function test() {
|
||||
if (++loadCount != 2)
|
||||
return;
|
||||
|
||||
browser1.removeEventListener("load", check, true);
|
||||
browser2.removeEventListener("load", check, true);
|
||||
|
||||
window.focus();
|
||||
|
||||
_browser_tabfocus_test_lastfocus = gURLBar;
|
||||
@ -139,8 +142,8 @@ function test() {
|
||||
EventUtils.synthesizeKey("VK_F6", { });
|
||||
is(fm.focusedWindow, window, "switch document forward again with f6 when browser non-focusable");
|
||||
|
||||
window.addEventListener("focus", _browser_tabfocus_test_eventOccured, true);
|
||||
window.addEventListener("blur", _browser_tabfocus_test_eventOccured, true);
|
||||
window.removeEventListener("focus", _browser_tabfocus_test_eventOccured, true);
|
||||
window.removeEventListener("blur", _browser_tabfocus_test_eventOccured, true);
|
||||
|
||||
// next, check whether navigating forward, focusing the urlbar and then
|
||||
// navigating back maintains the focus in the urlbar.
|
||||
@ -186,6 +189,7 @@ function _browser_tabfocus_navigation_test_eventOccured(event)
|
||||
setTimeout(function () contentwin.history.back(), 0);
|
||||
}
|
||||
else if (contentwin.location.toString().indexOf("2") > 0) {
|
||||
event.currentTarget.removeEventListener("pageshow", _browser_tabfocus_navigation_test_eventOccured, true);
|
||||
is(window.document.activeElement, gURLBar.inputField, "urlbar still focused after navigating back");
|
||||
gBrowser.removeCurrentTab();
|
||||
gBrowser.removeCurrentTab();
|
||||
|
@ -42,6 +42,7 @@ function test() {
|
||||
|
||||
testWindow = OpenBrowserWindow();
|
||||
testWindow.addEventListener("load", function() {
|
||||
testWindow.removeEventListener("load", arguments.callee, false);
|
||||
ok(true, "Load listener called");
|
||||
|
||||
executeSoon(function() {
|
||||
|
@ -82,6 +82,8 @@ function zoomInAndOut(transitionsExpected, callback) {
|
||||
ok(transitioned >= 0, "There can be transitions");
|
||||
else
|
||||
ok(!transitioned, "There should have been no transitions");
|
||||
|
||||
contentWindow.document.removeEventListener("transitionend", onTransitionEnd, false);
|
||||
callback();
|
||||
};
|
||||
|
||||
|
@ -9,11 +9,13 @@ function test() {
|
||||
let windowTwo;
|
||||
|
||||
windowOne.addEventListener("load", function() {
|
||||
windowOne.removeEventListener("load", arguments.callee, false);
|
||||
windowOne.gBrowser.selectedBrowser.addEventListener("load", function() {
|
||||
windowOne.gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
|
||||
windowTwo = openDialog(location, "", "chrome,all,dialog=no", "http://mochi.test:8888/");
|
||||
windowTwo.addEventListener("load", function() {
|
||||
windowTwo.removeEventListener("load", arguments.callee, false);
|
||||
windowTwo.gBrowser.selectedBrowser.addEventListener("load", function() {
|
||||
windowTwo.gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
|
||||
@ -145,4 +147,4 @@ function whenWindowObservesOnce(win, topic, func) {
|
||||
}
|
||||
}
|
||||
windowWatcher.registerNotification(windowObserver);
|
||||
}
|
||||
}
|
||||
|
@ -63,6 +63,7 @@ function test() {
|
||||
prefetchCert: true,
|
||||
};
|
||||
function testCheckbox() {
|
||||
win.removeEventListener("load", testCheckbox, false);
|
||||
Services.obs.addObserver(function (aSubject, aTopic, aData) {
|
||||
Services.obs.removeObserver(arguments.callee, "cert-exception-ui-ready", false);
|
||||
ok(win.gCert, "The certificate information should be available now");
|
||||
@ -88,6 +89,7 @@ function test() {
|
||||
prefetchCert: true,
|
||||
};
|
||||
function testCheckbox() {
|
||||
win.removeEventListener("load", testCheckbox, false);
|
||||
Services.obs.addObserver(function (aSubject, aTopic, aData) {
|
||||
Services.obs.removeObserver(arguments.callee, "cert-exception-ui-ready", false);
|
||||
ok(win.gCert, "The certificate information should be available now");
|
||||
|
@ -52,6 +52,7 @@ function test() {
|
||||
|
||||
let pageInfo1 = BrowserPageInfo();
|
||||
pageInfo1.addEventListener("load", function () {
|
||||
pageInfo1.removeEventListener("load", arguments.callee, false);
|
||||
|
||||
let tab2 = gBrowser.addTab();
|
||||
gBrowser.selectedTab = tab2;
|
||||
@ -61,8 +62,10 @@ function test() {
|
||||
|
||||
let pageInfo2 = BrowserPageInfo();
|
||||
pageInfo2.addEventListener("load", function () {
|
||||
pageInfo2.removeEventListener("load", arguments.callee, false);
|
||||
|
||||
pageInfo1.addEventListener("unload", function () {
|
||||
pageInfo1.removeEventListener("unload", arguments.callee, false);
|
||||
pageInfo1 = null;
|
||||
ok(true, "Page info 1 being closed as expected");
|
||||
if (!pageInfo2)
|
||||
@ -70,6 +73,7 @@ function test() {
|
||||
}, false);
|
||||
|
||||
pageInfo2.addEventListener("unload", function () {
|
||||
pageInfo2.removeEventListener("unload", arguments.callee, false);
|
||||
pageInfo2 = null;
|
||||
ok(true, "Page info 2 being closed as expected");
|
||||
if (!pageInfo1)
|
||||
|
@ -59,11 +59,14 @@ function test() {
|
||||
pb.privateBrowsingEnabled = true;
|
||||
browser = gBrowser.selectedBrowser;
|
||||
browser.addEventListener("load", function() {
|
||||
browser.removeEventListener("load", arguments.callee, true);
|
||||
|
||||
// setTimeout is needed here because the onload handler of about:privatebrowsing sets the focus
|
||||
setTimeout(function() {
|
||||
// ensure that the URL bar is focused inside the private browsing mode
|
||||
is(document.commandDispatcher.focusedElement, gURLBar.inputField,
|
||||
"URL Bar should be focused inside the private browsing mode");
|
||||
|
||||
// ensure that the URL bar is emptied inside the private browsing mode
|
||||
is(gURLBar.value, "", "URL Bar should be empty inside the private browsing mode");
|
||||
|
||||
@ -71,9 +74,12 @@ function test() {
|
||||
pb.privateBrowsingEnabled = false;
|
||||
browser = gBrowser.selectedBrowser;
|
||||
browser.addEventListener("load", function() {
|
||||
browser.removeEventListener("load", arguments.callee, true);
|
||||
|
||||
// ensure that the URL bar is no longer focused after leaving the private browsing mode
|
||||
isnot(document.commandDispatcher.focusedElement, gURLBar.inputField,
|
||||
"URL Bar should no longer be focused after leaving the private browsing mode");
|
||||
|
||||
// ensure that the URL bar is no longer empty after leaving the private browsing mode
|
||||
isnot(gURLBar.value, "", "URL Bar should no longer be empty after leaving the private browsing mode");
|
||||
|
||||
|
@ -71,6 +71,8 @@ function test() {
|
||||
|
||||
let newWin = openDialog(location, "", "chrome,all,dialog=no", testURL);
|
||||
newWin.addEventListener("load", function(aEvent) {
|
||||
newWin.removeEventListener("load", arguments.callee, false);
|
||||
|
||||
newWin.gBrowser.selectedBrowser.addEventListener("load", function(aEvent) {
|
||||
newWin.gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
|
||||
@ -102,6 +104,8 @@ function test() {
|
||||
let restoredTabs = 0;
|
||||
let expectedTabs = data.tabs.length;
|
||||
newWin2.addEventListener("load", function(aEvent) {
|
||||
newWin2.removeEventListener("load", arguments.callee, false);
|
||||
|
||||
newWin2.gBrowser.tabContainer.addEventListener("SSTabRestored", function(aEvent) {
|
||||
if (++restoredTabs < expectedTabs)
|
||||
return;
|
||||
@ -160,6 +164,8 @@ function test() {
|
||||
let url = "http://window" + windowsToOpen.length + ".example.com";
|
||||
let win = openDialog(location, "", settings, url);
|
||||
win.addEventListener("load", function(aEvent) {
|
||||
win.removeEventListener("load", arguments.callee, false);
|
||||
|
||||
win.gBrowser.selectedBrowser.addEventListener("DOMContentLoaded", function(aEvent) {
|
||||
win.gBrowser.selectedBrowser.removeEventListener("DOMContentLoaded", arguments.callee, true);
|
||||
// the window _should_ have state with a tab of url, but it doesn't
|
||||
@ -174,7 +180,7 @@ function test() {
|
||||
});
|
||||
});
|
||||
}, true);
|
||||
}, true);
|
||||
}, false);
|
||||
}
|
||||
|
||||
let windowsToOpen = [{isPopup: false},
|
||||
|
@ -48,11 +48,11 @@ function browserWindowsCount() {
|
||||
function test() {
|
||||
/** Test for Bug 461634 **/
|
||||
is(browserWindowsCount(), 1, "Only one browser window should be open initially");
|
||||
|
||||
|
||||
// test setup
|
||||
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
|
||||
waitForExplicitFinish();
|
||||
|
||||
|
||||
const REMEMBER = Date.now(), FORGET = Math.random();
|
||||
let test_state = { windows: [{ "tabs": [{ "entries": [] }], _closedTabs: [
|
||||
{ state: { entries: [{ url: "http://www.example.net/" }] }, title: FORGET },
|
||||
@ -61,10 +61,10 @@ function test() {
|
||||
{ state: { entries: [{ url: "http://www.example.net/" }] }, title: REMEMBER },
|
||||
] }] };
|
||||
let remember_count = 2;
|
||||
|
||||
|
||||
function countByTitle(aClosedTabList, aTitle)
|
||||
aClosedTabList.filter(function(aData) aData.title == aTitle).length;
|
||||
|
||||
|
||||
function testForError(aFunction) {
|
||||
try {
|
||||
aFunction();
|
||||
@ -74,14 +74,16 @@ function test() {
|
||||
return ex.name == "NS_ERROR_ILLEGAL_VALUE";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// open a window and add the above closed tab list
|
||||
let newWin = openDialog(location, "", "chrome,all,dialog=no");
|
||||
newWin.addEventListener("load", function(aEvent) {
|
||||
newWin.removeEventListener("load", arguments.callee, false);
|
||||
|
||||
gPrefService.setIntPref("browser.sessionstore.max_tabs_undo",
|
||||
test_state.windows[0]._closedTabs.length);
|
||||
ss.setWindowState(newWin, JSON.stringify(test_state), true);
|
||||
|
||||
|
||||
let closedTabs = JSON.parse(ss.getClosedTabData(newWin));
|
||||
is(closedTabs.length, test_state.windows[0]._closedTabs.length,
|
||||
"Closed tab list has the expected length");
|
||||
@ -90,7 +92,7 @@ function test() {
|
||||
"The correct amout of tabs are to be forgotten");
|
||||
is(countByTitle(closedTabs, REMEMBER), remember_count,
|
||||
"Everything is set up.");
|
||||
|
||||
|
||||
// all of the following calls with illegal arguments should throw NS_ERROR_ILLEGAL_VALUE
|
||||
ok(testForError(function() ss.forgetClosedTab({}, 0)),
|
||||
"Invalid window for forgetClosedTab throws");
|
||||
@ -98,11 +100,11 @@ function test() {
|
||||
"Invalid tab for forgetClosedTab throws");
|
||||
ok(testForError(function() ss.forgetClosedTab(newWin, test_state.windows[0]._closedTabs.length + 1)),
|
||||
"Invalid tab for forgetClosedTab throws");
|
||||
|
||||
|
||||
// Remove third tab, then first tab
|
||||
ss.forgetClosedTab(newWin, 2);
|
||||
ss.forgetClosedTab(newWin, null);
|
||||
|
||||
|
||||
closedTabs = JSON.parse(ss.getClosedTabData(newWin));
|
||||
is(closedTabs.length, remember_count,
|
||||
"The correct amout of tabs was removed");
|
||||
|
@ -47,11 +47,11 @@ function browserWindowsCount() {
|
||||
function test() {
|
||||
/** Test for Bug 464199 **/
|
||||
is(browserWindowsCount(), 1, "Only one browser window should be open initially");
|
||||
|
||||
|
||||
// test setup
|
||||
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
|
||||
waitForExplicitFinish();
|
||||
|
||||
|
||||
const REMEMBER = Date.now(), FORGET = Math.random();
|
||||
let test_state = { windows: [{ "tabs": [{ "entries": [] }], _closedTabs: [
|
||||
{ state: { entries: [{ url: "http://www.example.net/" }] }, title: FORGET },
|
||||
@ -79,13 +79,15 @@ function test() {
|
||||
extData: { "setTabValue": "http://example.net:80" } }, title: REMEMBER }
|
||||
] }] };
|
||||
let remember_count = 5;
|
||||
|
||||
|
||||
function countByTitle(aClosedTabList, aTitle)
|
||||
aClosedTabList.filter(function(aData) aData.title == aTitle).length;
|
||||
|
||||
|
||||
// open a window and add the above closed tab list
|
||||
let newWin = openDialog(location, "", "chrome,all,dialog=no");
|
||||
newWin.addEventListener("load", function(aEvent) {
|
||||
newWin.removeEventListener("load", arguments.callee, false);
|
||||
|
||||
gPrefService.setIntPref("browser.sessionstore.max_tabs_undo",
|
||||
test_state.windows[0]._closedTabs.length);
|
||||
ss.setWindowState(newWin, JSON.stringify(test_state), true);
|
||||
@ -98,11 +100,11 @@ function test() {
|
||||
"The correct amout of tabs are to be forgotten");
|
||||
is(countByTitle(closedTabs, REMEMBER), remember_count,
|
||||
"Everything is set up.");
|
||||
|
||||
|
||||
let pb = Cc["@mozilla.org/privatebrowsing;1"].
|
||||
getService(Ci.nsIPrivateBrowsingService);
|
||||
pb.removeDataFromDomain("example.net");
|
||||
|
||||
|
||||
closedTabs = JSON.parse(ss.getClosedTabData(newWin));
|
||||
is(closedTabs.length, remember_count,
|
||||
"The correct amout of tabs was removed");
|
||||
@ -110,7 +112,7 @@ function test() {
|
||||
"All tabs to be forgotten were indeed removed");
|
||||
is(countByTitle(closedTabs, REMEMBER), remember_count,
|
||||
"... and tabs to be remembered weren't.");
|
||||
|
||||
|
||||
// clean up
|
||||
newWin.close();
|
||||
is(browserWindowsCount(), 1, "Only one browser window should be open eventually");
|
||||
|
@ -47,42 +47,44 @@ function browserWindowsCount() {
|
||||
function test() {
|
||||
/** Test for Bug 465223 **/
|
||||
is(browserWindowsCount(), 1, "Only one browser window should be open initially");
|
||||
|
||||
|
||||
// test setup
|
||||
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
|
||||
waitForExplicitFinish();
|
||||
|
||||
|
||||
let uniqueKey1 = "bug 465223.1";
|
||||
let uniqueKey2 = "bug 465223.2";
|
||||
let uniqueValue1 = "unik" + Date.now();
|
||||
let uniqueValue2 = "pi != " + Math.random();
|
||||
|
||||
|
||||
// open a window and set a value on it
|
||||
let newWin = openDialog(location, "_blank", "chrome,all,dialog=no");
|
||||
newWin.addEventListener("load", function(aEvent) {
|
||||
newWin.removeEventListener("load", arguments.callee, false);
|
||||
|
||||
ss.setWindowValue(newWin, uniqueKey1, uniqueValue1);
|
||||
|
||||
|
||||
let newState = { windows: [{ tabs:[{ entries: [] }], extData: {} }] };
|
||||
newState.windows[0].extData[uniqueKey2] = uniqueValue2;
|
||||
ss.setWindowState(newWin, JSON.stringify(newState), false);
|
||||
|
||||
|
||||
is(newWin.gBrowser.tabs.length, 2,
|
||||
"original tab wasn't overwritten");
|
||||
is(ss.getWindowValue(newWin, uniqueKey1), uniqueValue1,
|
||||
"window value wasn't overwritten when the tabs weren't");
|
||||
is(ss.getWindowValue(newWin, uniqueKey2), uniqueValue2,
|
||||
"new window value was correctly added");
|
||||
|
||||
|
||||
newState.windows[0].extData[uniqueKey2] = uniqueValue1;
|
||||
ss.setWindowState(newWin, JSON.stringify(newState), true);
|
||||
|
||||
|
||||
is(newWin.gBrowser.tabs.length, 1,
|
||||
"original tabs were overwritten");
|
||||
is(ss.getWindowValue(newWin, uniqueKey1), "",
|
||||
"window value was cleared");
|
||||
is(ss.getWindowValue(newWin, uniqueKey2), uniqueValue1,
|
||||
"window value was correctly overwritten");
|
||||
|
||||
|
||||
// clean up
|
||||
newWin.close();
|
||||
is(browserWindowsCount(), 1, "Only one browser window should be open eventually");
|
||||
|
@ -57,6 +57,8 @@ function test() {
|
||||
|
||||
let newWin = openDialog(location, "_blank", "chrome,all,dialog=no");
|
||||
newWin.addEventListener("load", function(aEvent) {
|
||||
newWin.removeEventListener("load", arguments.callee, false);
|
||||
|
||||
let newState = { windows: [{
|
||||
tabs: [{ entries: [] }],
|
||||
_closedTabs: [{
|
||||
@ -65,42 +67,42 @@ function test() {
|
||||
}],
|
||||
sizemode: "maximized"
|
||||
}] };
|
||||
|
||||
|
||||
let uniqueKey = "bug 477657";
|
||||
let uniqueValue = "unik" + Date.now();
|
||||
|
||||
|
||||
ss.setWindowValue(newWin, uniqueKey, uniqueValue);
|
||||
is(ss.getWindowValue(newWin, uniqueKey), uniqueValue,
|
||||
"window value was set before the window was overwritten");
|
||||
ss.setWindowState(newWin, JSON.stringify(newState), true);
|
||||
|
||||
|
||||
// use setTimeout(..., 0) to mirror sss_restoreWindowFeatures
|
||||
setTimeout(function() {
|
||||
is(ss.getWindowValue(newWin, uniqueKey), "",
|
||||
"window value was implicitly cleared");
|
||||
|
||||
|
||||
is(newWin.windowState, newWin.STATE_MAXIMIZED,
|
||||
"the window was maximized");
|
||||
|
||||
|
||||
is(JSON.parse(ss.getClosedTabData(newWin)).length, 1,
|
||||
"the closed tab was added before the window was overwritten");
|
||||
delete newState.windows[0]._closedTabs;
|
||||
delete newState.windows[0].sizemode;
|
||||
ss.setWindowState(newWin, JSON.stringify(newState), true);
|
||||
|
||||
|
||||
setTimeout(function() {
|
||||
is(JSON.parse(ss.getClosedTabData(newWin)).length, 0,
|
||||
"closed tabs were implicitly cleared");
|
||||
|
||||
|
||||
is(newWin.windowState, newWin.STATE_MAXIMIZED,
|
||||
"the window remains maximized");
|
||||
newState.windows[0].sizemode = "normal";
|
||||
ss.setWindowState(newWin, JSON.stringify(newState), true);
|
||||
|
||||
|
||||
setTimeout(function() {
|
||||
isnot(newWin.windowState, newWin.STATE_MAXIMIZED,
|
||||
"the window was explicitly unmaximized");
|
||||
|
||||
|
||||
newWin.close();
|
||||
is(browserWindowsCount(), 1, "Only one browser window should be open eventually");
|
||||
finish();
|
||||
|
@ -66,6 +66,8 @@ function test() {
|
||||
|
||||
var theWin = openDialog(location, "", "chrome,all,dialog=no");
|
||||
theWin.addEventListener("load", function () {
|
||||
theWin.removeEventListener("load", arguments.callee, false);
|
||||
|
||||
executeSoon(function () {
|
||||
var gotError = false;
|
||||
try {
|
||||
|
@ -20,6 +20,7 @@ function test() {
|
||||
|
||||
var win = openDialog(location, "", "chrome,all,dialog=no");
|
||||
win.addEventListener("load", function () {
|
||||
win.removeEventListener("load", arguments.calle, false);
|
||||
browserWindowsCount(2);
|
||||
win.close();
|
||||
browserWindowsCount(1);
|
||||
|
@ -37,10 +37,12 @@
|
||||
function test() {
|
||||
let tab1 = gBrowser.addTab("about:robots");
|
||||
let tab2 = gBrowser.addTab("about:mozilla");
|
||||
tab1.addEventListener("load", mainPart, true);
|
||||
tab1.linkedBrowser.addEventListener("load", mainPart, true);
|
||||
waitForExplicitFinish();
|
||||
|
||||
function mainPart() {
|
||||
tab1.linkedBrowser.removeEventListener("load", mainPart, true);
|
||||
|
||||
// Tell the session storer that the tab is pinned
|
||||
let newTabState = '{"entries":[{"url":"about:robots"}],"pinned":true,"userTypedValue":"Hello World!"}';
|
||||
let ss = Cc["@mozilla.org/browser/sessionstore;1"]
|
||||
|
@ -5,6 +5,8 @@ function test() {
|
||||
gBrowser.pinTab(tab1);
|
||||
|
||||
tab1.linkedBrowser.addEventListener("load", function () {
|
||||
tab1.linkedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
|
||||
var tab2 = gBrowser.addTab();
|
||||
gBrowser.pinTab(tab2);
|
||||
|
||||
|
@ -44,6 +44,7 @@ function openWinWithCb(cb, argURIs, expectedURIs) {
|
||||
"chrome,all,dialog=no", argURIs.join("|"));
|
||||
|
||||
win.addEventListener("load", function () {
|
||||
win.removeEventListener("load", arguments.callee, false);
|
||||
info("the window loaded");
|
||||
|
||||
var expectedLoads = expectedURIs.length;
|
||||
|
@ -206,7 +206,10 @@ function onStateRestored(aSubject, aTopic, aData) {
|
||||
if (shouldPinTab)
|
||||
newWin.gBrowser.pinTab(newWin.gBrowser.selectedTab);
|
||||
|
||||
newWin.addEventListener("unload", onWindowUnloaded, false);
|
||||
newWin.addEventListener("unload", function () {
|
||||
newWin.removeEventListener("unload", arguments.callee, false);
|
||||
onWindowUnloaded();
|
||||
}, false);
|
||||
// Open a new tab as well. On Windows/Linux this will be restored when the
|
||||
// new window is opened below (in onWindowUnloaded). On OS X we'll just
|
||||
// restore the pinned tabs, leaving the unpinned tab in the closedWindowsData.
|
||||
@ -257,6 +260,8 @@ function onWindowUnloaded() {
|
||||
newWin.removeEventListener("load", arguments.callee, false);
|
||||
|
||||
newWin.gBrowser.selectedBrowser.addEventListener("load", function () {
|
||||
newWin.gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
|
||||
// Good enough for checking the state
|
||||
afterTestCallback(previousClosedWindowData, ss.getClosedWindowData());
|
||||
afterTestCleanup(newWin);
|
||||
|
@ -73,6 +73,7 @@ function test() {
|
||||
let newWin = openDialog(location, "", "chrome,all,dialog=no", "http://example.com");
|
||||
newWin.addEventListener("load", function(aEvent) {
|
||||
newWin.removeEventListener("load", arguments.callee, false);
|
||||
|
||||
newWin.gBrowser.addEventListener("load", function(aEvent) {
|
||||
newWin.gBrowser.removeEventListener("load", arguments.callee, true);
|
||||
|
||||
@ -85,6 +86,8 @@ function test() {
|
||||
|
||||
newWin.close();
|
||||
newWin.addEventListener("unload", function(aEvent) {
|
||||
newWin.removeEventListener("unload", arguments.callee, false);
|
||||
|
||||
is(ss.getClosedWindowCount(), closedWindowCount + 1,
|
||||
"increased closed window count");
|
||||
is(browserWindowsCount(), 1, "there should be 1 window open currently");
|
||||
|
@ -292,11 +292,13 @@ function test_setBrowserState() {
|
||||
|
||||
// waitForBrowserState does it's own observing for windows, but doesn't attach
|
||||
// the listeners we want here, so do it ourselves.
|
||||
let newWindow;
|
||||
function windowObserver(aSubject, aTopic, aData) {
|
||||
if (aTopic == "domwindowopened") {
|
||||
let newWindow = aSubject.QueryInterface(Ci.nsIDOMWindow);
|
||||
newWindow = aSubject.QueryInterface(Ci.nsIDOMWindow);
|
||||
newWindow.addEventListener("load", function() {
|
||||
newWindow.removeEventListener("load", arguments.callee, false);
|
||||
|
||||
Services.ww.unregisterNotification(windowObserver);
|
||||
|
||||
windowEvents[getOuterWindowID(newWindow)] = { busyEventCount: 0, readyEventCount: 0 };
|
||||
@ -332,6 +334,8 @@ function test_setBrowserState() {
|
||||
"[test_setBrowserState] checked 2 windows");
|
||||
window.removeEventListener("SSWindowStateBusy", onSSWindowStateBusy, false);
|
||||
window.removeEventListener("SSWindowStateReady", onSSWindowStateReady, false);
|
||||
newWindow.removeEventListener("SSWindowStateBusy", onSSWindowStateBusy, false);
|
||||
newWindow.removeEventListener("SSWindowStateReady", onSSWindowStateReady, false);
|
||||
runNextTest();
|
||||
});
|
||||
}
|
||||
@ -357,6 +361,7 @@ function test_undoCloseWindow() {
|
||||
|
||||
reopenedWindow.addEventListener("load", function() {
|
||||
reopenedWindow.removeEventListener("load", arguments.callee, false);
|
||||
|
||||
reopenedWindow.gBrowser.tabContainer.addEventListener("SSTabRestored", onSSTabRestored, false);
|
||||
}, false);
|
||||
});
|
||||
|
@ -4,6 +4,8 @@ const DG_OPTION_KEY = DG_BACKGROUND + "/picture_options";
|
||||
const DG_DRAW_BG_KEY = DG_BACKGROUND + "/draw_background";
|
||||
|
||||
function onPageLoad() {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", onPageLoad, true);
|
||||
|
||||
var bs = Cc["@mozilla.org/intl/stringbundle;1"].
|
||||
getService(Ci.nsIStringBundleService);
|
||||
var brandName = bs.createBundle("chrome://branding/locale/brand.properties").
|
||||
|
@ -165,7 +165,10 @@ var gWindowCatcher = {
|
||||
this.windowsOpen++;
|
||||
let win = subject.QueryInterface(Ci.nsIDOMWindow);
|
||||
info("window catcher caught window opening: " + win.document.documentURI);
|
||||
win.addEventListener("load", this.windowLoad.bind(this, win), false);
|
||||
win.addEventListener("load", function () {
|
||||
win.removeEventListener("load", arguments.callee, false);
|
||||
gWindowCatcher.windowLoad(win);
|
||||
}, false);
|
||||
}
|
||||
};
|
||||
|
||||
@ -357,7 +360,10 @@ function testShowNotification()
|
||||
// Wait for any windows caught by the windowcatcher to close
|
||||
gWindowCatcher.finish(function () {
|
||||
button.click();
|
||||
gBrowser.selectedBrowser.addEventListener("load", testNotificationURL, true);
|
||||
gBrowser.selectedBrowser.addEventListener("load", function () {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
testNotificationURL();
|
||||
}, true);
|
||||
});
|
||||
} else {
|
||||
notifyBox.removeAllNotifications(true);
|
||||
|
@ -27,6 +27,8 @@ function testXFOFrameInChrome() {
|
||||
var frame = newBrowser.contentDocument.createElement("iframe");
|
||||
frame.src = "http://mochi.test:8888/tests/content/base/test/file_x-frame-options_page.sjs?testid=deny&xfo=deny";
|
||||
frame.addEventListener("load", function() {
|
||||
frame.removeEventListener("load", arguments.callee, true);
|
||||
|
||||
// Test that the frame loaded
|
||||
var test = this.contentDocument.getElementById("test");
|
||||
is(test.tagName, "H1", "wrong element type");
|
||||
@ -48,6 +50,8 @@ function testXFOFrameInContent() {
|
||||
var frame = newBrowser.contentDocument.createElement("iframe");
|
||||
frame.src = "http://mochi.test:8888/tests/content/base/test/file_x-frame-options_page.sjs?testid=deny&xfo=deny";
|
||||
frame.addEventListener("load", function() {
|
||||
frame.removeEventListener("load", arguments.callee, true);
|
||||
|
||||
// Test that the frame DID NOT load
|
||||
var test = this.contentDocument.getElementById("test");
|
||||
is(test, undefined, "should be about:blank");
|
||||
|
@ -3,7 +3,9 @@ function test() {
|
||||
|
||||
let tab = gBrowser.addTab("http://example.com");
|
||||
|
||||
tab.linkedBrowser.addEventListener('load', function() {
|
||||
tab.linkedBrowser.addEventListener("load", function() {
|
||||
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
|
||||
let numLocationChanges = 0;
|
||||
|
||||
let listener = {
|
||||
|
@ -14,22 +14,14 @@ function isActive(aWindow) {
|
||||
return docshell.isActive;
|
||||
}
|
||||
|
||||
// Returns a closure that will remove itself as a listener from
|
||||
// aElem and then call aCallback. aCallback is executed asynchronously,
|
||||
// which is handy because load events fire before mIsDocumentLoaded is actually
|
||||
// set to true. :(
|
||||
function autoRemovedListener(aElem, aType, aCallback) {
|
||||
function oneShotListener(aElem, aType, aCallback) {
|
||||
aElem.addEventListener(aType, function () {
|
||||
aElem.removeEventListener(aType, arguments.callee, true);
|
||||
|
||||
var elem = aElem;
|
||||
var type = aType;
|
||||
var callback = aCallback;
|
||||
|
||||
function remover() {
|
||||
elem.removeEventListener(type, remover, true);
|
||||
executeSoon(callback);
|
||||
}
|
||||
|
||||
return remover;
|
||||
// aCallback is executed asynchronously, which is handy because load
|
||||
// events fire before mIsDocumentLoaded is actually set to true. :(
|
||||
executeSoon(aCallback);
|
||||
}, true);
|
||||
}
|
||||
|
||||
// Returns a closure that iteratively (BFS) waits for all
|
||||
@ -58,7 +50,7 @@ function frameLoadWaiter(aInitialWindow, aFinalCallback) {
|
||||
if (curr.document.readyState == "complete")
|
||||
frameLoadCallback();
|
||||
else
|
||||
curr.addEventListener("load", autoRemovedListener(curr, "load", frameLoadCallback), true);
|
||||
oneShotListener(curr, "load", frameLoadCallback);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -93,9 +85,7 @@ function step1() {
|
||||
ctx.tab1 = gBrowser.addTab(testPath + "bug343515_pg1.html");
|
||||
ctx.tab1Browser = gBrowser.getBrowserForTab(ctx.tab1);
|
||||
ctx.tab1Window = ctx.tab1Browser.contentWindow;
|
||||
ctx.tab1Browser.addEventListener("load",
|
||||
autoRemovedListener(ctx.tab1Browser, "load", step2),
|
||||
true);
|
||||
oneShotListener(ctx.tab1Browser, "load", step2);
|
||||
}
|
||||
|
||||
function step2() {
|
||||
@ -115,10 +105,7 @@ function step2() {
|
||||
ctx.tab2 = gBrowser.addTab(testPath + "bug343515_pg2.html");
|
||||
ctx.tab2Browser = gBrowser.getBrowserForTab(ctx.tab2);
|
||||
ctx.tab2Window = ctx.tab2Browser.contentWindow;
|
||||
ctx.tab2Browser.addEventListener("load",
|
||||
autoRemovedListener(ctx.tab2Browser, "load",
|
||||
frameLoadWaiter(ctx.tab2Window, step3)),
|
||||
true);
|
||||
oneShotListener(ctx.tab2Browser, "load", frameLoadWaiter(ctx.tab2Window, step3));
|
||||
}
|
||||
|
||||
function step3() {
|
||||
@ -135,10 +122,7 @@ function step3() {
|
||||
|
||||
// Navigate tab 2 to a different page
|
||||
ctx.tab2Window.location = testPath + "bug343515_pg3.html";
|
||||
ctx.tab2Browser.addEventListener("load",
|
||||
autoRemovedListener(ctx.tab2Browser, "load",
|
||||
frameLoadWaiter(ctx.tab2Window, step4)),
|
||||
true);
|
||||
oneShotListener(ctx.tab2Browser, "load", frameLoadWaiter(ctx.tab2Window, step4));
|
||||
}
|
||||
|
||||
function step4() {
|
||||
@ -167,10 +151,7 @@ function step4() {
|
||||
ok(isActive(ctx.tab2Window.frames[1]), "Tab2 iframe 1 should be active");
|
||||
|
||||
// Go back
|
||||
ctx.tab2Browser.addEventListener("pageshow",
|
||||
autoRemovedListener(ctx.tab2Browser, "pageshow",
|
||||
frameLoadWaiter(ctx.tab2Window, step5)),
|
||||
true);
|
||||
oneShotListener(ctx.tab2Browser, "pageshow", frameLoadWaiter(ctx.tab2Window, step5));
|
||||
ctx.tab2Browser.goBack();
|
||||
|
||||
}
|
||||
@ -189,10 +170,7 @@ function step5() {
|
||||
|
||||
// Navigate to page 3
|
||||
ctx.tab1Window.location = testPath + "bug343515_pg3.html";
|
||||
ctx.tab1Browser.addEventListener("load",
|
||||
autoRemovedListener(ctx.tab1Browser, "load",
|
||||
frameLoadWaiter(ctx.tab1Window, step6)),
|
||||
true);
|
||||
oneShotListener(ctx.tab1Browser, "load", frameLoadWaiter(ctx.tab1Window, step6));
|
||||
}
|
||||
|
||||
function step6() {
|
||||
@ -208,10 +186,7 @@ function step6() {
|
||||
ok(!isActive(ctx.tab2Window.frames[1]), "Tab2 iframe 1 should be inactive");
|
||||
|
||||
// Go forward on tab 2
|
||||
ctx.tab2Browser.addEventListener("pageshow",
|
||||
autoRemovedListener(ctx.tab2Browser, "pageshow",
|
||||
frameLoadWaiter(ctx.tab2Window, step7)),
|
||||
true);
|
||||
oneShotListener(ctx.tab2Browser, "pageshow", frameLoadWaiter(ctx.tab2Window, step7));
|
||||
var tab2docshell = ctx.tab2Window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation);
|
||||
tab2docshell.goForward();
|
||||
|
@ -35,14 +35,17 @@ function test()
|
||||
{
|
||||
addTab(TEST_URI);
|
||||
|
||||
browser.addEventListener("load", function(aEvent) {
|
||||
browser.removeEventListener(aEvent.type, arguments.callee, true);
|
||||
let initialLoad = true;
|
||||
|
||||
openConsole();
|
||||
|
||||
HUDService.lastFinishedRequestCallback = requestDoneCallback;
|
||||
|
||||
browser.addEventListener("load", performTest, true);
|
||||
content.location.reload();
|
||||
browser.addEventListener("load", function () {
|
||||
if (initialLoad) {
|
||||
openConsole();
|
||||
HUDService.lastFinishedRequestCallback = requestDoneCallback;
|
||||
content.location.reload();
|
||||
initialLoad = false;
|
||||
} else {
|
||||
browser.removeEventListener("load", arguments.callee, true);
|
||||
performTest();
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
@ -38,18 +38,22 @@ function test()
|
||||
{
|
||||
addTab("data:text/html,Web Console - bug 600183 test");
|
||||
|
||||
browser.addEventListener("load", function(aEvent) {
|
||||
browser.removeEventListener(aEvent.type, arguments.callee, true);
|
||||
let initialLoad = true;
|
||||
|
||||
waitForFocus(function() {
|
||||
openConsole();
|
||||
browser.addEventListener("load", function () {
|
||||
if (initialLoad) {
|
||||
waitForFocus(function() {
|
||||
openConsole();
|
||||
|
||||
HUDService.saveRequestAndResponseBodies = true;
|
||||
HUDService.lastFinishedRequestCallback = requestDoneCallback;
|
||||
HUDService.saveRequestAndResponseBodies = true;
|
||||
HUDService.lastFinishedRequestCallback = requestDoneCallback;
|
||||
|
||||
browser.addEventListener("load", performTest, true);
|
||||
content.location = TEST_URI;
|
||||
}, content);
|
||||
content.location = TEST_URI;
|
||||
}, content);
|
||||
initialLoad = false;
|
||||
} else {
|
||||
browser.removeEventListener("load", arguments.callee, true);
|
||||
performTest();
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
|
@ -72,6 +72,7 @@ var Watcher = {
|
||||
.getInterface(Components.interfaces.nsIDOMWindowInternal);
|
||||
var self = this;
|
||||
domwindow.addEventListener("load", function() {
|
||||
domwindow.removeEventListener("load", arguments.callee, false);
|
||||
self.windowLoad(domwindow);
|
||||
}, false);
|
||||
},
|
||||
@ -96,6 +97,7 @@ function test() {
|
||||
var win2 = window.openDialog(location, "", "chrome,all,dialog=no", "about:blank");
|
||||
win2.addEventListener("load", function() {
|
||||
win2.removeEventListener("load", arguments.callee, false);
|
||||
|
||||
gBrowser.selectedTab = gBrowser.addTab(TEST_URL);
|
||||
gBrowser.selectedBrowser.addEventListener("DOMContentLoaded", function() {
|
||||
if (window.content.location.href != TEST_URL)
|
||||
|
@ -72,6 +72,7 @@ var Watcher = {
|
||||
.getInterface(Components.interfaces.nsIDOMWindowInternal);
|
||||
var self = this;
|
||||
domwindow.addEventListener("load", function() {
|
||||
domwindow.removeEventListener("load", arguments.callee, false);
|
||||
self.windowLoad(domwindow);
|
||||
}, false);
|
||||
},
|
||||
|
@ -31,8 +31,9 @@ function test() {
|
||||
let tab = gBrowser.selectedTab = gBrowser.addTab("about:blank");
|
||||
let browser = gBrowser.getBrowserForTab(tab);
|
||||
browser.addEventListener("load", function() {
|
||||
ok(true, "about:crashes loaded");
|
||||
executeSoon(function() { check_crash_list(tab, crashes); });
|
||||
}, true);
|
||||
browser.removeEventListener("load", arguments.callee, true);
|
||||
ok(true, "about:crashes loaded");
|
||||
executeSoon(function() { check_crash_list(tab, crashes); });
|
||||
}, true);
|
||||
browser.loadURI("about:crashes", null, null);
|
||||
}
|
||||
|
@ -55,15 +55,19 @@ function test() {
|
||||
|
||||
let tab = gBrowser.selectedTab = gBrowser.addTab("about:blank");
|
||||
let browser = gBrowser.getBrowserForTab(tab);
|
||||
browser.addEventListener("load", function() {
|
||||
executeSoon(function() {
|
||||
if (run_test_onload(tab)) {
|
||||
// prep and run the next test
|
||||
run_test_setup(crD);
|
||||
executeSoon(function() { browser.loadURI("about:crashes", null, null); });
|
||||
}
|
||||
});
|
||||
}, true);
|
||||
let onLoad = function () {
|
||||
executeSoon(function() {
|
||||
if (run_test_onload(tab)) {
|
||||
// prep and run the next test
|
||||
run_test_setup(crD);
|
||||
executeSoon(function() { browser.loadURI("about:crashes", null, null); });
|
||||
}
|
||||
});
|
||||
};
|
||||
browser.addEventListener("load", onLoad, true);
|
||||
registerCleanupFunction(function () {
|
||||
browser.removeEventListener("load", onLoad, true);
|
||||
});
|
||||
// kick things off
|
||||
run_test_setup(crD);
|
||||
browser.loadURI("about:crashes", null, null);
|
||||
|
@ -52,6 +52,7 @@ add_test(function() {
|
||||
|
||||
var utilsBtn = gManagerWindow.document.getElementById("header-utils-btn");
|
||||
utilsBtn.addEventListener("popupshown", function() {
|
||||
utilsBtn.removeEventListener("popupshown", arguments.callee, false);
|
||||
wait_for_view_load(gManagerWindow, function() {
|
||||
is(gCategoryUtilities.isVisible(recentCat), true, "Recent Updates category should now be visible");
|
||||
is(gManagerWindow.document.getElementById("categories").selectedItem.value, "addons://updates/recent", "Recent Updates category should now be selected");
|
||||
|
@ -6,6 +6,8 @@ function loadURI(aUri, aCallback) {
|
||||
if (gBrowser.selectedBrowser.currentURI.spec != aUri)
|
||||
return;
|
||||
|
||||
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
|
||||
aCallback();
|
||||
}, true);
|
||||
|
||||
|
@ -80,16 +80,24 @@ function page_shown() {
|
||||
|
||||
function pfs_loaded() {
|
||||
info("PFS loaded");
|
||||
gPFS.document.documentElement.addEventListener("pageshow", page_shown, false);
|
||||
gPFS.document.documentElement.addEventListener("wizardfinish", function() {
|
||||
var docEle = gPFS.document.documentElement;
|
||||
|
||||
docEle.addEventListener("pageshow", page_shown, false);
|
||||
docEle.addEventListener("wizardfinish", function onwizardfinish() {
|
||||
info("wizardfinish event");
|
||||
}, false);
|
||||
gPFS.document.documentElement.addEventListener("wizardnext", function() {
|
||||
docEle.addEventListener("wizardnext", function onwizardnext() {
|
||||
info("wizardnext event");
|
||||
}, false);
|
||||
|
||||
gPFS.addEventListener("unload", function() {
|
||||
info("unload event");
|
||||
gPFS.removeEventListener("unload", arguments.callee, false);
|
||||
docEle.removeEventListener("pageshow", page_shown, false);
|
||||
docEle.removeEventListener("wizardfinish", onwizardfinish, false);
|
||||
docEle.removeEventListener("wizardnext", onwizardnext, false);
|
||||
}, false);
|
||||
|
||||
page_shown();
|
||||
}
|
||||
|
||||
@ -112,14 +120,21 @@ function prepare_test_1() {
|
||||
}
|
||||
|
||||
function test_1_start() {
|
||||
gPFS.removeEventListener("load", test_1_start, false);
|
||||
|
||||
pfs_loaded();
|
||||
gPFS.addEventListener("unload", prepare_test_2, false);
|
||||
gPFS.addEventListener("unload", function () {
|
||||
gPFS.removeEventListener("unload", arguments.callee, false);
|
||||
prepare_test_2();
|
||||
}, false);
|
||||
gSeenAvailable = false;
|
||||
|
||||
gPFS.document.documentElement.wizardPages[1].addEventListener("pageshow", function() {
|
||||
gPFS.document.documentElement.wizardPages[1].addEventListener("pageshow", function(e) {
|
||||
e.currentTarget.removeEventListener(e.type, arguments.callee, false);
|
||||
executeSoon(test_1_available);
|
||||
}, false);
|
||||
gPFS.document.documentElement.wizardPages[4].addEventListener("pageshow", function() {
|
||||
gPFS.document.documentElement.wizardPages[4].addEventListener("pageshow", function(e) {
|
||||
e.currentTarget.removeEventListener(e.type, arguments.callee, false);
|
||||
executeSoon(test_1_complete);
|
||||
}, false);
|
||||
}
|
||||
@ -162,14 +177,21 @@ function prepare_test_2() {
|
||||
}
|
||||
|
||||
function test_2_start() {
|
||||
gPFS.removeEventListener("load", test_2_start, false);
|
||||
|
||||
pfs_loaded();
|
||||
gPFS.addEventListener("unload", prepare_test_3, false);
|
||||
gPFS.addEventListener("unload", function () {
|
||||
gPFS.removeEventListener("unload", arguments.callee, false);
|
||||
prepare_test_3();
|
||||
}, false);
|
||||
gSeenAvailable = false;
|
||||
|
||||
gPFS.document.documentElement.wizardPages[1].addEventListener("pageshow", function() {
|
||||
gPFS.document.documentElement.wizardPages[1].addEventListener("pageshow", function(e) {
|
||||
e.currentTarget.removeEventListener(e.type, arguments.callee, false);
|
||||
executeSoon(test_2_available);
|
||||
}, false);
|
||||
gPFS.document.documentElement.wizardPages[4].addEventListener("pageshow", function() {
|
||||
gPFS.document.documentElement.wizardPages[4].addEventListener("pageshow", function(e) {
|
||||
e.currentTarget.removeEventListener(e.type, arguments.callee, false);
|
||||
executeSoon(test_2_complete);
|
||||
}, false);
|
||||
}
|
||||
@ -216,14 +238,21 @@ function prepare_test_3() {
|
||||
}
|
||||
|
||||
function test_3_start() {
|
||||
gPFS.removeEventListener("load", test_3_start, false);
|
||||
|
||||
pfs_loaded();
|
||||
gPFS.addEventListener("unload", prepare_test_4, false);
|
||||
gPFS.addEventListener("unload", function () {
|
||||
gPFS.removeEventListener("unload", arguments.callee, false);
|
||||
prepare_test_4();
|
||||
}, false);
|
||||
gSeenAvailable = false;
|
||||
|
||||
gPFS.document.documentElement.wizardPages[1].addEventListener("pageshow", function() {
|
||||
gPFS.document.documentElement.wizardPages[1].addEventListener("pageshow", function(e) {
|
||||
e.currentTarget.removeEventListener(e.type, arguments.callee, false);
|
||||
executeSoon(test_3_available);
|
||||
}, false);
|
||||
gPFS.document.documentElement.wizardPages[4].addEventListener("pageshow", function() {
|
||||
gPFS.document.documentElement.wizardPages[4].addEventListener("pageshow", function(e) {
|
||||
e.currentTarget.removeEventListener(e.type, arguments.callee, false);
|
||||
executeSoon(test_3_complete);
|
||||
}, false);
|
||||
}
|
||||
@ -270,14 +299,21 @@ function prepare_test_4() {
|
||||
}
|
||||
|
||||
function test_4_start() {
|
||||
gPFS.removeEventListener("load", test_4_start, false);
|
||||
|
||||
pfs_loaded();
|
||||
gPFS.addEventListener("unload", prepare_test_5, false);
|
||||
gPFS.addEventListener("unload", function () {
|
||||
gPFS.removeEventListener("unload", arguments.callee, false);
|
||||
prepare_test_5();
|
||||
}, false);
|
||||
gSeenAvailable = false;
|
||||
|
||||
gPFS.document.documentElement.wizardPages[1].addEventListener("pageshow", function() {
|
||||
gPFS.document.documentElement.wizardPages[1].addEventListener("pageshow", function(e) {
|
||||
e.currentTarget.removeEventListener(e.type, arguments.callee, false);
|
||||
executeSoon(test_4_available);
|
||||
}, false);
|
||||
gPFS.document.documentElement.wizardPages[4].addEventListener("pageshow", function() {
|
||||
gPFS.document.documentElement.wizardPages[4].addEventListener("pageshow", function(e) {
|
||||
e.currentTarget.removeEventListener(e.type, arguments.callee, false);
|
||||
executeSoon(test_4_complete);
|
||||
}, false);
|
||||
}
|
||||
@ -321,14 +357,21 @@ function prepare_test_5() {
|
||||
}
|
||||
|
||||
function test_5_start() {
|
||||
gPFS.removeEventListener("load", test_5_start, false);
|
||||
|
||||
pfs_loaded();
|
||||
gPFS.addEventListener("unload", prepare_test_6, false);
|
||||
gPFS.addEventListener("unload", function () {
|
||||
gPFS.removeEventListener("unload", arguments.callee, false);
|
||||
prepare_test_6();
|
||||
}, false);
|
||||
gSeenAvailable = false;
|
||||
|
||||
gPFS.document.documentElement.wizardPages[1].addEventListener("pageshow", function() {
|
||||
gPFS.document.documentElement.wizardPages[1].addEventListener("pageshow", function(e) {
|
||||
e.currentTarget.removeEventListener(e.type, arguments.callee, false);
|
||||
executeSoon(test_5_available);
|
||||
}, false);
|
||||
gPFS.document.documentElement.wizardPages[4].addEventListener("pageshow", function() {
|
||||
gPFS.document.documentElement.wizardPages[4].addEventListener("pageshow", function(e) {
|
||||
e.currentTarget.removeEventListener(e.type, arguments.callee, false);
|
||||
executeSoon(test_5_complete);
|
||||
}, false);
|
||||
}
|
||||
@ -378,14 +421,21 @@ function prepare_test_6() {
|
||||
}
|
||||
|
||||
function test_6_start() {
|
||||
gPFS.removeEventListener("load", test_6_start, false);
|
||||
|
||||
pfs_loaded();
|
||||
gPFS.addEventListener("unload", prepare_test_7, false);
|
||||
gPFS.addEventListener("unload", function () {
|
||||
gPFS.removeEventListener("unload", arguments.callee, false);
|
||||
prepare_test_7();
|
||||
}, false);
|
||||
gSeenAvailable = false;
|
||||
|
||||
gPFS.document.documentElement.wizardPages[1].addEventListener("pageshow", function() {
|
||||
gPFS.document.documentElement.wizardPages[1].addEventListener("pageshow", function(e) {
|
||||
e.currentTarget.removeEventListener(e.type, arguments.callee, false);
|
||||
executeSoon(test_6_available);
|
||||
}, false);
|
||||
gPFS.document.documentElement.wizardPages[4].addEventListener("pageshow", function() {
|
||||
gPFS.document.documentElement.wizardPages[4].addEventListener("pageshow", function(e) {
|
||||
e.currentTarget.removeEventListener(e.type, arguments.callee, false);
|
||||
executeSoon(test_6_complete);
|
||||
}, false);
|
||||
}
|
||||
@ -432,14 +482,21 @@ function prepare_test_7() {
|
||||
}
|
||||
|
||||
function test_7_start() {
|
||||
gPFS.removeEventListener("load", test_7_start, false);
|
||||
|
||||
pfs_loaded();
|
||||
gPFS.addEventListener("unload", prepare_test_8, false);
|
||||
gPFS.addEventListener("unload", function () {
|
||||
gPFS.removeEventListener("unload", arguments.callee, false);
|
||||
prepare_test_8();
|
||||
}, false);
|
||||
gSeenAvailable = false;
|
||||
|
||||
gPFS.document.documentElement.wizardPages[1].addEventListener("pageshow", function() {
|
||||
gPFS.document.documentElement.wizardPages[1].addEventListener("pageshow", function(e) {
|
||||
e.currentTarget.removeEventListener(e.type, arguments.callee, false);
|
||||
executeSoon(test_7_available);
|
||||
}, false);
|
||||
gPFS.document.documentElement.wizardPages[4].addEventListener("pageshow", function() {
|
||||
gPFS.document.documentElement.wizardPages[4].addEventListener("pageshow", function(e) {
|
||||
e.currentTarget.removeEventListener(e.type, arguments.callee, false);
|
||||
executeSoon(test_7_complete);
|
||||
}, false);
|
||||
}
|
||||
@ -493,14 +550,21 @@ function prepare_test_8() {
|
||||
}
|
||||
|
||||
function test_8_start() {
|
||||
gPFS.removeEventListener("load", test_8_start, false);
|
||||
|
||||
pfs_loaded();
|
||||
gPFS.addEventListener("unload", prepare_test_9, false);
|
||||
gPFS.addEventListener("unload", function () {
|
||||
gPFS.removeEventListener("unload", arguments.callee, false);
|
||||
prepare_test_9();
|
||||
}, false);
|
||||
gSeenAvailable = false;
|
||||
|
||||
gPFS.document.documentElement.wizardPages[1].addEventListener("pageshow", function() {
|
||||
gPFS.document.documentElement.wizardPages[1].addEventListener("pageshow", function(e) {
|
||||
e.currentTarget.removeEventListener(e.type, arguments.callee, false);
|
||||
executeSoon(test_8_available);
|
||||
}, false);
|
||||
gPFS.document.documentElement.wizardPages[4].addEventListener("pageshow", function() {
|
||||
gPFS.document.documentElement.wizardPages[4].addEventListener("pageshow", function(e) {
|
||||
e.currentTarget.removeEventListener(e.type, arguments.callee, false);
|
||||
executeSoon(test_8_complete);
|
||||
}, false);
|
||||
}
|
||||
@ -549,13 +613,20 @@ function prepare_test_9() {
|
||||
}
|
||||
|
||||
function test_9_start() {
|
||||
pfs_loaded();
|
||||
gPFS.addEventListener("unload", prepare_test_10, false);
|
||||
gPFS.removeEventListener("load", test_9_start, false);
|
||||
|
||||
gPFS.document.documentElement.wizardPages[1].addEventListener("pageshow", function() {
|
||||
pfs_loaded();
|
||||
gPFS.addEventListener("unload", function () {
|
||||
gPFS.removeEventListener("unload", arguments.callee, false);
|
||||
prepare_test_10();
|
||||
}, false);
|
||||
|
||||
gPFS.document.documentElement.wizardPages[1].addEventListener("pageshow", function(e) {
|
||||
e.currentTarget.removeEventListener(e.type, arguments.callee, false);
|
||||
ok(false, "Should not have found plugins to install");
|
||||
}, false);
|
||||
gPFS.document.documentElement.wizardPages[4].addEventListener("pageshow", function() {
|
||||
gPFS.document.documentElement.wizardPages[4].addEventListener("pageshow", function(e) {
|
||||
e.currentTarget.removeEventListener(e.type, arguments.callee, false);
|
||||
executeSoon(test_9_complete);
|
||||
}, false);
|
||||
}
|
||||
@ -588,13 +659,20 @@ function prepare_test_10() {
|
||||
}
|
||||
|
||||
function test_10_start() {
|
||||
pfs_loaded();
|
||||
gPFS.addEventListener("unload", prepare_test_11, false);
|
||||
gPFS.removeEventListener("load", test_10_start, false);
|
||||
|
||||
gPFS.document.documentElement.wizardPages[1].addEventListener("pageshow", function() {
|
||||
pfs_loaded();
|
||||
gPFS.addEventListener("unload", function () {
|
||||
gPFS.removeEventListener("unload", arguments.callee, false);
|
||||
prepare_test_11();
|
||||
}, false);
|
||||
|
||||
gPFS.document.documentElement.wizardPages[1].addEventListener("pageshow", function(e) {
|
||||
e.currentTarget.removeEventListener(e.type, arguments.callee, false);
|
||||
ok(false, "Should not have found plugins to install");
|
||||
}, false);
|
||||
gPFS.document.documentElement.wizardPages[4].addEventListener("pageshow", function() {
|
||||
gPFS.document.documentElement.wizardPages[4].addEventListener("pageshow", function(e) {
|
||||
e.currentTarget.removeEventListener(e.type, arguments.callee, false);
|
||||
executeSoon(test_10_complete);
|
||||
}, false);
|
||||
}
|
||||
@ -627,13 +705,20 @@ function prepare_test_11() {
|
||||
}
|
||||
|
||||
function test_11_start() {
|
||||
pfs_loaded();
|
||||
gPFS.addEventListener("unload", finishTest, false);
|
||||
gPFS.removeEventListener("load", test_11_start, false);
|
||||
|
||||
gPFS.document.documentElement.wizardPages[1].addEventListener("pageshow", function() {
|
||||
pfs_loaded();
|
||||
gPFS.addEventListener("unload", function () {
|
||||
gPFS.removeEventListener("unload", arguments.callee, false);
|
||||
finishTest();
|
||||
}, false);
|
||||
|
||||
gPFS.document.documentElement.wizardPages[1].addEventListener("pageshow", function(e) {
|
||||
e.currentTarget.removeEventListener(e.type, arguments.callee, false);
|
||||
ok(false, "Should not have found plugins to install");
|
||||
}, false);
|
||||
gPFS.document.documentElement.wizardPages[4].addEventListener("pageshow", function() {
|
||||
gPFS.document.documentElement.wizardPages[4].addEventListener("pageshow", function(e) {
|
||||
e.currentTarget.removeEventListener(e.type, arguments.callee, false);
|
||||
executeSoon(test_11_complete);
|
||||
}, false);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user