Bug 796911 - Attempt to fix Intermittent test_clear_browser_data.html. r=jwatt
authorMounir Lamouri <mounir.lamouri@gmail.com>
Wed, 03 Oct 2012 13:46:21 +0100
changeset 115356 1e5584c8e7d0d7aa6ae41d27a555856c5b82d070
parent 115355 9b992222370b37a610d329067d02fe1b1773c96d
child 115357 e9cb6c2176810c7a2f56eabd23ba593f9686d1b8
push idunknown
push userunknown
push dateunknown
reviewersjwatt
bugs796911
milestone18.0a1
Bug 796911 - Attempt to fix Intermittent test_clear_browser_data.html. r=jwatt
dom/tests/mochitest/localstorage/test_clear_browser_data.html
--- a/dom/tests/mochitest/localstorage/test_clear_browser_data.html
+++ b/dom/tests/mochitest/localstorage/test_clear_browser_data.html
@@ -188,38 +188,40 @@ function browserLoadEvent() {
 
   setupStorage(gAppStorage.localStorage);
   setupStorage(gAppStorage.sessionStorage);
   setupStorage(gBrowserStorage.localStorage);
   setupStorage(gBrowserStorage.sessionStorage);
 
   frames[1].postMessage("clear", "http://www.example.com");
 
-  navigator.mozApps.mgmt.getAll().onsuccess = function() {
-    for (i in this.result) {
-      var app = this.result[i];
-      if (app.manifestURL == gManifestURL) {
-        is(gBrowserStorage.localStorage.getItem("foo"), null, "localstorage data have been deleted");
-        is(gBrowserStorage.sessionStorage.getItem("foo"), "bar", "sessionstorage data have not been deleted");
+  SimpleTest.executeSoon(function() {
+    navigator.mozApps.mgmt.getAll().onsuccess = function() {
+      for (i in this.result) {
+        var app = this.result[i];
+        if (app.manifestURL == gManifestURL) {
+          is(gBrowserStorage.localStorage.getItem("foo"), null, "localstorage data have been deleted");
+          is(gBrowserStorage.sessionStorage.getItem("foo"), "bar", "sessionstorage data have not been deleted");
 
-        is(gAppStorage.localStorage.getItem("foo"), "bar", "data are still there");
-        is(gAppStorage.sessionStorage.getItem("foo"), "bar", "data are still there");
+          is(gAppStorage.localStorage.getItem("foo"), "bar", "data are still there");
+          is(gAppStorage.sessionStorage.getItem("foo"), "bar", "data are still there");
 
-        is(gWitnessStorage.localStorage.getItem("foo"), "bar", "data are still there");
-        is(gWitnessStorage.sessionStorage.getItem("foo"), "bar", "data are still there");
+          is(gWitnessStorage.localStorage.getItem("foo"), "bar", "data are still there");
+          is(gWitnessStorage.sessionStorage.getItem("foo"), "bar", "data are still there");
 
-        Webapps.DOMApplicationRegistry.allAppsLaunchable = gPreviousLaunchableValue;
+          Webapps.DOMApplicationRegistry.allAppsLaunchable = gPreviousLaunchableValue;
 
-        // Now we uninstall the app and make sure everything is clean.
-        app.uninstall().onsuccess = function() {
-          finish();
-        };
+          // Now we uninstall the app and make sure everything is clean.
+          app.uninstall().onsuccess = function() {
+            finish();
+          };
+        }
       }
-    }
-  };
+    };
+  });
 }
 
 /**
  * This method will be called when the test will be done. It is going to clear
  * all storage data, permissions, etc.
  */
 function finish() {
   gWitnessStorage.localStorage.clear();