Skip to content

Commit 95e2146

Browse files
authored
[webview] prevent potential double resolution in XMLHttpRequest handling (#22404)
Although the JavaScript engine can handle this situation, attempting to handle both `resolve` and `reject` for the same `Promise` in the code logic indicates that the code structure is not sufficiently rigorous and may have design flaws. This can obscure the intent of the code and potentially confuse other developers.
1 parent a780ec9 commit 95e2146

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/web_or_worker_shell_read.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
xhr.onload = () => {
3131
if (xhr.status == 200 || (xhr.status == 0 && xhr.response)) { // file URLs can return 0
3232
resolve(xhr.response);
33+
return;
3334
}
3435
reject(xhr.status);
3536
};

0 commit comments

Comments
 (0)