mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-19 01:51:27 +01:00
Get Opera Ready for MV3 (#13190)
* Add Opera Sidebar Related Manifest Keys * Be stricter about where sidebar API's come from * Skip Sidebar Icon Changes in MV3 * Fix typo in comment * Add `open_at_install`
This commit is contained in:
parent
182f9baa0f
commit
5f2a773d0d
@ -128,6 +128,13 @@
|
|||||||
},
|
},
|
||||||
"description": "__MSG_commandOpenSidebar__"
|
"description": "__MSG_commandOpenSidebar__"
|
||||||
},
|
},
|
||||||
|
"__opera___execute_sidebar_action": {
|
||||||
|
"suggested_key": {
|
||||||
|
"default": "Alt+Shift+Y",
|
||||||
|
"linux": "Alt+Shift+U"
|
||||||
|
},
|
||||||
|
"description": "__MSG_commandOpenSidebar__"
|
||||||
|
},
|
||||||
"autofill_login": {
|
"autofill_login": {
|
||||||
"suggested_key": {
|
"suggested_key": {
|
||||||
"default": "Ctrl+Shift+L"
|
"default": "Ctrl+Shift+L"
|
||||||
@ -182,5 +189,12 @@
|
|||||||
"storage": {
|
"storage": {
|
||||||
"managed_schema": "managed_schema.json"
|
"managed_schema": "managed_schema.json"
|
||||||
},
|
},
|
||||||
"__firefox__storage": null
|
"__firefox__storage": null,
|
||||||
|
"__opera__sidebar_action": {
|
||||||
|
"default_title": "Bitwarden",
|
||||||
|
"default_panel": "popup/index.html?uilocation=sidebar",
|
||||||
|
"default_icon": "images/icon19.png",
|
||||||
|
"open_at_install": false,
|
||||||
|
"browser_style": false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -530,10 +530,15 @@ export class BrowserApi {
|
|||||||
win: Window & typeof globalThis,
|
win: Window & typeof globalThis,
|
||||||
): OperaSidebarAction | FirefoxSidebarAction | null {
|
): OperaSidebarAction | FirefoxSidebarAction | null {
|
||||||
const deviceType = BrowserPlatformUtilsService.getDevice(win);
|
const deviceType = BrowserPlatformUtilsService.getDevice(win);
|
||||||
if (deviceType !== DeviceType.FirefoxExtension && deviceType !== DeviceType.OperaExtension) {
|
if (deviceType === DeviceType.FirefoxExtension) {
|
||||||
return null;
|
return browser.sidebarAction;
|
||||||
}
|
}
|
||||||
return win.opr?.sidebarAction || browser.sidebarAction;
|
|
||||||
|
if (deviceType === DeviceType.OperaExtension) {
|
||||||
|
return win.opr?.sidebarAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
static captureVisibleTab(): Promise<string> {
|
static captureVisibleTab(): Promise<string> {
|
||||||
|
@ -165,6 +165,13 @@ export class UpdateBadge {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ("opr" in this.win && BrowserApi.isManifestVersion(3)) {
|
||||||
|
// setIcon API is currenly broken for Opera MV3 extensions
|
||||||
|
// https://forums.opera.com/topic/75680/opr-sidebaraction-seticon-api-is-broken-access-to-extension-api-denied?_=1738349261570
|
||||||
|
// The API currently crashes on MacOS
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.isOperaSidebar(this.sidebarAction)) {
|
if (this.isOperaSidebar(this.sidebarAction)) {
|
||||||
await new Promise<void>((resolve) =>
|
await new Promise<void>((resolve) =>
|
||||||
(this.sidebarAction as OperaSidebarAction).setIcon(options, () => resolve()),
|
(this.sidebarAction as OperaSidebarAction).setIcon(options, () => resolve()),
|
||||||
|
Loading…
Reference in New Issue
Block a user