mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 05:47:34 +00:00
LibWeb: Align NavigationParams and the creation AOs to the spec
And remove assorted spec FIXMEs along the way. Also align populate_session_history_entry_document to the spec, with a bonus spec bug to be filed. This involves creating a new NonFetchSchemeNavigationParams spec, and having the associated AOs take a Variant rather than Optional to accomodate the fact that this extra struct could be returned by the algorithm. We don't actually *do* anything with these params, but the scaffolding is there now, with less TODOs.
This commit is contained in:
parent
f296382e1a
commit
dc0f7c4c54
9 changed files with 400 additions and 125 deletions
|
@ -236,7 +236,13 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Document>> Document::create_and_initialize(
|
|||
HTML::WindowEnvironmentSettingsObject::setup(
|
||||
creation_url.value(),
|
||||
move(realm_execution_context),
|
||||
navigation_params.reserved_environment,
|
||||
navigation_params.reserved_environment.visit(
|
||||
// FIXME: Environment is virtual. We *really* shouldn't be slicing it here
|
||||
[](Empty const&) -> Optional<HTML::Environment> { return {}; },
|
||||
[](HTML::Environment* env) -> Optional<HTML::Environment> { if (env) return *env; return {}; },
|
||||
[](JS::NonnullGCPtr<HTML::EnvironmentSettingsObject>) -> Optional<HTML::Environment> {
|
||||
TODO();
|
||||
}),
|
||||
top_level_creation_url.value(),
|
||||
top_level_origin);
|
||||
}
|
||||
|
|
|
@ -445,6 +445,10 @@ public:
|
|||
bool is_initial_about_blank() const { return m_is_initial_about_blank; }
|
||||
void set_is_initial_about_blank(bool b) { m_is_initial_about_blank = b; }
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#concept-document-about-base-url
|
||||
Optional<AK::URL> about_base_url() const { return m_about_base_url; }
|
||||
void set_about_base_url(Optional<AK::URL> url) { m_about_base_url = url; }
|
||||
|
||||
DeprecatedString domain() const;
|
||||
void set_domain(String const&);
|
||||
|
||||
|
@ -655,6 +659,9 @@ private:
|
|||
// https://html.spec.whatwg.org/multipage/dom.html#is-initial-about:blank
|
||||
bool m_is_initial_about_blank { false };
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#concept-document-about-base-url
|
||||
Optional<AK::URL> m_about_base_url;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#concept-document-coop
|
||||
HTML::CrossOriginOpenerPolicy m_cross_origin_opener_policy;
|
||||
|
||||
|
|
|
@ -263,7 +263,7 @@ JS::GCPtr<DOM::Document> load_document(Optional<HTML::NavigationParams> navigati
|
|||
auto& realm = document->realm();
|
||||
|
||||
if (navigation_params->response->body()) {
|
||||
auto process_body = [navigation_params, document](ByteBuffer bytes) {
|
||||
auto process_body = [document](ByteBuffer bytes) {
|
||||
if (!parse_document(*document, bytes)) {
|
||||
dbgln("FIXME: Load html page with an error if parsing failed.");
|
||||
}
|
||||
|
@ -307,32 +307,35 @@ JS::GCPtr<DOM::Document> create_document_for_inline_content(JS::GCPtr<HTML::Navi
|
|||
|
||||
// 4. Let navigationParams be a new navigation params with
|
||||
// id: navigationId
|
||||
// navigable: navigable
|
||||
// request: null
|
||||
// response: a new response
|
||||
// origin: origin
|
||||
// fetch controller: null
|
||||
// commit early hints: null
|
||||
// COOP enforcement result: coopEnforcementResult
|
||||
// reserved environment: null
|
||||
// policy container: a new policy container
|
||||
// final sandboxing flag set: an empty set
|
||||
// cross-origin opener policy: coop
|
||||
// COOP enforcement result: coopEnforcementResult
|
||||
// reserved environment: null
|
||||
// navigable: navigable
|
||||
// FIXME: navigation timing type: navTimingType
|
||||
// FIXME: fetch controller: fetch controller
|
||||
// FIXME: commit early hints: null
|
||||
// about base URL: null
|
||||
auto response = Fetch::Infrastructure::Response::create(vm);
|
||||
response->url_list().append(AK::URL("about:error")); // AD-HOC: https://github.com/whatwg/html/issues/9122
|
||||
HTML::NavigationParams navigation_params {
|
||||
.id = navigation_id,
|
||||
.navigable = navigable,
|
||||
.request = {},
|
||||
.response = *response,
|
||||
.fetch_controller = nullptr,
|
||||
.commit_early_hints = nullptr,
|
||||
.coop_enforcement_result = move(coop_enforcement_result),
|
||||
.reserved_environment = {},
|
||||
.origin = move(origin),
|
||||
.policy_container = HTML::PolicyContainer {},
|
||||
.final_sandboxing_flag_set = HTML::SandboxingFlagSet {},
|
||||
.cross_origin_opener_policy = move(coop),
|
||||
.coop_enforcement_result = move(coop_enforcement_result),
|
||||
.reserved_environment = {},
|
||||
.browsing_context = navigable->active_browsing_context(),
|
||||
.navigable = navigable,
|
||||
.about_base_url = {},
|
||||
};
|
||||
|
||||
// 5. Let document be the result of creating and initializing a Document object given "html", "text/html", and navigationParams.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue