From 7d8648596f35e4745617c776ee0cc9013b783cb8 Mon Sep 17 00:00:00 2001 From: Gabriel Luong Date: Mon, 28 Oct 2019 20:45:21 +0000 Subject: [PATCH] Bug 1578745 - Introduce a preference to enable fission frame inspection in DevTools. r=nchevobbe Differential Revision: https://phabricator.services.mozilla.com/D50666 --HG-- extra : moz-landing-system : lando --- browser/app/profile/firefox.js | 7 ++++++- devtools/shared/fronts/inspector.js | 29 +++++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index a864bf66645d..6997c1a31f70 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -1969,12 +1969,17 @@ pref("devtools.toolbox.splitconsoleEnabled", false); pref("devtools.toolbox.splitconsoleHeight", 100); pref("devtools.toolbox.tabsOrder", ""); -// The fission pref is enabling the "Omniscient Browser Toolbox", which will +// The fission pref for enabling the "Omniscient Browser Toolbox", which will // make it possible to debug anything in Firefox (See Bug 1570639 for more // information). // ⚠ This is a work in progress. Expect weirdness when the pref is enabled. ⚠ pref("devtools.browsertoolbox.fission", false); +// The fission pref for enabling Fission frame debugging directly from the +// regular web/content toolbox. +// ⚠ This is a work in progress. Expect weirdness when the pref is enabled. ⚠ +pref("devtools.contenttoolbox.fission", false); + // This pref is also related to fission, but not only. It allows the toolbox // to stay open even if the debugged tab switches to another process. // It can happen between two documents, one running in the parent process like diff --git a/devtools/shared/fronts/inspector.js b/devtools/shared/fronts/inspector.js index 0ddd8b40f5a7..7366c4f7c26b 100644 --- a/devtools/shared/fronts/inspector.js +++ b/devtools/shared/fronts/inspector.js @@ -19,7 +19,8 @@ const TELEMETRY_EYEDROPPER_OPENED_MENU = const SHOW_ALL_ANONYMOUS_CONTENT_PREF = "devtools.inspector.showAllAnonymousContent"; const SHOW_UA_SHADOW_ROOTS_PREF = "devtools.inspector.showUserAgentShadowRoots"; -const FISSION_ENABLED_PREF = "devtools.browsertoolbox.fission"; +const BROWSER_FISSION_ENABLED_PREF = "devtools.browsertoolbox.fission"; +const CONTENT_FISSION_ENABLED_PREF = "devtools.contenttoolbox.fission"; const USE_NEW_BOX_MODEL_HIGHLIGHTER_PREF = "devtools.inspector.use-new-box-model-highlighter"; @@ -49,6 +50,26 @@ class InspectorFront extends FrontClassWithSpec(inspectorSpec) { ]); } + get isBrowserFissionEnabled() { + if (this._isBrowserFissionEnabled === undefined) { + this._isBrowserFissionEnabled = Services.prefs.getBoolPref( + BROWSER_FISSION_ENABLED_PREF + ); + } + + return this._isBrowserFissionEnabled; + } + + get isContentFissionEnabled() { + if (this._isContentFissionEnabled === undefined) { + this._isContentFissionEnabled = Services.prefs.getBoolPref( + CONTENT_FISSION_ENABLED_PREF + ); + } + + return this._isContentFissionEnabled; + } + async _getWalker() { const showAllAnonymousContent = Services.prefs.getBoolPref( SHOW_ALL_ANONYMOUS_CONTENT_PREF @@ -140,11 +161,11 @@ class InspectorFront extends FrontClassWithSpec(inspectorSpec) { * @return {Array} The list of InspectorFront instances. */ async getChildInspectors() { - const fissionEnabled = Services.prefs.getBoolPref(FISSION_ENABLED_PREF); const childInspectors = []; const target = this.targetFront; + // this line can be removed when we are ready for fission frames - if (fissionEnabled && target.chrome && !target.isAddon) { + if (this.isBrowserFissionEnabled && target.chrome && !target.isAddon) { const { frames } = await target.listRemoteFrames(); // attempt to get targets and filter by targets that could connect for (const descriptor of frames) { @@ -182,7 +203,7 @@ class InspectorFront extends FrontClassWithSpec(inspectorSpec) { async getNodeFrontFromNodeGrip(grip) { const gripHasContentDomReference = "contentDomReference" in grip; - if (!gripHasContentDomReference) { + if (!this.isContentFissionEnabled || !gripHasContentDomReference) { // Backward compatibility ( < Firefox 71): // If the grip does not have a contentDomReference, we can't know in which browsing // context id the node lives. We fall back on gripToNodeFront that might retrieve -- 2.11.4.GIT