Flatten threads: fix feature in Firefox
The feature didn't work in Firefox because we referenced chrome, which
doesn't exist in the main world in Firefox. This CL fixes this issue.
Change-Id: I5cc3363205fb0e60d3b595394025ff123feb6c96
diff --git a/src/common/actionApi.js b/src/common/actionApi.js
index 69c68b8..0cf8528 100644
--- a/src/common/actionApi.js
+++ b/src/common/actionApi.js
@@ -1,5 +1,5 @@
// #!if browser_target == 'chromium_mv3'
-export default chrome.action;
+export default typeof chrome !== 'undefined' ? chrome.action : undefined;
// #!else
-export default chrome.browserAction;
+export default typeof chrome !== 'undefined' ? chrome.browserAction : undefined;
// #!endif
diff --git a/src/common/litI18nUtils.js b/src/common/litI18nUtils.js
index 1f95baa..df502ab 100644
--- a/src/common/litI18nUtils.js
+++ b/src/common/litI18nUtils.js
@@ -16,7 +16,7 @@
#setUpLitL10n() {
let pLocale;
- if (chrome.i18n) {
+ if (typeof chrome !== 'undefined' && chrome.i18n) {
pLocale = Promise.resolve(chrome.i18n.getUILanguage());
} else {
pLocale = this.#MWI18nClient.getUILanguage();