Backed out 5 changesets (bug 1495944) for DevTools failures in devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_menubar.js
authorDorel Luca <dluca@mozilla.com>
Fri, 18 Jan 2019 16:14:34 +0200
changeset 511551 f93fc53741db6086041008a87b3213af336e3cc1
parent 511550 53e88d5a31a7dd64100ef79cbfe8cd53df963edb
child 511552 9915f978e03beef3b5da8d0aa870e8b28394f73c
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1495944
milestone66.0a1
backs out52e5f0d019001b4c9a3ca168d3624fe11dc9e7f5
025ffd6f441f637c739be150a462db49607c26ce
df656c9d03b1e141adc6d5a8a467baaea409b355
be64b571b600b15ab290ab162b66318048b5b3df
9418ac4c2fa1a57fb1d7ffe005381c16ce8f4de8
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
Backed out 5 changesets (bug 1495944) for DevTools failures in devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_menubar.js Backed out changeset 52e5f0d01900 (bug 1495944) Backed out changeset 025ffd6f441f (bug 1495944) Backed out changeset df656c9d03b1 (bug 1495944) Backed out changeset be64b571b600 (bug 1495944) Backed out changeset 9418ac4c2fa1 (bug 1495944)
browser/base/content/nsContextMenu.js
devtools/client/aboutdebugging-new/test/browser/browser.ini
devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_contextmenu.js
devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_menubar.js
devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_shortcuts.js
devtools/client/framework/browser-menus.js
devtools/client/framework/devtools-browser.js
--- a/browser/base/content/nsContextMenu.js
+++ b/browser/base/content/nsContextMenu.js
@@ -420,31 +420,22 @@ nsContextMenu.prototype = {
     this.setItemAttr("context-sendaudio", "disabled", !this.mediaURL || mediaIsBlob);
   },
 
   initViewItems: function CM_initViewItems() {
     // View source is always OK, unless in directory listing.
     this.showItem("context-viewpartialsource-selection",
                   this.isContentSelected);
 
-    const {gBrowser} = this.browser.ownerGlobal;
-    // Hide menu that opens devtools when the window is showing `about:devtools-toolbox`.
-    // This is to avoid displaying multiple devtools at the same time. See bug 1495944.
-    const isAboutDevtoolsToolbox = gBrowser &&
-                                   gBrowser.currentURI &&
-                                   gBrowser.currentURI.scheme === "about" &&
-                                   gBrowser.currentURI.filePath === "devtools-toolbox";
-
     var shouldShow = !(this.isContentSelected ||
                        this.onImage || this.onCanvas ||
                        this.onVideo || this.onAudio ||
                        this.onLink || this.onTextInput);
 
     var showInspect = this.inTabBrowser &&
-                      !isAboutDevtoolsToolbox &&
                       Services.prefs.getBoolPref("devtools.inspector.enabled", true) &&
                       !Services.prefs.getBoolPref("devtools.policy.disabled", false);
 
     var showInspectA11Y = showInspect &&
                           // Only when accessibility service started.
                           Services.appinfo.accessibilityEnabled &&
                           this.inTabBrowser &&
                           Services.prefs.getBoolPref("devtools.enabled", true) &&
--- a/devtools/client/aboutdebugging-new/test/browser/browser.ini
+++ b/devtools/client/aboutdebugging-new/test/browser/browser.ini
@@ -35,19 +35,16 @@ skip-if = (os == 'linux' && bits == 32) 
 [browser_aboutdebugging_connect_toggle_usb_devices.js]
 skip-if = (os == 'linux' && bits == 32) # ADB start() fails on linux 32, see Bug 1499638
 [browser_aboutdebugging_connection_prompt_setting.js]
 [browser_aboutdebugging_debug-target-pane_collapsibilities_interaction.js]
 [browser_aboutdebugging_debug-target-pane_collapsibilities_preference.js]
 [browser_aboutdebugging_debug-target-pane_empty.js]
 [browser_aboutdebugging_debug-target-pane_usb_runtime.js]
 [browser_aboutdebugging_devtools.js]
-[browser_aboutdebugging_devtoolstoolbox_contextmenu.js]
-[browser_aboutdebugging_devtoolstoolbox_menubar.js]
-[browser_aboutdebugging_devtoolstoolbox_shortcuts.js]
 [browser_aboutdebugging_navigate.js]
 [browser_aboutdebugging_persist_connection.js]
 [browser_aboutdebugging_routes.js]
 [browser_aboutdebugging_runtime_connection-prompt.js]
 [browser_aboutdebugging_runtime_usbclient_closed.js]
 [browser_aboutdebugging_select_network_runtime.js]
 [browser_aboutdebugging_select_page_with_serviceworker.js]
 [browser_aboutdebugging_serviceworker_multie10s.js]
deleted file mode 100644
--- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_contextmenu.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-/* import-globals-from helper-collapsibilities.js */
-Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-collapsibilities.js", this);
-
-/**
- * Test context menu on about:devtools-toolbox page.
- */
-add_task(async function() {
-  info("Force all debug target panes to be expanded");
-  prepareCollapsibilitiesTest();
-
-  const { document, tab, window } = await openAboutDebugging();
-
-  info("Show about:devtools-toolbox page");
-  const target = findDebugTargetByText("about:debugging", document);
-  ok(target, "about:debugging tab target appeared");
-  const inspectButton = target.querySelector(".js-debug-target-inspect-button");
-  ok(inspectButton, "Inspect button for about:debugging appeared");
-  inspectButton.click();
-  await Promise.all([
-    waitUntil(() => tab.nextElementSibling),
-    waitForRequestsToSettle(window.AboutDebugging.store),
-    gDevTools.once("toolbox-ready"),
-  ]);
-
-  info("Wait for about:devtools-toolbox tab will be selected");
-  const devtoolsTab = tab.nextElementSibling;
-  await waitUntil(() => gBrowser.selectedTab === devtoolsTab);
-  info("Check whether the menu item which opens devtools is disabled");
-  const rootDocument = devtoolsTab.ownerDocument;
-  await assertContextMenu(rootDocument, gBrowser.selectedBrowser,
-                          ".debug-target-info", false);
-
-  info("Force to select about:debugging page");
-  gBrowser.selectedTab = tab;
-  info("Check whether the menu item which opens devtools is enabled");
-  await assertContextMenu(rootDocument, gBrowser.selectedBrowser, "#mount", true);
-
-  await removeTab(devtoolsTab);
-  await waitForRequestsToSettle(window.AboutDebugging.store);
-  await removeTab(tab);
-});
-
-async function assertContextMenu(rootDocument, browser, targetSelector, shouldBeEnabled) {
-  // Show content context menu.
-  const contextMenu = rootDocument.getElementById("contentAreaContextMenu");
-  const popupShownPromise = BrowserTestUtils.waitForEvent(contextMenu, "popupshown");
-  BrowserTestUtils.synthesizeMouseAtCenter(targetSelector,
-                                           { type: "contextmenu" }, browser);
-  await popupShownPromise;
-
-  // Check hidden attribute of #context-inspect.
-  const inspectMenuItem = rootDocument.getElementById("context-inspect");
-  is(inspectMenuItem.hidden, !shouldBeEnabled,
-     '"hidden" attribute of #context-inspect should be correct');
-
-  // Hide content context menu.
-  const popupHiddenPromise = BrowserTestUtils.waitForEvent(contextMenu, "popuphidden");
-  contextMenu.hidePopup();
-  await popupHiddenPromise;
-}
deleted file mode 100644
--- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_menubar.js
+++ /dev/null
@@ -1,67 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-/* import-globals-from helper-collapsibilities.js */
-Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-collapsibilities.js", this);
-
-/**
- * Test the status of menu items when open about:devtools-toolbox.
- */
-add_task(async function() {
-  info("Force all debug target panes to be expanded");
-  prepareCollapsibilitiesTest();
-
-  const { document, tab, window } = await openAboutDebugging();
-
-  info("Show about:devtools-toolbox page");
-  const target = findDebugTargetByText("about:debugging", document);
-  ok(target, "about:debugging tab target appeared");
-  const inspectButton = target.querySelector(".js-debug-target-inspect-button");
-  ok(inspectButton, "Inspect button for about:debugging appeared");
-  inspectButton.click();
-  await Promise.all([
-    waitUntil(() => tab.nextElementSibling),
-    waitForRequestsToSettle(window.AboutDebugging.store),
-    gDevTools.once("toolbox-ready"),
-  ]);
-
-  info("Wait for about:devtools-toolbox tab will be selected");
-  const devtoolsTab = tab.nextElementSibling;
-  await waitUntil(() => gBrowser.selectedTab === devtoolsTab);
-  info("Check whether the menu items are disabled");
-  const rootDocument = devtoolsTab.ownerDocument;
-  await assertMenusItems(rootDocument, false);
-
-  info("Force to select about:debugging page");
-  gBrowser.selectedTab = tab;
-  info("Check whether the menu items are enabled");
-  await assertMenusItems(rootDocument, true);
-
-  await removeTab(devtoolsTab);
-  await waitForRequestsToSettle(window.AboutDebugging.store);
-  await removeTab(tab);
-});
-
-async function assertMenusItems(rootDocument, shouldBeEnabled) {
-  const menuItem = rootDocument.getElementById("menu_devToolbox");
-  // Wait for hidden attribute changed since the menu items will update asynchronously.
-  await waitUntil(() => menuItem.hidden === !shouldBeEnabled);
-
-  assertMenuItem(rootDocument, "menu_devToolbox", shouldBeEnabled);
-
-  for (const toolDefinition of gDevTools.getToolDefinitionArray()) {
-    if (!toolDefinition.inMenu) {
-      continue;
-    }
-
-    assertMenuItem(rootDocument, "menuitem_" + toolDefinition.id, shouldBeEnabled);
-  }
-}
-
-function assertMenuItem(rootDocument, menuItemId, shouldBeEnabled) {
-  const menuItem = rootDocument.getElementById(menuItemId);
-  is(menuItem.hidden, !shouldBeEnabled,
-     `"hidden" attribute of menu item(${ menuItemId }) should be correct`);
-}
deleted file mode 100644
--- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_shortcuts.js
+++ /dev/null
@@ -1,91 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-/* import-globals-from helper-collapsibilities.js */
-Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-collapsibilities.js", this);
-
-/**
- * Test shortcut keys on about:devtools-toolbox page.
- */
-add_task(async function() {
-  info("Force all debug target panes to be expanded");
-  prepareCollapsibilitiesTest();
-
-  const { document, tab, window } = await openAboutDebugging();
-
-  info("Show about:devtools-toolbox page");
-  const target = findDebugTargetByText("about:debugging", document);
-  ok(target, "about:debugging tab target appeared");
-  const inspectButton = target.querySelector(".js-debug-target-inspect-button");
-  ok(inspectButton, "Inspect button for about:debugging appeared");
-  inspectButton.click();
-  await Promise.all([
-    waitUntil(() => tab.nextElementSibling),
-    waitForRequestsToSettle(window.AboutDebugging.store),
-    gDevTools.once("toolbox-ready"),
-  ]);
-
-  info("Wait for about:devtools-toolbox tab will be selected");
-  const devtoolsTab = tab.nextElementSibling;
-  await waitUntil(() => gBrowser.selectedTab === devtoolsTab);
-  info("Check whether the shortcut keys which opens devtools is disabled");
-  await assertShortcutKeys(gBrowser.selectedBrowser, false);
-
-  info("Force to select about:debugging page");
-  gBrowser.selectedTab = tab;
-  info("Check whether the shortcut keys which opens devtools is enabled");
-  await assertShortcutKeys(gBrowser.selectedBrowser, true);
-
-  await removeTab(devtoolsTab);
-  await waitForRequestsToSettle(window.AboutDebugging.store);
-  await removeTab(tab);
-});
-
-async function assertShortcutKeys(browser, shouldBeEnabled) {
-  await assertShortcutKey(browser.contentWindow, "VK_F12", {}, shouldBeEnabled);
-  await assertShortcutKey(browser.contentWindow, "I", {
-    accelKey: true,
-    shiftKey: !navigator.userAgent.match(/Mac/),
-    altKey: navigator.userAgent.match(/Mac/),
-  }, shouldBeEnabled);
-}
-
-async function assertShortcutKey(win, key, modifiers, shouldBeEnabled) {
-  info(`Assert shortcut key [${ key }]`);
-
-  if (shouldBeEnabled) {
-    await assertShortcutKeyEnabled(win, key, modifiers);
-  } else {
-    await assertShortcutKeyDisabled(win, key, modifiers);
-  }
-}
-
-async function assertShortcutKeyDisabled(win, key, modifiers) {
-  let isReadyCalled = false;
-  const toolboxListener = () => {
-    isReadyCalled = true;
-  };
-  gDevTools.on("toolbox-ready", toolboxListener);
-
-  EventUtils.synthesizeKey(key, modifiers, win);
-  await wait(1000);
-  ok(!isReadyCalled, `Devtools should not be opened by ${ key }`);
-
-  gDevTools.off("toolbox-ready", toolboxListener);
-}
-
-async function assertShortcutKeyEnabled(win, key, modifiers) {
-  // Open devtools
-  const onToolboxReady = gDevTools.once("toolbox-ready");
-  EventUtils.synthesizeKey(key, modifiers, win);
-  await onToolboxReady;
-  ok(true, `Devtools should be opened by ${ key }`);
-
-  // Close devtools
-  const onToolboxDestroyed = gDevTools.once("toolbox-destroyed");
-  EventUtils.synthesizeKey(key, modifiers, win);
-  await onToolboxDestroyed;
-  ok(true, `Devtopls should be closed by ${ key }`);
-}
--- a/devtools/client/framework/browser-menus.js
+++ b/devtools/client/framework/browser-menus.js
@@ -294,56 +294,8 @@ exports.addMenus = function(doc) {
  * @param {XULDocument} doc
  *        The document to which menus are to be removed.
  */
 exports.removeMenus = function(doc) {
   // We only remove top level entries. Per-tool entries are removed while
   // unregistering each tool.
   removeTopLevelItems(doc);
 };
-
-/**
- * This is used for about:devtools-toolbox and that we are hiding the main toolbox toggle
- * menu item, as well as all the tool items displayed on the menu. But we keep the
- * non-toolbox menu items such as Scratchpad, Browser Console etc.
- *
- * @param {XULDocument} doc
- * @param {boolean} isEnabled
- */
-function setDevtoolsMenuItemsEnabled(doc, isEnabled) {
-  setMenuItemEnabled(doc, "menu_devToolbox", isEnabled);
-
-  for (const toolDefinition of gDevTools.getToolDefinitionArray()) {
-    if (!toolDefinition.inMenu) {
-      continue;
-    }
-    setMenuItemEnabled(doc, "menuitem_" + toolDefinition.id, isEnabled);
-  }
-}
-
-function setMenuItemEnabled(doc, menuItemId, isEnabled) {
-  const menuItem = doc.getElementById(menuItemId);
-  if (menuItem) {
-    if (isEnabled) {
-      menuItem.removeAttribute("hidden");
-    } else {
-      menuItem.setAttribute("hidden", true);
-    }
-  }
-}
-
-/**
- * Enable all devtools menu items.
- *
- * @param {XULDocument} doc
- */
-exports.enableDevtoolsMenuItems = function(doc) {
-  setDevtoolsMenuItemsEnabled(doc, true);
-};
-
-/**
- * Disable all devtools menu items.
- *
- * @param {XULDocument} doc
- */
-exports.disableDevtoolsMenuItems = function(doc) {
-  setDevtoolsMenuItemsEnabled(doc, false);
-};
--- a/devtools/client/framework/devtools-browser.js
+++ b/devtools/client/framework/devtools-browser.js
@@ -237,26 +237,16 @@ var gDevToolsBrowser = exports.gDevTools
    *         - `toolId` used to identify a toolbox's panel like inspector or webconsole,
    *         - `id` used to identify any other key shortcuts like scratchpad or
    *         about:debugging
    * @param {Number} startTime
    *        Optional, indicates the time at which the key event fired. This is a
    *        `Cu.now()` timing.
    */
   async onKeyShortcut(window, key, startTime) {
-    // Avoid to open devtools when the about:devtools-toolbox page is showing
-    // on the window now.
-    if (gDevToolsBrowser._isAboutDevtoolsToolbox(window) &&
-        (key.toolId ||
-         key.id === "toggleToolbox" ||
-         key.id === "toggleToolboxF12" ||
-         key.id === "inspectorMac")) {
-      return;
-    }
-
     // If this is a toolbox's panel key shortcut, delegate to selectToolCommand
     if (key.toolId) {
       await gDevToolsBrowser.selectToolCommand(window.gBrowser, key.toolId, startTime);
       return;
     }
     // Otherwise implement all other key shortcuts individually here
     switch (key.id) {
       case "toggleToolbox":
@@ -594,20 +584,16 @@ var gDevToolsBrowser = exports.gDevTools
       if (def === toolDefinition) {
         break;
       }
       prevDef = def;
     }
 
     for (const win of gDevToolsBrowser._trackedBrowserWindows) {
       BrowserMenus.insertToolMenuElements(win.document, toolDefinition, prevDef);
-      // If we are on a page where devtools menu items are hidden such as
-      // about:devtools-toolbox, we need to call _updateMenuItems to update the
-      // visibility of the newly created menu item.
-      gDevToolsBrowser._updateMenuItems(win);
     }
 
     if (toolDefinition.id === "jsdebugger") {
       gDevToolsBrowser.setSlowScriptDebugHandler();
     }
   },
 
   hasToolboxOpened(win) {
@@ -616,61 +602,33 @@ var gDevToolsBrowser = exports.gDevTools
       if (target.tab == tab) {
         return true;
       }
     }
     return false;
   },
 
   /**
-   * Update developer tools menu items and the "Toggle Tools" checkbox. This is
+   * Update the "Toggle Tools" checkbox in the developer tools menu. This is
    * called when a toolbox is created or destroyed.
    */
-  _updateMenu() {
+  _updateMenuCheckbox() {
     for (const win of gDevToolsBrowser._trackedBrowserWindows) {
-      gDevToolsBrowser._updateMenuItems(win);
-    }
-  },
-
-  /**
-   * Update developer tools menu items and the "Toggle Tools" checkbox of XULWindow.
-   *
-   * @param {XULWindow} win
-   */
-  _updateMenuItems(win) {
-    if (gDevToolsBrowser._isAboutDevtoolsToolbox(win)) {
-      BrowserMenus.disableDevtoolsMenuItems(win.document);
-      return;
-    }
-
-    BrowserMenus.enableDevtoolsMenuItems(win.document);
+      const hasToolbox = gDevToolsBrowser.hasToolboxOpened(win);
 
-    const hasToolbox = gDevToolsBrowser.hasToolboxOpened(win);
-
-    const menu = win.document.getElementById("menu_devToolbox");
-    if (hasToolbox) {
-      menu.setAttribute("checked", "true");
-    } else {
-      menu.removeAttribute("checked");
+      const menu = win.document.getElementById("menu_devToolbox");
+      if (hasToolbox) {
+        menu.setAttribute("checked", "true");
+      } else {
+        menu.removeAttribute("checked");
+      }
     }
   },
 
   /**
-   * Check whether the window is showing about:devtools-toolbox page or not.
-   *
-   * @param {XULWindow} win
-   * @return {boolean} true: about:devtools-toolbox is showing
-   *                   false: otherwise
-   */
-  _isAboutDevtoolsToolbox(win) {
-    const currentURI = win.gBrowser.currentURI;
-    return currentURI.scheme === "about" && currentURI.filePath === "devtools-toolbox";
-  },
-
-  /**
    * Remove the menuitem for a tool to all open browser windows.
    *
    * @param {string} toolId
    *        id of the tool to remove
    */
   _removeToolFromWindows(toolId) {
     for (const win of gDevToolsBrowser._trackedBrowserWindows) {
       BrowserMenus.removeToolFromMenu(toolId, win.document);
@@ -712,17 +670,17 @@ var gDevToolsBrowser = exports.gDevTools
 
     const tabContainer = win.gBrowser.tabContainer;
     tabContainer.removeEventListener("TabSelect", this);
   },
 
   handleEvent(event) {
     switch (event.type) {
       case "TabSelect":
-        gDevToolsBrowser._updateMenu();
+        gDevToolsBrowser._updateMenuCheckbox();
         break;
       case "unload":
         // top-level browser window unload
         gDevToolsBrowser._forgetBrowserWindow(event.target.defaultView);
         break;
     }
   },
 
@@ -764,18 +722,18 @@ gDevTools.on("tool-registered", function
     gDevToolsBrowser._addToolToWindows(toolDefinition);
   }
 });
 
 gDevTools.on("tool-unregistered", function(toolId) {
   gDevToolsBrowser._removeToolFromWindows(toolId);
 });
 
-gDevTools.on("toolbox-ready", gDevToolsBrowser._updateMenu);
-gDevTools.on("toolbox-destroyed", gDevToolsBrowser._updateMenu);
+gDevTools.on("toolbox-ready", gDevToolsBrowser._updateMenuCheckbox);
+gDevTools.on("toolbox-destroyed", gDevToolsBrowser._updateMenuCheckbox);
 
 Services.obs.addObserver(gDevToolsBrowser, "quit-application");
 Services.obs.addObserver(gDevToolsBrowser, "browser-delayed-startup-finished");
 // Watch for module loader unload. Fires when the tools are reloaded.
 Services.obs.addObserver(gDevToolsBrowser, "devtools:loader:destroy");
 
 // Fake end of browser window load event for all already opened windows
 // that is already fully loaded.