aboutsummaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-01-24 14:20:17 -0500
committerGitHub <noreply@github.com>2021-01-24 14:20:17 -0500
commita0657e1bab6450095b020fb47b9c09a8ca7b5cdc (patch)
treed7c727c68d7ac1d66cc6f486a9a53022746017b0 /ext
parent4b6bb529523612743ab0086e97b3ca062678bd96 (diff)
Various firefox fixes (#1306)
* Fix for chrome.commands not being present on Firefox's embedded float.html * Fix _getSearchContext mishandling _optionsContextOverride
Diffstat (limited to 'ext')
-rw-r--r--ext/fg/js/frontend.js18
-rw-r--r--ext/mixed/js/hotkey-help-controller.js5
2 files changed, 16 insertions, 7 deletions
diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js
index e9b57eb5..94edeb12 100644
--- a/ext/fg/js/frontend.js
+++ b/ext/fg/js/frontend.js
@@ -637,14 +637,14 @@ class Frontend {
}
async _getOptionsContext() {
- return (await this._getSearchContext()).optionsContext;
+ let optionsContext = this._optionsContextOverride;
+ if (optionsContext === null) {
+ optionsContext = (await this._getSearchContext()).optionsContext;
+ }
+ return optionsContext;
}
async _getSearchContext() {
- if (this._optionsContextOverride !== null) {
- return this._optionsContextOverride;
- }
-
let url = window.location.href;
let documentTitle = document.title;
if (this._useProxyPopup) {
@@ -655,9 +655,13 @@ class Frontend {
}
}
- const depth = this._depth;
+ let optionsContext = this._optionsContextOverride;
+ if (optionsContext === null) {
+ optionsContext = {depth: this._depth, url};
+ }
+
return {
- optionsContext: {depth, url},
+ optionsContext,
detail: {documentTitle}
};
}
diff --git a/ext/mixed/js/hotkey-help-controller.js b/ext/mixed/js/hotkey-help-controller.js
index 032573c1..8137b50b 100644
--- a/ext/mixed/js/hotkey-help-controller.js
+++ b/ext/mixed/js/hotkey-help-controller.js
@@ -83,6 +83,11 @@ class HotkeyHelpController {
async _setupGlobalCommands(commandMap) {
const commands = await new Promise((resolve, reject) => {
+ if (!(isObject(chrome.commands) && typeof chrome.commands.getAll === 'function')) {
+ resolve([]);
+ return;
+ }
+
chrome.commands.getAll((result) => {
const e = chrome.runtime.lastError;
if (e) {