Bug 919060 - Make browser_625016.js wait for another saveState() call if the window is untracked. r=smacleod, a=test-only
authorTim Taubert <ttaubert@mozilla.com>
Fri, 08 Nov 2013 17:59:49 +0100
changeset 166576 af4713bfdd0764c9d029236e0fac78c951b806a4
parent 166575 9cedd5ca03dc741526eec6ff00f86e1f2821bdc8
child 166577 6ebf8f6c224689277b11c43c05315e04a6bb5c84
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmacleod, test-only
bugs919060
milestone27.0a2
Bug 919060 - Make browser_625016.js wait for another saveState() call if the window is untracked. r=smacleod, a=test-only
browser/components/sessionstore/test/browser_625016.js
--- a/browser/components/sessionstore/test/browser_625016.js
+++ b/browser/components/sessionstore/test/browser_625016.js
@@ -35,16 +35,26 @@ function setup() {
   is(ss.getClosedWindowCount(), 0, "starting with no closed windows");
 
   // Open a new window, which should trigger a save event soon.
   waitForSaveState(onSaveState);
   newWin = openDialog(location, "_blank", "chrome,all,dialog=no", "about:rights");
 }
 
 function onSaveState() {
+  try {
+    ss.getWindowValue(newWin, "foobar");
+  } catch (e) {
+    // The window is untracked which means that the saveState() call isn't the
+    // one we're waiting for. It's most likely been triggered by an async
+    // collection running in the background.
+    waitForSaveState(onSaveState);
+    return;
+  }
+
   // Double check that we have no closed windows
   is(ss.getClosedWindowCount(), 0, "no closed windows on first save");
 
   Services.obs.addObserver(observe1, "sessionstore-state-write", false);
 
   // Now close the new window, which should trigger another save event
   newWin.close();
 }