Skip to content

Commit 4c52207

Browse files
committed
cli: enable can_block by default, add --no-can-block flag
Make boa's cli consistent with the behaviour of other major JavaScript shells (d8, jsc, spidermonkey at least) as well as boa_tester by enabling [[CanBlock]] by default. Add --no-can-block flag to opt out, same as V8 (https://github.com/v8/v8/blob/main/src/d8/d8.cc#L6417). Needed for Atomics tests to pass when using an external test262 harness.
1 parent 0c6e4ba commit 4c52207

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cli/src/main.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ struct Opt {
157157
#[arg(long)]
158158
test262_object: bool,
159159

160+
/// Disallow the main thread from blocking (e.g. `Atomics.wait`).
161+
#[arg(long)]
162+
no_can_block: bool,
163+
160164
/// Treats the input files as modules.
161165
#[arg(long, short = 'm', group = "mod")]
162166
module: bool,
@@ -558,6 +562,7 @@ fn main() -> Result<()> {
558562
let context = &mut ContextBuilder::new()
559563
.job_executor(executor.clone())
560564
.module_loader(loader.clone())
565+
.can_block(!args.no_can_block)
561566
.build()
562567
.map_err(|e| eyre!(e.to_string()))?;
563568

0 commit comments

Comments
 (0)