1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-10 08:09:06 -05:00

fix: primordials in extensions/net and runtime/js (#11270)

This commit is contained in:
Simon Rask 2021-07-04 17:26:38 +02:00 committed by GitHub
parent f0fbd49a2d
commit a8f9ac654d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 7 deletions

View file

@ -6,7 +6,6 @@
const { BadResource } = core; const { BadResource } = core;
const { const {
PromiseResolve, PromiseResolve,
Symbol,
SymbolAsyncIterator, SymbolAsyncIterator,
Uint8Array, Uint8Array,
TypedArrayPrototypeSubarray, TypedArrayPrototypeSubarray,
@ -187,7 +186,7 @@
core.close(this.rid); core.close(this.rid);
} }
async *[Symbol.asyncIterator]() { async *[SymbolAsyncIterator]() {
while (true) { while (true) {
try { try {
yield await this.receive(); yield await this.receive();

View file

@ -20,6 +20,7 @@ delete Object.prototype.__proto__;
Symbol, Symbol,
SymbolFor, SymbolFor,
SymbolIterator, SymbolIterator,
PromisePrototypeThen,
} = window.__bootstrap.primordials; } = window.__bootstrap.primordials;
const util = window.__bootstrap.util; const util = window.__bootstrap.util;
const eventTarget = window.__bootstrap.eventTarget; const eventTarget = window.__bootstrap.eventTarget;
@ -67,11 +68,13 @@ delete Object.prototype.__proto__;
windowIsClosing = true; windowIsClosing = true;
// Push a macrotask to exit after a promise resolve. // Push a macrotask to exit after a promise resolve.
// This is not perfect, but should be fine for first pass. // This is not perfect, but should be fine for first pass.
PromiseResolve().then(() => PromisePrototypeThen(
FunctionPrototypeCall(timers.setTimeout, null, () => { PromiseResolve(),
// This should be fine, since only Window/MainWorker has .close() () =>
os.exit(0); FunctionPrototypeCall(timers.setTimeout, null, () => {
}, 0) // This should be fine, since only Window/MainWorker has .close()
os.exit(0);
}, 0),
); );
} }
} }