mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1674977 - [devtools] Always return true from gDevTools::isFissionContentToolboxEnabled r=ochameau
Depends on D95685 Keep the isFissionContentToolboxEnabled method but always return true to effectively enable all fission related behavior for all content toolboxes. Differential Revision: https://phabricator.services.mozilla.com/D95686
This commit is contained in:
parent
d17e35eb23
commit
4952a99950
@ -2090,13 +2090,6 @@ pref("devtools.browsertoolbox.fission", true);
|
||||
pref("devtools.browsertoolbox.fission", false);
|
||||
#endif
|
||||
|
||||
// The fission pref for enabling Fission frame debugging directly from the
|
||||
// regular web/content toolbox.
|
||||
// When set to true, the toolbox will start showing content from remote frames
|
||||
// if (and only if) fission.autostart is also set to true.
|
||||
// When set to false, the toolbox should not show content from remote frames.
|
||||
pref("devtools.contenttoolbox.fission", true);
|
||||
|
||||
// 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
|
||||
|
@ -93,7 +93,6 @@ async function shutdownAccessibility(browser) {
|
||||
registerCleanupFunction(async () => {
|
||||
info("Cleaning up...");
|
||||
Services.prefs.clearUserPref("devtools.accessibility.enabled");
|
||||
Services.prefs.clearUserPref("devtools.contenttoolbox.fission");
|
||||
});
|
||||
|
||||
const EXPANDABLE_PROPS = ["actions", "states", "attributes"];
|
||||
@ -807,9 +806,6 @@ async function closeTabToolboxAccessibility(tab = gBrowser.selectedTab) {
|
||||
function addA11YPanelTask(msg, uri, task, options = {}) {
|
||||
add_task(async function a11YPanelTask() {
|
||||
info(msg);
|
||||
if (options.remoteIframe) {
|
||||
await pushPref("devtools.contenttoolbox.fission", true);
|
||||
}
|
||||
|
||||
const env = await addTestTab(buildURL(uri, options));
|
||||
await task(env);
|
||||
|
@ -26,12 +26,6 @@ const PREFERENCES = [
|
||||
"Console, so that it can see and debug resources from the content " +
|
||||
"processes at the same time as resources from the parent process",
|
||||
],
|
||||
[
|
||||
"devtools.contenttoolbox.fission",
|
||||
"Enable fission support in the regular Toolbox. Allows to see and debug " +
|
||||
"resources from remote frames. Should only be used when " +
|
||||
"`fission.autostart` is enabled",
|
||||
],
|
||||
[
|
||||
"devtools.target-switching.enabled",
|
||||
"If you navigate between two distinct process, the toolbox won’t close " +
|
||||
|
@ -51,8 +51,6 @@ const {
|
||||
const FORBIDDEN_IDS = new Set(["toolbox", ""]);
|
||||
const MAX_ORDINAL = 99;
|
||||
|
||||
const CONTENT_FISSION_ENABLED_PREF = "devtools.contenttoolbox.fission";
|
||||
|
||||
/**
|
||||
* DevTools is a class that represents a set of developer tools, it holds a
|
||||
* set of tools and keeps track of open toolboxes in the browser.
|
||||
@ -839,36 +837,10 @@ DevTools.prototype = {
|
||||
|
||||
/**
|
||||
* Check if the content from remote frames should be displayed in the toolbox.
|
||||
* This depends both on enabling the dedicated devtools preference as well as
|
||||
* the fission.autostart preference.
|
||||
* XXX: Temporarily enable fissionContentToolbox by default.
|
||||
*/
|
||||
isFissionContentToolboxEnabled() {
|
||||
if (typeof this._cachedFissionContentToolboxEnabled === "undefined") {
|
||||
const isContentFissionEnabled = Services.prefs.getBoolPref(
|
||||
CONTENT_FISSION_ENABLED_PREF,
|
||||
false
|
||||
);
|
||||
|
||||
// Checking fission.autostart is not used to check if the current target
|
||||
// is a Fission tab, but only to check if the user is currently dogfooding
|
||||
// Fission.
|
||||
const isFissionEnabled = Services.appinfo.fissionAutostart;
|
||||
this._cachedFissionContentToolboxEnabled =
|
||||
isFissionEnabled && isContentFissionEnabled;
|
||||
}
|
||||
return this._cachedFissionContentToolboxEnabled;
|
||||
},
|
||||
|
||||
/**
|
||||
* Clear the _cachedFissionContentToolboxEnabled reference so next call to
|
||||
* isFissionContentToolboxEnabled will read the preferences values again instead of
|
||||
* relying on the cached value.
|
||||
* ⚠️ This should only be used in tests as it could lead to different
|
||||
* isFissionContentToolboxEnabled results if the preferences are changed while
|
||||
* toolboxes are open ⚠️.
|
||||
*/
|
||||
clearIsFissionContentToolboxEnabledReferenceForTest() {
|
||||
delete this._cachedFissionContentToolboxEnabled;
|
||||
return true;
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -12,8 +12,6 @@ const TEST_ORG_URI =
|
||||
ORG_URL_ROOT + "doc_inspector_fission_frame_navigation.html";
|
||||
|
||||
add_task(async function() {
|
||||
await pushPref("devtools.contenttoolbox.fission", true);
|
||||
|
||||
const { inspector } = await openInspectorForURL(TEST_ORG_URI);
|
||||
const tree = `
|
||||
id="root"
|
||||
@ -68,8 +66,6 @@ add_task(async function navigateFrameNotExpandedInMarkupView() {
|
||||
return;
|
||||
}
|
||||
|
||||
await pushPref("devtools.contenttoolbox.fission", true);
|
||||
|
||||
const { inspector } = await openInspectorForURL(TEST_ORG_URI);
|
||||
const resourceWatcher = inspector.toolbox.resourceWatcher;
|
||||
|
||||
|
@ -323,9 +323,6 @@ registerCleanupFunction(async function cleanup() {
|
||||
conn.close();
|
||||
}
|
||||
}
|
||||
|
||||
// Clear the cached value for the fission content toolbox preference.
|
||||
gDevTools.clearIsFissionContentToolboxEnabledReferenceForTest();
|
||||
});
|
||||
|
||||
async function safeCloseBrowserConsole({ clearOutput = false } = {}) {
|
||||
|
@ -11,7 +11,6 @@ const IFRAME_PATH = `${FILE_FOLDER}/test-console-evaluation-context-selector-chi
|
||||
requestLongerTimeout(2);
|
||||
|
||||
add_task(async function() {
|
||||
await pushPref("devtools.contenttoolbox.fission", true);
|
||||
await pushPref("devtools.contenttoolbox.webconsole.input.context", true);
|
||||
|
||||
const hud = await openNewTabWithIframesAndConsole(TEST_URI, [
|
||||
|
@ -14,7 +14,6 @@ const IFRAME_PATH = `${FILE_FOLDER}/test-console-evaluation-context-selector-chi
|
||||
requestLongerTimeout(2);
|
||||
|
||||
add_task(async function() {
|
||||
await pushPref("devtools.contenttoolbox.fission", true);
|
||||
await pushPref("devtools.contenttoolbox.webconsole.input.context", true);
|
||||
|
||||
const hud = await openNewTabWithIframesAndConsole(TEST_URI, [
|
||||
|
@ -12,7 +12,6 @@ const TEST_URI = `${URL_ROOT_COM}test-console-evaluation-context-selector.html`;
|
||||
const IFRAME_FILE = `test-console-evaluation-context-selector-child.html`;
|
||||
|
||||
add_task(async function() {
|
||||
await pushPref("devtools.contenttoolbox.fission", true);
|
||||
await pushPref("devtools.contenttoolbox.webconsole.input.context", true);
|
||||
|
||||
const tab = await addTab(TEST_URI);
|
||||
|
@ -12,7 +12,6 @@ const IFRAME_PATH = `${FILE_FOLDER}/test-console-evaluation-context-selector-chi
|
||||
// the context is set to the top one if the destroyed target was selected).
|
||||
|
||||
add_task(async function() {
|
||||
await pushPref("devtools.contenttoolbox.fission", true);
|
||||
await pushPref("devtools.contenttoolbox.webconsole.input.context", true);
|
||||
|
||||
const hud = await openNewTabWithIframesAndConsole(TEST_URI, [
|
||||
|
@ -38,9 +38,6 @@ const TEST_URI = `data:text/html,<meta charset=utf8>
|
||||
add_task(async function() {
|
||||
// Enable CSS Warnings
|
||||
await pushPref("devtools.webconsole.filter.css", true);
|
||||
if (isFissionEnabled()) {
|
||||
await pushPref("devtools.contenttoolbox.fission", true);
|
||||
}
|
||||
|
||||
const hud = await openNewTabAndConsole(TEST_URI);
|
||||
const toolbox = hud.toolbox;
|
||||
|
@ -20,7 +20,6 @@ add_task(async function() {
|
||||
|
||||
let hud, node;
|
||||
if (isFissionEnabled()) {
|
||||
await pushPref("devtools.contenttoolbox.fission", true);
|
||||
// When fission is enabled, we might miss the early message emitted while the target
|
||||
// is being switched, so here we directly open the "real" test URI. See Bug 1614291.
|
||||
hud = await openNewTabAndConsole(TEST_URI);
|
||||
|
@ -151,7 +151,7 @@ module.exports = {
|
||||
*/
|
||||
function getWatchingBrowsingContexts(watcher) {
|
||||
// If we are watching for additional frame targets, it means that fission mode is enabled,
|
||||
// either via devtools.contenttoolbox.fission or devtools.browsertoolbox.fission pref.
|
||||
// either for a content toolbox or a BrowserToolbox via devtools.browsertoolbox.fission pref.
|
||||
const watchingAdditionalTargets = WatcherRegistry.isWatchingTargets(
|
||||
watcher,
|
||||
Targets.TYPES.FRAME
|
||||
|
@ -10,9 +10,8 @@ const { TargetList } = require("devtools/shared/resources/target-list");
|
||||
const FISSION_TEST_URL = URL_ROOT_SSL + "/fission_document.html";
|
||||
|
||||
add_task(async function() {
|
||||
// Enabled fission's prefs as the TargetList is almost disabled without it
|
||||
// Enabled fission prefs
|
||||
await pushPref("devtools.browsertoolbox.fission", true);
|
||||
await pushPref("devtools.contenttoolbox.fission", true);
|
||||
// Disable the preloaded process as it gets created lazily and may interfere
|
||||
// with process count assertions
|
||||
await pushPref("dom.ipc.processPrelaunch.enabled", false);
|
||||
|
@ -7,8 +7,6 @@
|
||||
|
||||
const { TargetList } = require("devtools/shared/resources/target-list");
|
||||
|
||||
const FISSION_TEST_URL = URL_ROOT_SSL + "/fission_document.html";
|
||||
|
||||
add_task(async function() {
|
||||
// Disable the preloaded process as it gets created lazily and may interfere
|
||||
// with process count assertions
|
||||
@ -23,20 +21,10 @@ add_task(async function() {
|
||||
|
||||
// Assert the limited behavior of this API with fission preffed off
|
||||
await pushPref("devtools.browsertoolbox.fission", false);
|
||||
await pushPref("devtools.contenttoolbox.fission", false);
|
||||
|
||||
is(
|
||||
gDevTools.isFissionContentToolboxEnabled(),
|
||||
false,
|
||||
"isFissionContentToolboxEnabled returns the expected value"
|
||||
);
|
||||
|
||||
// Test with Main process targets as top level target
|
||||
await testPreffedOffMainProcess(mainRoot, mainProcess);
|
||||
|
||||
// Test with Tab target as top level target
|
||||
await testPreffedOffTab(mainRoot);
|
||||
|
||||
await client.close();
|
||||
});
|
||||
|
||||
@ -101,62 +89,3 @@ async function testPreffedOffMainProcess(mainRoot, mainProcess) {
|
||||
|
||||
targetList.destroy();
|
||||
}
|
||||
|
||||
async function testPreffedOffTab(mainRoot) {
|
||||
info(
|
||||
"Test TargetList when devtools's fission pref is false, via the tab target"
|
||||
);
|
||||
|
||||
// Create a TargetList for a given test tab
|
||||
const tab = await addTab(FISSION_TEST_URL);
|
||||
const descriptor = await mainRoot.getTab({ tab });
|
||||
const target = await descriptor.getTarget();
|
||||
const targetList = new TargetList(mainRoot, target);
|
||||
|
||||
await targetList.startListening();
|
||||
|
||||
const processes = await targetList.getAllTargets([TargetList.TYPES.PROCESS]);
|
||||
is(processes.length, 0, "Tabs don't expose any process");
|
||||
// This only reports the top level target when devtools fission preference is off
|
||||
const frames = await targetList.getAllTargets([TargetList.TYPES.FRAME]);
|
||||
is(frames.length, 1, "We get only one frame when preffed-off");
|
||||
is(frames[0], target, "The target is the top level one via getAllTargets");
|
||||
|
||||
const processTargets = [];
|
||||
const onProcessAvailable = ({ type, targetFront }) => {
|
||||
processTargets.push(targetFront);
|
||||
};
|
||||
await targetList.watchTargets([TargetList.TYPES.PROCESS], onProcessAvailable);
|
||||
is(processTargets.length, 0, "We get no process when preffed-off");
|
||||
targetList.unwatchTargets([TargetList.TYPES.PROCESS], onProcessAvailable);
|
||||
|
||||
const frameTargets = [];
|
||||
const onFrameAvailable = ({ targetFront }) => {
|
||||
is(
|
||||
targetFront.targetType,
|
||||
TargetList.TYPES.FRAME,
|
||||
"We are only notified about frame targets"
|
||||
);
|
||||
ok(
|
||||
targetFront.isTopLevel,
|
||||
"We are only notified about the top level target"
|
||||
);
|
||||
frameTargets.push(targetFront);
|
||||
};
|
||||
await targetList.watchTargets([TargetList.TYPES.FRAME], onFrameAvailable);
|
||||
is(
|
||||
frameTargets.length,
|
||||
1,
|
||||
"We get one frame via watchTargets when preffed-off"
|
||||
);
|
||||
is(
|
||||
frameTargets[0],
|
||||
target,
|
||||
"The target is the top level one via watchTargets"
|
||||
);
|
||||
targetList.unwatchTargets([TargetList.TYPES.FRAME], onFrameAvailable);
|
||||
|
||||
targetList.destroy();
|
||||
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user