From 970cc13ce5e2d031f37bae24044e4e0b06d7cf31 Mon Sep 17 00:00:00 2001 From: Sonia Singla Date: Thu, 17 Dec 2020 19:14:07 +0000 Subject: [PATCH] Bug 1458764 - Removed the references with extensions.webextensions.tabhide.enabled pref. r=rpl Differential Revision: https://phabricator.services.mozilla.com/D97092 --- .../components/extensions/parent/ext-tabs.js | 14 ------- .../test/browser/browser_ext_tabs_hide.js | 40 ------------------- .../browser/browser_ext_tabs_sharingState.js | 4 -- modules/libpref/init/all.js | 3 -- 4 files changed, 61 deletions(-) diff --git a/browser/components/extensions/parent/ext-tabs.js b/browser/components/extensions/parent/ext-tabs.js index 5c09eaa95270..1216abfc2065 100644 --- a/browser/components/extensions/parent/ext-tabs.js +++ b/browser/components/extensions/parent/ext-tabs.js @@ -50,8 +50,6 @@ XPCOMUtils.defineLazyGetter(this, "strBundle", function() { var { DefaultMap, ExtensionError } = ExtensionUtils; -const TABHIDE_PREFNAME = "extensions.webextensions.tabhide.enabled"; - const TAB_HIDE_CONFIRMED_TYPE = "tabHideNotification"; const TAB_ID_NONE = -1; @@ -1536,12 +1534,6 @@ this.tabs = class extends ExtensionAPI { }, show(tabIds) { - if (!Services.prefs.getBoolPref(TABHIDE_PREFNAME, false)) { - throw new ExtensionError( - `tabs.show is currently experimental and must be enabled with the ${TABHIDE_PREFNAME} preference.` - ); - } - for (let tab of getNativeTabsFromIDArray(tabIds)) { if (tab.ownerGlobal) { tab.ownerGlobal.gBrowser.showTab(tab); @@ -1550,12 +1542,6 @@ this.tabs = class extends ExtensionAPI { }, hide(tabIds) { - if (!Services.prefs.getBoolPref(TABHIDE_PREFNAME, false)) { - throw new ExtensionError( - `tabs.hide is currently experimental and must be enabled with the ${TABHIDE_PREFNAME} preference.` - ); - } - let hidden = []; for (let tab of getNativeTabsFromIDArray(tabIds)) { if (tab.ownerGlobal && !tab.hidden) { diff --git a/browser/components/extensions/test/browser/browser_ext_tabs_hide.js b/browser/components/extensions/test/browser/browser_ext_tabs_hide.js index 0b07924dd94c..6e7ce147ae30 100644 --- a/browser/components/extensions/test/browser/browser_ext_tabs_hide.js +++ b/browser/components/extensions/test/browser/browser_ext_tabs_hide.js @@ -21,10 +21,6 @@ const { E10SUtils } = ChromeUtils.import( const triggeringPrincipal_base64 = E10SUtils.SERIALIZED_SYSTEMPRINCIPAL; async function doorhangerTest(testFn) { - await SpecialPowers.pushPrefEnv({ - set: [["extensions.webextensions.tabhide.enabled", true]], - }); - let extension = ExtensionTestUtils.loadExtension({ manifest: { permissions: ["tabs", "tabHide"], @@ -385,39 +381,3 @@ add_task(async function test_tabs_shutdown() { BrowserTestUtils.removeTab(tabs[0]); BrowserTestUtils.removeTab(tabs[1]); }); - -// Ensure the pref prevents API use when the extension has the tabHide permission. -add_task(async function test_pref_disabled() { - // This should run last since SpecialPowers.pushPrefEnv won't cleanup until - // this file finishes executing. - await SpecialPowers.pushPrefEnv({ - set: [["extensions.webextensions.tabhide.enabled", false]], - }); - - async function background() { - let tabs = await browser.tabs.query({ hidden: false }); - let ids = tabs.map(tab => tab.id); - - await browser.test - .assertRejects( - browser.tabs.hide(ids), - /tabs.hide is currently experimental/, - "Got the expected error when pref not enabled" - ) - .catch(err => { - browser.test.notifyFail("pref-test"); - throw err; - }); - - browser.test.notifyPass("pref-test"); - } - - let extdata = { - manifest: { permissions: ["tabs", "tabHide"] }, - background, - }; - let extension = ExtensionTestUtils.loadExtension(extdata); - await extension.startup(); - await extension.awaitFinish("pref-test"); - await extension.unload(); -}); diff --git a/browser/components/extensions/test/browser/browser_ext_tabs_sharingState.js b/browser/components/extensions/test/browser/browser_ext_tabs_sharingState.js index 4f3c965f7d7a..47f20063078d 100644 --- a/browser/components/extensions/test/browser/browser_ext_tabs_sharingState.js +++ b/browser/components/extensions/test/browser/browser_ext_tabs_sharingState.js @@ -1,10 +1,6 @@ "use strict"; add_task(async function test_tabs_mediaIndicators() { - await SpecialPowers.pushPrefEnv({ - set: [["extensions.webextensions.tabhide.enabled", true]], - }); - let initialTab = gBrowser.selectedTab; let tab = await BrowserTestUtils.openNewForegroundTab( gBrowser, diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 575bbb082b67..a78acd0b778c 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -3885,9 +3885,6 @@ pref("extensions.webextensions.restrictedDomains", "accounts-static.cdn.mozilla. // unless other process sandboxing and extension remoting prefs are changed. pref("extensions.webextensions.protocol.remote", true); -// Enable tab hiding API by default. -pref("extensions.webextensions.tabhide.enabled", true); - // Enable userScripts API by default. pref("extensions.webextensions.userScripts.enabled", true);