mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:27:44 +00:00
LibWeb: Replace GlobalObject with Realm in wrapper functions
Similar to create() in LibJS, wrap() et al. are on a low enough level to warrant passing a Realm directly instead of relying on the current realm from the VM, as a wrapper may need to be allocated while no JS is being executed.
This commit is contained in:
parent
56b2ae5ac0
commit
40a70461a0
60 changed files with 261 additions and 235 deletions
|
@ -343,18 +343,17 @@ void queue_mutation_observer_microtask(DOM::Document& document)
|
|||
// 4. If records is not empty, then invoke mo’s callback with « records, mo », and mo. If this throws an exception, catch it, and report the exception.
|
||||
if (!records.is_empty()) {
|
||||
auto& callback = mutation_observer.callback();
|
||||
auto& global_object = callback.callback_context.global_object();
|
||||
auto& realm = callback.callback_context.realm();
|
||||
|
||||
auto* wrapped_records = MUST(JS::Array::create(realm, 0));
|
||||
for (size_t i = 0; i < records.size(); ++i) {
|
||||
auto& record = records.at(i);
|
||||
auto* wrapped_record = Bindings::wrap(global_object, record);
|
||||
auto* wrapped_record = Bindings::wrap(realm, record);
|
||||
auto property_index = JS::PropertyKey { i };
|
||||
MUST(wrapped_records->create_data_property(property_index, wrapped_record));
|
||||
}
|
||||
|
||||
auto* wrapped_mutation_observer = Bindings::wrap(global_object, mutation_observer);
|
||||
auto* wrapped_mutation_observer = Bindings::wrap(realm, mutation_observer);
|
||||
|
||||
auto result = IDL::invoke_callback(callback, wrapped_mutation_observer, wrapped_records, wrapped_mutation_observer);
|
||||
if (result.is_abrupt())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue