mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:38:12 +00:00
WebDriver: Fix crash in async execute script endpoint
Removal of dummy execution context in
9aca54091a
caused a crash in
`execute_async_script` because of empty execution contexts stack
during `create_resolving_functions` call.
This commit is contained in:
parent
7c0b360881
commit
84e17fcbcc
1 changed files with 8 additions and 0 deletions
|
@ -311,6 +311,8 @@ ExecuteScriptResultSerialized execute_script(Web::Page& page, DeprecatedString c
|
|||
|
||||
ExecuteScriptResultSerialized execute_async_script(Web::Page& page, DeprecatedString const& body, JS::MarkedVector<JS::Value> arguments, Optional<u64> const& timeout)
|
||||
{
|
||||
auto* document = page.top_level_browsing_context().active_document();
|
||||
auto& settings_object = document->relevant_settings_object();
|
||||
auto* window = page.top_level_browsing_context().active_window();
|
||||
auto& realm = window->realm();
|
||||
auto& vm = window->vm();
|
||||
|
@ -321,9 +323,15 @@ ExecuteScriptResultSerialized execute_async_script(Web::Page& page, DeprecatedSt
|
|||
|
||||
// FIXME: 5 Run the following substeps in parallel:
|
||||
auto result = [&] {
|
||||
// NOTE: We need to push an execution context in order to make create_resolving_functions() succeed.
|
||||
vm.push_execution_context(settings_object.realm_execution_context());
|
||||
|
||||
// 1. Let resolvingFunctions be CreateResolvingFunctions(promise).
|
||||
auto resolving_functions = promise->create_resolving_functions();
|
||||
|
||||
VERIFY(&settings_object.realm_execution_context() == &vm.running_execution_context());
|
||||
vm.pop_execution_context();
|
||||
|
||||
// 2. Append resolvingFunctions.[[Resolve]] to arguments.
|
||||
arguments.append(&resolving_functions.resolve);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue