mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 23:28:11 +00:00
LibWeb: Implement creation of fresh top-level traversables
Co-authored-by: Andreas Kling <kling@serenityos.org>
This commit is contained in:
parent
9a19bdbfcf
commit
3c89286467
4 changed files with 117 additions and 0 deletions
|
@ -35,6 +35,23 @@ void BrowsingContextGroup::visit_edges(Cell::Visitor& visitor)
|
|||
visitor.visit(context);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/document-sequences.html#creating-a-new-browsing-context-group-and-document
|
||||
auto BrowsingContextGroup::create_a_new_browsing_context_group_and_document(Page& page) -> WebIDL::ExceptionOr<BrowsingContextGroupAndDocument>
|
||||
{
|
||||
// 1. Let group be a new browsing context group.
|
||||
// 2. Append group to the user agent's browsing context group set.
|
||||
auto group = Bindings::main_thread_vm().heap().allocate_without_realm<BrowsingContextGroup>(page);
|
||||
|
||||
// 3. Let browsingContext and document be the result of creating a new browsing context and document with null, null, and group.
|
||||
auto [browsing_context, document] = TRY(BrowsingContext::create_a_new_browsing_context_and_document(page, nullptr, nullptr, group));
|
||||
|
||||
// 4. Append browsingContext to group.
|
||||
group->append(browsing_context);
|
||||
|
||||
// 5. Return group and document.
|
||||
return BrowsingContextGroupAndDocument { group, document };
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/browsers.html#creating-a-new-browsing-context-group
|
||||
JS::NonnullGCPtr<BrowsingContextGroup> BrowsingContextGroup::create_a_new_browsing_context_group(Web::Page& page)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue