mirror of
https://github.com/zen-browser/desktop.git
synced 2026-03-06 16:57:04 +00:00
feat: Improve addon panel opening method, b=no-bug, c=no-component
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
import { XPCOMUtils } from 'resource://gre/modules/XPCOMUtils.sys.mjs';
|
||||
import { UrlbarProvider, UrlbarUtils } from 'resource:///modules/UrlbarUtils.sys.mjs';
|
||||
import { globalActions } from 'resource:///modules/ZenUBGlobalActions.sys.mjs';
|
||||
import { ExtensionCommon } from 'resource://gre/modules/ExtensionCommon.sys.mjs';
|
||||
|
||||
const lazy = {};
|
||||
|
||||
@@ -32,8 +31,6 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
||||
true
|
||||
);
|
||||
|
||||
let { makeWidgetId } = ExtensionCommon;
|
||||
|
||||
/**
|
||||
* A provider that lets the user view all available global actions for a query.
|
||||
*/
|
||||
@@ -104,7 +101,7 @@ export class ZenUrlbarProviderGlobalActions extends UrlbarProvider {
|
||||
(addon) =>
|
||||
addon.isActive &&
|
||||
!addon.isSystem &&
|
||||
window.document.getElementById(makeWidgetId(addon.id) + '-BAP')
|
||||
window.gUnifiedExtensions.browserActionFor(window.WebExtensionPolicy.getByID(addon.id))
|
||||
)
|
||||
.map((addon) => {
|
||||
return {
|
||||
@@ -370,10 +367,11 @@ export class ZenUrlbarProviderGlobalActions extends UrlbarProvider {
|
||||
return;
|
||||
}
|
||||
if (payload.extensionId) {
|
||||
const widgetId = makeWidgetId(payload.extensionId) + '-BAP';
|
||||
const node = ownerGlobal.document.getElementById(widgetId);
|
||||
if (node) {
|
||||
node.doCommand();
|
||||
const action = ownerGlobal.gUnifiedExtensions.browserActionFor(
|
||||
ownerGlobal.WebExtensionPolicy.getByID(payload.extensionId)
|
||||
);
|
||||
if (action) {
|
||||
action.openPopup(ownerGlobal, /* without user interaction = */ true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user