浏览代码

LibWeb: Don't get impl in document_tree_child_browsing_context_count

This caused `Object.getOwnPropertyNames(window)` to throw, as the
`this` value is `Object`.

All users of document_tree_child_browsing_context_count call it on an
existing Window impl, including WP::internal_own_property_keys, so
getting the impl from the JS VM is not necessary.
Luke Wilde 2 年之前
父节点
当前提交
645a64ef0f
共有 1 个文件被更改,包括 1 次插入3 次删除
  1. 1 3
      Userland/Libraries/LibWeb/HTML/Window.cpp

+ 1 - 3
Userland/Libraries/LibWeb/HTML/Window.cpp

@@ -1040,10 +1040,8 @@ JS_DEFINE_NATIVE_FUNCTION(Window::btoa)
 // https://html.spec.whatwg.org/multipage/window-object.html#number-of-document-tree-child-browsing-contexts
 JS::ThrowCompletionOr<size_t> Window::document_tree_child_browsing_context_count() const
 {
-    auto* impl = TRY(impl_from(vm()));
-
     // 1. If W's browsing context is null, then return 0.
-    auto* this_browsing_context = impl->associated_document().browsing_context();
+    auto* this_browsing_context = associated_document().browsing_context();
     if (!this_browsing_context)
         return 0;