1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-25 15:29:32 -05:00

fix: regression in workers using dynamic imports (#20006)

Closes https://github.com/denoland/deno/issues/19903
This commit is contained in:
Bartek Iwańczuk 2023-08-02 03:19:44 +02:00 committed by GitHub
parent 1cefa831fd
commit 9d1c32945c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 51 additions and 10 deletions

13
Cargo.lock generated
View file

@ -982,9 +982,9 @@ dependencies = [
[[package]] [[package]]
name = "deno_core" name = "deno_core"
version = "0.198.0" version = "0.199.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b34b6caa86eeea6f1449334c9ee26bec07e1db909bff5a4849727482cf06473" checksum = "70fbd0cb620ac36fac08d708c5f01362280c5aa8149657a225db4932bd73758e"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
@ -1354,9 +1354,9 @@ dependencies = [
[[package]] [[package]]
name = "deno_ops" name = "deno_ops"
version = "0.76.0" version = "0.77.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4ca7df186f9f20d087a03d0ab314706bf5ffec1cf18c658efae833ce5dac3e8" checksum = "8b345c096fd8433337ed8e1727f4732397c134e188e1739c88b0c077869020f3"
dependencies = [ dependencies = [
"deno-proc-macro-rules", "deno-proc-macro-rules",
"lazy-regex", "lazy-regex",
@ -1371,7 +1371,6 @@ dependencies = [
"syn 1.0.109", "syn 1.0.109",
"syn 2.0.22", "syn 2.0.22",
"thiserror", "thiserror",
"v8",
] ]
[[package]] [[package]]
@ -4457,9 +4456,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_v8" name = "serde_v8"
version = "0.109.0" version = "0.110.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "440a8a1f1cb9abe071937aa5190b0186fa6ce15ba0de5f88e57f71583e212b2c" checksum = "b3bafaee0eecbef6c47ad3e7e0a764e22eb35a229ff7d06b7801fcbeaa5364b8"
dependencies = [ dependencies = [
"bytes", "bytes",
"derive_more", "derive_more",

View file

@ -41,9 +41,9 @@ repository = "https://github.com/denoland/deno"
v8 = { version = "0.74.1", default-features = false } v8 = { version = "0.74.1", default-features = false }
deno_ast = { version = "0.27.0", features = ["transpiling"] } deno_ast = { version = "0.27.0", features = ["transpiling"] }
deno_core = "0.198.0" deno_core = "0.199.0"
deno_ops = "0.76.0" deno_ops = "0.77.0"
serde_v8 = "0.109.0" serde_v8 = "0.110.0"
deno_runtime = { version = "0.121.0", path = "./runtime" } deno_runtime = { version = "0.121.0", path = "./runtime" }
napi_sym = { version = "0.43.0", path = "./cli/napi/sym" } napi_sym = { version = "0.43.0", path = "./cli/napi/sym" }

View file

@ -108,3 +108,10 @@ itest!(worker_error_event {
output: "workers/error_event.ts.out", output: "workers/error_event.ts.out",
exit_code: 1, exit_code: 1,
}); });
// Regression test for https://github.com/denoland/deno/issues/19903
itest!(worker_doest_stall_event_loop {
args: "run --quiet -A workers/worker_doest_stall_event_loop.ts",
output: "workers/worker_doest_stall_event_loop.ts.out",
exit_code: 0,
});

View file

@ -0,0 +1,29 @@
const moduleCode = `
console.log('module start');
const hash = await crypto.subtle.digest('SHA-1', new TextEncoder().encode('data'));
const __default = {};
export { __default as default };
console.log('module finish');
`;
const workerCode = `
console.log('worker!');
globalThis.onmessage = (msg) => {
const { moduleCode } = msg.data;
(async () => {
console.log('before import');
await import(URL.createObjectURL(new Blob([ moduleCode ])));
console.log('after import');
self.postMessage('thanks');
})();
}
`;
const worker = new Worker(URL.createObjectURL(new Blob([workerCode])), {
type: "module",
});
worker.onmessage = () => {
console.log("worker.terminate");
worker.terminate();
};
worker.postMessage({ moduleCode });

View file

@ -0,0 +1,6 @@
worker!
before import
module start
module finish
after import
worker.terminate