mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-12 11:09:18 +00:00
LibWeb+LibURL: Move HTML::Origin to URL::Origin
While Origin is defined in the HTML spec - this leaves us with quite an awkward relationship as the URL spec makes use of AO's from what is defined in the HTML spec. To simplify this factoring, relocate Origin into LibURL.
This commit is contained in:
parent
e9dd05b2b5
commit
dc401f49ea
Notes:
github-actions[bot]
2024-10-05 08:47:56 +00:00
Author: https://github.com/shannonbooth
Commit: dc401f49ea
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1636
55 changed files with 143 additions and 157 deletions
|
@ -25,14 +25,14 @@ public:
|
|||
JS::GCPtr<DOM::Document> responsible_document() override { return nullptr; }
|
||||
String api_url_character_encoding() override { return m_api_url_character_encoding; }
|
||||
URL::URL api_base_url() override { return m_url; }
|
||||
Origin origin() override { return m_origin; }
|
||||
URL::Origin origin() override { return m_origin; }
|
||||
PolicyContainer policy_container() override { return m_policy_container; }
|
||||
CanUseCrossOriginIsolatedAPIs cross_origin_isolated_capability() override { return CanUseCrossOriginIsolatedAPIs::No; }
|
||||
|
||||
private:
|
||||
String m_api_url_character_encoding;
|
||||
URL::URL m_url;
|
||||
HTML::Origin m_origin;
|
||||
URL::Origin m_origin;
|
||||
HTML::PolicyContainer m_policy_container;
|
||||
};
|
||||
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibJS/Forward.h>
|
||||
#include <LibURL/Origin.h>
|
||||
#include <LibURL/URL.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/HTML/EventLoop/EventLoop.h>
|
||||
#include <LibWeb/HTML/Origin.h>
|
||||
#include <LibWeb/HTML/Scripting/ModuleMap.h>
|
||||
#include <LibWeb/HTML/Scripting/SerializedEnvironmentSettingsObject.h>
|
||||
|
||||
|
@ -34,7 +34,7 @@ public:
|
|||
URL::URL top_level_creation_url;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/webappapis.html#concept-environment-top-level-origin
|
||||
Origin top_level_origin;
|
||||
URL::Origin top_level_origin;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/webappapis.html#concept-environment-target-browsing-context
|
||||
JS::GCPtr<BrowsingContext> target_browsing_context;
|
||||
|
@ -77,7 +77,7 @@ public:
|
|||
virtual URL::URL api_base_url() = 0;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/webappapis.html#concept-settings-object-origin
|
||||
virtual Origin origin() = 0;
|
||||
virtual URL::Origin origin() = 0;
|
||||
|
||||
// A policy container https://html.spec.whatwg.org/multipage/webappapis.html#concept-settings-object-policy-container
|
||||
virtual PolicyContainer policy_container() = 0;
|
||||
|
|
|
@ -34,10 +34,10 @@ ErrorOr<Web::HTML::SerializedEnvironmentSettingsObject> decode(Decoder& decoder)
|
|||
object.id = TRY(decoder.decode<String>());
|
||||
object.creation_url = TRY(decoder.decode<URL::URL>());
|
||||
object.top_level_creation_url = TRY(decoder.decode<URL::URL>());
|
||||
object.top_level_origin = TRY(decoder.decode<Web::HTML::Origin>());
|
||||
object.top_level_origin = TRY(decoder.decode<URL::Origin>());
|
||||
object.api_url_character_encoding = TRY(decoder.decode<String>());
|
||||
object.api_base_url = TRY(decoder.decode<URL::URL>());
|
||||
object.origin = TRY(decoder.decode<Web::HTML::Origin>());
|
||||
object.origin = TRY(decoder.decode<URL::Origin>());
|
||||
object.policy_container = TRY(decoder.decode<Web::HTML::PolicyContainer>());
|
||||
object.cross_origin_isolated_capability = TRY(decoder.decode<Web::HTML::CanUseCrossOriginIsolatedAPIs>());
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
#include <AK/String.h>
|
||||
#include <LibIPC/Forward.h>
|
||||
#include <LibURL/Origin.h>
|
||||
#include <LibURL/URL.h>
|
||||
#include <LibWeb/HTML/Origin.h>
|
||||
#include <LibWeb/HTML/PolicyContainers.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
@ -23,11 +23,11 @@ struct SerializedEnvironmentSettingsObject {
|
|||
String id;
|
||||
URL::URL creation_url;
|
||||
URL::URL top_level_creation_url;
|
||||
Origin top_level_origin;
|
||||
URL::Origin top_level_origin;
|
||||
|
||||
String api_url_character_encoding;
|
||||
URL::URL api_base_url;
|
||||
Origin origin;
|
||||
URL::Origin origin;
|
||||
PolicyContainer policy_container;
|
||||
CanUseCrossOriginIsolatedAPIs cross_origin_isolated_capability;
|
||||
};
|
||||
|
|
|
@ -29,7 +29,7 @@ void WindowEnvironmentSettingsObject::visit_edges(JS::Cell::Visitor& visitor)
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/window-object.html#set-up-a-window-environment-settings-object
|
||||
void WindowEnvironmentSettingsObject::setup(Page& page, URL::URL const& creation_url, NonnullOwnPtr<JS::ExecutionContext> execution_context, JS::GCPtr<Environment> reserved_environment, URL::URL top_level_creation_url, Origin top_level_origin)
|
||||
void WindowEnvironmentSettingsObject::setup(Page& page, URL::URL const& creation_url, NonnullOwnPtr<JS::ExecutionContext> execution_context, JS::GCPtr<Environment> reserved_environment, URL::URL top_level_creation_url, URL::Origin top_level_origin)
|
||||
{
|
||||
// 1. Let realm be the value of execution context's Realm component.
|
||||
auto realm = execution_context->realm;
|
||||
|
@ -104,7 +104,7 @@ URL::URL WindowEnvironmentSettingsObject::api_base_url()
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/window-object.html#script-settings-for-window-objects:concept-settings-object-origin
|
||||
Origin WindowEnvironmentSettingsObject::origin()
|
||||
URL::Origin WindowEnvironmentSettingsObject::origin()
|
||||
{
|
||||
// Return the origin of window's associated Document.
|
||||
return m_window->associated_document().origin();
|
||||
|
|
|
@ -16,14 +16,14 @@ class WindowEnvironmentSettingsObject final : public EnvironmentSettingsObject {
|
|||
JS_DECLARE_ALLOCATOR(WindowEnvironmentSettingsObject);
|
||||
|
||||
public:
|
||||
static void setup(Page&, URL::URL const& creation_url, NonnullOwnPtr<JS::ExecutionContext>, JS::GCPtr<Environment>, URL::URL top_level_creation_url, Origin top_level_origin);
|
||||
static void setup(Page&, URL::URL const& creation_url, NonnullOwnPtr<JS::ExecutionContext>, JS::GCPtr<Environment>, URL::URL top_level_creation_url, URL::Origin top_level_origin);
|
||||
|
||||
virtual ~WindowEnvironmentSettingsObject() override;
|
||||
|
||||
virtual JS::GCPtr<DOM::Document> responsible_document() override;
|
||||
virtual String api_url_character_encoding() override;
|
||||
virtual URL::URL api_base_url() override;
|
||||
virtual Origin origin() override;
|
||||
virtual URL::Origin origin() override;
|
||||
virtual PolicyContainer policy_container() override;
|
||||
virtual CanUseCrossOriginIsolatedAPIs cross_origin_isolated_capability() override;
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ URL::URL WorkerEnvironmentSettingsObject::api_base_url()
|
|||
return m_global_scope->url();
|
||||
}
|
||||
|
||||
Origin WorkerEnvironmentSettingsObject::origin()
|
||||
URL::Origin WorkerEnvironmentSettingsObject::origin()
|
||||
{
|
||||
// FIXME: Return a unique opaque origin if worker global scope's url's scheme is "data", and inherited origin otherwise.
|
||||
return m_origin;
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
JS::GCPtr<DOM::Document> responsible_document() override { return nullptr; }
|
||||
String api_url_character_encoding() override { return m_api_url_character_encoding; }
|
||||
URL::URL api_base_url() override;
|
||||
Origin origin() override;
|
||||
URL::Origin origin() override;
|
||||
PolicyContainer policy_container() override;
|
||||
CanUseCrossOriginIsolatedAPIs cross_origin_isolated_capability() override;
|
||||
|
||||
|
@ -39,7 +39,7 @@ private:
|
|||
virtual void visit_edges(JS::Cell::Visitor&) override;
|
||||
|
||||
String m_api_url_character_encoding;
|
||||
HTML::Origin m_origin;
|
||||
URL::Origin m_origin;
|
||||
|
||||
JS::NonnullGCPtr<WorkerGlobalScope> m_global_scope;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue