From 1ae91e0f9556d6e0fe561f746e6d19f6e14bb850 Mon Sep 17 00:00:00 2001 From: Shihua Zheng Date: Fri, 1 Sep 2023 09:06:29 -0700 Subject: [PATCH] Allowlist localhost for amp-worker and extensions in localDev (#39424) --- src/service/extension-script.js | 3 ++- src/web-worker/amp-worker.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/service/extension-script.js b/src/service/extension-script.js index b77da604ae23..4eceece3dd8b 100644 --- a/src/service/extension-script.js +++ b/src/service/extension-script.js @@ -164,7 +164,8 @@ export function createExtensionScript(win, extensionId, version) { // Only allow trusted URLs if ( regexURL.test(url) || - (getMode().test && testRegexURL.test(new URL(url).hostname)) || + ((getMode().test || getMode().localDev) && + testRegexURL.test(new URL(url).hostname)) || new URL(url).host === 'fonts.googleapis.com' ) { return url; diff --git a/src/web-worker/amp-worker.js b/src/web-worker/amp-worker.js index 16b0d8067f28..70658eaccf53 100644 --- a/src/web-worker/amp-worker.js +++ b/src/web-worker/amp-worker.js @@ -82,7 +82,7 @@ class AmpWorker { /^https:\/\/([a-zA-Z0-9_-]+\.)?cdn\.ampproject\.org(\/.*)?$/; if ( - (regexURL.test(url) || getMode().test) && + (regexURL.test(url) || getMode().test || getMode().localDev) && (url.endsWith('ww.js') || url.endsWith('ww.min.js') || url.endsWith('ww.mjs') ||