mirror of
https://github.com/denoland/deno.git
synced 2025-01-03 12:58:54 -05:00
FUTURE: remove deprecated APIs within workers (#23220)
This commit is contained in:
parent
945eb5eba6
commit
207349cfb7
5 changed files with 56 additions and 7 deletions
|
@ -813,7 +813,7 @@ fn create_web_worker_callback(
|
||||||
node_ipc_fd: None,
|
node_ipc_fd: None,
|
||||||
disable_deprecated_api_warning: shared.disable_deprecated_api_warning,
|
disable_deprecated_api_warning: shared.disable_deprecated_api_warning,
|
||||||
verbose_deprecated_api_warning: shared.verbose_deprecated_api_warning,
|
verbose_deprecated_api_warning: shared.verbose_deprecated_api_warning,
|
||||||
future: false,
|
future: shared.enable_future_features,
|
||||||
},
|
},
|
||||||
extensions: vec![],
|
extensions: vec![],
|
||||||
startup_snapshot: crate::js::deno_isolate_init(),
|
startup_snapshot: crate::js::deno_isolate_init(),
|
||||||
|
|
|
@ -837,7 +837,7 @@ function bootstrapWorkerRuntime(
|
||||||
6: argv0,
|
6: argv0,
|
||||||
7: shouldDisableDeprecatedApiWarning,
|
7: shouldDisableDeprecatedApiWarning,
|
||||||
8: shouldUseVerboseDeprecatedApiWarning,
|
8: shouldUseVerboseDeprecatedApiWarning,
|
||||||
9: _future,
|
9: future,
|
||||||
} = runtimeOptions;
|
} = runtimeOptions;
|
||||||
|
|
||||||
deprecatedApiWarningDisabled = shouldDisableDeprecatedApiWarning;
|
deprecatedApiWarningDisabled = shouldDisableDeprecatedApiWarning;
|
||||||
|
@ -937,6 +937,37 @@ function bootstrapWorkerRuntime(
|
||||||
workerMetadata,
|
workerMetadata,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (future) {
|
||||||
|
delete Deno.Buffer;
|
||||||
|
delete Deno.close;
|
||||||
|
delete Deno.copy;
|
||||||
|
delete Deno.File;
|
||||||
|
delete Deno.fstat;
|
||||||
|
delete Deno.fstatSync;
|
||||||
|
delete Deno.ftruncate;
|
||||||
|
delete Deno.ftruncateSync;
|
||||||
|
delete Deno.flock;
|
||||||
|
delete Deno.flockSync;
|
||||||
|
delete Deno.FsFile.prototype.rid;
|
||||||
|
delete Deno.funlock;
|
||||||
|
delete Deno.funlockSync;
|
||||||
|
delete Deno.iter;
|
||||||
|
delete Deno.iterSync;
|
||||||
|
delete Deno.metrics;
|
||||||
|
delete Deno.readAll;
|
||||||
|
delete Deno.readAllSync;
|
||||||
|
delete Deno.read;
|
||||||
|
delete Deno.readSync;
|
||||||
|
delete Deno.resources;
|
||||||
|
delete Deno.seek;
|
||||||
|
delete Deno.seekSync;
|
||||||
|
delete Deno.shutdown;
|
||||||
|
delete Deno.writeAll;
|
||||||
|
delete Deno.writeAllSync;
|
||||||
|
delete Deno.write;
|
||||||
|
delete Deno.writeSync;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Warmup
|
// Warmup
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
{
|
{
|
||||||
"args": "run -A main.js",
|
"steps": [
|
||||||
|
{
|
||||||
|
"args": "run -A --unstable-fs main.js",
|
||||||
|
"output": "main.out",
|
||||||
|
"envs": {
|
||||||
|
"DENO_FUTURE": "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"args": "run -A --unstable-fs worker.js",
|
||||||
"output": "main.out",
|
"output": "main.out",
|
||||||
"envs": {
|
"envs": {
|
||||||
"DENO_FUTURE": "1"
|
"DENO_FUTURE": "1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
|
@ -30,3 +30,5 @@ console.log("Deno.writeAll is", Deno.writeAll);
|
||||||
console.log("Deno.writeAllSync is", Deno.writeAllSync);
|
console.log("Deno.writeAllSync is", Deno.writeAllSync);
|
||||||
console.log("Deno.write is", Deno.write);
|
console.log("Deno.write is", Deno.write);
|
||||||
console.log("Deno.writeSync is", Deno.writeSync);
|
console.log("Deno.writeSync is", Deno.writeSync);
|
||||||
|
|
||||||
|
self.close();
|
||||||
|
|
5
tests/specs/future/runtime_api/worker.js
Normal file
5
tests/specs/future/runtime_api/worker.js
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
import { delay } from "../../../util/std/async/delay.ts";
|
||||||
|
|
||||||
|
const worker = new Worker(import.meta.resolve("./main.js"), { type: "module" });
|
||||||
|
await delay(1_000);
|
||||||
|
worker.terminate();
|
Loading…
Reference in a new issue