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
This commit is contained in:
Gabriel Luong 2019-10-28 20:45:21 +00:00
parent 8ae1d6eba9
commit 7d8648596f
2 changed files with 31 additions and 5 deletions

View File

@ -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

View File

@ -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