LibWeb: Implement clean_up_after_running_script on a Realm

Taking further steps towards implementing the shadow realm spec :^)
This commit is contained in:
Shannon Booth 2024-10-21 16:18:25 +13:00 committed by Andrew Kaster
parent 0628b74272
commit d6fdaf6b26
Notes: github-actions[bot] 2024-11-01 19:16:25 +00:00
10 changed files with 35 additions and 31 deletions

View file

@ -102,6 +102,7 @@ ErrorOr<ByteBuffer> get_buffer_source_copy(JS::Object const& buffer_source)
}
// https://webidl.spec.whatwg.org/#call-user-object-operation-return
// https://whatpr.org/webidl/1437.html#call-user-object-operation-return
inline JS::Completion clean_up_on_return(HTML::EnvironmentSettingsObject& stored_settings, HTML::EnvironmentSettingsObject& relevant_settings, JS::Completion& completion, OperationReturnsPromise operation_returns_promise)
{
auto& realm = stored_settings.realm();
@ -111,8 +112,8 @@ inline JS::Completion clean_up_on_return(HTML::EnvironmentSettingsObject& stored
// 1. Clean up after running a callback with stored settings.
stored_settings.clean_up_after_running_callback();
// 2. Clean up after running script with relevant settings.
relevant_settings.clean_up_after_running_script();
// 2. Clean up after running script with relevant realm.
HTML::clean_up_after_running_script(relevant_settings.realm());
// 3. If completion is a normal completion, return completion.
if (completion.type() == JS::Completion::Type::Normal)
@ -313,8 +314,8 @@ JS::Completion construct(WebIDL::CallbackType& callback, JS::MarkedVector<JS::Va
// 1. Clean up after running a callback with stored settings.
stored_settings->clean_up_after_running_callback();
// 2. Clean up after running script with relevant settings.
relevant_settings.clean_up_after_running_script();
// 2. Clean up after running script with relevant realm.
HTML::clean_up_after_running_script(realm);
// 3. Return completion.
return completion;