Bug 1229272 - Stop using CPOW when creating indexed DB in storage tests. r=mratcliffe
authorAlexandre Poirot <poirot.alex@gmail.com>
Fri, 18 Mar 2016 02:44:22 -0700
changeset 313246 571fa014bb35a2026fef866abe08daa52e599a46
parent 313245 c35895f48511d4ed74a9935415c5a786546fe982
child 313247 1fde3cca31b4e3dc322f7498f5b7a2f151d32d30
push id9480
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 17:12:58 +0000
treeherdermozilla-aurora@0d6a91c76a9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmratcliffe
bugs1229272
milestone48.0a1
Bug 1229272 - Stop using CPOW when creating indexed DB in storage tests. r=mratcliffe
devtools/client/storage/test/browser.ini
devtools/client/storage/test/head.js
--- a/devtools/client/storage/test/browser.ini
+++ b/devtools/client/storage/test/browser.ini
@@ -11,10 +11,9 @@ support-files =
   storage-updates.html
   head.js
 
 [browser_storage_basic.js]
 [browser_storage_dynamic_updates.js]
 [browser_storage_overflow.js]
 [browser_storage_search.js]
 [browser_storage_sidebar.js]
-skip-if = (os == 'win' && e10s) # bug 1229272
 [browser_storage_values.js]
--- a/devtools/client/storage/test/head.js
+++ b/devtools/client/storage/test/head.js
@@ -87,25 +87,48 @@ function addTab(url) {
  * @return {Promise} A promise that resolves after storage inspector is ready
  */
 function* openTabAndSetupStorage(url) {
   let content = yield addTab(url);
 
   gWindow = content.wrappedJSObject;
 
   // Setup the async storages in main window and for all its iframes
-  let callSetup = function*(win) {
-    if (typeof (win.setup) == "function") {
-      yield win.setup();
+  yield ContentTask.spawn(gBrowser.selectedBrowser, null, function*() {
+    /**
+     * Get all windows including frames recursively.
+     *
+     * @param {Window} [baseWindow]
+     *        The base window at which to start looking for child windows
+     *        (optional).
+     * @return {Set}
+     *         A set of windows.
+     */
+    function getAllWindows(baseWindow) {
+      let windows = new Set();
+
+      let _getAllWindows = function(win) {
+        windows.add(win.wrappedJSObject);
+
+        for (let i = 0; i < win.length; i++) {
+          _getAllWindows(win[i]);
+        }
+      };
+      _getAllWindows(baseWindow);
+
+      return windows;
     }
-    for (let i = 0; i < win.frames.length; i++) {
-      yield callSetup(win.frames[i]);
+
+    let windows = getAllWindows(content);
+    for (let win of windows) {
+      if (win.setup) {
+        yield win.setup();
+      }
     }
-  };
-  yield callSetup(gWindow);
+  });
 
   // open storage inspector
   return yield openStoragePanel();
 }
 
 /**
  * Open the toolbox, with the storage tool visible.
  *
@@ -208,31 +231,31 @@ function* finishTests() {
      *        (optional).
      * @return {Set}
      *         A set of windows.
      */
     function getAllWindows(baseWindow) {
       let windows = new Set();
 
       let _getAllWindows = function(win) {
-        windows.add(win);
+        windows.add(win.wrappedJSObject);
 
         for (let i = 0; i < win.length; i++) {
           _getAllWindows(win[i]);
         }
       };
       _getAllWindows(baseWindow);
 
       return windows;
     }
 
-    let windows = getAllWindows(content.wrappedJSObject);
+    let windows = getAllWindows(content);
     for (let win of windows) {
       if (win.clear) {
-        yield Task.spawn(win.clear);
+        yield win.clear();
       }
     }
   });
 
   forceCollections();
   finish();
 }