Backed out changeset 27104628616c (bug 1231437)
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Fri, 01 Apr 2016 09:27:22 +0200
changeset 291340 4f09dd6aa299804f73f654c1357ffc43d3bc3d8e
parent 291339 587a80aed81e49b6c7df3117b66d15e2793b9406
child 291341 b5300f1eae9346e1e966fbf7f74b184b9799b22c
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1231437
milestone48.0a1
backs out27104628616c5550fc56b060e727248c5f3a1c2c
Backed out changeset 27104628616c (bug 1231437)
devtools/client/storage/test/browser_storage_basic.js
devtools/client/storage/test/browser_storage_cookies_edit.js
devtools/client/storage/test/browser_storage_cookies_edit_keyboard.js
devtools/client/storage/test/browser_storage_cookies_tab_navigation.js
devtools/client/storage/test/browser_storage_delete.js
devtools/client/storage/test/browser_storage_dynamic_updates.js
devtools/client/storage/test/browser_storage_overflow.js
devtools/client/storage/test/browser_storage_search.js
devtools/client/storage/test/browser_storage_sidebar.js
devtools/client/storage/test/browser_storage_values.js
devtools/client/storage/test/head.js
--- a/devtools/client/storage/test/browser_storage_basic.js
+++ b/devtools/client/storage/test/browser_storage_basic.js
@@ -13,18 +13,16 @@
 //   ["key_value1", "key_value2", ...] - The value of the first (unique) column
 //                                       for each row in the table corresponding
 //                                       to the tree item selected.
 // ]
 // These entries are formed by the cookies, local storage, session storage and
 // indexedDB entries created in storage-listings.html,
 // storage-secured-iframe.html and storage-unsecured-iframe.html
 
