summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/js/background/backend.js19
1 files changed, 11 insertions, 8 deletions
diff --git a/ext/js/background/backend.js b/ext/js/background/backend.js
index 6cae9cea..569cb53d 100644
--- a/ext/js/background/backend.js
+++ b/ext/js/background/backend.js
@@ -253,7 +253,7 @@ export class Backend {
this._prepareInternalSync();
this._permissions = await getAllPermissions();
- this._defaultBrowserActionTitle = await this._getBrowserIconTitle();
+ this._defaultBrowserActionTitle = this._getBrowserIconTitle();
this._badgePrepareDelayTimer = setTimeout(() => {
this._badgePrepareDelayTimer = null;
this._updateBadge();
@@ -1616,15 +1616,18 @@ export class Backend {
}
/**
- * @returns {Promise<string>}
+ * Returns the action's default title.
+ * @throws {Error}
+ * @returns {string}
*/
_getBrowserIconTitle() {
- return (
- isObjectNotArray(chrome.action) &&
- typeof chrome.action.getTitle === 'function' ?
- new Promise((resolve) => { chrome.action.getTitle({}, resolve); }) :
- Promise.resolve('')
- );
+ const manifest = /** @type {chrome.runtime.ManifestV3} */ (chrome.runtime.getManifest());
+ const action = manifest.action;
+ if (typeof action === 'undefined') { throw new Error('Failed to find action'); }
+ const defaultTitle = action.default_title;
+ if (typeof defaultTitle === 'undefined') { throw new Error('Failed to find default_title'); }
+
+ return defaultTitle;
}
/**