Bug 1544372 - part2: filter out hidden webextensions by default in about:debugging r=daisuke,Ola
authorJulian Descottes <jdescottes@mozilla.com>
Fri, 26 Apr 2019 13:58:35 +0000
changeset 530300 26048370172d6a7635f33dab067b4eb88954b14f
parent 530299 c33e07c9d8211a19e24324a60ffec05459b7b849
child 530301 836d02c18692c8037a94c319054b6104e0380208
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdaisuke, Ola
bugs1544372
milestone68.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 1544372 - part2: filter out hidden webextensions by default in about:debugging r=daisuke,Ola Depends on D28629 Follows exactly the same pattern as showSystemAddons. Enabled by default for local builds, disabled otherwise. Differential Revision: https://phabricator.services.mozilla.com/D28630
devtools/client/aboutdebugging-new/src/actions/debug-targets.js
devtools/client/aboutdebugging-new/src/constants.js
devtools/client/aboutdebugging-new/src/create-store.js
devtools/client/aboutdebugging-new/src/reducers/ui-state.js
devtools/client/aboutdebugging-new/test/browser/browser.ini
devtools/client/aboutdebugging/components/addons/Panel.js
devtools/client/aboutdebugging/test/browser_addons_debug_info.js
devtools/client/preferences/devtools-client.js
devtools/server/actors/addon/webextension.js
--- a/devtools/client/aboutdebugging-new/src/actions/debug-targets.js
+++ b/devtools/client/aboutdebugging-new/src/actions/debug-targets.js
@@ -182,19 +182,22 @@ function requestExtensions() {
     const clientWrapper = getCurrentClient(getState().runtimes);
 
     try {
       const isIconDataURLRequired = runtime.type !== RUNTIMES.THIS_FIREFOX;
       const addons =
         await clientWrapper.listAddons({ iconDataURL: isIconDataURLRequired });
       let extensions = addons.filter(a => a.debuggable);
 
-      // Filter out system addons unless the dedicated preference is set to true.
-      if (!getState().ui.showSystemAddons) {
-        extensions = extensions.filter(e => !e.isSystem);
+      // Filter out hidden & system addons unless the dedicated preference is set to true.
+      if (!getState().ui.showHiddenAddons) {
+        // System addons should normally also have the hidden flag. However on DevTools
+        // side, `hidden` is not available on FF67 servers or older. Check both flags for
+        // backward compatibility.
+        extensions = extensions.filter(e => !e.isSystem && !e.hidden);
       }
 
       if (runtime.type !== RUNTIMES.THIS_FIREFOX) {
         // manifestURL can only be used when debugging local addons, remove this
         // information for the extension data.
         extensions.forEach(extension => {
           extension.manifestURL = null;
         });
--- a/devtools/client/aboutdebugging-new/src/constants.js
+++ b/devtools/client/aboutdebugging-new/src/constants.js
@@ -100,18 +100,18 @@ const PAGE_TYPES = {
   CONNECT: "connect",
 };
 
 const PREFERENCES = {
   // Preference that drives the display of the "Tabs" category on This Firefox.
   LOCAL_TAB_DEBUGGING_ENABLED: "devtools.aboutdebugging.local-tab-debugging",
   // Preference that drives the display of the "Processes" debug target category.
   PROCESS_DEBUGGING_ENABLED: "devtools.aboutdebugging.process-debugging",
-  // Preference that drives the display of system addons in about:debugging.
-  SHOW_SYSTEM_ADDONS: "devtools.aboutdebugging.showSystemAddons",
+  // Preference that drives the display of hidden & system addons in about:debugging.
+  SHOW_HIDDEN_ADDONS: "devtools.aboutdebugging.showHiddenAddons",
 };
 
 const RUNTIME_PREFERENCE = {
   CHROME_DEBUG_ENABLED: "devtools.chrome.enabled",
   CONNECTION_PROMPT: "devtools.debugger.prompt-connection",
   PERMANENT_PRIVATE_BROWSING: "browser.privatebrowsing.autostart",
   REMOTE_DEBUG_ENABLED: "devtools.debugger.remote-enabled",
   SERVICE_WORKERS_ENABLED: "dom.serviceWorkers.enabled",
--- a/devtools/client/aboutdebugging-new/src/create-store.js
+++ b/devtools/client/aboutdebugging-new/src/create-store.js
@@ -44,14 +44,14 @@ function configureStore() {
                                      waitUntilService);
 
   return createStore(rootReducer, initialState, middleware);
 }
 
 function getUiState() {
   const collapsibilities = getDebugTargetCollapsibilities();
   const locations = getNetworkLocations();
-  const showSystemAddons = Services.prefs.getBoolPref(PREFERENCES.SHOW_SYSTEM_ADDONS,
+  const showHiddenAddons = Services.prefs.getBoolPref(PREFERENCES.SHOW_HIDDEN_ADDONS,
     false);
-  return new UiState(locations, collapsibilities, showSystemAddons);
+  return new UiState(locations, collapsibilities, showHiddenAddons);
 }
 
 exports.configureStore = configureStore;
--- a/devtools/client/aboutdebugging-new/src/reducers/ui-state.js
+++ b/devtools/client/aboutdebugging-new/src/reducers/ui-state.js
@@ -14,26 +14,26 @@ const {
   SHOW_PROFILER_DIALOG,
   TEMPORARY_EXTENSION_INSTALL_FAILURE,
   TEMPORARY_EXTENSION_INSTALL_SUCCESS,
   USB_RUNTIMES_SCAN_START,
   USB_RUNTIMES_SCAN_SUCCESS,
 } = require("../constants");
 
 function UiState(locations = [], debugTargetCollapsibilities = {},
-                 showSystemAddons = false) {
+                 showHiddenAddons = false) {
   return {
     adbAddonStatus: null,
     debugTargetCollapsibilities,
     isAdbReady: false,
     isScanningUsb: false,
     networkLocations: locations,
     selectedPage: null,
     showProfilerDialog: false,
-    showSystemAddons,
+    showHiddenAddons,
     temporaryInstallError: null,
   };
 }
 
 function uiReducer(state = UiState(), action) {
   switch (action.type) {
     case ADB_ADDON_STATUS_UPDATED: {
       const { adbAddonStatus } = action;
--- a/devtools/client/aboutdebugging-new/test/browser/browser.ini
+++ b/devtools/client/aboutdebugging-new/test/browser/browser.ini
@@ -1,15 +1,15 @@
 [DEFAULT]
 tags = devtools
 subsuite = devtools
 prefs =
-  # showSystemAddons has different values depending on the build flags,
-  # ensure consistent test behavior by always setting this to false.
-  devtools.aboutdebugging.showSystemAddons=false
+  # showHiddenAddons has different values depending on the build flags, ensure consistent
+  # test behavior by always setting it to false.
+  devtools.aboutdebugging.showHiddenAddons=false
 support-files =
   head.js
   helper-adb.js
   helper-addons.js
   helper-collapsibilities.js
   helper-mocks.js
   helper-real-usb.js
   helper-serviceworker.js
--- a/devtools/client/aboutdebugging/components/addons/Panel.js
+++ b/devtools/client/aboutdebugging/components/addons/Panel.js
@@ -20,17 +20,17 @@ loader.lazyRequireGetter(this, "Debugger
   "devtools/shared/client/debugger-client", true);
 
 const Strings = Services.strings.createBundle(
   "chrome://devtools/locale/aboutdebugging.properties");
 
 const ExtensionIcon = "chrome://mozapps/skin/extensions/extensionGeneric.svg";
 const CHROME_ENABLED_PREF = "devtools.chrome.enabled";
 const REMOTE_ENABLED_PREF = "devtools.debugger.remote-enabled";
-const SYSTEM_ENABLED_PREF = "devtools.aboutdebugging.showSystemAddons";
+const SYSTEM_ENABLED_PREF = "devtools.aboutdebugging.showHiddenAddons";
 const WEB_EXT_URL = "https://developer.mozilla.org/Add-ons" +
                     "/WebExtensions/Getting_started_with_web-ext";
 
 class AddonsPanel extends Component {
   static get propTypes() {
     return {
       client: PropTypes.instanceOf(DebuggerClient).isRequired,
       connect: PropTypes.object,
--- a/devtools/client/aboutdebugging/test/browser_addons_debug_info.js
+++ b/devtools/client/aboutdebugging/test/browser_addons_debug_info.js
@@ -1,14 +1,14 @@
 "use strict";
 
 const { Preferences } = ChromeUtils.import("resource://gre/modules/Preferences.jsm");
 
 const UUID_REGEX = /^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/;
-const SHOW_SYSTEM_ADDONS_PREF = "devtools.aboutdebugging.showSystemAddons";
+const SHOW_SYSTEM_ADDONS_PREF = "devtools.aboutdebugging.showHiddenAddons";
 
 function testFilePath(container, expectedFilePath) {
   // Verify that the path to the install location is shown next to its label.
   const filePath = container.querySelector(".file-path");
   ok(filePath, "file path is in DOM");
   ok(filePath.textContent.endsWith(expectedFilePath), "file path is set correctly");
   is(filePath.previousElementSibling.textContent, "Location", "file path has label");
 }
--- a/devtools/client/preferences/devtools-client.js
+++ b/devtools/client/preferences/devtools-client.js
@@ -364,17 +364,17 @@ pref("devtools.aboutdebugging.network-lo
 // Debug target pane collapse/expand settings.
 pref("devtools.aboutdebugging.collapsibilities.installedExtension", false);
 pref("devtools.aboutdebugging.collapsibilities.otherWorker", false);
 pref("devtools.aboutdebugging.collapsibilities.serviceWorker", false);
 pref("devtools.aboutdebugging.collapsibilities.sharedWorker", false);
 pref("devtools.aboutdebugging.collapsibilities.tab", false);
 pref("devtools.aboutdebugging.collapsibilities.temporaryExtension", false);
 
-// about:debugging: only show system add-ons in local builds by default.
+// about:debugging: only show system and hidden extensions in local builds by default.
 #ifdef MOZILLA_OFFICIAL
-  pref("devtools.aboutdebugging.showSystemAddons", false);
+  pref("devtools.aboutdebugging.showHiddenAddons", false);
 #else
-  pref("devtools.aboutdebugging.showSystemAddons", true);
+  pref("devtools.aboutdebugging.showHiddenAddons", true);
 #endif
 
 // Map top-level await expressions in the console
 pref("devtools.debugger.features.map-await-expression", true);
--- a/devtools/server/actors/addon/webextension.js
+++ b/devtools/server/actors/addon/webextension.js
@@ -66,16 +66,17 @@ const WebExtensionActor = protocol.Actor
     });
   },
 
   form() {
     const policy = ExtensionParent.WebExtensionPolicy.getByID(this.addonId);
     return {
       actor: this.actorID,
       debuggable: this.addon.isDebuggable,
+      hidden: this.addon.hidden,
       // iconDataURL is available after calling loadIconDataURL
       iconDataURL: this._iconDataURL,
       iconURL: this.addon.iconURL,
       id: this.addonId,
       isAPIExtension: this.addon.isAPIExtension,
       isSystem: this.addon.isSystem,
       isWebExtension: this.addon.isWebExtension,
       manifestURL: policy && policy.getURL("manifest.json"),