-/* import-globals-from head.js */
-
 "use strict";
 
 const testCases = [
   [["cookies", "test1.example.org"],
    ["c1", "cs2", "c3", "uc1"]],
   [["cookies", "sectest1.example.org"],
    ["uc1", "cs2", "sc1"]],
   [["localStorage", "http://test1.example.org"],
--- a/devtools/client/storage/test/browser_storage_cookies_edit.js
+++ b/devtools/client/storage/test/browser_storage_cookies_edit.js
@@ -1,16 +1,14 @@
 /* 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/. */
 
 // Basic test to check the editing of cookies.
 
-/* import-globals-from head.js */
-
 "use strict";
 
 add_task(function*() {
   yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-cookies.html");
   yield gUI.table.once(TableWidget.EVENTS.FIELDS_EDITABLE);
 
   showAllColumns(true);
 
--- a/devtools/client/storage/test/browser_storage_cookies_edit_keyboard.js
+++ b/devtools/client/storage/test/browser_storage_cookies_edit_keyboard.js
@@ -1,16 +1,14 @@
 /* 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/. */
 
 // Basic test to check the editing of cookies with the keyboard.
 
-/* import-globals-from head.js */
-
 "use strict";
 
 add_task(function*() {
   yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-cookies.html");
   yield gUI.table.once(TableWidget.EVENTS.FIELDS_EDITABLE);
 
   showAllColumns(true);
 
--- a/devtools/client/storage/test/browser_storage_cookies_tab_navigation.js
+++ b/devtools/client/storage/test/browser_storage_cookies_tab_navigation.js
@@ -1,16 +1,14 @@
 /* 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/. */
 
 // Basic test to check cookie table tab navigation.
 
-/* import-globals-from head.js */
-
 "use strict";
 
 add_task(function*() {
   yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-cookies.html");
   yield gUI.table.once(TableWidget.EVENTS.FIELDS_EDITABLE);
 
   showAllColumns(true);
 
--- a/devtools/client/storage/test/browser_storage_delete.js
+++ b/devtools/client/storage/test/browser_storage_delete.js
@@ -1,14 +1,13 @@
 /* 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/. */
 
-/* import-globals-from head.js */
-
+/* import-globals-from ../../framework/test/shared-head.js */
 "use strict";
 
 // Test deleting storage items
 
 const TEST_CASES = [
   [["localStorage", "http://test1.example.org"],
     "ls1", "name"],
   [["sessionStorage", "http://test1.example.org"],
--- a/devtools/client/storage/test/browser_storage_dynamic_updates.js
+++ b/devtools/client/storage/test/browser_storage_dynamic_updates.js
@@ -1,14 +1,12 @@
 /* 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/. */
 
-/* import-globals-from head.js */
-
 "use strict";
 
 add_task(function*() {
   yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-updates.html");
 
   let $ = id => gPanelWindow.document.querySelector(id);
   let $$ = sel => gPanelWindow.document.querySelectorAll(sel);
 
--- a/devtools/client/storage/test/browser_storage_overflow.js
+++ b/devtools/client/storage/test/browser_storage_overflow.js
@@ -1,13 +1,10 @@
 // Test endless scrolling when a lot of items are present in the storage
 // inspector table.
-
-/* import-globals-from head.js */
-
 "use strict";
 
 add_task(function*() {
   yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-overflow.html");
 
   let $ = id => gPanelWindow.document.querySelector(id);
   let $$ = sel => gPanelWindow.document.querySelectorAll(sel);
 
--- a/devtools/client/storage/test/browser_storage_search.js
+++ b/devtools/client/storage/test/browser_storage_search.js
@@ -1,12 +1,9 @@
 // Tests the filter search box in the storage inspector
-
-/* import-globals-from head.js */
-
 "use strict";
 
 add_task(function*() {
   yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-search.html");
 
   let $$ = sel => gPanelWindow.document.querySelectorAll(sel);
   gUI.tree.expandAll();
   yield selectTreeItem(["localStorage", "http://test1.example.org"]);
--- a/devtools/client/storage/test/browser_storage_sidebar.js
+++ b/devtools/client/storage/test/browser_storage_sidebar.js
@@ -7,18 +7,16 @@
 
 // Format: [
 //   <id of the table item to click> or <id array for tree item to select> or
 //     null to press Escape,
 //   <do we wait for the async "sidebar-updated" event>,
 //   <is the sidebar open>
 // ]
 
-/* import-globals-from head.js */
-
 "use strict";
 
 const testCases = [
   {
     location: ["cookies", "sectest1.example.org"],
     sidebarHidden: true
   },
   {
--- a/devtools/client/storage/test/browser_storage_values.js
+++ b/devtools/client/storage/test/browser_storage_values.js
@@ -7,18 +7,16 @@
 // Format: [
 //   <id of the table item to click> or <id array for tree item to select> or
 //     null do click nothing,
 //   null to skip checking value in variables view or a key value pair object
 //     which will be asserted to exist in the storage sidebar,
 //   true if the check is to be made in the parsed value section
 // ]
 
-/* import-globals-from head.js */
-
 "use strict";
 
 const testCases = [
   ["cs2", [
     {name: "cs2", value: "sessionCookie"},
     {name: "cs2.path", value: "/"},
     {name: "cs2.isDomain", value: "true"},
     {name: "cs2.isHttpOnly", value: "false"},
--- a/devtools/client/storage/test/head.js
+++ b/devtools/client/storage/test/head.js
@@ -39,28 +39,58 @@ registerCleanupFunction(() => {
   Services.prefs.clearUserPref(CACHES_ON_HTTP_PREF);
   DevToolsUtils.testing = false;
   while (gBrowser.tabs.length > 1) {
     gBrowser.removeCurrentTab();
   }
 });
 
 /**
+ * Add a new test tab in the browser and load the given url.
+ *
+ * @param {String} url The url to be loaded in the new tab
+ *
+ * @return a promise that resolves to the content window when the url is loaded
+ */
+function addTab(url) {
+  info("Adding a new tab with URL: '" + url + "'");
+  let def = promise.defer();
+
+  // Bug 921935 should bring waitForFocus() support to e10s, which would
+  // probably cover the case of the test losing focus when the page is loading.
+  // For now, we just make sure the window is focused.
+  window.focus();
+
+  let tab = window.gBrowser.selectedTab = window.gBrowser.addTab(url);
+  let linkedBrowser = tab.linkedBrowser;
+
+  linkedBrowser.addEventListener("load", function onload(event) {
+    if (event.originalTarget.location.href != url) {
+      return;
+    }
+    linkedBrowser.removeEventListener("load", onload, true);
+    info("URL '" + url + "' loading complete");
+    def.resolve(tab.linkedBrowser.contentWindow);
+  }, true);
+
+  return def.promise;
+}
+
+/**
  * This generator function opens the given url in a new tab, then sets up the
  * page by waiting for all cookies, indexedDB items etc. to be created; Then
  * opens the storage inspector and waits for the storage tree and table to be
  * populated.
  *
  * @param url {String} The url to be opened in the new tab
  *
  * @return {Promise} A promise that resolves after storage inspector is ready
  */
 function* openTabAndSetupStorage(url) {
-  let tab = yield addTab(url);
-  let content = tab.linkedBrowser.contentWindow;
+  let content = yield addTab(url);
 
   gWindow = content.wrappedJSObject;
 
   // Setup the async storages in main window and for all its iframes
   yield ContentTask.spawn(gBrowser.selectedBrowser, null, function*() {
     /**
      * Get all windows including frames recursively.
      *