Skip to content

Commit 2f672ea

Browse files
committed
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.
1 parent 44d51c8 commit 2f672ea

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/browser_reporting.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function reportResultToServer(result, port) {
1414
out(`RESULT: ${result}`);
1515
} else {
1616
let doFetch = typeof origFetch != 'undefined' ? origFetch : fetch;
17-
doFetch(`http://localhost:${port}/report_result?${result}`).then(() => {
17+
doFetch(`http://localhost:${port}/report_result?${encodeURIComponent(result)}`).then(() => {
1818
if (typeof window === 'object' && window && hasModule && !Module['pageThrewException']) {
1919
/* for easy debugging, don't close window on failure */
2020
window.close();
@@ -24,7 +24,7 @@ function reportResultToServer(result, port) {
2424
}
2525

2626
function sendFileToServer(filename, contents) {
27-
fetch(`http://localhost:8888/?file=${filename}`, {method: "POST", body: contents});
27+
fetch(`http://localhost:8888/?file=${encodeURIComponent(filename)}`, {method: "POST", body: contents});
2828
}
2929

3030
/**
@@ -39,7 +39,7 @@ function reportErrorToServer(message) {
3939
if (typeof ENVIRONMENT_IS_NODE !== 'undefined' && ENVIRONMENT_IS_NODE) {
4040
err(message);
4141
} else {
42-
fetch(encodeURI(`http://localhost:8888?stderr=${message}`));
42+
fetch(`http://localhost:8888?stderr=${encodeURIComponent(message)}`);
4343
}
4444
}
4545

0 commit comments

Comments
 (0)