From dd1db45dac27ce885a894e61e3e7e992d0cb9673 Mon Sep 17 00:00:00 2001 From: Marco Bonardo Date: Tue, 13 Oct 2009 15:31:53 +0200 Subject: [PATCH] Bug 507784 - Some session restore tests don't correctly remove event listeners. r=trivial-cleanup --- .../components/sessionstore/test/browser/browser_339445.js | 2 ++ .../components/sessionstore/test/browser/browser_346337.js | 3 +++ .../components/sessionstore/test/browser/browser_350525.js | 2 ++ .../components/sessionstore/test/browser/browser_354894.js | 5 +++++ .../components/sessionstore/test/browser/browser_367052.js | 1 + .../components/sessionstore/test/browser/browser_393716.js | 3 +++ .../components/sessionstore/test/browser/browser_394759.js | 5 ++++- .../components/sessionstore/test/browser/browser_408470.js | 3 +++ .../components/sessionstore/test/browser/browser_454908.js | 2 ++ .../components/sessionstore/test/browser/browser_456342.js | 1 + .../components/sessionstore/test/browser/browser_459906.js | 3 ++- .../components/sessionstore/test/browser/browser_461634.js | 1 + .../components/sessionstore/test/browser/browser_463205.js | 3 ++- .../components/sessionstore/test/browser/browser_463206.js | 3 ++- .../components/sessionstore/test/browser/browser_464199.js | 1 + .../components/sessionstore/test/browser/browser_465223.js | 1 + .../components/sessionstore/test/browser/browser_466937.js | 2 ++ .../components/sessionstore/test/browser/browser_476161.js | 2 ++ .../components/sessionstore/test/browser/browser_477657.js | 1 + .../components/sessionstore/test/browser/browser_480148.js | 5 ++++- .../components/sessionstore/test/browser/browser_483330.js | 4 ++-- .../components/sessionstore/test/browser/browser_485482.js | 2 ++ .../components/sessionstore/test/browser/browser_485563.js | 1 + .../components/sessionstore/test/browser/browser_491168.js | 4 ++-- .../components/sessionstore/test/browser/browser_491577.js | 1 + 25 files changed, 52 insertions(+), 9 deletions(-) diff --git a/browser/components/sessionstore/test/browser/browser_339445.js b/browser/components/sessionstore/test/browser/browser_339445.js index ca2074f7578..b2e8dfb70d7 100644 --- a/browser/components/sessionstore/test/browser/browser_339445.js +++ b/browser/components/sessionstore/test/browser/browser_339445.js @@ -44,12 +44,14 @@ function test() { let tab = gBrowser.addTab(testURL); tab.linkedBrowser.addEventListener("load", function(aEvent) { + this.removeEventListener("load", arguments.callee, true); let doc = tab.linkedBrowser.contentDocument; is(doc.getElementById("storageTestItem").textContent, "PENDING", "sessionStorage value has been set"); let tab2 = gBrowser.duplicateTab(tab); tab2.linkedBrowser.addEventListener("load", function(aEvent) { + this.removeEventListener("load", arguments.callee, true); let doc2 = tab2.linkedBrowser.contentDocument; is(doc2.getElementById("storageTestItem").textContent, "SUCCESS", "sessionStorage value has been duplicated"); diff --git a/browser/components/sessionstore/test/browser/browser_346337.js b/browser/components/sessionstore/test/browser/browser_346337.js index 33e0fada9b4..904145662ba 100644 --- a/browser/components/sessionstore/test/browser/browser_346337.js +++ b/browser/components/sessionstore/test/browser/browser_346337.js @@ -99,11 +99,13 @@ function test() { "browser/components/sessionstore/test/browser/browser_346337_sample.html"; let tab = tabbrowser.addTab(testURL); tab.linkedBrowser.addEventListener("load", function(aEvent) { + this.removeEventListener("load", arguments.callee, true); for (let xpath in fieldList) setFormValue(tab, xpath, fieldList[xpath]); let tab2 = tabbrowser.duplicateTab(tab); tab2.linkedBrowser.addEventListener("load", function(aEvent) { + this.removeEventListener("load", arguments.callee, true); for (let xpath in fieldList) ok(compareFormValue(tab2, xpath, fieldList[xpath]), "The value for \"" + xpath + "\" was correctly restored"); @@ -114,6 +116,7 @@ function test() { tab = undoCloseTab(); tab.linkedBrowser.addEventListener("load", function(aEvent) { + this.removeEventListener("load", arguments.callee, true); for (let xpath in fieldList) if (fieldList[xpath]) ok(!compareFormValue(tab, xpath, fieldList[xpath]), diff --git a/browser/components/sessionstore/test/browser/browser_350525.js b/browser/components/sessionstore/test/browser/browser_350525.js index fb468f54c90..5884e2b7c95 100644 --- a/browser/components/sessionstore/test/browser/browser_350525.js +++ b/browser/components/sessionstore/test/browser/browser_350525.js @@ -74,6 +74,7 @@ function test() { let testURL = "about:"; tab = tabbrowser.addTab(testURL); tab.linkedBrowser.addEventListener("load", function(aEvent) { + this.removeEventListener("load", arguments.callee, true); // make sure that the next closed tab will increase getClosedTabCount gPrefService.setIntPref("browser.sessionstore.max_tabs_undo", max_tabs_undo + 1); @@ -89,6 +90,7 @@ function test() { ok(tab, "undoCloseTab doesn't throw") tab.linkedBrowser.addEventListener("load", function(aEvent) { + this.removeEventListener("load", arguments.callee, true); is(this.currentURI.spec, testURL, "correct tab was reopened"); // clean up diff --git a/browser/components/sessionstore/test/browser/browser_354894.js b/browser/components/sessionstore/test/browser/browser_354894.js index df91ec34fb0..0072c67b809 100644 --- a/browser/components/sessionstore/test/browser/browser_354894.js +++ b/browser/components/sessionstore/test/browser/browser_354894.js @@ -248,6 +248,7 @@ function test() { // The previously closed window should be restored newWin = openDialog(location, "_blank", CHROME_FEATURES); newWin.addEventListener("load", function() { + this.removeEventListener("load", arguments.callee, true); executeSoon(function() { is(newWin.gBrowser.browsers.length, TEST_URLS.length + 1, "Restored window in-session with otherpopup windows around"); @@ -281,6 +282,7 @@ function test() { // The previously closed window should NOT be restored newWin = openDialog(location, "_blank", CHROME_FEATURES); newWin.addEventListener("load", function() { + this.removeEventListener("load", arguments.callee, true); executeSoon(function() { is(newWin.gBrowser.browsers.length, 1, "Did not restore in private browing mode"); @@ -293,6 +295,7 @@ function test() { newWin = openDialog(location, "_blank", CHROME_FEATURES); newWin.addEventListener("load", function() { + this.removeEventListener("load", arguments.callee, true); executeSoon(function() { is(newWin.gBrowser.browsers.length, TEST_URLS.length + 1, "Restored after leaving private browsing again"); @@ -334,6 +337,7 @@ function test() { // open a new window the previously closed window should be restored to newWin = openDialog(location, "_blank", CHROME_FEATURES); newWin.addEventListener("load", function() { + this.removeEventListener("load", arguments.callee, true); executeSoon(function() { is(newWin.gBrowser.browsers.length, TEST_URLS.length + 1, "Restored window and associated tabs in session"); @@ -364,6 +368,7 @@ function test() { // gets a chance. let popup = openDialog(location, "popup", POPUP_FEATURES, TEST_URLS[1]); popup.addEventListener("load", function() { + this.removeEventListener("load", arguments.callee, true); is(popup.gBrowser.browsers.length, 1, "Did not restore the popup window (1)"); popup.BrowserTryToCloseWindow(); diff --git a/browser/components/sessionstore/test/browser/browser_367052.js b/browser/components/sessionstore/test/browser/browser_367052.js index 14cfa33b74c..6b33af927c7 100644 --- a/browser/components/sessionstore/test/browser/browser_367052.js +++ b/browser/components/sessionstore/test/browser/browser_367052.js @@ -57,6 +57,7 @@ function test() { ss.setTabState(tab, "{ entries: [] }"); tab.linkedBrowser.addEventListener("load", function(aEvent) { + this.removeEventListener("load", arguments.callee, true); ok(history.count == 0, "the tab was restored without any history whatsoever"); tabbrowser.removeTab(tab); diff --git a/browser/components/sessionstore/test/browser/browser_393716.js b/browser/components/sessionstore/test/browser/browser_393716.js index 7484c8eabd0..08758f34272 100644 --- a/browser/components/sessionstore/test/browser/browser_393716.js +++ b/browser/components/sessionstore/test/browser/browser_393716.js @@ -21,6 +21,7 @@ function test() { let tab = tabbrowser.addTab(testURL); ss.setTabValue(tab, key, value); tab.linkedBrowser.addEventListener("load", function(aEvent) { + this.removeEventListener("load", arguments.callee, true); // get the tab's state let state = ss.getTabState(tab); ok(state, "get the tab's state"); @@ -51,6 +52,7 @@ function test() { // set the tab's state ss.setTabState(tab2, state.toSource()); tab2.linkedBrowser.addEventListener("load", function(aEvent) { + this.removeEventListener("load", arguments.callee, true); // verify the correctness of the restored tab ok(ss.getTabValue(tab2, key2) == value2 && this.currentURI.spec == testURL, "the tab's state was correctly restored"); @@ -64,6 +66,7 @@ function test() { tabbrowser.removeTab(tab2); duplicateTab.linkedBrowser.addEventListener("load", function(aEvent) { + this.removeEventListener("load", arguments.callee, true); // verify the correctness of the duplicated tab ok(ss.getTabValue(duplicateTab, key2) == value2 && this.currentURI.spec == testURL, "correctly duplicated the tab's state"); diff --git a/browser/components/sessionstore/test/browser/browser_394759.js b/browser/components/sessionstore/test/browser/browser_394759.js index 203c2d7341a..fc94687d7f5 100644 --- a/browser/components/sessionstore/test/browser/browser_394759.js +++ b/browser/components/sessionstore/test/browser/browser_394759.js @@ -87,6 +87,7 @@ function test() { "The reopened window was removed from Recently Closed Windows"); newWin2.addEventListener("load", function(aEvent) { + this.removeEventListener("load", arguments.callee, false); newWin2.gBrowser.addEventListener("SSTabRestored", function(aEvent) { newWin2.gBrowser.removeEventListener("SSTabRestored", arguments.callee, true); @@ -142,12 +143,14 @@ function test() { let url = "http://window" + windowsToOpen.length + ".example.com"; let window = openDialog(location, "_blank", settings, url); window.addEventListener("load", function(aEvent) { + this.removeEventListener("load", arguments.callee, true); window.gBrowser.addEventListener("load", function(aEvent) { + this.removeEventListener("load", arguments.callee, true); // the window _should_ have state with a tab of url, but it doesn't // always happend before window.close(). addTab ensure we don't treat // this window as a stateless window window.gBrowser.addTab(); - window.gBrowser.removeEventListener("load", arguments.callee, true); + executeSoon(function() { window.close(); executeSoon(function() { diff --git a/browser/components/sessionstore/test/browser/browser_408470.js b/browser/components/sessionstore/test/browser/browser_408470.js index 688b3a7585d..4b729aeff55 100644 --- a/browser/components/sessionstore/test/browser/browser_408470.js +++ b/browser/components/sessionstore/test/browser/browser_408470.js @@ -45,6 +45,7 @@ function test() { let tab = gBrowser.addTab(testUrl); tab.linkedBrowser.addEventListener("load", function(aEvent) { + this.removeEventListener("load", arguments.callee, true); // enable all stylesheets and verify that they're correctly persisted Array.forEach(tab.linkedBrowser.contentDocument.styleSheets, function(aSS, aIx) { pendingCount++; @@ -53,6 +54,7 @@ function test() { let newTab = gBrowser.duplicateTab(tab); newTab.linkedBrowser.addEventListener("load", function(aEvent) { + this.removeEventListener("load", arguments.callee, true); let states = Array.map(newTab.linkedBrowser.contentDocument.styleSheets, function(aSS) !aSS.disabled); let correct = states.indexOf(true) == aIx && states.indexOf(true, aIx + 1) == -1; @@ -72,6 +74,7 @@ function test() { tab.linkedBrowser.markupDocumentViewer.authorStyleDisabled = true; let newTab = gBrowser.duplicateTab(tab); newTab.linkedBrowser.addEventListener("load", function(aEvent) { + this.removeEventListener("load", arguments.callee, true); is(newTab.linkedBrowser.markupDocumentViewer.authorStyleDisabled, true, "disabled all stylesheets"); diff --git a/browser/components/sessionstore/test/browser/browser_454908.js b/browser/components/sessionstore/test/browser/browser_454908.js index c91a613319b..8e1bb4d15a3 100644 --- a/browser/components/sessionstore/test/browser/browser_454908.js +++ b/browser/components/sessionstore/test/browser/browser_454908.js @@ -51,6 +51,7 @@ function test() { "browser/components/sessionstore/test/browser/browser_454908_sample.html"; let tab = gBrowser.addTab(testURL); tab.linkedBrowser.addEventListener("load", function(aEvent) { + this.removeEventListener("load", arguments.callee, true); let doc = tab.linkedBrowser.contentDocument; for (let id in fieldValues) doc.getElementById(id).value = fieldValues[id]; @@ -59,6 +60,7 @@ function test() { tab = undoCloseTab(); tab.linkedBrowser.addEventListener("load", function(aEvent) { + this.removeEventListener("load", arguments.callee, true); let doc = tab.linkedBrowser.contentDocument; for (let id in fieldValues) { let node = doc.getElementById(id); diff --git a/browser/components/sessionstore/test/browser/browser_456342.js b/browser/components/sessionstore/test/browser/browser_456342.js index d1a38f6027a..83d93e13c68 100644 --- a/browser/components/sessionstore/test/browser/browser_456342.js +++ b/browser/components/sessionstore/test/browser/browser_456342.js @@ -46,6 +46,7 @@ function test() { "browser/components/sessionstore/test/browser/browser_456342_sample.xhtml"; let tab = gBrowser.addTab(testURL); tab.linkedBrowser.addEventListener("load", function(aEvent) { + this.removeEventListener("load", arguments.callee, true); gBrowser.removeTab(tab); let ss = Cc["@mozilla.org/browser/sessionstore;1"] diff --git a/browser/components/sessionstore/test/browser/browser_459906.js b/browser/components/sessionstore/test/browser/browser_459906.js index 5ea64c3ea6b..e267263bb82 100644 --- a/browser/components/sessionstore/test/browser/browser_459906.js +++ b/browser/components/sessionstore/test/browser/browser_459906.js @@ -60,7 +60,8 @@ function test() { // wait for all frames to load (and reload!) completely if (frameCount++ < 2) return; - + this.removeEventListener("load", arguments.callee, true); + let maxWait = Date.now() + 1000; executeSoon(function() { let iframes = tab2.linkedBrowser.contentWindow.frames; diff --git a/browser/components/sessionstore/test/browser/browser_461634.js b/browser/components/sessionstore/test/browser/browser_461634.js index 64190507c51..c4dfde0ff8d 100644 --- a/browser/components/sessionstore/test/browser/browser_461634.js +++ b/browser/components/sessionstore/test/browser/browser_461634.js @@ -67,6 +67,7 @@ function test() { // open a window and add the above closed tab list let newWin = openDialog(location, "_blank", "chrome,all,dialog=no"); newWin.addEventListener("load", function(aEvent) { + this.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); diff --git a/browser/components/sessionstore/test/browser/browser_463205.js b/browser/components/sessionstore/test/browser/browser_463205.js index d0a90a59ef6..56dc2a78e4b 100644 --- a/browser/components/sessionstore/test/browser/browser_463205.js +++ b/browser/components/sessionstore/test/browser/browser_463205.js @@ -69,7 +69,8 @@ function test() { // wait for all frames to load (and reload!) completely if (frameCount++ < 4) return; - + this.removeEventListener("load", arguments.callee, true); + let win = tab2.linkedBrowser.contentWindow; isnot(win.frames[0].document.getElementById("original").value, uniqueValue, "subframes must match URL to get text restored"); diff --git a/browser/components/sessionstore/test/browser/browser_463206.js b/browser/components/sessionstore/test/browser/browser_463206.js index a4c66c3935c..c269f4eb771 100644 --- a/browser/components/sessionstore/test/browser/browser_463206.js +++ b/browser/components/sessionstore/test/browser/browser_463206.js @@ -69,7 +69,8 @@ function test() { // wait for all frames to load completely if (frameCount++ < 5) return; - + this.removeEventListener("load", arguments.callee, true); + let doc = tab2.linkedBrowser.contentDocument; let win = tab2.linkedBrowser.contentWindow; isnot(doc.getElementById("out1").value, diff --git a/browser/components/sessionstore/test/browser/browser_464199.js b/browser/components/sessionstore/test/browser/browser_464199.js index c06d18ef5e5..9e3e4f056da 100644 --- a/browser/components/sessionstore/test/browser/browser_464199.js +++ b/browser/components/sessionstore/test/browser/browser_464199.js @@ -75,6 +75,7 @@ function test() { // open a window and add the above closed tab list let newWin = openDialog(location, "_blank", "chrome,all,dialog=no"); newWin.addEventListener("load", function(aEvent) { + this.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); diff --git a/browser/components/sessionstore/test/browser/browser_465223.js b/browser/components/sessionstore/test/browser/browser_465223.js index 14c4033106d..a8b48a8f64d 100644 --- a/browser/components/sessionstore/test/browser/browser_465223.js +++ b/browser/components/sessionstore/test/browser/browser_465223.js @@ -49,6 +49,7 @@ function test() { // open a window and set a value on it let newWin = openDialog(location, "_blank", "chrome,all,dialog=no"); newWin.addEventListener("load", function(aEvent) { + this.removeEventListener("load", arguments.callee, false); ss.setWindowValue(newWin, uniqueKey1, uniqueValue1); let newState = { windows: [{ tabs:[{ entries: [] }], extData: {} }] }; diff --git a/browser/components/sessionstore/test/browser/browser_466937.js b/browser/components/sessionstore/test/browser/browser_466937.js index 9dd4fb5b6fd..095a5e5a321 100644 --- a/browser/components/sessionstore/test/browser/browser_466937.js +++ b/browser/components/sessionstore/test/browser/browser_466937.js @@ -45,12 +45,14 @@ function test() { let tab = gBrowser.addTab(testURL); tab.linkedBrowser.addEventListener("load", function(aEvent) { + this.removeEventListener("load", arguments.callee, true); let doc = tab.linkedBrowser.contentDocument; doc.getElementById("reverse_thief").value = "/home/user/secret2"; doc.getElementById("bystander").value = testPath; let tab2 = gBrowser.duplicateTab(tab); tab2.linkedBrowser.addEventListener("load", function(aEvent) { + this.removeEventListener("load", arguments.callee, true); doc = tab2.linkedBrowser.contentDocument; is(doc.getElementById("thief").value, "", "file path wasn't set to text field value"); diff --git a/browser/components/sessionstore/test/browser/browser_476161.js b/browser/components/sessionstore/test/browser/browser_476161.js index 84b2f8ba5f8..69b4e0ed5e5 100644 --- a/browser/components/sessionstore/test/browser/browser_476161.js +++ b/browser/components/sessionstore/test/browser/browser_476161.js @@ -43,6 +43,7 @@ function test() { "browser/components/sessionstore/test/browser/browser_476161_sample.html"; let tab = gBrowser.addTab(testURL); tab.linkedBrowser.addEventListener("load", function(aEvent) { + this.removeEventListener("load", arguments.callee, true); let doc = tab.linkedBrowser.contentDocument; doc.getElementById("modify1").value += Math.random(); @@ -50,6 +51,7 @@ function test() { let tab2 = gBrowser.duplicateTab(tab); tab2.linkedBrowser.addEventListener("load", function(aEvent) { + this.removeEventListener("load", arguments.callee, true); let doc = tab2.linkedBrowser.contentDocument; let changed = doc.getElementById("changed").textContent.trim().split(); diff --git a/browser/components/sessionstore/test/browser/browser_477657.js b/browser/components/sessionstore/test/browser/browser_477657.js index d8d215aab9c..6e551088ce1 100644 --- a/browser/components/sessionstore/test/browser/browser_477657.js +++ b/browser/components/sessionstore/test/browser/browser_477657.js @@ -42,6 +42,7 @@ function test() { let newWin = openDialog(location, "_blank", "chrome,all,dialog=no"); newWin.addEventListener("load", function(aEvent) { + this.removeEventListener("load", arguments.callee, false); let newState = { windows: [{ tabs: [{ entries: [] }], _closedTabs: [{ diff --git a/browser/components/sessionstore/test/browser/browser_480148.js b/browser/components/sessionstore/test/browser/browser_480148.js index 134756615cc..71cf52adfc4 100644 --- a/browser/components/sessionstore/test/browser/browser_480148.js +++ b/browser/components/sessionstore/test/browser/browser_480148.js @@ -108,8 +108,11 @@ function test() { // cleanup this.window.close(); // if we're all done, explicitly finish - if (++completedTests == numTests) + if (++completedTests == numTests) { + this.window.removeEventListener("load", this, false); + this.window.removeEventListener("SSTabRestoring", this, false); finish(); + } }, handleLoad: function (aEvent) { diff --git a/browser/components/sessionstore/test/browser/browser_483330.js b/browser/components/sessionstore/test/browser/browser_483330.js index c060e7ab5fb..993c94c8c1e 100644 --- a/browser/components/sessionstore/test/browser/browser_483330.js +++ b/browser/components/sessionstore/test/browser/browser_483330.js @@ -10,7 +10,7 @@ function test() { let browser = tab.linkedBrowser; browser.addEventListener("load", function loadListener(e) { - browser.removeEventListener("load", arguments.callee, false); + browser.removeEventListener("load", arguments.callee, true); // Scroll the content document browser.contentWindow.scrollTo(1100, 1200); @@ -21,7 +21,7 @@ function test() { let newTab = ss.undoCloseTab(window, 0); newTab.addEventListener("SSTabRestored", function tabRestored(e) { - newTab.removeEventListener("SSTabRestored", arguments.callee, false); + newTab.removeEventListener("SSTabRestored", arguments.callee, true); let newBrowser = newTab.linkedBrowser; diff --git a/browser/components/sessionstore/test/browser/browser_485482.js b/browser/components/sessionstore/test/browser/browser_485482.js index b71ddade87a..cb34e39eb6f 100644 --- a/browser/components/sessionstore/test/browser/browser_485482.js +++ b/browser/components/sessionstore/test/browser/browser_485482.js @@ -45,12 +45,14 @@ function test() { "browser/components/sessionstore/test/browser/browser_485482_sample.html"; let tab = gBrowser.addTab(testURL); tab.linkedBrowser.addEventListener("load", function(aEvent) { + this.removeEventListener("load", arguments.callee, true); let doc = tab.linkedBrowser.contentDocument; doc.querySelector("input[type=text]").value = uniqueValue; doc.querySelector("input[type=checkbox]").checked = true; let tab2 = gBrowser.duplicateTab(tab); tab2.linkedBrowser.addEventListener("load", function(aEvent) { + this.removeEventListener("load", arguments.callee, true); doc = tab2.linkedBrowser.contentDocument; is(doc.querySelector("input[type=text]").value, uniqueValue, "generated XPath expression was valid"); diff --git a/browser/components/sessionstore/test/browser/browser_485563.js b/browser/components/sessionstore/test/browser/browser_485563.js index 1b24ecfd396..c4ac04ab938 100644 --- a/browser/components/sessionstore/test/browser/browser_485563.js +++ b/browser/components/sessionstore/test/browser/browser_485563.js @@ -44,6 +44,7 @@ function test() { let tab = gBrowser.addTab(); tab.linkedBrowser.addEventListener("load", function(aEvent) { + this.removeEventListener("load", arguments.callee, true); ss.setTabValue(tab, "bug485563", uniqueValue); let tabState = eval("(" + ss.getTabState(tab) + ")"); is(tabState.extData["bug485563"], uniqueValue, diff --git a/browser/components/sessionstore/test/browser/browser_491168.js b/browser/components/sessionstore/test/browser/browser_491168.js index 09b7820290c..b6bbd6a3adc 100644 --- a/browser/components/sessionstore/test/browser/browser_491168.js +++ b/browser/components/sessionstore/test/browser/browser_491168.js @@ -61,13 +61,13 @@ function test() { ss.setTabState(tab, JSON.stringify(tabState)); tab.addEventListener("SSTabRestored", function() { - tab.removeEventListener("SSTabRestored", arguments.callee, false); + tab.removeEventListener("SSTabRestored", arguments.callee, true); is(window.content.document.referrer, REFERRER2, "document.referrer matches referrer set via setTabState."); gBrowser.removeTab(tab); let newTab = ss.undoCloseTab(window, 0); newTab.addEventListener("SSTabRestored", function() { - newTab.removeEventListener("SSTabRestored", arguments.callee, false); + newTab.removeEventListener("SSTabRestored", arguments.callee, true); is(window.content.document.referrer, REFERRER2, "document.referrer is still correct after closing and reopening the tab."); gBrowser.removeTab(newTab); diff --git a/browser/components/sessionstore/test/browser/browser_491577.js b/browser/components/sessionstore/test/browser/browser_491577.js index 60e1f65e3a9..a504be17d70 100644 --- a/browser/components/sessionstore/test/browser/browser_491577.js +++ b/browser/components/sessionstore/test/browser/browser_491577.js @@ -115,6 +115,7 @@ function test() { // open a window and add the above closed window list let newWin = openDialog(location, "_blank", "chrome,all,dialog=no"); newWin.addEventListener("load", function(aEvent) { + this.removeEventListener("load", arguments.callee, false); gPrefService.setIntPref("browser.sessionstore.max_windows_undo", test_state._closedWindows.length); ss.setWindowState(newWin, JSON.stringify(test_state), true);