fix(test): disable preventDefault() for beforeunload event (#18911)

Fixes #18910.
This commit is contained in:
Nayeem Rahman 2023-05-03 22:10:51 +01:00 committed by GitHub
parent d905f20cad
commit e3276fbb71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 40 additions and 12 deletions

View file

@ -498,12 +498,9 @@ async fn bench_specifier(
sender.send(BenchEvent::Result(desc.id, result))?;
}
loop {
if !worker.dispatch_beforeunload_event(located_script_name!())? {
break;
}
worker.run_event_loop(false).await?;
}
// Ignore `defaultPrevented` of the `beforeunload` event. We don't allow the
// event loop to continue beyond what's needed to await results.
worker.dispatch_beforeunload_event(located_script_name!())?;
worker.dispatch_unload_event(located_script_name!())?;
Ok(())
}

View file

@ -1033,12 +1033,9 @@ pub async fn test_specifier(
sender.send(TestEvent::Result(desc.id, result, elapsed as u64))?;
}
loop {
if !worker.dispatch_beforeunload_event(located_script_name!())? {
break;
}
worker.run_event_loop(false).await?;
}
// Ignore `defaultPrevented` of the `beforeunload` event. We don't allow the
// event loop to continue beyond what's needed to await results.
worker.dispatch_beforeunload_event(located_script_name!())?;
worker.dispatch_unload_event(located_script_name!())?;
if let Some(coverage_collector) = coverage_collector.as_mut() {