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.devInfoURL", "https://wiki.mozilla.org/Addons/Extension_Signing");
// Enable extensionStorage storage actor by default
pref("devtools.storage.extensionStorage.enabled", true);
// Enable the unified extensions UI by default.
pref("extensions.unifiedExtensions.enabled", true);
// Dictionary download preference
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";
add_task(async function set_enable_extensionStorage_pref() {
await pushPref("devtools.storage.extensionStorage.enabled", true);
add_setup(async function() {
// Always on top mode mess up with toolbox focus and openStoragePanelForAddon would timeout
// waiting for toolbox focus.
await pushPref("devtools.toolbox.alwaysOnTop", false);

View file

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

View file

@ -4,13 +4,6 @@ http://creativecommons.org/publicdomain/zero/1.0/ */
"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(
async function test_extensionStorage_disabled_for_non_extension_target() {
if (isFissionEnabled()) {

View file

@ -41,20 +41,12 @@ const { createAppInfo, promiseStartupManager } = AddonTestUtils;
const LEAVE_UUID_PREF = "extensions.webextensions.keepUuidOnUninstall";
const LEAVE_STORAGE_PREF = "extensions.webextensions.keepStorageOnUninstall";
const EXTENSION_STORAGE_ENABLED_PREF =
"devtools.storage.extensionStorage.enabled";
AddonTestUtils.init(this);
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "42");
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() {
await promiseStartupManager();
const dir = createMissingIndexedDBDirs();
@ -1157,32 +1149,3 @@ add_task(async function test_live_update_with_no_extension_listener() {
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 EXTENSION_STORAGE_ENABLED_PREF =
"devtools.storage.extensionStorage.enabled";
AddonTestUtils.init(this);
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "42");
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() {
await promiseStartupManager();
const dir = createMissingIndexedDBDirs();