fix(core): fix APIs not to be affected by Promise.prototype.then modification (#16326)

This commit is contained in:
Kenta Moriuchi 2022-10-29 18:25:23 +09:00 committed by GitHub
parent edaceecec7
commit 59ac110edd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 145 additions and 42 deletions

View file

@ -13,7 +13,8 @@
String,
TypeError,
Uint8Array,
PromiseAll,
PromisePrototypeThen,
SafePromiseAll,
SymbolFor,
} = window.__bootstrap.primordials;
const {
@ -155,7 +156,7 @@
const waitPromise = core.opAsync("op_spawn_wait", this.#rid);
this.#waitPromiseId = waitPromise[promiseIdSymbol];
this.#status = waitPromise.then((res) => {
this.#status = PromisePrototypeThen(waitPromise, (res) => {
this.#rid = null;
signal?.[remove](onAbort);
return res;
@ -179,7 +180,7 @@
);
}
const [status, stdout, stderr] = await PromiseAll([
const [status, stdout, stderr] = await SafePromiseAll([
this.#status,
collectOutput(this.#stdout),
collectOutput(this.#stderr),