Bug 1231437 - Storage Inspector: context menu to remove cookie/storage item (part 2: tests) r=mratcliffe
☠☠ backed out by 68be59c75e1e ☠ ☠
authorJarda Snajdr <jsnajdr@gmail.com>
Tue, 29 Mar 2016 07:37:00 +0200
changeset 329195 64550b75f51b8a8a4c155e93f55d8c3d7494aa22
parent 329194 64f6fc2851310d90d85c9da6bde4caf4e13df894
child 329196 646cc46e3cfc57fde0a898635a866bb7341750aa
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmratcliffe
bugs1231437
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1231437 - Storage Inspector: context menu to remove cookie/storage item (part 2: tests) r=mratcliffe
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,16 +13,18 @@
 //   ["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,14 +1,16 @@
 /* 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,14 +1,16 @@
 /* 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,14 +1,16 @@
 /* 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,13 +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/. */
 
-/* import-globals-from ../../framework/test/shared-head.js */
+/* import-globals-from 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,12 +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/. */
 
+/* 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,10 +1,13 @@
 // 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,9 +1,12 @@
 // 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,16 +7,18 @@
 
 // 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,16 +7,18 @@
 // 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,58 +39,28 @@ 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 content = yield addTab(url);
+  let tab = yield addTab(url);
+  let content = tab.linkedBrowser.contentWindow;
 
   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.
      *