Skip to content

Commit

Permalink
Fix constant error on firefox mobile from chrome.contextMenus (#1675)
Browse files Browse the repository at this point in the history
* Fix constant error on firefox mobile from chrome.contextMenus

* Put if check over whole block

* Split out into separate method so it can early return
  • Loading branch information
Kuuuube authored Dec 17, 2024
1 parent db9c07d commit f23c870
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions ext/js/background/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -1330,7 +1330,20 @@ export class Backend {
this._clipboardMonitor.stop();
}

this._setupContextMenu(options);

void this._accessibilityController.update(this._getOptionsFull(false));

this._sendMessageAllTabsIgnoreResponse({action: 'applicationOptionsUpdated', params: {source}});
}

/**
* @param {import('settings').ProfileOptions} options
*/
_setupContextMenu(options) {
try {
if (!chrome.contextMenus) { return; }

if (options.general.enableContextMenuScanSelected) {
chrome.contextMenus.create({
id: 'yomitan_lookup',
Expand All @@ -1348,10 +1361,6 @@ export class Backend {
} catch (e) {
log.error(e);
}

void this._accessibilityController.update(this._getOptionsFull(false));

this._sendMessageAllTabsIgnoreResponse({action: 'applicationOptionsUpdated', params: {source}});
}

/**
Expand Down

0 comments on commit f23c870

Please sign in to comment.