fix temporal dead zone in apply.js
This commit is contained in:
parent
5ba48bbdb7
commit
a0fc147015
|
@ -16,12 +16,21 @@ self.INJECTED !== 1 && (() => {
|
||||||
compare: (a, b) => a.id - b.id,
|
compare: (a, b) => a.id - b.id,
|
||||||
onUpdate: onInjectorUpdate,
|
onUpdate: onInjectorUpdate,
|
||||||
});
|
});
|
||||||
const initializing = init();
|
|
||||||
|
// save it now because chrome.runtime will be unavailable in the orphaned script
|
||||||
|
const orphanEventId = chrome.runtime.id;
|
||||||
|
let isOrphaned;
|
||||||
|
// firefox doesn't orphanize content scripts so the old elements stay
|
||||||
|
if (!chrome.app) styleInjector.clearOrphans();
|
||||||
|
|
||||||
/** @type chrome.runtime.Port */
|
/** @type chrome.runtime.Port */
|
||||||
let port;
|
let port;
|
||||||
let lazyBadge = IS_FRAME;
|
let lazyBadge = IS_FRAME;
|
||||||
let parentDomain;
|
let parentDomain;
|
||||||
|
|
||||||
|
// Declare all vars before init() or it'll throw due to "temporal dead zone" of const/let
|
||||||
|
const initializing = init();
|
||||||
|
|
||||||
// the popup needs a check as it's not a tab but can be opened in a tab manually for whatever reason
|
// the popup needs a check as it's not a tab but can be opened in a tab manually for whatever reason
|
||||||
if (!IS_TAB) {
|
if (!IS_TAB) {
|
||||||
chrome.tabs.getCurrent(tab => {
|
chrome.tabs.getCurrent(tab => {
|
||||||
|
@ -30,12 +39,6 @@ self.INJECTED !== 1 && (() => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// save it now because chrome.runtime will be unavailable in the orphaned script
|
|
||||||
const orphanEventId = chrome.runtime.id;
|
|
||||||
let isOrphaned;
|
|
||||||
// firefox doesn't orphanize content scripts so the old elements stay
|
|
||||||
if (!chrome.app) styleInjector.clearOrphans();
|
|
||||||
|
|
||||||
msg.onTab(applyOnMessage);
|
msg.onTab(applyOnMessage);
|
||||||
|
|
||||||
if (!chrome.tabs) {
|
if (!chrome.tabs) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user