Bug 914438. Prevent propagation of SSTabRestored events in tests when we close the relevant tab. r=dao
authorBoris Zbarsky <bzbarsky@mit.edu>
Wed, 11 Sep 2013 23:19:07 -0400
changeset 146744 be78e31dbc2042ca2802e227a5e49fa8e3630d02
parent 146743 855e0295dfdf4e0a09c3dc4c13ea381827a96228
child 146745 a1509b9ca551a625ff2abbbb1f5b60c497aa9350
push id25270
push useremorley@mozilla.com
push dateThu, 12 Sep 2013 11:04:52 +0000
treeherdermozilla-central@b83f6d80af5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao
bugs914438
milestone26.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 914438. Prevent propagation of SSTabRestored events in tests when we close the relevant tab. r=dao
browser/components/sessionstore/test/browser_483330.js
browser/components/sessionstore/test/browser_491168.js
browser/components/sessionstore/test/browser_662743.js
--- a/browser/components/sessionstore/test/browser_483330.js
+++ b/browser/components/sessionstore/test/browser_483330.js
@@ -23,15 +23,18 @@ function test() {
 
       let newBrowser = newTab.linkedBrowser;
 
       // check that the scroll position was restored
       is(newBrowser.contentWindow.scrollX, 1100, "still scrolled horizontally");
       is(newBrowser.contentWindow.scrollY, 1200, "still scrolled vertically");
 
       gBrowser.removeTab(newTab);
+      // Call stopPropagation on the event so we won't fire the
+      // tabbrowser's SSTabRestored listeners.
+      e.stopPropagation();
 
       finish();
     }, true);
   }, true);
 
   browser.loadURI("data:text/html;charset=utf-8,<body style='width: 100000px; height: 100000px;'><p>top</p></body>");
 }
--- a/browser/components/sessionstore/test/browser_491168.js
+++ b/browser/components/sessionstore/test/browser_491168.js
@@ -19,27 +19,34 @@ function test() {
 
     let tabState = JSON.parse(ss.getTabState(tab));
     is(tabState.entries[0].referrer,  REFERRER1,
        "Referrer retrieved via getTabState matches referrer set via loadURI.");
 
     tabState.entries[0].referrer = REFERRER2;
     ss.setTabState(tab, JSON.stringify(tabState));
 
-    tab.addEventListener("SSTabRestored", function() {
+    tab.addEventListener("SSTabRestored", function(e) {
       tab.removeEventListener("SSTabRestored", arguments.callee, true);
       is(window.content.document.referrer, REFERRER2, "document.referrer matches referrer set via setTabState.");
 
       gBrowser.removeTab(tab);
+      // Call stopPropagation on the event so we won't fire the
+      // tabbrowser's SSTabRestored listeners.
+      e.stopPropagation();
+
       let newTab = ss.undoCloseTab(window, 0);
-      newTab.addEventListener("SSTabRestored", function() {
+      newTab.addEventListener("SSTabRestored", function(e) {
         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);
+        // Call stopPropagation on the event so we won't fire the
+        // tabbrowser's SSTabRestored listeners.
+        e.stopPropagation();
 
         finish();
       }, true);
     }, true);
   },true);
 
   let referrerURI = Services.io.newURI(REFERRER1, null, null);
   browser.loadURI("http://example.org", referrerURI, null);
--- a/browser/components/sessionstore/test/browser_662743.js
+++ b/browser/components/sessionstore/test/browser_662743.js
@@ -93,16 +93,19 @@ function testTabRestoreData(aFormData, a
       let value = select.options[select.selectedIndex].value;
 
       // test select options values
       is(value, aExpectedValues[0],
         "Select Option by selectedIndex &/or value has been restored correctly");
 
       // clean up
       gBrowser.removeTab(tab);
+      // Call stopPropagation on the event so we won't fire the
+      // tabbrowser's SSTabRestored listeners.
+      aEvent.stopPropagation();
       aCallback();
     });
 
     tab.addEventListener("TabClose", function(aEvent) {
       tab.removeEventListener("TabClose", arguments.callee);
       let restoredTabState = JSON.parse(ss.getTabState(tab));
       let restoredFormData = restoredTabState.entries[0].formdata;
       let selectIdFormData = restoredFormData.id.select_id;