Bug 1186168 - Fix intermittent browser_607016.js failures by using ss.getTabState() instead of closing tabs to check their state r=mconley
authorTim Taubert <ttaubert@mozilla.com>
Wed, 22 Jul 2015 11:59:39 +0200
changeset 254124 1b94786e5516f75bb79c2b94cdd7ccc256d74237
parent 254123 08cf05d407fccd4cb12761506669fe16a9740fca
child 254125 68596c2c0496cb4745ae005572495b76a5524dd7
push id29089
push userryanvm@gmail.com
push dateWed, 22 Jul 2015 20:29:27 +0000
treeherdermozilla-central@7abecce35aca [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley
bugs1186168
milestone42.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 1186168 - Fix intermittent browser_607016.js failures by using ss.getTabState() instead of closing tabs to check their state r=mconley
browser/components/sessionstore/test/browser_607016.js
--- a/browser/components/sessionstore/test/browser_607016.js
+++ b/browser/components/sessionstore/test/browser_607016.js
@@ -35,56 +35,55 @@ add_task(function* () {
         ok(!("extData" in tabCurState) || !("uniq" in tabCurState.extData),
            "sanity check that tab doesn't have extData or extData doesn't have 'uniq'");
       }
     }
 
     // Now we'll set a new unique value on 1 of the tabs
     let newUniq = r();
     ss.setTabValue(gBrowser.tabs[1], "uniq", newUniq);
-    yield promiseRemoveTab(gBrowser.tabs[1]);
-    let closedTabData = (JSON.parse(ss.getClosedTabData(window)))[0];
-    is(closedTabData.state.extData.uniq, newUniq,
+    let tabState = JSON.parse(ss.getTabState(gBrowser.tabs[1]));
+    is(tabState.extData.uniq, newUniq,
        "(overwriting) new data is stored in extData");
 
     // hide the next tab before closing it
-    gBrowser.hideTab(gBrowser.tabs[1]);
-    yield promiseRemoveTab(gBrowser.tabs[1]);
-    closedTabData = (JSON.parse(ss.getClosedTabData(window)))[0];
-    ok(closedTabData.state.hidden, "(hiding) tab data has hidden == true");
+    gBrowser.hideTab(gBrowser.tabs[2]);
+    tabState = JSON.parse(ss.getTabState(gBrowser.tabs[2]));
+    ok(tabState.hidden, "(hiding) tab data has hidden == true");
 
     // set data that's not in a conflicting key
     let stillUniq = r();
-    ss.setTabValue(gBrowser.tabs[1], "stillUniq", stillUniq);
-    yield promiseRemoveTab(gBrowser.tabs[1]);
-    closedTabData = (JSON.parse(ss.getClosedTabData(window)))[0];
-    is(closedTabData.state.extData.stillUniq, stillUniq,
+    ss.setTabValue(gBrowser.tabs[3], "stillUniq", stillUniq);
+    tabState = JSON.parse(ss.getTabState(gBrowser.tabs[3]));
+    is(tabState.extData.stillUniq, stillUniq,
        "(adding) new data is stored in extData");
 
     // remove the uniq value and make sure it's not there in the closed data
-    ss.deleteTabValue(gBrowser.tabs[1], "uniq");
-    yield promiseRemoveTab(gBrowser.tabs[1]);
-    closedTabData = (JSON.parse(ss.getClosedTabData(window)))[0];
+    ss.deleteTabValue(gBrowser.tabs[4], "uniq");
+    tabState = JSON.parse(ss.getTabState(gBrowser.tabs[4]));
     // Since Panorama might have put data in, first check if there is extData.
     // If there is explicitly check that "uniq" isn't in it. Otherwise, we're ok
-    if ("extData" in closedTabData.state) {
-      ok(!("uniq" in closedTabData.state.extData),
+    if ("extData" in tabState) {
+      ok(!("uniq" in tabState.extData),
          "(deleting) uniq not in existing extData");
     }
     else {
       ok(true, "(deleting) no data is stored in extData");
     }
 
     // set unique data on the tab that never had any set, make sure that's saved
     let newUniq2 = r();
-    ss.setTabValue(gBrowser.tabs[1], "uniq", newUniq2);
-    yield promiseRemoveTab(gBrowser.tabs[1]);
-    closedTabData = (JSON.parse(ss.getClosedTabData(window)))[0];
-    is(closedTabData.state.extData.uniq, newUniq2,
+    ss.setTabValue(gBrowser.tabs[5], "uniq", newUniq2);
+    tabState = JSON.parse(ss.getTabState(gBrowser.tabs[5]));
+    is(tabState.extData.uniq, newUniq2,
        "(creating) new data is stored in extData where there was none");
+
+    while (gBrowser.tabs.length > 1) {
+      yield promiseRemoveTab(gBrowser.tabs[1]);
+    }
   }
 
   // Set the test state.
   ss.setBrowserState(JSON.stringify(state));
 
   // Wait until the selected tab is restored and all others are pending.
   yield Promise.all(Array.map(gBrowser.tabs, tab => {
     return (tab == gBrowser.selectedTab) ?