Bug 1811230 - [devtools] Consider extension storage inspection always enabled. r=devtools-reviewers,nchevobbe

This pref has been true for a while and isn't meant to be disabled by the user.

Differential Revision: https://phabricator.services.mozilla.com/D166660
This commit is contained in:
Alexandre Poirot 2023-01-19 17:16:34 +00:00
parent ec1c1ce4c1
commit d42dc60869
6 changed files with 313 additions and 377 deletions

View file

@ -70,8 +70,8 @@ pref("extensions.langpacks.signatures.required", true);
pref("xpinstall.signatures.required", true); pref("xpinstall.signatures.required", true);
pref("xpinstall.signatures.devInfoURL", "https://wiki.mozilla.org/Addons/Extension_Signing"); pref("xpinstall.signatures.devInfoURL", "https://wiki.mozilla.org/Addons/Extension_Signing");
// Enable extensionStorage storage actor by default // Enable the unified extensions UI by default.
pref("devtools.storage.extensionStorage.enabled", true); pref("extensions.unifiedExtensions.enabled", true);
// Dictionary download preference // Dictionary download preference
pref("browser.dictionaries.download.url", "https://addons.mozilla.org/%LOCALE%/firefox/language-tools/"); pref("browser.dictionaries.download.url", "https://addons.mozilla.org/%LOCALE%/firefox/language-tools/");

View file

