diff options
author | Andreu Botella <abb@randomunok.com> | 2021-08-16 14:29:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-16 14:29:54 +0200 |
commit | ddbb7b83f2c483e354f425dfb70dbab494b05ea5 (patch) | |
tree | fa84f5607395773284e331fe32f2b86b59f02a5d /runtime/worker.rs | |
parent | d1d2388d7f1a09fd2469b356f00b6b361269a0b7 (diff) |
feat(runtime): support classic workers for internal testing (#11338)
This commit implements classic workers, but only when the `--enable-testing-features-do-not-use` flag is provided. This change is not user facing. Classic workers are used extensively in WPT tests. The classic workers do not support loading from disk, and do not support TypeScript.
Co-authored-by: Luca Casonato <hello@lcas.dev>
Diffstat (limited to 'runtime/worker.rs')
-rw-r--r-- | runtime/worker.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/runtime/worker.rs b/runtime/worker.rs index b200ef08e..b1096024b 100644 --- a/runtime/worker.rs +++ b/runtime/worker.rs @@ -50,6 +50,7 @@ pub struct WorkerOptions { pub args: Vec<String>, pub debug_flag: bool, pub unstable: bool, + pub enable_testing_features: bool, pub unsafely_ignore_certificate_errors: Option<Vec<String>>, pub root_cert_store: Option<RootCertStore>, pub user_agent: String, @@ -84,10 +85,12 @@ impl MainWorker { ) -> Self { // Permissions: many ops depend on this let unstable = options.unstable; + let enable_testing_features = options.enable_testing_features; let perm_ext = Extension::builder() .state(move |state| { state.put::<Permissions>(permissions.clone()); state.put(ops::UnstableChecker { unstable }); + state.put(ops::TestingFeaturesEnabled(enable_testing_features)); Ok(()) }) .build(); @@ -304,6 +307,7 @@ mod tests { args: vec![], debug_flag: false, unstable: false, + enable_testing_features: false, unsafely_ignore_certificate_errors: None, root_cert_store: None, seed: None, |