From 0eb2a8f034865052764099e959ccbe0615029146 Mon Sep 17 00:00:00 2001 From: Sid Vishnoi <8426945+sidvishnoi@users.noreply.github.com> Date: Wed, 10 Apr 2024 12:38:27 +0530 Subject: [PATCH] fix(api:node): proxy all local scripts with useLocal, not just main (#4683) --- tools/respecDocWriter.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/tools/respecDocWriter.js b/tools/respecDocWriter.js index bb27c8148c..f7d7f1fae1 100644 --- a/tools/respecDocWriter.js +++ b/tools/respecDocWriter.js @@ -132,7 +132,7 @@ export async function toHTML(src, options = {}) { async function useLocalReSpec(page, log) { await page.setRequestInterception(true); - page.on("request", async function requestInterceptor(request) { + page.on("request", async request => { if (!isRespecScript(request)) { await request.continue(); return; @@ -148,9 +148,6 @@ async function useLocalReSpec(page, log) { contentType: "text/javascript; charset=utf-8", body: await readFile(localPath), }); - // Workaround for https://github.com/puppeteer/puppeteer/issues/4208 - page.off("request", requestInterceptor); - await page.setRequestInterception(false); }); } @@ -163,9 +160,7 @@ function isRespecScript(req) { const { host, pathname: path } = new URL(req.url()); switch (host) { case "www.w3.org": - return ( - path.startsWith("/Tools/respec/") && !path.includes("respec-highlight") - ); + return path.startsWith("/Tools/respec/"); case "w3c.github.io": return path.startsWith("/respec/builds/"); default: