mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:57:45 +00:00
LibWeb: Remove unecessary dependence on Window from DOM and WebIDL
These classes only needed Window to get at its realm. Pass a realm directly to construct DOM and WebIDL classes. This change importantly removes the guarantee that a Document will always have a non-null Window object. Only Documents created by a BrowsingContext will have a non-null Window object. Documents created by for example, DocumentFragment, will not have a Window (soon). This incremental commit leaves some workarounds in place to keep other parts of the code building.
This commit is contained in:
parent
8407bf60c5
commit
8de7e49a56
56 changed files with 364 additions and 326 deletions
|
@ -12,7 +12,7 @@
|
|||
namespace Web::DOM {
|
||||
|
||||
NodeIterator::NodeIterator(Node& root)
|
||||
: PlatformObject(root.window().cached_web_prototype("NodeIterator"))
|
||||
: PlatformObject(Bindings::cached_web_prototype(root.realm(), "NodeIterator"))
|
||||
, m_root(root)
|
||||
, m_reference({ root })
|
||||
{
|
||||
|
@ -130,7 +130,7 @@ JS::ThrowCompletionOr<NodeFilter::Result> NodeIterator::filter(Node& node)
|
|||
{
|
||||
// 1. If traverser’s active flag is set, then throw an "InvalidStateError" DOMException.
|
||||
if (m_active)
|
||||
return throw_completion(WebIDL::InvalidStateError::create(global_object(), "NodeIterator is already active"));
|
||||
return throw_completion(WebIDL::InvalidStateError::create(realm(), "NodeIterator is already active"));
|
||||
|
||||
// 2. Let n be node’s nodeType attribute value − 1.
|
||||
auto n = node.node_type() - 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue