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 148728 d9acd6b4accd18832922a50f2d442c7b7a6c6a2b
parent 148727 d6d40b2ae04278e69e738c14d7bf43bfcaa14627
child 148729 647b075ab8425e9c838babf06fea5b62ced40475
push id110
push userryanvm@gmail.com
push dateWed, 11 Dec 2013 14:11:19 +0000
reviewersehsan, test-only
bugs943793
milestone24.2.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);