diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:42 +0000 |
commit | da4c7e7ed675c3bf405668739c3012d140856109 (patch) | |
tree | cdd868dba063fecba609a1d819de271f0d51b23e /browser/components/extensions/parent | |
parent | Adding upstream version 125.0.3. (diff) | |
download | firefox-da4c7e7ed675c3bf405668739c3012d140856109.tar.xz firefox-da4c7e7ed675c3bf405668739c3012d140856109.zip |
Adding upstream version 126.0.upstream/126.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/extensions/parent')
5 files changed, 42 insertions, 25 deletions
diff --git a/browser/components/extensions/parent/ext-browser.js b/browser/components/extensions/parent/ext-browser.js index 7b01d15101..d2f72d4f46 100644 --- a/browser/components/extensions/parent/ext-browser.js +++ b/browser/components/extensions/parent/ext-browser.js @@ -67,8 +67,12 @@ global.openOptionsPage = extension => { return Promise.reject({ message: "No browser window available" }); } - if (extension.manifest.options_ui.open_in_tab) { - window.switchToTabHavingURI(extension.manifest.options_ui.page, true, { + const { optionsPageProperties } = extension; + if (!optionsPageProperties) { + return Promise.reject({ message: "No options page" }); + } + if (optionsPageProperties.open_in_tab) { + window.switchToTabHavingURI(optionsPageProperties.page, true, { triggeringPrincipal: extension.principal, }); return Promise.resolve(); diff --git a/browser/components/extensions/parent/ext-chrome-settings-overrides.js b/browser/components/extensions/parent/ext-chrome-settings-overrides.js index 1fbb794b51..3d1b7d363e 100644 --- a/browser/components/extensions/parent/ext-chrome-settings-overrides.js +++ b/browser/components/extensions/parent/ext-chrome-settings-overrides.js @@ -56,7 +56,7 @@ ChromeUtils.defineLazyGetter(this, "homepagePopup", () => { Services.prefs.addObserver(HOMEPAGE_PREF, async function prefObserver() { Services.prefs.removeObserver(HOMEPAGE_PREF, prefObserver); let loaded = waitForTabLoaded(tab); - win.BrowserHome(); + win.BrowserCommands.home(); await loaded; // Manually trigger an event in case this is controlled again. popup.open(); diff --git a/browser/components/extensions/parent/ext-commands.js b/browser/components/extensions/parent/ext-commands.js index 328f05a802..5b2b5f11b2 100644 --- a/browser/components/extensions/parent/ext-commands.js +++ b/browser/components/extensions/parent/ext-commands.js @@ -13,8 +13,13 @@ ChromeUtils.defineESModuleGetters(this, { this.commands = class extends ExtensionAPIPersistent { PERSISTENT_EVENTS = { onCommand({ fire }) { + const { extension } = this; + const { tabManager } = extension; + let listener = (eventName, commandName) => { - fire.async(commandName); + let nativeTab = tabTracker.activeTab; + tabManager.addActiveTabPermission(nativeTab); + fire.async(commandName, tabManager.convert(nativeTab)); }; this.on("command", listener); return { diff --git a/browser/components/extensions/parent/ext-devtools-panels.js b/browser/components/extensions/parent/ext-devtools-panels.js index 6b83ea5dbb..4b88b91eab 100644 --- a/browser/components/extensions/parent/ext-devtools-panels.js +++ b/browser/components/extensions/parent/ext-devtools-panels.js @@ -104,20 +104,21 @@ class BaseDevToolsPanel { /** * Represents an addon devtools panel in the main process. - * - * @param {ExtensionChildProxyContext} context - * A devtools extension proxy context running in a main process. - * @param {object} options - * @param {string} options.id - * The id of the addon devtools panel. - * @param {string} options.icon - * The icon of the addon devtools panel. - * @param {string} options.title - * The title of the addon devtools panel. - * @param {string} options.url - * The url of the addon devtools panel, relative to the extension base URL. */ class ParentDevToolsPanel extends BaseDevToolsPanel { + /** + * @param {DevToolsExtensionPageContextParent} context + * A devtools extension proxy context running in a main process. + * @param {object} panelOptions + * @param {string} panelOptions.id + * The id of the addon devtools panel. + * @param {string} panelOptions.icon + * The icon of the addon devtools panel. + * @param {string} panelOptions.title + * The title of the addon devtools panel. + * @param {string} panelOptions.url + * The url of the addon devtools panel, relative to the extension base URL. + */ constructor(context, panelOptions) { super(context, panelOptions); @@ -339,16 +340,17 @@ class DevToolsSelectionObserver extends EventEmitter { /** * Represents an addon devtools inspector sidebar in the main process. - * - * @param {ExtensionChildProxyContext} context - * A devtools extension proxy context running in a main process. - * @param {object} options - * @param {string} options.id - * The id of the addon devtools sidebar. - * @param {string} options.title - * The title of the addon devtools sidebar. */ class ParentDevToolsInspectorSidebar extends BaseDevToolsPanel { + /** + * @param {DevToolsExtensionPageContextParent} context + * A devtools extension proxy context running in a main process. + * @param {object} panelOptions + * @param {string} panelOptions.id + * The id of the addon devtools sidebar. + * @param {string} panelOptions.title + * The title of the addon devtools sidebar. + */ constructor(context, panelOptions) { super(context, panelOptions); diff --git a/browser/components/extensions/parent/ext-tabs.js b/browser/components/extensions/parent/ext-tabs.js index 128a42439b..4b8d296d67 100644 --- a/browser/components/extensions/parent/ext-tabs.js +++ b/browser/components/extensions/parent/ext-tabs.js @@ -1026,7 +1026,13 @@ this.tabs = class extends ExtensionAPIPersistent { ? windowTracker.getTopWindow(context) : windowTracker.getWindow(windowId, context); - let tab = tabManager.wrapTab(window.gBrowser.selectedTab); + let tab = tabManager.getWrapper(window.gBrowser.selectedTab); + if ( + !extension.hasPermission("<all_urls>") && + !tab.hasActiveTabPermission + ) { + throw new ExtensionError("Missing activeTab permission"); + } await tabListener.awaitTabReady(tab.nativeTab); let zoom = window.ZoomManager.getZoomForBrowser( |