@ -6,9 +6,7 @@ http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict"; "use strict";
add_task(async function set_enable_extensionStorage_pref() { add_setup(async function() {
await pushPref("devtools.storage.extensionStorage.enabled", true);
// Always on top mode mess up with toolbox focus and openStoragePanelForAddon would timeout // Always on top mode mess up with toolbox focus and openStoragePanelForAddon would timeout
// waiting for toolbox focus. // waiting for toolbox focus.
await pushPref("devtools.toolbox.alwaysOnTop", false); await pushPref("devtools.toolbox.alwaysOnTop", false);

View file

@ -33,9 +33,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
Sqlite: "resource://gre/modules/Sqlite.sys.mjs", Sqlite: "resource://gre/modules/Sqlite.sys.mjs",
}); });
const EXTENSION_STORAGE_ENABLED_PREF =
"devtools.storage.extensionStorage.enabled";
const DEFAULT_VALUE = "value"; const DEFAULT_VALUE = "value";
loader.lazyRequireGetter( loader.lazyRequireGetter(
@ -1784,8 +1781,7 @@ exports.setupParentProcessForExtensionStorage = function({ mm, prefix }) {
/** /**
* The Extension Storage actor. * The Extension Storage actor.
*/ */
if (Services.prefs.getBoolPref(EXTENSION_STORAGE_ENABLED_PREF, false)) { StorageActors.createActor(
StorageActors.createActor(
{ {
typeName: "extensionStorage", typeName: "extensionStorage",
}, },
@ -1855,9 +1851,7 @@ if (Services.prefs.getBoolPref(EXTENSION_STORAGE_ENABLED_PREF, false)) {
setupParent: "setupParentProcessForExtensionStorage", setupParent: "setupParentProcessForExtensionStorage",
}); });
extensionStorageHelpers.onChangedChildListeners.add( extensionStorageHelpers.onChangedChildListeners.add(this.onStorageChange);
this.onStorageChange
);
this.setupStorageInParent = extensionStorageHelpers.callParentProcessAsync.bind( this.setupStorageInParent = extensionStorageHelpers.callParentProcessAsync.bind(
extensionStorageHelpers, extensionStorageHelpers,
"setupStorageInParent" "setupStorageInParent"
@ -1952,9 +1946,7 @@ if (Services.prefs.getBoolPref(EXTENSION_STORAGE_ENABLED_PREF, false)) {
return; return;
} }
const extension = ExtensionProcessScript.getExtensionChild( const extension = ExtensionProcessScript.getExtensionChild(this.addonId);
this.addonId
);
if (!extension || !extension.hasPermission("storage")) { if (!extension || !extension.hasPermission("storage")) {
return; return;
} }
@ -2145,8 +2137,7 @@ if (Services.prefs.getBoolPref(EXTENSION_STORAGE_ENABLED_PREF, false)) {
); );
}, },
} }
); );
}
StorageActors.createActor( StorageActors.createActor(
{ {

View file

@ -4,13 +4,6 @@ http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict"; "use strict";
// Pref remains in effect until test completes and is automatically cleared afterwards
add_task(async function set_enable_extensionStorage_pref() {
await SpecialPowers.pushPrefEnv({
set: [["devtools.storage.extensionStorage.enabled", true]],
});
});
add_task( add_task(
async function test_extensionStorage_disabled_for_non_extension_target() { async function test_extensionStorage_disabled_for_non_extension_target() {
if (isFissionEnabled()) { if (isFissionEnabled()) {

View file

@ -41,20 +41,12 @@ const { createAppInfo, promiseStartupManager } = AddonTestUtils;
const LEAVE_UUID_PREF = "extensions.webextensions.keepUuidOnUninstall"; const LEAVE_UUID_PREF = "extensions.webextensions.keepUuidOnUninstall";
const LEAVE_STORAGE_PREF = "extensions.webextensions.keepStorageOnUninstall"; const LEAVE_STORAGE_PREF = "extensions.webextensions.keepStorageOnUninstall";
const EXTENSION_STORAGE_ENABLED_PREF =
"devtools.storage.extensionStorage.enabled";
AddonTestUtils.init(this); AddonTestUtils.init(this);
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "42"); createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "42");
ExtensionTestUtils.init(this); ExtensionTestUtils.init(this);
// This storage actor is gated behind a pref, so make sure it is enabled first
Services.prefs.setBoolPref(EXTENSION_STORAGE_ENABLED_PREF, true);
registerCleanupFunction(() => {
Services.prefs.clearUserPref(EXTENSION_STORAGE_ENABLED_PREF);
});
add_setup(async function setup() { add_setup(async function setup() {
await promiseStartupManager(); await promiseStartupManager();
const dir = createMissingIndexedDBDirs(); const dir = createMissingIndexedDBDirs();
@ -1157,32 +1149,3 @@ add_task(async function test_live_update_with_no_extension_listener() {
await shutdown(extension, target); await shutdown(extension, target);
}); });
/*
* This task should be last, as it sets a pref to disable the extensionStorage
* storage actor. Since this pref is set at the beginning of the file, it
* already will be cleared via registerCleanupFunction when the test finishes.
*/
add_task(
{
// This test fails if the extension runs in the main process
// like in Thunderbird (see bug 1575183 comment #15 for details).
skip_if: () => !WebExtensionPolicy.useRemoteWebExtensions,
},
async function test_extensionStorage_store_disabled_on_pref() {
Services.prefs.setBoolPref(EXTENSION_STORAGE_ENABLED_PREF, false);
const extension = await startupExtension(getExtensionConfig());
const { target, extensionStorage } = await openAddonStoragePanel(
extension.id
);
ok(
extensionStorage === null,
"Should not have an extensionStorage store when pref disabled"
);
await shutdown(extension, target);
}
);

View file

@ -35,20 +35,11 @@ PromiseTestUtils.allowMatchingRejectionsGlobally(
const { createAppInfo, promiseStartupManager } = AddonTestUtils; const { createAppInfo, promiseStartupManager } = AddonTestUtils;
const EXTENSION_STORAGE_ENABLED_PREF =
"devtools.storage.extensionStorage.enabled";
AddonTestUtils.init(this); AddonTestUtils.init(this);
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "42"); createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "42");
ExtensionTestUtils.init(this); ExtensionTestUtils.init(this);
// This storage actor is gated behind a pref, so make sure it is enabled first
Services.prefs.setBoolPref(EXTENSION_STORAGE_ENABLED_PREF, true);
registerCleanupFunction(() => {
Services.prefs.clearUserPref(EXTENSION_STORAGE_ENABLED_PREF);
});
add_task(async function setup() { add_task(async function setup() {
await promiseStartupManager(); await promiseStartupManager();
const dir = createMissingIndexedDBDirs(); const dir = createMissingIndexedDBDirs();