Bug 943793 - Intermittent TEST-UNEXPECTED-FAIL | chrome://mochitests/content/browser/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage.js. r=ehsan, a=test-only
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Tue, 10 Dec 2013 13:39:53 +0200
changeset 156843 d92ee957e3f7dd9b18796e3925e46073712f6043
parent 156842 ac0bdb64d9abf7d09a8296a1bd020d1b31e44c08
child 156844 a1a7cb75d912a9efe1efbe5fed30eb2ba1a2d047
push id350
push userryanvm@gmail.com
push dateWed, 11 Dec 2013 14:11:29 +0000
reviewersehsan, test-only
bugs943793
milestone26.0
Bug 943793 - Intermittent TEST-UNEXPECTED-FAIL | chrome://mochitests/content/browser/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage.js. r=ehsan, a=test-only
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage.js
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage.js
@@ -1,33 +1,37 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 function test() {
   waitForExplicitFinish();
 
+  const page1 = 'http://mochi.test:8888/browser/browser/components/privatebrowsing/test/browser/' +
+                'browser_privatebrowsing_localStorage_page1.html'
+
   function checkLocalStorage(aWindow, aCallback) {
     executeSoon(function() {
       let tab = aWindow.gBrowser.selectedTab = aWindow.gBrowser.addTab();
       let browser = aWindow.gBrowser.selectedBrowser;
       browser.addEventListener('load', function() {
+        if (browser.contentWindow.location != page1) {
+          browser.loadURI(page1);
+          return;
+        }
         browser.removeEventListener('load', arguments.callee, true);
         let tab2 = aWindow.gBrowser.selectedTab = aWindow.gBrowser.addTab();
         browser.contentWindow.location = 'http://mochi.test:8888/browser/browser/components/privatebrowsing/test/browser/' +
                          'browser_privatebrowsing_localStorage_page2.html';
         browser.addEventListener('load', function() {
           browser.removeEventListener('load', arguments.callee, true);
           is(browser.contentWindow.document.title, '2', "localStorage should contain 2 items");
           aCallback();
         }, true);
       }, true);
-
-      browser.loadURI('http://mochi.test:8888/browser/browser/components/privatebrowsing/test/browser/' +
-                      'browser_privatebrowsing_localStorage_page1.html');
     });
   }
 
   let windowsToClose = [];
   function testOnWindow(options, callback) {
     let win = OpenBrowserWindow(options);
     win.addEventListener("load", function onLoad() {
       win.removeEventListener("load", onLoad, false);