From e56e64c9fd052bc003b2fc3395c8f47641f356db Mon Sep 17 00:00:00 2001 From: Federico Brigante Date: Tue, 31 May 2022 05:18:27 +0800 Subject: [PATCH] Various import/copy cleanup, avoid unnecessary library injection (#3511) --- package-lock.json | 165 ++++-------------- package.json | 4 +- src/background/activateBrowserActionIcon.ts | 2 +- src/background/permissionPrompt.ts | 13 +- src/blocks/available.test.ts | 42 ++++- src/blocks/available.ts | 24 +-- src/development/autoreload.ts | 6 +- src/frameworks/contrib/ember.ts | 7 +- src/layout/EnvironmentBanner.tsx | 2 +- .../pages/settings/LoggingSettings.tsx | 16 +- src/sidebar/messenger/api.ts | 8 - static/grayIconWhileLoading.js | 2 +- 12 files changed, 109 insertions(+), 182 deletions(-) diff --git a/package-lock.json b/package-lock.json index dd22dc5039..1f641173f8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -127,11 +127,11 @@ "webext-additional-permissions": "^2.3.0", "webext-content-scripts": "^1.0.1", "webext-detect-page": "^4.0.1", - "webext-dynamic-content-scripts": "^8.0.1", + "webext-dynamic-content-scripts": "^8.1.1", "webext-messenger": "^0.18.2", "webext-patterns": "^1.1.1", "webext-polyfill-kinda": "^0.10.0", - "webext-tools": "^0.3.0", + "webext-tools": "^1.0.0", "webextension-polyfill": "^0.9.0", "whatwg-mimetype": "^3.0.0", "yup": "^0.32.11" @@ -16514,34 +16514,18 @@ } }, "node_modules/content-scripts-register-polyfill": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/content-scripts-register-polyfill/-/content-scripts-register-polyfill-3.2.0.tgz", - "integrity": "sha512-YQhVwjZcVd4JXCMsYPRcvLeaW05IMc2ZYyjI5xjv7L1e1AGXMNEm75RjyDikjWQwnSBRIcyPD1tBTGAyZHqOsQ==", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/content-scripts-register-polyfill/-/content-scripts-register-polyfill-3.2.2.tgz", + "integrity": "sha512-3v/PSOWU/1F4zkIhnv3mIJUEUFaN2tEW8BHUv85q3OophSqJDLwo2Tj5DzoGCQ5N5iVYTeGO0eeR/NHrDcCnvQ==", "dependencies": { - "webext-content-scripts": "^0.12.0", + "webext-content-scripts": "^1.0.1", "webext-patterns": "^1.1.1", - "webext-polyfill-kinda": "^0.9.0" - }, - "funding": { - "url": "https://github.com/sponsors/fregante" - } - }, - "node_modules/content-scripts-register-polyfill/node_modules/webext-content-scripts": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/webext-content-scripts/-/webext-content-scripts-0.12.0.tgz", - "integrity": "sha512-IWeFx80vhGfFVFYkZJURgMg8oZqtpFhCafXYO0u7fD2Tnd+4xKbgGYCwgvSVFB/NME8i1ZB8jTvk6ofdgYFNig==", - "dependencies": { - "webext-polyfill-kinda": "^0.9.0" + "webext-polyfill-kinda": "^0.10.0" }, "funding": { "url": "https://github.com/sponsors/fregante" } }, - "node_modules/content-scripts-register-polyfill/node_modules/webext-polyfill-kinda": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/webext-polyfill-kinda/-/webext-polyfill-kinda-0.9.0.tgz", - "integrity": "sha512-TTtitT7rgdaR2nx0+TZDIYHpZ5TXH9Ak8C2TaBaJT9qNeHXexKzde6uQ6cjdOK2G80C04r8fcx98Iy+PTCNN7Q==" - }, "node_modules/content-type": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", @@ -37243,34 +37227,18 @@ "integrity": "sha512-Y9Skw6/Uj0dGwOIidc1XqZ3neEbmuuT4BlkL/J4JHAo6fVznHIZq6/MWDsPGOA/jnNowiSXtHHh4S/TOxbl6bQ==" }, "node_modules/webext-dynamic-content-scripts": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/webext-dynamic-content-scripts/-/webext-dynamic-content-scripts-8.1.0.tgz", - "integrity": "sha512-4VcS+UJeChzjQFMKjrlMz1/V95Xt6z4XUdqqst5/8v48K3ULm9jCd3Gjck2uuTOkFH1kngv1qDmNuKYcKATLtg==", - "dependencies": { - "content-scripts-register-polyfill": "^3.2.0", - "webext-additional-permissions": "^2.1.1", - "webext-content-scripts": "^0.12.0" - }, - "funding": { - "url": "https://github.com/sponsors/fregante" - } - }, - "node_modules/webext-dynamic-content-scripts/node_modules/webext-content-scripts": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/webext-content-scripts/-/webext-content-scripts-0.12.0.tgz", - "integrity": "sha512-IWeFx80vhGfFVFYkZJURgMg8oZqtpFhCafXYO0u7fD2Tnd+4xKbgGYCwgvSVFB/NME8i1ZB8jTvk6ofdgYFNig==", + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/webext-dynamic-content-scripts/-/webext-dynamic-content-scripts-8.1.1.tgz", + "integrity": "sha512-raVyQFZOGPU15V+O2vbWlsiQlL54hq+y57AqEqgqLkWntYbcx2x+EaKtL/faAj9Ytw4Mm73JDebyoEH3A4JeqA==", "dependencies": { - "webext-polyfill-kinda": "^0.9.0" + "content-scripts-register-polyfill": "^3.2.2", + "webext-additional-permissions": "^2.3.0", + "webext-content-scripts": "^1.0.1" }, "funding": { "url": "https://github.com/sponsors/fregante" } }, - "node_modules/webext-dynamic-content-scripts/node_modules/webext-polyfill-kinda": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/webext-polyfill-kinda/-/webext-polyfill-kinda-0.9.0.tgz", - "integrity": "sha512-TTtitT7rgdaR2nx0+TZDIYHpZ5TXH9Ak8C2TaBaJT9qNeHXexKzde6uQ6cjdOK2G80C04r8fcx98Iy+PTCNN7Q==" - }, "node_modules/webext-messenger": { "version": "0.18.2", "resolved": "https://registry.npmjs.org/webext-messenger/-/webext-messenger-0.18.2.tgz", @@ -37293,34 +37261,18 @@ "integrity": "sha512-Yz5WTwig5byFfMXgagtfaJkVU+RrnVqtL1hmvA+GIbpRaGKU1DIrFYHMUUFkeyFqxRSuhbOdLKzteXxCd6VNzA==" }, "node_modules/webext-tools": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/webext-tools/-/webext-tools-0.3.0.tgz", - "integrity": "sha512-v9CTMUjIE3wmvn5uIfGWODkCurPSO/EHrRCI7mrzTZ0HwUbzlZIf6AA9cN5BxIwhHTe1Fxjf8HnI0MzsNZA7zw==", - "dependencies": { - "webext-content-scripts": "^0.12.0", - "webext-detect-page": "^4.0.0", - "webext-polyfill-kinda": "^0.9.0" - }, - "funding": { - "url": "https://github.com/sponsors/fregante" - } - }, - "node_modules/webext-tools/node_modules/webext-content-scripts": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/webext-content-scripts/-/webext-content-scripts-0.12.0.tgz", - "integrity": "sha512-IWeFx80vhGfFVFYkZJURgMg8oZqtpFhCafXYO0u7fD2Tnd+4xKbgGYCwgvSVFB/NME8i1ZB8jTvk6ofdgYFNig==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/webext-tools/-/webext-tools-1.0.0.tgz", + "integrity": "sha512-VGU7dCsIoUO3d+aFCd9hX/7Mn3D/oNJKjc6r/0uVaY9YbwUpfdRY7nK8lFLlIjLP0qPbvhcHLV1IGE6vSUjo2w==", "dependencies": { - "webext-polyfill-kinda": "^0.9.0" + "webext-content-scripts": "^1.0.1", + "webext-detect-page": "^4.0.1", + "webext-polyfill-kinda": "^0.10.0" }, "funding": { "url": "https://github.com/sponsors/fregante" } }, - "node_modules/webext-tools/node_modules/webext-polyfill-kinda": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/webext-polyfill-kinda/-/webext-polyfill-kinda-0.9.0.tgz", - "integrity": "sha512-TTtitT7rgdaR2nx0+TZDIYHpZ5TXH9Ak8C2TaBaJT9qNeHXexKzde6uQ6cjdOK2G80C04r8fcx98Iy+PTCNN7Q==" - }, "node_modules/webextension-polyfill": { "version": "0.9.0", "resolved": "https://registry.npmjs.org/webextension-polyfill/-/webextension-polyfill-0.9.0.tgz", @@ -50754,28 +50706,13 @@ } }, "content-scripts-register-polyfill": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/content-scripts-register-polyfill/-/content-scripts-register-polyfill-3.2.0.tgz", - "integrity": "sha512-YQhVwjZcVd4JXCMsYPRcvLeaW05IMc2ZYyjI5xjv7L1e1AGXMNEm75RjyDikjWQwnSBRIcyPD1tBTGAyZHqOsQ==", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/content-scripts-register-polyfill/-/content-scripts-register-polyfill-3.2.2.tgz", + "integrity": "sha512-3v/PSOWU/1F4zkIhnv3mIJUEUFaN2tEW8BHUv85q3OophSqJDLwo2Tj5DzoGCQ5N5iVYTeGO0eeR/NHrDcCnvQ==", "requires": { - "webext-content-scripts": "^0.12.0", + "webext-content-scripts": "^1.0.1", "webext-patterns": "^1.1.1", - "webext-polyfill-kinda": "^0.9.0" - }, - "dependencies": { - "webext-content-scripts": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/webext-content-scripts/-/webext-content-scripts-0.12.0.tgz", - "integrity": "sha512-IWeFx80vhGfFVFYkZJURgMg8oZqtpFhCafXYO0u7fD2Tnd+4xKbgGYCwgvSVFB/NME8i1ZB8jTvk6ofdgYFNig==", - "requires": { - "webext-polyfill-kinda": "^0.9.0" - } - }, - "webext-polyfill-kinda": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/webext-polyfill-kinda/-/webext-polyfill-kinda-0.9.0.tgz", - "integrity": "sha512-TTtitT7rgdaR2nx0+TZDIYHpZ5TXH9Ak8C2TaBaJT9qNeHXexKzde6uQ6cjdOK2G80C04r8fcx98Iy+PTCNN7Q==" - } + "webext-polyfill-kinda": "^0.10.0" } }, "content-type": { @@ -66891,28 +66828,13 @@ "integrity": "sha512-Y9Skw6/Uj0dGwOIidc1XqZ3neEbmuuT4BlkL/J4JHAo6fVznHIZq6/MWDsPGOA/jnNowiSXtHHh4S/TOxbl6bQ==" }, "webext-dynamic-content-scripts": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/webext-dynamic-content-scripts/-/webext-dynamic-content-scripts-8.1.0.tgz", - "integrity": "sha512-4VcS+UJeChzjQFMKjrlMz1/V95Xt6z4XUdqqst5/8v48K3ULm9jCd3Gjck2uuTOkFH1kngv1qDmNuKYcKATLtg==", + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/webext-dynamic-content-scripts/-/webext-dynamic-content-scripts-8.1.1.tgz", + "integrity": "sha512-raVyQFZOGPU15V+O2vbWlsiQlL54hq+y57AqEqgqLkWntYbcx2x+EaKtL/faAj9Ytw4Mm73JDebyoEH3A4JeqA==", "requires": { - "content-scripts-register-polyfill": "^3.2.0", - "webext-additional-permissions": "^2.1.1", - "webext-content-scripts": "^0.12.0" - }, - "dependencies": { - "webext-content-scripts": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/webext-content-scripts/-/webext-content-scripts-0.12.0.tgz", - "integrity": "sha512-IWeFx80vhGfFVFYkZJURgMg8oZqtpFhCafXYO0u7fD2Tnd+4xKbgGYCwgvSVFB/NME8i1ZB8jTvk6ofdgYFNig==", - "requires": { - "webext-polyfill-kinda": "^0.9.0" - } - }, - "webext-polyfill-kinda": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/webext-polyfill-kinda/-/webext-polyfill-kinda-0.9.0.tgz", - "integrity": "sha512-TTtitT7rgdaR2nx0+TZDIYHpZ5TXH9Ak8C2TaBaJT9qNeHXexKzde6uQ6cjdOK2G80C04r8fcx98Iy+PTCNN7Q==" - } + "content-scripts-register-polyfill": "^3.2.2", + "webext-additional-permissions": "^2.3.0", + "webext-content-scripts": "^1.0.1" } }, "webext-messenger": { @@ -66937,28 +66859,13 @@ "integrity": "sha512-Yz5WTwig5byFfMXgagtfaJkVU+RrnVqtL1hmvA+GIbpRaGKU1DIrFYHMUUFkeyFqxRSuhbOdLKzteXxCd6VNzA==" }, "webext-tools": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/webext-tools/-/webext-tools-0.3.0.tgz", - "integrity": "sha512-v9CTMUjIE3wmvn5uIfGWODkCurPSO/EHrRCI7mrzTZ0HwUbzlZIf6AA9cN5BxIwhHTe1Fxjf8HnI0MzsNZA7zw==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/webext-tools/-/webext-tools-1.0.0.tgz", + "integrity": "sha512-VGU7dCsIoUO3d+aFCd9hX/7Mn3D/oNJKjc6r/0uVaY9YbwUpfdRY7nK8lFLlIjLP0qPbvhcHLV1IGE6vSUjo2w==", "requires": { - "webext-content-scripts": "^0.12.0", - "webext-detect-page": "^4.0.0", - "webext-polyfill-kinda": "^0.9.0" - }, - "dependencies": { - "webext-content-scripts": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/webext-content-scripts/-/webext-content-scripts-0.12.0.tgz", - "integrity": "sha512-IWeFx80vhGfFVFYkZJURgMg8oZqtpFhCafXYO0u7fD2Tnd+4xKbgGYCwgvSVFB/NME8i1ZB8jTvk6ofdgYFNig==", - "requires": { - "webext-polyfill-kinda": "^0.9.0" - } - }, - "webext-polyfill-kinda": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/webext-polyfill-kinda/-/webext-polyfill-kinda-0.9.0.tgz", - "integrity": "sha512-TTtitT7rgdaR2nx0+TZDIYHpZ5TXH9Ak8C2TaBaJT9qNeHXexKzde6uQ6cjdOK2G80C04r8fcx98Iy+PTCNN7Q==" - } + "webext-content-scripts": "^1.0.1", + "webext-detect-page": "^4.0.1", + "webext-polyfill-kinda": "^0.10.0" } }, "webextension-polyfill": { diff --git a/package.json b/package.json index ca4920ff4d..c03d93fd61 100644 --- a/package.json +++ b/package.json @@ -148,11 +148,11 @@ "webext-additional-permissions": "^2.3.0", "webext-content-scripts": "^1.0.1", "webext-detect-page": "^4.0.1", - "webext-dynamic-content-scripts": "^8.0.1", + "webext-dynamic-content-scripts": "^8.1.1", "webext-messenger": "^0.18.2", "webext-patterns": "^1.1.1", "webext-polyfill-kinda": "^0.10.0", - "webext-tools": "^0.3.0", + "webext-tools": "^1.0.0", "webextension-polyfill": "^0.9.0", "whatwg-mimetype": "^3.0.0", "yup": "^0.32.11" diff --git a/src/background/activateBrowserActionIcon.ts b/src/background/activateBrowserActionIcon.ts index fe69bbd81b..c649efb40c 100644 --- a/src/background/activateBrowserActionIcon.ts +++ b/src/background/activateBrowserActionIcon.ts @@ -17,6 +17,6 @@ export default function activateBrowserActionIcon() { // This re-sets the colored manifest icons - const { icons: path } = chrome.runtime.getManifest(); + const { icons: path } = browser.runtime.getManifest(); (chrome.browserAction ?? chrome.action).setIcon({ path }); } diff --git a/src/background/permissionPrompt.ts b/src/background/permissionPrompt.ts index 1c4678d063..98c706977e 100644 --- a/src/background/permissionPrompt.ts +++ b/src/background/permissionPrompt.ts @@ -17,6 +17,7 @@ import { Tabs, Windows } from "webextension-polyfill"; import { isFirefox } from "webext-detect-page"; +import { isMac } from "@/utils"; const POPUP_WIDTH_PX = 400; // Makes the native prompt appear centered const POPUP_HEIGHT_PX = 215; // Includes titlebar height, must fit the content and error to avoid scrollbars @@ -46,7 +47,7 @@ async function openPopup( url: string, opener: Windows.Window ): Promise { - // `top` and `left are ignored in .create on Firefox, but attempt anyway. + // `top` and `left` are ignored in .create on Firefox, but attempt anyway. // If present, the popup will be centered on screen rather than on the window. // https://bugzilla.mozilla.org/show_bug.cgi?id=1396881 const window = await browser.windows.create({ @@ -65,15 +66,11 @@ async function openPopup( /** * Return true if popups are expected to work properly for the user agent / operating system. */ -async function detectPopupSupport( - currentWindow: Windows.Window -): Promise { +function detectPopupSupport(currentWindow: Windows.Window): boolean { // Firefox on Mac seems to be unable to handle popups in fullscreen mode, changing the macOS "space" // back to the desktop const isBuggy = - isFirefox() && - navigator.userAgent.includes("Macintosh") && - currentWindow.state === "fullscreen"; + isFirefox() && isMac() && currentWindow.state === "fullscreen"; return !isBuggy; } @@ -84,7 +81,7 @@ export async function openPopupPrompt(openerTabId: number, url: string) { const { windowId } = await browser.tabs.get(openerTabId); const openerWindow = await browser.windows.get(windowId); - const popupTab = (await detectPopupSupport(openerWindow)) + const popupTab = detectPopupSupport(openerWindow) ? await openPopup(url, openerWindow) : await openTab(url, openerTabId); diff --git a/src/blocks/available.test.ts b/src/blocks/available.test.ts index d34e7a351d..08c53bb9c9 100644 --- a/src/blocks/available.test.ts +++ b/src/blocks/available.test.ts @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -import { checkAvailable } from "@/blocks/available"; +import { checkAvailable, testMatchPatterns } from "@/blocks/available"; describe("isAvailable.urlPatterns", () => { test("can match hash", async () => { @@ -57,3 +57,43 @@ describe("isAvailable.matchPatterns", () => { ).toBe(false); }); }); + +describe("testMatchPatterns", () => { + test("can match pattern", async () => { + const patterns = [ + "https://www.example.com/*", + "https://*.pixiebrix.com/update/*", + ]; + expect(testMatchPatterns(patterns, "https://www.example.com")).toBeTrue(); + expect( + testMatchPatterns(patterns, "https://pixiebrix.com/update/") + ).toBeTrue(); + + expect(testMatchPatterns(patterns, "https://example.com")).toBeFalse(); + expect( + testMatchPatterns(patterns, "https://www.example.comunication") + ).toBeFalse(); + expect( + testMatchPatterns(patterns, "https://www.pixiebrix.com/") + ).toBeFalse(); + }); + + test("will throw BusinessError or invalid patterns", async () => { + const url = "irrelevant"; + expect(() => + testMatchPatterns(["https://pixiebrix.*/update/*"], url) + ).toThrowErrorMatchingInlineSnapshot( + '"Pattern not recognized as valid match pattern: https://pixiebrix.*/update/*"' + ); + expect(() => + testMatchPatterns(["www.example.com/*"], url) + ).toThrowErrorMatchingInlineSnapshot( + '"Pattern not recognized as valid match pattern: www.example.com/*"' + ); + expect(() => + testMatchPatterns(["*.example.com/*"], url) + ).toThrowErrorMatchingInlineSnapshot( + '"Pattern not recognized as valid match pattern: *.example.com/*"' + ); + }); +}); diff --git a/src/blocks/available.ts b/src/blocks/available.ts index 70bc65bb49..d2e320639c 100644 --- a/src/blocks/available.ts +++ b/src/blocks/available.ts @@ -28,25 +28,19 @@ export function testMatchPatterns( patterns: string[], url: string = document.location.href ): boolean { - let re; - - try { - // Try all at once - re = patternToRegex(...patterns); - } catch { - // Try them one at a time to find the broken one - for (const pattern of patterns) { - try { - patternToRegex(pattern); - } catch { - throw new BusinessError( - `Pattern not recognized as valid match pattern: ${pattern}` - ); + for (const pattern of patterns) { + try { + if (patternToRegex(pattern).test(url)) { + return true; } + } catch { + throw new BusinessError( + `Pattern not recognized as valid match pattern: ${pattern}` + ); } } - return re.test(url); + return false; } function testUrlPattern( diff --git a/src/development/autoreload.ts b/src/development/autoreload.ts index 2780f833da..45b23f7a50 100644 --- a/src/development/autoreload.ts +++ b/src/development/autoreload.ts @@ -24,17 +24,17 @@ if ( isChrome() && "localStorage" in globalThis // MV3 doesn't support localStorage ) { - const { version_name } = chrome.runtime.getManifest(); + const { version_name } = browser.runtime.getManifest(); if (localStorage.getItem("dev:last-version") === version_name) { // Removing the key ensures that it does not go into a reloading loop // by making the above condition false after the reload localStorage.removeItem("dev:last-version"); - chrome.runtime.reload(); + browser.runtime.reload(); } // Chrome only calls this function if the extension is reloaded - chrome.runtime.onInstalled.addListener(({ reason }) => { + browser.runtime.onInstalled.addListener(({ reason }) => { if (reason === "update") { localStorage.setItem("dev:last-version", version_name); } diff --git a/src/frameworks/contrib/ember.ts b/src/frameworks/contrib/ember.ts index 68ce1dcbef..9c8bc4f6fb 100644 --- a/src/frameworks/contrib/ember.ts +++ b/src/frameworks/contrib/ember.ts @@ -98,9 +98,10 @@ export function getEmberComponentById(componentId: string): EmberObject { } function isMutableCell(cell: unknown): cell is MutableCell { - // https://github.com/emberjs/ember.js/blob/f73d8440d19cf86a10c61ddb89d45881acfcf974/packages/%40ember/-internals/views/lib/compat/attrs.js - // FIXME: field is actually a symbol and isn't enumerable, so this is probably wrong - return Object.keys(cell).some((key) => key.startsWith("__MUTABLE_CELL__")); + // As of Ember 4.6.0 this is not a real Symbol, so Object.keys should detect it. If they change it, this will stop working: + // https://github.com/emberjs/ember.js/blob/55ffe6326f11efcaeb278cdf7e0f86543daa9f04/packages/%40ember/-internals/utils/lib/symbol.ts#L14-L26 + // https://github.com/emberjs/ember.js/blob/55ffe6326f11efcaeb278cdf7e0f86543daa9f04/packages/%40ember/-internals/views/lib/compat/attrs.ts#L1 + return Object.keys(cell).some((key) => key.startsWith("__MUTABLE_CELL")); } // diff --git a/src/layout/EnvironmentBanner.tsx b/src/layout/EnvironmentBanner.tsx index f9dd44bf30..7a35eca5bc 100644 --- a/src/layout/EnvironmentBanner.tsx +++ b/src/layout/EnvironmentBanner.tsx @@ -42,7 +42,7 @@ const EnvironmentBannerMessage: React.VFC = () => { const [versionName] = useAsyncState(async () => { const manifest = isExtension - ? chrome.runtime.getManifest() + ? browser.runtime.getManifest() : await connectPage(); return manifest.version_name; }, []); diff --git a/src/options/pages/settings/LoggingSettings.tsx b/src/options/pages/settings/LoggingSettings.tsx index b91f4eeb10..6eeabe1295 100644 --- a/src/options/pages/settings/LoggingSettings.tsx +++ b/src/options/pages/settings/LoggingSettings.tsx @@ -45,16 +45,12 @@ const LoggingSettings: React.FunctionComponent = () => { Developer Settings -

- Enable value logging to - include brick inputs/outputs in the brick logs. You can access the - logs from the Active Bricks screen, the Workshop, or the Page - Editor. -

- -

- Brick logs are never transmitted from your browser. -

+ Enable value logging to + include brick inputs/outputs in the brick logs. You can access the + logs from the Active Bricks screen, the Workshop, or the Page Editor. +
+ + Brick logs are never transmitted from your browser. {config ? ( diff --git a/src/sidebar/messenger/api.ts b/src/sidebar/messenger/api.ts index 6e32753965..2e6602e2de 100644 --- a/src/sidebar/messenger/api.ts +++ b/src/sidebar/messenger/api.ts @@ -17,14 +17,6 @@ /* Do not use `registerMethod` in this file */ import { getMethod } from "webext-messenger"; -import { isBrowserSidebar } from "@/chrome"; - -// TODO: This should be a hard error, but due to unknown dependency routes, it can't be enforced yet -if (isBrowserSidebar() && process.env.DEBUG) { - console.warn( - "This should not have been imported in the sidebar. Use the API directly instead." - ); -} export const renderPanels = getMethod("SIDEBAR_RENDER_PANELS"); export const showForm = getMethod("SIDEBAR_SHOW_FORM"); diff --git a/static/grayIconWhileLoading.js b/static/grayIconWhileLoading.js index e385245871..89bb7a3d3c 100644 --- a/static/grayIconWhileLoading.js +++ b/static/grayIconWhileLoading.js @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -/** @file This is a standalone background entry point that must run independendently of the rest of extension */ +/** @file This is a standalone background entry point that must run independently of the rest of extension */ const { icons } = chrome.runtime.getManifest(); const inactiveIcons = {};