mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:48:11 +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
|
@ -118,12 +118,12 @@ JS::ThrowCompletionOr<RefPtr<Node>> NodeIterator::traverse(Direction direction)
|
|||
JS::ThrowCompletionOr<NodeFilter::Result> NodeIterator::filter(Node& node)
|
||||
{
|
||||
VERIFY(wrapper());
|
||||
auto& global_object = wrapper()->global_object();
|
||||
auto& vm = wrapper()->vm();
|
||||
auto& realm = *vm.current_realm();
|
||||
|
||||
// 1. If traverser’s active flag is set, then throw an "InvalidStateError" DOMException.
|
||||
if (m_active)
|
||||
return JS::throw_completion(wrap(global_object, InvalidStateError::create("NodeIterator is already active")));
|
||||
return JS::throw_completion(wrap(realm, InvalidStateError::create("NodeIterator is already active")));
|
||||
|
||||
// 2. Let n be node’s nodeType attribute value − 1.
|
||||
auto n = node.node_type() - 1;
|
||||
|
@ -141,7 +141,7 @@ JS::ThrowCompletionOr<NodeFilter::Result> NodeIterator::filter(Node& node)
|
|||
|
||||
// 6. Let result be the return value of call a user object’s operation with traverser’s filter, "acceptNode", and « node ».
|
||||
// If this throws an exception, then unset traverser’s active flag and rethrow the exception.
|
||||
auto result = Bindings::IDL::call_user_object_operation(m_filter->callback(), "acceptNode", {}, wrap(global_object, node));
|
||||
auto result = Bindings::IDL::call_user_object_operation(m_filter->callback(), "acceptNode", {}, wrap(realm, node));
|
||||
if (result.is_abrupt()) {
|
||||
m_active = false;
|
||||
return result;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue