mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 23:55:07 +00:00
LibWeb: Add about base url to the various AOs that construct documents
And some assorted cleanup along the way. The browsing context and document AOs in particular need re-alignment with the spec.
This commit is contained in:
parent
dc0f7c4c54
commit
7e277797ad
5 changed files with 28 additions and 2 deletions
|
@ -269,6 +269,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Document>> Document::create_and_initialize(
|
||||||
document->set_url(*creation_url);
|
document->set_url(*creation_url);
|
||||||
document->m_navigation_id = navigation_params.id;
|
document->m_navigation_id = navigation_params.id;
|
||||||
document->m_readiness = HTML::DocumentReadyState::Loading;
|
document->m_readiness = HTML::DocumentReadyState::Loading;
|
||||||
|
document->m_about_base_url = navigation_params.about_base_url;
|
||||||
|
|
||||||
document->m_window = window;
|
document->m_window = window;
|
||||||
|
|
||||||
|
|
|
@ -121,11 +121,17 @@ WebIDL::ExceptionOr<BrowsingContext::BrowsingContextAndDocument> BrowsingContext
|
||||||
// 3. Let creatorOrigin be null.
|
// 3. Let creatorOrigin be null.
|
||||||
Optional<Origin> creator_origin = {};
|
Optional<Origin> creator_origin = {};
|
||||||
|
|
||||||
|
// FIXME: This algorithm needs re-aligned with the spec
|
||||||
|
Optional<AK::URL> creator_base_url = {};
|
||||||
|
|
||||||
// 4. If creator is non-null, then:
|
// 4. If creator is non-null, then:
|
||||||
if (creator) {
|
if (creator) {
|
||||||
// 1. Set creatorOrigin to creator's origin.
|
// 1. Set creatorOrigin to creator's origin.
|
||||||
creator_origin = creator->origin();
|
creator_origin = creator->origin();
|
||||||
|
|
||||||
|
// FIXME: This algorithm needs re-aligned with the spec
|
||||||
|
creator_base_url = creator->base_url();
|
||||||
|
|
||||||
// FIXME: 2. Set browsingContext's creator base URL to an algorithm which returns creator's base URL.
|
// FIXME: 2. Set browsingContext's creator base URL to an algorithm which returns creator's base URL.
|
||||||
|
|
||||||
// FIXME: 3. Set browsingContext's virtual browsing context group ID to creator's browsing context's top-level browsing context's virtual browsing context group ID.
|
// FIXME: 3. Set browsingContext's virtual browsing context group ID to creator's browsing context's top-level browsing context's virtual browsing context group ID.
|
||||||
|
@ -211,6 +217,9 @@ WebIDL::ExceptionOr<BrowsingContext::BrowsingContextAndDocument> BrowsingContext
|
||||||
// is initial about:blank: true
|
// is initial about:blank: true
|
||||||
document->set_is_initial_about_blank(true);
|
document->set_is_initial_about_blank(true);
|
||||||
|
|
||||||
|
// about base URL: creatorBaseURL
|
||||||
|
document->set_about_base_url(creator_base_url);
|
||||||
|
|
||||||
// 15. If creator is non-null, then:
|
// 15. If creator is non-null, then:
|
||||||
if (creator) {
|
if (creator) {
|
||||||
// 1. Set document's referrer to the serialization of creator's URL.
|
// 1. Set document's referrer to the serialization of creator's URL.
|
||||||
|
|
|
@ -1531,6 +1531,7 @@ WebIDL::ExceptionOr<void> Navigable::navigate_to_a_javascript_url(AK::URL const&
|
||||||
document_state->set_request_referrer_policy(old_doc_state->request_referrer_policy());
|
document_state->set_request_referrer_policy(old_doc_state->request_referrer_policy());
|
||||||
document_state->set_initiator_origin(initiator_origin);
|
document_state->set_initiator_origin(initiator_origin);
|
||||||
document_state->set_origin(initiator_origin);
|
document_state->set_origin(initiator_origin);
|
||||||
|
document_state->set_about_base_url(old_doc_state->about_base_url());
|
||||||
document_state->set_ever_populated(true);
|
document_state->set_ever_populated(true);
|
||||||
document_state->set_navigable_target_name(old_doc_state->navigable_target_name());
|
document_state->set_navigable_target_name(old_doc_state->navigable_target_name());
|
||||||
|
|
||||||
|
|
|
@ -80,12 +80,18 @@ WebIDL::ExceptionOr<void> NavigableContainer::create_new_child_navigable()
|
||||||
target_name = String::from_deprecated_string(value).release_value_but_fixme_should_propagate_errors();
|
target_name = String::from_deprecated_string(value).release_value_but_fixme_should_propagate_errors();
|
||||||
|
|
||||||
// 6. Let documentState be a new document state, with
|
// 6. Let documentState be a new document state, with
|
||||||
// document: document
|
// - document: document
|
||||||
// navigable target name: targetName
|
// - initiator origin: document's origin
|
||||||
|
// - origin: document's origin
|
||||||
|
// - navigable target name: targetName
|
||||||
|
// - about base URL: document's about base URL
|
||||||
JS::NonnullGCPtr<DocumentState> document_state = *heap().allocate_without_realm<HTML::DocumentState>();
|
JS::NonnullGCPtr<DocumentState> document_state = *heap().allocate_without_realm<HTML::DocumentState>();
|
||||||
document_state->set_document(document);
|
document_state->set_document(document);
|
||||||
|
document_state->set_initiator_origin(document->origin());
|
||||||
|
document_state->set_origin(document->origin());
|
||||||
if (target_name.has_value())
|
if (target_name.has_value())
|
||||||
document_state->set_navigable_target_name(*target_name);
|
document_state->set_navigable_target_name(*target_name);
|
||||||
|
document_state->set_about_base_url(document->about_base_url());
|
||||||
|
|
||||||
// 7. Let navigable be a new navigable.
|
// 7. Let navigable be a new navigable.
|
||||||
JS::NonnullGCPtr<Navigable> navigable = *heap().allocate_without_realm<Navigable>();
|
JS::NonnullGCPtr<Navigable> navigable = *heap().allocate_without_realm<Navigable>();
|
||||||
|
|
|
@ -71,9 +71,18 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<TraversableNavigable>> TraversableNavigable
|
||||||
// document: document
|
// document: document
|
||||||
document_state->set_document(document);
|
document_state->set_document(document);
|
||||||
|
|
||||||
|
// initiator origin: null if opener is null; otherwise, document's origin
|
||||||
|
document_state->set_initiator_origin(opener ? Optional<Origin> {} : document->origin());
|
||||||
|
|
||||||
|
// origin: document's origin
|
||||||
|
document_state->set_origin(document->origin());
|
||||||
|
|
||||||
// navigable target name: targetName
|
// navigable target name: targetName
|
||||||
document_state->set_navigable_target_name(target_name);
|
document_state->set_navigable_target_name(target_name);
|
||||||
|
|
||||||
|
// about base URL: document's about base URL
|
||||||
|
document_state->set_about_base_url(document->about_base_url());
|
||||||
|
|
||||||
// 5. Let traversable be a new traversable navigable.
|
// 5. Let traversable be a new traversable navigable.
|
||||||
auto traversable = vm.heap().allocate_without_realm<TraversableNavigable>(page);
|
auto traversable = vm.heap().allocate_without_realm<TraversableNavigable>(page);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue