From 2f672eae28c11e65fa8d7790dc04c43bcc48f78a Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Wed, 4 Dec 2024 13:54:47 -0800 Subject: [PATCH] Use encodeURI consistently in browser_reporting. NFC While working on a separate change I ran into issues where chrome was refusing to fetch a report_result and this fixed the issue. --- test/browser_reporting.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/browser_reporting.js b/test/browser_reporting.js index 7fedae09e9725..f651b8b1092ea 100644 --- a/test/browser_reporting.js +++ b/test/browser_reporting.js @@ -14,7 +14,7 @@ function reportResultToServer(result, port) { out(`RESULT: ${result}`); } else { let doFetch = typeof origFetch != 'undefined' ? origFetch : fetch; - doFetch(`http://localhost:${port}/report_result?${result}`).then(() => { + doFetch(`http://localhost:${port}/report_result?${encodeURIComponent(result)}`).then(() => { if (typeof window === 'object' && window && hasModule && !Module['pageThrewException']) { /* for easy debugging, don't close window on failure */ window.close(); @@ -24,7 +24,7 @@ function reportResultToServer(result, port) { } function sendFileToServer(filename, contents) { - fetch(`http://localhost:8888/?file=${filename}`, {method: "POST", body: contents}); + fetch(`http://localhost:8888/?file=${encodeURIComponent(filename)}`, {method: "POST", body: contents}); } /** @@ -39,7 +39,7 @@ function reportErrorToServer(message) { if (typeof ENVIRONMENT_IS_NODE !== 'undefined' && ENVIRONMENT_IS_NODE) { err(message); } else { - fetch(encodeURI(`http://localhost:8888?stderr=${message}`)); + fetch(`http://localhost:8888?stderr=${encodeURIComponent(message)}`); } }