mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-11 18:50:50 +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
|
@ -4656,6 +4656,7 @@ void generate_prototype_implementation(IDL::Interface const& interface, StringBu
|
||||||
#include <LibJS/Runtime/TypedArray.h>
|
#include <LibJS/Runtime/TypedArray.h>
|
||||||
#include <LibJS/Runtime/Value.h>
|
#include <LibJS/Runtime/Value.h>
|
||||||
#include <LibJS/Runtime/ValueInlines.h>
|
#include <LibJS/Runtime/ValueInlines.h>
|
||||||
|
#include <LibURL/Origin.h>
|
||||||
#include <LibWeb/Bindings/@prototype_class@.h>
|
#include <LibWeb/Bindings/@prototype_class@.h>
|
||||||
#include <LibWeb/Bindings/ExceptionOrUtils.h>
|
#include <LibWeb/Bindings/ExceptionOrUtils.h>
|
||||||
#include <LibWeb/Bindings/Intrinsics.h>
|
#include <LibWeb/Bindings/Intrinsics.h>
|
||||||
|
@ -4665,7 +4666,6 @@ void generate_prototype_implementation(IDL::Interface const& interface, StringBu
|
||||||
#include <LibWeb/DOM/NodeFilter.h>
|
#include <LibWeb/DOM/NodeFilter.h>
|
||||||
#include <LibWeb/DOM/Range.h>
|
#include <LibWeb/DOM/Range.h>
|
||||||
#include <LibWeb/HTML/Numbers.h>
|
#include <LibWeb/HTML/Numbers.h>
|
||||||
#include <LibWeb/HTML/Origin.h>
|
|
||||||
#include <LibWeb/HTML/Scripting/Environments.h>
|
#include <LibWeb/HTML/Scripting/Environments.h>
|
||||||
#include <LibWeb/HTML/Window.h>
|
#include <LibWeb/HTML/Window.h>
|
||||||
#include <LibWeb/HTML/WindowProxy.h>
|
#include <LibWeb/HTML/WindowProxy.h>
|
||||||
|
@ -4930,6 +4930,7 @@ void generate_global_mixin_implementation(IDL::Interface const& interface, Strin
|
||||||
#include <LibJS/Runtime/TypedArray.h>
|
#include <LibJS/Runtime/TypedArray.h>
|
||||||
#include <LibJS/Runtime/Value.h>
|
#include <LibJS/Runtime/Value.h>
|
||||||
#include <LibJS/Runtime/ValueInlines.h>
|
#include <LibJS/Runtime/ValueInlines.h>
|
||||||
|
#include <LibURL/Origin.h>
|
||||||
#include <LibWeb/Bindings/@class_name@.h>
|
#include <LibWeb/Bindings/@class_name@.h>
|
||||||
#include <LibWeb/Bindings/@prototype_name@.h>
|
#include <LibWeb/Bindings/@prototype_name@.h>
|
||||||
#include <LibWeb/Bindings/ExceptionOrUtils.h>
|
#include <LibWeb/Bindings/ExceptionOrUtils.h>
|
||||||
|
@ -4939,7 +4940,6 @@ void generate_global_mixin_implementation(IDL::Interface const& interface, Strin
|
||||||
#include <LibWeb/DOM/IDLEventListener.h>
|
#include <LibWeb/DOM/IDLEventListener.h>
|
||||||
#include <LibWeb/DOM/NodeFilter.h>
|
#include <LibWeb/DOM/NodeFilter.h>
|
||||||
#include <LibWeb/DOM/Range.h>
|
#include <LibWeb/DOM/Range.h>
|
||||||
#include <LibWeb/HTML/Origin.h>
|
|
||||||
#include <LibWeb/HTML/Scripting/Environments.h>
|
#include <LibWeb/HTML/Scripting/Environments.h>
|
||||||
#include <LibWeb/HTML/Window.h>
|
#include <LibWeb/HTML/Window.h>
|
||||||
#include <LibWeb/HTML/WindowProxy.h>
|
#include <LibWeb/HTML/WindowProxy.h>
|
||||||
|
|
|
@ -96,6 +96,16 @@ ErrorOr<URL::URL> decode(Decoder& decoder)
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
ErrorOr<URL::Origin> decode(Decoder& decoder)
|
||||||
|
{
|
||||||
|
auto scheme = TRY(decoder.decode<ByteString>());
|
||||||
|
auto host = TRY(decoder.decode<URL::Host>());
|
||||||
|
u16 port = TRY(decoder.decode<u16>());
|
||||||
|
|
||||||
|
return URL::Origin { move(scheme), move(host), port };
|
||||||
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
ErrorOr<File> decode(Decoder& decoder)
|
ErrorOr<File> decode(Decoder& decoder)
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include <LibIPC/File.h>
|
#include <LibIPC/File.h>
|
||||||
#include <LibIPC/Forward.h>
|
#include <LibIPC/Forward.h>
|
||||||
#include <LibIPC/Message.h>
|
#include <LibIPC/Message.h>
|
||||||
|
#include <LibURL/Origin.h>
|
||||||
#include <LibURL/URL.h>
|
#include <LibURL/URL.h>
|
||||||
|
|
||||||
namespace IPC {
|
namespace IPC {
|
||||||
|
@ -104,6 +105,9 @@ ErrorOr<UnixDateTime> decode(Decoder&);
|
||||||
template<>
|
template<>
|
||||||
ErrorOr<URL::URL> decode(Decoder&);
|
ErrorOr<URL::URL> decode(Decoder&);
|
||||||
|
|
||||||
|
template<>
|
||||||
|
ErrorOr<URL::Origin> decode(Decoder&);
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
ErrorOr<File> decode(Decoder&);
|
ErrorOr<File> decode(Decoder&);
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include <LibCore/System.h>
|
#include <LibCore/System.h>
|
||||||
#include <LibIPC/Encoder.h>
|
#include <LibIPC/Encoder.h>
|
||||||
#include <LibIPC/File.h>
|
#include <LibIPC/File.h>
|
||||||
|
#include <LibURL/Origin.h>
|
||||||
#include <LibURL/URL.h>
|
#include <LibURL/URL.h>
|
||||||
|
|
||||||
namespace IPC {
|
namespace IPC {
|
||||||
|
@ -114,6 +115,16 @@ ErrorOr<void> encode(Encoder& encoder, URL::URL const& value)
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
ErrorOr<void> encode(Encoder& encoder, URL::Origin const& origin)
|
||||||
|
{
|
||||||
|
TRY(encoder.encode<ByteString>(origin.scheme()));
|
||||||
|
TRY(encoder.encode(origin.host()));
|
||||||
|
TRY(encoder.encode(origin.port()));
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
ErrorOr<void> encode(Encoder& encoder, File const& file)
|
ErrorOr<void> encode(Encoder& encoder, File const& file)
|
||||||
{
|
{
|
||||||
|
|
|
@ -104,6 +104,9 @@ ErrorOr<void> encode(Encoder&, UnixDateTime const&);
|
||||||
template<>
|
template<>
|
||||||
ErrorOr<void> encode(Encoder&, URL::URL const&);
|
ErrorOr<void> encode(Encoder&, URL::URL const&);
|
||||||
|
|
||||||
|
template<>
|
||||||
|
ErrorOr<void> encode(Encoder&, URL::Origin const&);
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
ErrorOr<void> encode(Encoder&, File const&);
|
ErrorOr<void> encode(Encoder&, File const&);
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
namespace URL {
|
namespace URL {
|
||||||
|
class Origin;
|
||||||
class URL;
|
class URL;
|
||||||
class Parser;
|
class Parser;
|
||||||
|
|
||||||
|
|
|
@ -8,17 +8,15 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <AK/ByteString.h>
|
#include <AK/ByteString.h>
|
||||||
#include <LibIPC/Decoder.h>
|
|
||||||
#include <LibIPC/Encoder.h>
|
|
||||||
#include <LibURL/Parser.h>
|
#include <LibURL/Parser.h>
|
||||||
#include <LibURL/URL.h>
|
#include <LibURL/URL.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace URL {
|
||||||
|
|
||||||
class Origin {
|
class Origin {
|
||||||
public:
|
public:
|
||||||
Origin() = default;
|
Origin() = default;
|
||||||
Origin(Optional<ByteString> const& scheme, URL::Host const& host, u16 port)
|
Origin(Optional<ByteString> const& scheme, Host const& host, u16 port)
|
||||||
: m_scheme(scheme)
|
: m_scheme(scheme)
|
||||||
, m_host(host)
|
, m_host(host)
|
||||||
, m_port(port)
|
, m_port(port)
|
||||||
|
@ -32,7 +30,7 @@ public:
|
||||||
{
|
{
|
||||||
return m_scheme.map([](auto& str) { return str.view(); }).value_or(StringView {});
|
return m_scheme.map([](auto& str) { return str.view(); }).value_or(StringView {});
|
||||||
}
|
}
|
||||||
URL::Host const& host() const { return m_host; }
|
Host const& host() const { return m_host; }
|
||||||
u16 port() const { return m_port; }
|
u16 port() const { return m_port; }
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/origin.html#same-origin
|
// https://html.spec.whatwg.org/multipage/origin.html#same-origin
|
||||||
|
@ -88,7 +86,7 @@ public:
|
||||||
result.append("://"sv);
|
result.append("://"sv);
|
||||||
|
|
||||||
// 4. Append origin's host, serialized, to result.
|
// 4. Append origin's host, serialized, to result.
|
||||||
result.append(URL::Parser::serialize_host(host()).release_value_but_fixme_should_propagate_errors().to_byte_string());
|
result.append(Parser::serialize_host(host()).release_value_but_fixme_should_propagate_errors().to_byte_string());
|
||||||
|
|
||||||
// 5. If origin's port is non-null, append a U+003A COLON character (:), and origin's port, serialized, to result.
|
// 5. If origin's port is non-null, append a U+003A COLON character (:), and origin's port, serialized, to result.
|
||||||
if (port() != 0) {
|
if (port() != 0) {
|
||||||
|
@ -100,7 +98,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/origin.html#concept-origin-effective-domain
|
// https://html.spec.whatwg.org/multipage/origin.html#concept-origin-effective-domain
|
||||||
Optional<URL::Host> effective_domain() const
|
Optional<Host> effective_domain() const
|
||||||
{
|
{
|
||||||
// 1. If origin is an opaque origin, then return null.
|
// 1. If origin is an opaque origin, then return null.
|
||||||
if (is_opaque())
|
if (is_opaque())
|
||||||
|
@ -116,7 +114,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Optional<ByteString> m_scheme;
|
Optional<ByteString> m_scheme;
|
||||||
URL::Host m_host;
|
Host m_host;
|
||||||
u16 m_port { 0 };
|
u16 m_port { 0 };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -124,8 +122,8 @@ private:
|
||||||
|
|
||||||
namespace AK {
|
namespace AK {
|
||||||
template<>
|
template<>
|
||||||
struct Traits<Web::HTML::Origin> : public DefaultTraits<Web::HTML::Origin> {
|
struct Traits<URL::Origin> : public DefaultTraits<URL::Origin> {
|
||||||
static unsigned hash(Web::HTML::Origin const& origin)
|
static unsigned hash(URL::Origin const& origin)
|
||||||
{
|
{
|
||||||
auto hash_without_host = pair_int_hash(origin.scheme().hash(), origin.port());
|
auto hash_without_host = pair_int_hash(origin.scheme().hash(), origin.port());
|
||||||
if (origin.host().has<Empty>())
|
if (origin.host().has<Empty>())
|
||||||
|
@ -134,11 +132,3 @@ struct Traits<Web::HTML::Origin> : public DefaultTraits<Web::HTML::Origin> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} // namespace AK
|
} // namespace AK
|
||||||
|
|
||||||
namespace IPC {
|
|
||||||
template<>
|
|
||||||
ErrorOr<void> encode(Encoder&, Web::HTML::Origin const&);
|
|
||||||
|
|
||||||
template<>
|
|
||||||
ErrorOr<Web::HTML::Origin> decode(Decoder&);
|
|
||||||
}
|
|
|
@ -418,7 +418,6 @@ set(SOURCES
|
||||||
HTML/NavigatorBeacon.cpp
|
HTML/NavigatorBeacon.cpp
|
||||||
HTML/NavigatorID.cpp
|
HTML/NavigatorID.cpp
|
||||||
HTML/Numbers.cpp
|
HTML/Numbers.cpp
|
||||||
HTML/Origin.cpp
|
|
||||||
HTML/PageTransitionEvent.cpp
|
HTML/PageTransitionEvent.cpp
|
||||||
HTML/PolicyContainers.cpp
|
HTML/PolicyContainers.cpp
|
||||||
HTML/PopStateEvent.cpp
|
HTML/PopStateEvent.cpp
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <LibURL/Origin.h>
|
||||||
#include <LibWeb/Bindings/DOMImplementationPrototype.h>
|
#include <LibWeb/Bindings/DOMImplementationPrototype.h>
|
||||||
#include <LibWeb/Bindings/Intrinsics.h>
|
#include <LibWeb/Bindings/Intrinsics.h>
|
||||||
#include <LibWeb/Bindings/MainThreadVM.h>
|
#include <LibWeb/Bindings/MainThreadVM.h>
|
||||||
|
@ -14,7 +15,6 @@
|
||||||
#include <LibWeb/DOM/Text.h>
|
#include <LibWeb/DOM/Text.h>
|
||||||
#include <LibWeb/DOM/XMLDocument.h>
|
#include <LibWeb/DOM/XMLDocument.h>
|
||||||
#include <LibWeb/HTML/HTMLDocument.h>
|
#include <LibWeb/HTML/HTMLDocument.h>
|
||||||
#include <LibWeb/HTML/Origin.h>
|
|
||||||
#include <LibWeb/Namespace.h>
|
#include <LibWeb/Namespace.h>
|
||||||
|
|
||||||
namespace Web::DOM {
|
namespace Web::DOM {
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include <LibJS/Runtime/Array.h>
|
#include <LibJS/Runtime/Array.h>
|
||||||
#include <LibJS/Runtime/FunctionObject.h>
|
#include <LibJS/Runtime/FunctionObject.h>
|
||||||
#include <LibJS/Runtime/NativeFunction.h>
|
#include <LibJS/Runtime/NativeFunction.h>
|
||||||
|
#include <LibURL/Origin.h>
|
||||||
#include <LibUnicode/Segmenter.h>
|
#include <LibUnicode/Segmenter.h>
|
||||||
#include <LibWeb/Animations/Animation.h>
|
#include <LibWeb/Animations/Animation.h>
|
||||||
#include <LibWeb/Animations/AnimationPlaybackEvent.h>
|
#include <LibWeb/Animations/AnimationPlaybackEvent.h>
|
||||||
|
@ -98,7 +99,6 @@
|
||||||
#include <LibWeb/HTML/Navigation.h>
|
#include <LibWeb/HTML/Navigation.h>
|
||||||
#include <LibWeb/HTML/NavigationParams.h>
|
#include <LibWeb/HTML/NavigationParams.h>
|
||||||
#include <LibWeb/HTML/Numbers.h>
|
#include <LibWeb/HTML/Numbers.h>
|
||||||
#include <LibWeb/HTML/Origin.h>
|
|
||||||
#include <LibWeb/HTML/Parser/HTMLParser.h>
|
#include <LibWeb/HTML/Parser/HTMLParser.h>
|
||||||
#include <LibWeb/HTML/PopStateEvent.h>
|
#include <LibWeb/HTML/PopStateEvent.h>
|
||||||
#include <LibWeb/HTML/Scripting/ClassicScript.h>
|
#include <LibWeb/HTML/Scripting/ClassicScript.h>
|
||||||
|
@ -723,12 +723,12 @@ JS::GCPtr<HTML::WindowProxy const> Document::default_view() const
|
||||||
return const_cast<Document*>(this)->default_view();
|
return const_cast<Document*>(this)->default_view();
|
||||||
}
|
}
|
||||||
|
|
||||||
HTML::Origin Document::origin() const
|
URL::Origin Document::origin() const
|
||||||
{
|
{
|
||||||
return m_origin;
|
return m_origin;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Document::set_origin(HTML::Origin const& origin)
|
void Document::set_origin(URL::Origin const& origin)
|
||||||
{
|
{
|
||||||
m_origin = origin;
|
m_origin = origin;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include <LibCore/Forward.h>
|
#include <LibCore/Forward.h>
|
||||||
#include <LibJS/Console.h>
|
#include <LibJS/Console.h>
|
||||||
#include <LibJS/Forward.h>
|
#include <LibJS/Forward.h>
|
||||||
|
#include <LibURL/Origin.h>
|
||||||
#include <LibURL/URL.h>
|
#include <LibURL/URL.h>
|
||||||
#include <LibUnicode/Forward.h>
|
#include <LibUnicode/Forward.h>
|
||||||
#include <LibWeb/CSS/CSSStyleSheet.h>
|
#include <LibWeb/CSS/CSSStyleSheet.h>
|
||||||
|
@ -32,7 +33,6 @@
|
||||||
#include <LibWeb/HTML/History.h>
|
#include <LibWeb/HTML/History.h>
|
||||||
#include <LibWeb/HTML/LazyLoadingElement.h>
|
#include <LibWeb/HTML/LazyLoadingElement.h>
|
||||||
#include <LibWeb/HTML/NavigationType.h>
|
#include <LibWeb/HTML/NavigationType.h>
|
||||||
#include <LibWeb/HTML/Origin.h>
|
|
||||||
#include <LibWeb/HTML/SandboxingFlagSet.h>
|
#include <LibWeb/HTML/SandboxingFlagSet.h>
|
||||||
#include <LibWeb/HTML/Scripting/Environments.h>
|
#include <LibWeb/HTML/Scripting/Environments.h>
|
||||||
#include <LibWeb/HTML/VisibilityState.h>
|
#include <LibWeb/HTML/VisibilityState.h>
|
||||||
|
@ -148,8 +148,8 @@ public:
|
||||||
String url_string() const { return MUST(m_url.to_string()); }
|
String url_string() const { return MUST(m_url.to_string()); }
|
||||||
String document_uri() const { return url_string(); }
|
String document_uri() const { return url_string(); }
|
||||||
|
|
||||||
HTML::Origin origin() const;
|
URL::Origin origin() const;
|
||||||
void set_origin(HTML::Origin const& origin);
|
void set_origin(URL::Origin const& origin);
|
||||||
|
|
||||||
HTML::OpenerPolicy const& opener_policy() const { return m_opener_policy; }
|
HTML::OpenerPolicy const& opener_policy() const { return m_opener_policy; }
|
||||||
void set_opener_policy(HTML::OpenerPolicy policy) { m_opener_policy = move(policy); }
|
void set_opener_policy(HTML::OpenerPolicy policy) { m_opener_policy = move(policy); }
|
||||||
|
@ -877,7 +877,7 @@ private:
|
||||||
String m_referrer;
|
String m_referrer;
|
||||||
|
|
||||||
// https://dom.spec.whatwg.org/#concept-document-origin
|
// https://dom.spec.whatwg.org/#concept-document-origin
|
||||||
HTML::Origin m_origin;
|
URL::Origin m_origin;
|
||||||
|
|
||||||
JS::GCPtr<HTMLCollection> m_applets;
|
JS::GCPtr<HTMLCollection> m_applets;
|
||||||
JS::GCPtr<HTMLCollection> m_anchors;
|
JS::GCPtr<HTMLCollection> m_anchors;
|
||||||
|
|
|
@ -23,7 +23,7 @@ JS::NonnullGCPtr<DOM::Document> create_document_for_inline_content(JS::GCPtr<HTM
|
||||||
auto& vm = navigable->vm();
|
auto& vm = navigable->vm();
|
||||||
|
|
||||||
// 1. Let origin be a new opaque origin.
|
// 1. Let origin be a new opaque origin.
|
||||||
HTML::Origin origin {};
|
URL::Origin origin {};
|
||||||
|
|
||||||
// 2. Let coop be a new opener policy.
|
// 2. Let coop be a new opener policy.
|
||||||
auto coop = HTML::OpenerPolicy {};
|
auto coop = HTML::OpenerPolicy {};
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include <LibJS/Heap/DeferGC.h>
|
#include <LibJS/Heap/DeferGC.h>
|
||||||
#include <LibJS/Runtime/FunctionObject.h>
|
#include <LibJS/Runtime/FunctionObject.h>
|
||||||
#include <LibRegex/Regex.h>
|
#include <LibRegex/Regex.h>
|
||||||
|
#include <LibURL/Origin.h>
|
||||||
#include <LibWeb/Bindings/MainThreadVM.h>
|
#include <LibWeb/Bindings/MainThreadVM.h>
|
||||||
#include <LibWeb/Bindings/NodePrototype.h>
|
#include <LibWeb/Bindings/NodePrototype.h>
|
||||||
#include <LibWeb/DOM/Attr.h>
|
#include <LibWeb/DOM/Attr.h>
|
||||||
|
@ -38,7 +39,6 @@
|
||||||
#include <LibWeb/HTML/HTMLStyleElement.h>
|
#include <LibWeb/HTML/HTMLStyleElement.h>
|
||||||
#include <LibWeb/HTML/Navigable.h>
|
#include <LibWeb/HTML/Navigable.h>
|
||||||
#include <LibWeb/HTML/NavigableContainer.h>
|
#include <LibWeb/HTML/NavigableContainer.h>
|
||||||
#include <LibWeb/HTML/Origin.h>
|
|
||||||
#include <LibWeb/HTML/Parser/HTMLParser.h>
|
#include <LibWeb/HTML/Parser/HTMLParser.h>
|
||||||
#include <LibWeb/Infra/CharacterTypes.h>
|
#include <LibWeb/Infra/CharacterTypes.h>
|
||||||
#include <LibWeb/Layout/Node.h>
|
#include <LibWeb/Layout/Node.h>
|
||||||
|
|
|
@ -479,7 +479,7 @@ void DOMURL::set_hash(String const& hash)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://url.spec.whatwg.org/#concept-url-origin
|
// https://url.spec.whatwg.org/#concept-url-origin
|
||||||
HTML::Origin url_origin(URL::URL const& url)
|
URL::Origin url_origin(URL::URL const& url)
|
||||||
{
|
{
|
||||||
// FIXME: We should probably have an extended version of URL::URL for LibWeb instead of standalone functions like this.
|
// FIXME: We should probably have an extended version of URL::URL for LibWeb instead of standalone functions like this.
|
||||||
|
|
||||||
|
@ -497,14 +497,14 @@ HTML::Origin url_origin(URL::URL const& url)
|
||||||
|
|
||||||
// 3. If pathURL is failure, then return a new opaque origin.
|
// 3. If pathURL is failure, then return a new opaque origin.
|
||||||
if (!path_url.is_valid())
|
if (!path_url.is_valid())
|
||||||
return HTML::Origin {};
|
return URL::Origin {};
|
||||||
|
|
||||||
// 4. If pathURL’s scheme is "http", "https", or "file", then return pathURL’s origin.
|
// 4. If pathURL’s scheme is "http", "https", or "file", then return pathURL’s origin.
|
||||||
if (path_url.scheme().is_one_of("http"sv, "https"sv, "file"sv))
|
if (path_url.scheme().is_one_of("http"sv, "https"sv, "file"sv))
|
||||||
return url_origin(path_url);
|
return url_origin(path_url);
|
||||||
|
|
||||||
// 5. Return a new opaque origin.
|
// 5. Return a new opaque origin.
|
||||||
return HTML::Origin {};
|
return URL::Origin {};
|
||||||
}
|
}
|
||||||
|
|
||||||
// -> "ftp"
|
// -> "ftp"
|
||||||
|
@ -514,7 +514,7 @@ HTML::Origin url_origin(URL::URL const& url)
|
||||||
// -> "wss"
|
// -> "wss"
|
||||||
if (url.scheme().is_one_of("ftp"sv, "http"sv, "https"sv, "ws"sv, "wss"sv)) {
|
if (url.scheme().is_one_of("ftp"sv, "http"sv, "https"sv, "ws"sv, "wss"sv)) {
|
||||||
// Return the tuple origin (url’s scheme, url’s host, url’s port, null).
|
// Return the tuple origin (url’s scheme, url’s host, url’s port, null).
|
||||||
return HTML::Origin(url.scheme().to_byte_string(), url.host(), url.port().value_or(0));
|
return URL::Origin(url.scheme().to_byte_string(), url.host(), url.port().value_or(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
// -> "file"
|
// -> "file"
|
||||||
|
@ -522,12 +522,12 @@ HTML::Origin url_origin(URL::URL const& url)
|
||||||
if (url.scheme() == "file"sv || url.scheme() == "resource"sv) {
|
if (url.scheme() == "file"sv || url.scheme() == "resource"sv) {
|
||||||
// Unfortunate as it is, this is left as an exercise to the reader. When in doubt, return a new opaque origin.
|
// Unfortunate as it is, this is left as an exercise to the reader. When in doubt, return a new opaque origin.
|
||||||
// Note: We must return an origin with the `file://' protocol for `file://' iframes to work from `file://' pages.
|
// Note: We must return an origin with the `file://' protocol for `file://' iframes to work from `file://' pages.
|
||||||
return HTML::Origin(url.scheme().to_byte_string(), String {}, 0);
|
return URL::Origin(url.scheme().to_byte_string(), String {}, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -> Otherwise
|
// -> Otherwise
|
||||||
// Return a new opaque origin.
|
// Return a new opaque origin.
|
||||||
return HTML::Origin {};
|
return URL::Origin {};
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://url.spec.whatwg.org/#concept-domain
|
// https://url.spec.whatwg.org/#concept-domain
|
||||||
|
|
|
@ -92,7 +92,7 @@ private:
|
||||||
JS::NonnullGCPtr<URLSearchParams> m_query;
|
JS::NonnullGCPtr<URLSearchParams> m_query;
|
||||||
};
|
};
|
||||||
|
|
||||||
HTML::Origin url_origin(URL::URL const&);
|
URL::Origin url_origin(URL::URL const&);
|
||||||
bool host_is_domain(URL::Host const&);
|
bool host_is_domain(URL::Host const&);
|
||||||
|
|
||||||
// https://url.spec.whatwg.org/#potentially-strip-trailing-spaces-from-an-opaque-path
|
// https://url.spec.whatwg.org/#potentially-strip-trailing-spaces-from-an-opaque-path
|
||||||
|
|
|
@ -69,8 +69,8 @@ bool tao_check(Infrastructure::Request const& request, Infrastructure::Response
|
||||||
// validates the results of the TAO check, the nested document would still have access to the full timing
|
// validates the results of the TAO check, the nested document would still have access to the full timing
|
||||||
// information, but the container document would not.
|
// information, but the container document would not.
|
||||||
if (request.mode() == Infrastructure::Request::Mode::Navigate
|
if (request.mode() == Infrastructure::Request::Mode::Navigate
|
||||||
&& request.origin().has<HTML::Origin>()
|
&& request.origin().has<URL::Origin>()
|
||||||
&& !DOMURL::url_origin(request.current_url()).is_same_origin(request.origin().get<HTML::Origin>())) {
|
&& !DOMURL::url_origin(request.current_url()).is_same_origin(request.origin().get<URL::Origin>())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Infrastructure::FetchController>> fetch(JS:
|
||||||
// - request’s unsafe-request flag is not set or request’s header list is empty
|
// - request’s unsafe-request flag is not set or request’s header list is empty
|
||||||
&& (!request.unsafe_request() || request.header_list()->is_empty())) {
|
&& (!request.unsafe_request() || request.header_list()->is_empty())) {
|
||||||
// 1. Assert: request’s origin is same origin with request’s client’s origin.
|
// 1. Assert: request’s origin is same origin with request’s client’s origin.
|
||||||
VERIFY(request.origin().has<HTML::Origin>() && request.origin().get<HTML::Origin>().is_same_origin(request.client()->origin()));
|
VERIFY(request.origin().has<URL::Origin>() && request.origin().get<URL::Origin>().is_same_origin(request.client()->origin()));
|
||||||
|
|
||||||
// 2. Let onPreloadedResponseAvailable be an algorithm that runs the following step given a response
|
// 2. Let onPreloadedResponseAvailable be an algorithm that runs the following step given a response
|
||||||
// response: set fetchParams’s preloaded response candidate to response.
|
// response: set fetchParams’s preloaded response candidate to response.
|
||||||
|
@ -353,7 +353,7 @@ WebIDL::ExceptionOr<JS::GCPtr<PendingResponse>> main_fetch(JS::Realm& realm, Inf
|
||||||
// -> request’s current URL’s scheme is "data"
|
// -> request’s current URL’s scheme is "data"
|
||||||
// -> request’s mode is "navigate" or "websocket"
|
// -> request’s mode is "navigate" or "websocket"
|
||||||
else if (
|
else if (
|
||||||
(request->origin().has<HTML::Origin>() && DOMURL::url_origin(request->current_url()).is_same_origin(request->origin().get<HTML::Origin>()) && request->response_tainting() == Infrastructure::Request::ResponseTainting::Basic)
|
(request->origin().has<URL::Origin>() && DOMURL::url_origin(request->current_url()).is_same_origin(request->origin().get<URL::Origin>()) && request->response_tainting() == Infrastructure::Request::ResponseTainting::Basic)
|
||||||
|| request->current_url().scheme() == "data"sv
|
|| request->current_url().scheme() == "data"sv
|
||||||
|| (request->mode() == Infrastructure::Request::Mode::Navigate || request->mode() == Infrastructure::Request::Mode::WebSocket)) {
|
|| (request->mode() == Infrastructure::Request::Mode::Navigate || request->mode() == Infrastructure::Request::Mode::WebSocket)) {
|
||||||
// 1. Set request’s response tainting to "basic".
|
// 1. Set request’s response tainting to "basic".
|
||||||
|
@ -919,7 +919,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> scheme_fetch(JS::Realm& r
|
||||||
else if (request->current_url().scheme() == "file"sv || request->current_url().scheme() == "resource"sv) {
|
else if (request->current_url().scheme() == "file"sv || request->current_url().scheme() == "resource"sv) {
|
||||||
// For now, unfortunate as it is, file: URLs are left as an exercise for the reader.
|
// For now, unfortunate as it is, file: URLs are left as an exercise for the reader.
|
||||||
// When in doubt, return a network error.
|
// When in doubt, return a network error.
|
||||||
if (request->origin().has<HTML::Origin>() && (request->origin().get<HTML::Origin>().is_opaque() || request->origin().get<HTML::Origin>().scheme() == "file"sv || request->origin().get<HTML::Origin>().scheme() == "resource"sv))
|
if (request->origin().has<URL::Origin>() && (request->origin().get<URL::Origin>().is_opaque() || request->origin().get<URL::Origin>().scheme() == "file"sv || request->origin().get<URL::Origin>().scheme() == "resource"sv))
|
||||||
return TRY(nonstandard_resource_loader_file_or_http_network_fetch(realm, fetch_params));
|
return TRY(nonstandard_resource_loader_file_or_http_network_fetch(realm, fetch_params));
|
||||||
else
|
else
|
||||||
return PendingResponse::create(vm, request, Infrastructure::Response::network_error(vm, "Request with 'file:' or 'resource:' URL blocked"sv));
|
return PendingResponse::create(vm, request, Infrastructure::Response::network_error(vm, "Request with 'file:' or 'resource:' URL blocked"sv));
|
||||||
|
@ -1200,8 +1200,8 @@ WebIDL::ExceptionOr<JS::GCPtr<PendingResponse>> http_redirect_fetch(JS::Realm& r
|
||||||
// locationURL’s origin, then return a network error.
|
// locationURL’s origin, then return a network error.
|
||||||
if (request->mode() == Infrastructure::Request::Mode::CORS
|
if (request->mode() == Infrastructure::Request::Mode::CORS
|
||||||
&& location_url.includes_credentials()
|
&& location_url.includes_credentials()
|
||||||
&& request->origin().has<HTML::Origin>()
|
&& request->origin().has<URL::Origin>()
|
||||||
&& !request->origin().get<HTML::Origin>().is_same_origin(DOMURL::url_origin(location_url))) {
|
&& !request->origin().get<URL::Origin>().is_same_origin(DOMURL::url_origin(location_url))) {
|
||||||
return PendingResponse::create(vm, request, Infrastructure::Response::network_error(vm, "Request with 'cors' mode and different URL and request origin must not include credentials in redirect URL"sv));
|
return PendingResponse::create(vm, request, Infrastructure::Response::network_error(vm, "Request with 'cors' mode and different URL and request origin must not include credentials in redirect URL"sv));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -172,7 +172,7 @@ bool Request::has_redirect_tainted_origin() const
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. If url’s origin is not same origin with lastURL’s origin and request’s origin is not same origin with lastURL’s origin, then return true.
|
// 2. If url’s origin is not same origin with lastURL’s origin and request’s origin is not same origin with lastURL’s origin, then return true.
|
||||||
auto const* request_origin = m_origin.get_pointer<HTML::Origin>();
|
auto const* request_origin = m_origin.get_pointer<URL::Origin>();
|
||||||
if (!DOMURL::url_origin(url).is_same_origin(DOMURL::url_origin(*last_url))
|
if (!DOMURL::url_origin(url).is_same_origin(DOMURL::url_origin(*last_url))
|
||||||
&& (request_origin == nullptr || !request_origin->is_same_origin(DOMURL::url_origin(*last_url)))) {
|
&& (request_origin == nullptr || !request_origin->is_same_origin(DOMURL::url_origin(*last_url)))) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -194,7 +194,7 @@ String Request::serialize_origin() const
|
||||||
return "null"_string;
|
return "null"_string;
|
||||||
|
|
||||||
// 2. Return request’s origin, serialized.
|
// 2. Return request’s origin, serialized.
|
||||||
return MUST(String::from_byte_string(m_origin.get<HTML::Origin>().serialize()));
|
return MUST(String::from_byte_string(m_origin.get<URL::Origin>().serialize()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://fetch.spec.whatwg.org/#byte-serializing-a-request-origin
|
// https://fetch.spec.whatwg.org/#byte-serializing-a-request-origin
|
||||||
|
@ -321,14 +321,14 @@ void Request::add_origin_header()
|
||||||
case ReferrerPolicy::ReferrerPolicy::StrictOriginWhenCrossOrigin:
|
case ReferrerPolicy::ReferrerPolicy::StrictOriginWhenCrossOrigin:
|
||||||
// If request’s origin is a tuple origin, its scheme is "https", and request’s current URL’s scheme is
|
// If request’s origin is a tuple origin, its scheme is "https", and request’s current URL’s scheme is
|
||||||
// not "https", then set serializedOrigin to `null`.
|
// not "https", then set serializedOrigin to `null`.
|
||||||
if (m_origin.has<HTML::Origin>() && m_origin.get<HTML::Origin>().scheme() == "https"sv && current_url().scheme() != "https"sv)
|
if (m_origin.has<URL::Origin>() && m_origin.get<URL::Origin>().scheme() == "https"sv && current_url().scheme() != "https"sv)
|
||||||
serialized_origin = MUST(ByteBuffer::copy("null"sv.bytes()));
|
serialized_origin = MUST(ByteBuffer::copy("null"sv.bytes()));
|
||||||
break;
|
break;
|
||||||
// -> "same-origin"
|
// -> "same-origin"
|
||||||
case ReferrerPolicy::ReferrerPolicy::SameOrigin:
|
case ReferrerPolicy::ReferrerPolicy::SameOrigin:
|
||||||
// If request’s origin is not same origin with request’s current URL’s origin, then set serializedOrigin
|
// If request’s origin is not same origin with request’s current URL’s origin, then set serializedOrigin
|
||||||
// to `null`.
|
// to `null`.
|
||||||
if (m_origin.has<HTML::Origin>() && !m_origin.get<HTML::Origin>().is_same_origin(DOMURL::url_origin(current_url())))
|
if (m_origin.has<URL::Origin>() && !m_origin.get<URL::Origin>().is_same_origin(DOMURL::url_origin(current_url())))
|
||||||
serialized_origin = MUST(ByteBuffer::copy("null"sv.bytes()));
|
serialized_origin = MUST(ByteBuffer::copy("null"sv.bytes()));
|
||||||
break;
|
break;
|
||||||
// -> Otherwise
|
// -> Otherwise
|
||||||
|
@ -364,7 +364,7 @@ bool Request::cross_origin_embedder_policy_allows_credentials() const
|
||||||
|
|
||||||
// 4. If request’s origin is same origin with request’s current URL’s origin and request does not have a redirect-tainted origin, then return true.
|
// 4. If request’s origin is same origin with request’s current URL’s origin and request does not have a redirect-tainted origin, then return true.
|
||||||
// 5. Return false.
|
// 5. Return false.
|
||||||
auto const* request_origin = m_origin.get_pointer<HTML::Origin>();
|
auto const* request_origin = m_origin.get_pointer<URL::Origin>();
|
||||||
if (request_origin == nullptr)
|
if (request_origin == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,10 @@
|
||||||
#include <LibJS/Forward.h>
|
#include <LibJS/Forward.h>
|
||||||
#include <LibJS/Heap/Cell.h>
|
#include <LibJS/Heap/Cell.h>
|
||||||
#include <LibJS/Heap/GCPtr.h>
|
#include <LibJS/Heap/GCPtr.h>
|
||||||
|
#include <LibURL/Origin.h>
|
||||||
#include <LibURL/URL.h>
|
#include <LibURL/URL.h>
|
||||||
#include <LibWeb/Fetch/Infrastructure/HTTP/Bodies.h>
|
#include <LibWeb/Fetch/Infrastructure/HTTP/Bodies.h>
|
||||||
#include <LibWeb/Fetch/Infrastructure/HTTP/Headers.h>
|
#include <LibWeb/Fetch/Infrastructure/HTTP/Headers.h>
|
||||||
#include <LibWeb/HTML/Origin.h>
|
|
||||||
#include <LibWeb/HTML/PolicyContainers.h>
|
#include <LibWeb/HTML/PolicyContainers.h>
|
||||||
#include <LibWeb/HTML/Scripting/Environments.h>
|
#include <LibWeb/HTML/Scripting/Environments.h>
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ public:
|
||||||
struct InternalPriority { };
|
struct InternalPriority { };
|
||||||
|
|
||||||
using BodyType = Variant<Empty, ByteBuffer, JS::NonnullGCPtr<Body>>;
|
using BodyType = Variant<Empty, ByteBuffer, JS::NonnullGCPtr<Body>>;
|
||||||
using OriginType = Variant<Origin, HTML::Origin>;
|
using OriginType = Variant<Origin, URL::Origin>;
|
||||||
using PolicyContainerType = Variant<PolicyContainer, HTML::PolicyContainer>;
|
using PolicyContainerType = Variant<PolicyContainer, HTML::PolicyContainer>;
|
||||||
using ReferrerType = Variant<Referrer, URL::URL>;
|
using ReferrerType = Variant<Referrer, URL::URL>;
|
||||||
using ReservedClientType = JS::GCPtr<HTML::Environment>;
|
using ReservedClientType = JS::GCPtr<HTML::Environment>;
|
||||||
|
|
|
@ -6,14 +6,14 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <LibURL/Origin.h>
|
||||||
#include <LibWeb/Forward.h>
|
#include <LibWeb/Forward.h>
|
||||||
#include <LibWeb/HTML/Origin.h>
|
|
||||||
|
|
||||||
namespace Web::Fetch::Infrastructure {
|
namespace Web::Fetch::Infrastructure {
|
||||||
|
|
||||||
// https://fetch.spec.whatwg.org/#network-partition-key
|
// https://fetch.spec.whatwg.org/#network-partition-key
|
||||||
struct NetworkPartitionKey {
|
struct NetworkPartitionKey {
|
||||||
HTML::Origin top_level_origin;
|
URL::Origin top_level_origin;
|
||||||
// FIXME: See https://github.com/whatwg/fetch/issues/1035
|
// FIXME: See https://github.com/whatwg/fetch/issues/1035
|
||||||
// This is the document origin in other browsers
|
// This is the document origin in other browsers
|
||||||
void* second_key = nullptr;
|
void* second_key = nullptr;
|
||||||
|
@ -32,6 +32,6 @@ class AK::Traits<Web::Fetch::Infrastructure::NetworkPartitionKey> : public Defau
|
||||||
public:
|
public:
|
||||||
static unsigned hash(Web::Fetch::Infrastructure::NetworkPartitionKey const& partition_key)
|
static unsigned hash(Web::Fetch::Infrastructure::NetworkPartitionKey const& partition_key)
|
||||||
{
|
{
|
||||||
return ::AK::Traits<Web::HTML::Origin>::hash(partition_key.top_level_origin);
|
return ::AK::Traits<URL::Origin>::hash(partition_key.top_level_origin);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,12 +7,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
|
#include <LibURL/Origin.h>
|
||||||
#include <LibURL/URL.h>
|
#include <LibURL/URL.h>
|
||||||
#include <LibWeb/Crypto/Crypto.h>
|
#include <LibWeb/Crypto/Crypto.h>
|
||||||
#include <LibWeb/DOM/Document.h>
|
#include <LibWeb/DOM/Document.h>
|
||||||
#include <LibWeb/FileAPI/Blob.h>
|
#include <LibWeb/FileAPI/Blob.h>
|
||||||
#include <LibWeb/FileAPI/BlobURLStore.h>
|
#include <LibWeb/FileAPI/BlobURLStore.h>
|
||||||
#include <LibWeb/HTML/Origin.h>
|
|
||||||
#include <LibWeb/HTML/Scripting/Environments.h>
|
#include <LibWeb/HTML/Scripting/Environments.h>
|
||||||
|
|
||||||
namespace Web::FileAPI {
|
namespace Web::FileAPI {
|
||||||
|
|
|
@ -484,7 +484,6 @@ class NavigationDestination;
|
||||||
class NavigationHistoryEntry;
|
class NavigationHistoryEntry;
|
||||||
class NavigationTransition;
|
class NavigationTransition;
|
||||||
class Navigator;
|
class Navigator;
|
||||||
class Origin;
|
|
||||||
class PageTransitionEvent;
|
class PageTransitionEvent;
|
||||||
class Path2D;
|
class Path2D;
|
||||||
class Plugin;
|
class Plugin;
|
||||||
|
|
|
@ -59,16 +59,16 @@ bool url_matches_about_srcdoc(URL::URL const& url)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/document-sequences.html#determining-the-origin
|
// https://html.spec.whatwg.org/multipage/document-sequences.html#determining-the-origin
|
||||||
HTML::Origin determine_the_origin(Optional<URL::URL> const& url, SandboxingFlagSet sandbox_flags, Optional<HTML::Origin> source_origin)
|
URL::Origin determine_the_origin(Optional<URL::URL> const& url, SandboxingFlagSet sandbox_flags, Optional<URL::Origin> source_origin)
|
||||||
{
|
{
|
||||||
// 1. If sandboxFlags has its sandboxed origin browsing context flag set, then return a new opaque origin.
|
// 1. If sandboxFlags has its sandboxed origin browsing context flag set, then return a new opaque origin.
|
||||||
if (has_flag(sandbox_flags, SandboxingFlagSet::SandboxedOrigin)) {
|
if (has_flag(sandbox_flags, SandboxingFlagSet::SandboxedOrigin)) {
|
||||||
return HTML::Origin {};
|
return URL::Origin {};
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. If url is null, then return a new opaque origin.
|
// 2. If url is null, then return a new opaque origin.
|
||||||
if (!url.has_value()) {
|
if (!url.has_value()) {
|
||||||
return HTML::Origin {};
|
return URL::Origin {};
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. If url is about:srcdoc, then:
|
// 3. If url is about:srcdoc, then:
|
||||||
|
@ -144,7 +144,7 @@ WebIDL::ExceptionOr<BrowsingContext::BrowsingContextAndDocument> BrowsingContext
|
||||||
[[maybe_unused]] auto unsafe_context_creation_time = HighResolutionTime::unsafe_shared_current_time();
|
[[maybe_unused]] auto unsafe_context_creation_time = HighResolutionTime::unsafe_shared_current_time();
|
||||||
|
|
||||||
// 3. Let creatorOrigin be null.
|
// 3. Let creatorOrigin be null.
|
||||||
Optional<Origin> creator_origin = {};
|
Optional<URL::Origin> creator_origin = {};
|
||||||
|
|
||||||
// 4. Let creatorBaseURL be null.
|
// 4. Let creatorBaseURL be null.
|
||||||
Optional<URL::URL> creator_base_url = {};
|
Optional<URL::URL> creator_base_url = {};
|
||||||
|
|
|
@ -15,10 +15,10 @@
|
||||||
#include <LibGfx/Size.h>
|
#include <LibGfx/Size.h>
|
||||||
#include <LibJS/Forward.h>
|
#include <LibJS/Forward.h>
|
||||||
#include <LibJS/Heap/Cell.h>
|
#include <LibJS/Heap/Cell.h>
|
||||||
|
#include <LibURL/Origin.h>
|
||||||
#include <LibWeb/DOM/Position.h>
|
#include <LibWeb/DOM/Position.h>
|
||||||
#include <LibWeb/HTML/ActivateTab.h>
|
#include <LibWeb/HTML/ActivateTab.h>
|
||||||
#include <LibWeb/HTML/NavigableContainer.h>
|
#include <LibWeb/HTML/NavigableContainer.h>
|
||||||
#include <LibWeb/HTML/Origin.h>
|
|
||||||
#include <LibWeb/HTML/SandboxingFlagSet.h>
|
#include <LibWeb/HTML/SandboxingFlagSet.h>
|
||||||
#include <LibWeb/HTML/SessionHistoryEntry.h>
|
#include <LibWeb/HTML/SessionHistoryEntry.h>
|
||||||
#include <LibWeb/HTML/TokenizedFeatures.h>
|
#include <LibWeb/HTML/TokenizedFeatures.h>
|
||||||
|
@ -145,7 +145,7 @@ private:
|
||||||
JS::GCPtr<BrowsingContext> m_opener_browsing_context;
|
JS::GCPtr<BrowsingContext> m_opener_browsing_context;
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/document-sequences.html#opener-origin-at-creation
|
// https://html.spec.whatwg.org/multipage/document-sequences.html#opener-origin-at-creation
|
||||||
Optional<HTML::Origin> m_opener_origin_at_creation;
|
Optional<URL::Origin> m_opener_origin_at_creation;
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/browsers.html#is-popup
|
// https://html.spec.whatwg.org/multipage/browsers.html#is-popup
|
||||||
TokenizedFeature::Popup m_is_popup { TokenizedFeature::Popup::No };
|
TokenizedFeature::Popup m_is_popup { TokenizedFeature::Popup::No };
|
||||||
|
@ -168,7 +168,7 @@ private:
|
||||||
JS::GCPtr<BrowsingContext> m_previous_sibling;
|
JS::GCPtr<BrowsingContext> m_previous_sibling;
|
||||||
};
|
};
|
||||||
|
|
||||||
HTML::Origin determine_the_origin(Optional<URL::URL> const&, SandboxingFlagSet, Optional<HTML::Origin> source_origin);
|
URL::Origin determine_the_origin(Optional<URL::URL> const&, SandboxingFlagSet, Optional<URL::Origin> source_origin);
|
||||||
|
|
||||||
SandboxingFlagSet determine_the_creation_sandboxing_flags(BrowsingContext const&, JS::GCPtr<DOM::Element> embedder);
|
SandboxingFlagSet determine_the_creation_sandboxing_flags(BrowsingContext const&, JS::GCPtr<DOM::Element> embedder);
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <LibURL/Origin.h>
|
||||||
#include <LibURL/URL.h>
|
#include <LibURL/URL.h>
|
||||||
#include <LibWeb/HTML/CrossOrigin/OpenerPolicy.h>
|
#include <LibWeb/HTML/CrossOrigin/OpenerPolicy.h>
|
||||||
#include <LibWeb/HTML/Origin.h>
|
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ struct OpenerPolicyEnforcementResult {
|
||||||
URL::URL url;
|
URL::URL url;
|
||||||
|
|
||||||
// An origin origin.
|
// An origin origin.
|
||||||
Origin origin;
|
URL::Origin origin;
|
||||||
|
|
||||||
// An opener policy.
|
// An opener policy.
|
||||||
OpenerPolicy opener_policy;
|
OpenerPolicy opener_policy;
|
||||||
|
|
|
@ -7,11 +7,11 @@
|
||||||
#include <AK/Assertions.h>
|
#include <AK/Assertions.h>
|
||||||
#include <AK/Vector.h>
|
#include <AK/Vector.h>
|
||||||
#include <LibJS/Runtime/PropertyKey.h>
|
#include <LibJS/Runtime/PropertyKey.h>
|
||||||
|
#include <LibURL/Origin.h>
|
||||||
#include <LibWeb/DOM/Document.h>
|
#include <LibWeb/DOM/Document.h>
|
||||||
#include <LibWeb/HTML/BrowsingContext.h>
|
#include <LibWeb/HTML/BrowsingContext.h>
|
||||||
#include <LibWeb/HTML/CrossOrigin/AbstractOperations.h>
|
#include <LibWeb/HTML/CrossOrigin/AbstractOperations.h>
|
||||||
#include <LibWeb/HTML/CrossOrigin/Reporting.h>
|
#include <LibWeb/HTML/CrossOrigin/Reporting.h>
|
||||||
#include <LibWeb/HTML/Origin.h>
|
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ void check_if_access_between_two_browsing_contexts_should_be_reported(
|
||||||
auto* accessor_top_document = accessor.top_level_browsing_context()->active_document();
|
auto* accessor_top_document = accessor.top_level_browsing_context()->active_document();
|
||||||
|
|
||||||
// 4. Let accessorInclusiveAncestorOrigins be the list obtained by taking the origin of the active document of each of accessor's active document's inclusive ancestor navigables.
|
// 4. Let accessorInclusiveAncestorOrigins be the list obtained by taking the origin of the active document of each of accessor's active document's inclusive ancestor navigables.
|
||||||
Vector<Origin> accessor_inclusive_ancestor_origins = {};
|
Vector<URL::Origin> accessor_inclusive_ancestor_origins = {};
|
||||||
auto accessor_inclusive_ancestors = accessor.active_document()->ancestor_navigables();
|
auto accessor_inclusive_ancestors = accessor.active_document()->ancestor_navigables();
|
||||||
accessor_inclusive_ancestor_origins.ensure_capacity(accessor_inclusive_ancestors.size());
|
accessor_inclusive_ancestor_origins.ensure_capacity(accessor_inclusive_ancestors.size());
|
||||||
for (auto const& ancestor : accessor_inclusive_ancestors) {
|
for (auto const& ancestor : accessor_inclusive_ancestors) {
|
||||||
|
@ -52,7 +52,7 @@ void check_if_access_between_two_browsing_contexts_should_be_reported(
|
||||||
auto* accessed_top_document = accessed->top_level_browsing_context()->active_document();
|
auto* accessed_top_document = accessed->top_level_browsing_context()->active_document();
|
||||||
|
|
||||||
// 6. Let accessedInclusiveAncestorOrigins be the list obtained by taking the origin of the active document of each of accessed's active document's inclusive ancestor navigables.
|
// 6. Let accessedInclusiveAncestorOrigins be the list obtained by taking the origin of the active document of each of accessed's active document's inclusive ancestor navigables.
|
||||||
Vector<Origin> accessed_inclusive_ancestor_origins = {};
|
Vector<URL::Origin> accessed_inclusive_ancestor_origins = {};
|
||||||
auto accessed_inclusive_ancestors = accessed->active_document()->ancestor_navigables();
|
auto accessed_inclusive_ancestors = accessed->active_document()->ancestor_navigables();
|
||||||
accessed_inclusive_ancestor_origins.ensure_capacity(accessed_inclusive_ancestors.size());
|
accessed_inclusive_ancestor_origins.ensure_capacity(accessed_inclusive_ancestors.size());
|
||||||
for (auto const& ancestor : accessed_inclusive_ancestors) {
|
for (auto const& ancestor : accessed_inclusive_ancestors) {
|
||||||
|
|
|
@ -8,10 +8,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <LibJS/Heap/Cell.h>
|
#include <LibJS/Heap/Cell.h>
|
||||||
|
#include <LibURL/Origin.h>
|
||||||
#include <LibURL/URL.h>
|
#include <LibURL/URL.h>
|
||||||
#include <LibWeb/Fetch/Infrastructure/HTTP/Requests.h>
|
#include <LibWeb/Fetch/Infrastructure/HTTP/Requests.h>
|
||||||
#include <LibWeb/Forward.h>
|
#include <LibWeb/Forward.h>
|
||||||
#include <LibWeb/HTML/Origin.h>
|
|
||||||
#include <LibWeb/HTML/POSTResource.h>
|
#include <LibWeb/HTML/POSTResource.h>
|
||||||
#include <LibWeb/HTML/PolicyContainers.h>
|
#include <LibWeb/HTML/PolicyContainers.h>
|
||||||
#include <LibWeb/ReferrerPolicy/ReferrerPolicy.h>
|
#include <LibWeb/ReferrerPolicy/ReferrerPolicy.h>
|
||||||
|
@ -49,11 +49,11 @@ public:
|
||||||
[[nodiscard]] ReferrerPolicy::ReferrerPolicy request_referrer_policy() const { return m_request_referrer_policy; }
|
[[nodiscard]] ReferrerPolicy::ReferrerPolicy request_referrer_policy() const { return m_request_referrer_policy; }
|
||||||
void set_request_referrer_policy(ReferrerPolicy::ReferrerPolicy request_referrer_policy) { m_request_referrer_policy = move(request_referrer_policy); }
|
void set_request_referrer_policy(ReferrerPolicy::ReferrerPolicy request_referrer_policy) { m_request_referrer_policy = move(request_referrer_policy); }
|
||||||
|
|
||||||
[[nodiscard]] Optional<HTML::Origin> initiator_origin() const { return m_initiator_origin; }
|
[[nodiscard]] Optional<URL::Origin> initiator_origin() const { return m_initiator_origin; }
|
||||||
void set_initiator_origin(Optional<HTML::Origin> initiator_origin) { m_initiator_origin = move(initiator_origin); }
|
void set_initiator_origin(Optional<URL::Origin> initiator_origin) { m_initiator_origin = move(initiator_origin); }
|
||||||
|
|
||||||
[[nodiscard]] Optional<HTML::Origin> origin() const { return m_origin; }
|
[[nodiscard]] Optional<URL::Origin> origin() const { return m_origin; }
|
||||||
void set_origin(Optional<HTML::Origin> origin) { m_origin = move(origin); }
|
void set_origin(Optional<URL::Origin> origin) { m_origin = move(origin); }
|
||||||
|
|
||||||
[[nodiscard]] Optional<URL::URL> const& about_base_url() const { return m_about_base_url; }
|
[[nodiscard]] Optional<URL::URL> const& about_base_url() const { return m_about_base_url; }
|
||||||
void set_about_base_url(Optional<URL::URL> url) { m_about_base_url = move(url); }
|
void set_about_base_url(Optional<URL::URL> url) { m_about_base_url = move(url); }
|
||||||
|
@ -91,10 +91,10 @@ private:
|
||||||
ReferrerPolicy::ReferrerPolicy m_request_referrer_policy { ReferrerPolicy::DEFAULT_REFERRER_POLICY };
|
ReferrerPolicy::ReferrerPolicy m_request_referrer_policy { ReferrerPolicy::DEFAULT_REFERRER_POLICY };
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#document-state-initiator-origin
|
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#document-state-initiator-origin
|
||||||
Optional<HTML::Origin> m_initiator_origin;
|
Optional<URL::Origin> m_initiator_origin;
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#document-state-origin
|
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#document-state-origin
|
||||||
Optional<HTML::Origin> m_origin;
|
Optional<URL::Origin> m_origin;
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#document-state-about-base-url
|
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#document-state-about-base-url
|
||||||
Optional<URL::URL> m_about_base_url = {};
|
Optional<URL::URL> m_about_base_url = {};
|
||||||
|
|
|
@ -5,13 +5,13 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <LibURL/Origin.h>
|
||||||
#include <LibWeb/Bindings/HTMLIFrameElementPrototype.h>
|
#include <LibWeb/Bindings/HTMLIFrameElementPrototype.h>
|
||||||
#include <LibWeb/DOM/Document.h>
|
#include <LibWeb/DOM/Document.h>
|
||||||
#include <LibWeb/DOM/Event.h>
|
#include <LibWeb/DOM/Event.h>
|
||||||
#include <LibWeb/HTML/BrowsingContext.h>
|
#include <LibWeb/HTML/BrowsingContext.h>
|
||||||
#include <LibWeb/HTML/HTMLIFrameElement.h>
|
#include <LibWeb/HTML/HTMLIFrameElement.h>
|
||||||
#include <LibWeb/HTML/Navigable.h>
|
#include <LibWeb/HTML/Navigable.h>
|
||||||
#include <LibWeb/HTML/Origin.h>
|
|
||||||
#include <LibWeb/HTML/Parser/HTMLParser.h>
|
#include <LibWeb/HTML/Parser/HTMLParser.h>
|
||||||
#include <LibWeb/Layout/FrameBox.h>
|
#include <LibWeb/Layout/FrameBox.h>
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ private:
|
||||||
URL::URL base_url;
|
URL::URL base_url;
|
||||||
// origin
|
// origin
|
||||||
// An origin
|
// An origin
|
||||||
HTML::Origin origin;
|
URL::Origin origin;
|
||||||
// environment
|
// environment
|
||||||
// An environment
|
// An environment
|
||||||
JS::GCPtr<HTML::EnvironmentSettingsObject> environment;
|
JS::GCPtr<HTML::EnvironmentSettingsObject> environment;
|
||||||
|
|
|
@ -26,7 +26,7 @@ u32 ListOfAvailableImages::Key::hash() const
|
||||||
u32 mode_hash = static_cast<u32>(mode);
|
u32 mode_hash = static_cast<u32>(mode);
|
||||||
u32 origin_hash = 0;
|
u32 origin_hash = 0;
|
||||||
if (origin.has_value())
|
if (origin.has_value())
|
||||||
origin_hash = Traits<HTML::Origin>::hash(origin.value());
|
origin_hash = Traits<URL::Origin>::hash(origin.value());
|
||||||
cached_hash = pair_int_hash(url_hash, pair_int_hash(mode_hash, origin_hash));
|
cached_hash = pair_int_hash(url_hash, pair_int_hash(mode_hash, origin_hash));
|
||||||
}
|
}
|
||||||
return cached_hash.value();
|
return cached_hash.value();
|
||||||
|
|
|
@ -8,10 +8,10 @@
|
||||||
|
|
||||||
#include <AK/HashMap.h>
|
#include <AK/HashMap.h>
|
||||||
#include <LibJS/Heap/Cell.h>
|
#include <LibJS/Heap/Cell.h>
|
||||||
|
#include <LibURL/Origin.h>
|
||||||
#include <LibURL/URL.h>
|
#include <LibURL/URL.h>
|
||||||
#include <LibWeb/Forward.h>
|
#include <LibWeb/Forward.h>
|
||||||
#include <LibWeb/HTML/CORSSettingAttribute.h>
|
#include <LibWeb/HTML/CORSSettingAttribute.h>
|
||||||
#include <LibWeb/HTML/Origin.h>
|
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ public:
|
||||||
struct Key {
|
struct Key {
|
||||||
URL::URL url;
|
URL::URL url;
|
||||||
HTML::CORSSettingAttribute mode;
|
HTML::CORSSettingAttribute mode;
|
||||||
Optional<HTML::Origin> origin;
|
Optional<URL::Origin> origin;
|
||||||
|
|
||||||
[[nodiscard]] bool operator==(Key const& other) const;
|
[[nodiscard]] bool operator==(Key const& other) const;
|
||||||
[[nodiscard]] u32 hash() const;
|
[[nodiscard]] u32 hash() const;
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include <AK/RefCounted.h>
|
#include <AK/RefCounted.h>
|
||||||
#include <AK/Weakable.h>
|
#include <AK/Weakable.h>
|
||||||
#include <LibCore/Socket.h>
|
#include <LibCore/Socket.h>
|
||||||
|
#include <LibIPC/File.h>
|
||||||
#include <LibWeb/Bindings/Transferable.h>
|
#include <LibWeb/Bindings/Transferable.h>
|
||||||
#include <LibWeb/DOM/EventTarget.h>
|
#include <LibWeb/DOM/EventTarget.h>
|
||||||
#include <LibWeb/Forward.h>
|
#include <LibWeb/Forward.h>
|
||||||
|
|
|
@ -779,7 +779,7 @@ static WebIDL::ExceptionOr<Navigable::NavigationParamsVariant> create_navigation
|
||||||
auto response_holder = ResponseHolder::create(vm);
|
auto response_holder = ResponseHolder::create(vm);
|
||||||
|
|
||||||
// 10. Let responseOrigin be null.
|
// 10. Let responseOrigin be null.
|
||||||
Optional<HTML::Origin> response_origin;
|
Optional<URL::Origin> response_origin;
|
||||||
|
|
||||||
// 11. Let fetchController be null.
|
// 11. Let fetchController be null.
|
||||||
JS::GCPtr<Fetch::Infrastructure::FetchController> fetch_controller = nullptr;
|
JS::GCPtr<Fetch::Infrastructure::FetchController> fetch_controller = nullptr;
|
||||||
|
@ -1537,7 +1537,7 @@ WebIDL::ExceptionOr<void> Navigable::navigate_to_a_fragment(URL::URL const& url,
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#evaluate-a-javascript:-url
|
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#evaluate-a-javascript:-url
|
||||||
WebIDL::ExceptionOr<JS::GCPtr<DOM::Document>> Navigable::evaluate_javascript_url(URL::URL const& url, Origin const& new_document_origin, String navigation_id)
|
WebIDL::ExceptionOr<JS::GCPtr<DOM::Document>> Navigable::evaluate_javascript_url(URL::URL const& url, URL::Origin const& new_document_origin, String navigation_id)
|
||||||
{
|
{
|
||||||
auto& vm = this->vm();
|
auto& vm = this->vm();
|
||||||
auto& realm = active_window()->realm();
|
auto& realm = active_window()->realm();
|
||||||
|
@ -1640,7 +1640,7 @@ WebIDL::ExceptionOr<JS::GCPtr<DOM::Document>> Navigable::evaluate_javascript_url
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate-to-a-javascript:-url
|
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate-to-a-javascript:-url
|
||||||
WebIDL::ExceptionOr<void> Navigable::navigate_to_a_javascript_url(URL::URL const& url, HistoryHandlingBehavior history_handling, Origin const& initiator_origin, CSPNavigationType csp_navigation_type, String navigation_id)
|
WebIDL::ExceptionOr<void> Navigable::navigate_to_a_javascript_url(URL::URL const& url, HistoryHandlingBehavior history_handling, URL::Origin const& initiator_origin, CSPNavigationType csp_navigation_type, String navigation_id)
|
||||||
{
|
{
|
||||||
// 1. Assert: historyHandling is "replace".
|
// 1. Assert: historyHandling is "replace".
|
||||||
VERIFY(history_handling == HistoryHandlingBehavior::Replace);
|
VERIFY(history_handling == HistoryHandlingBehavior::Replace);
|
||||||
|
|
|
@ -150,8 +150,8 @@ public:
|
||||||
|
|
||||||
WebIDL::ExceptionOr<void> navigate_to_a_fragment(URL::URL const&, HistoryHandlingBehavior, UserNavigationInvolvement, Optional<SerializationRecord> navigation_api_state, String navigation_id);
|
WebIDL::ExceptionOr<void> navigate_to_a_fragment(URL::URL const&, HistoryHandlingBehavior, UserNavigationInvolvement, Optional<SerializationRecord> navigation_api_state, String navigation_id);
|
||||||
|
|
||||||
WebIDL::ExceptionOr<JS::GCPtr<DOM::Document>> evaluate_javascript_url(URL::URL const&, Origin const& new_document_origin, String navigation_id);
|
WebIDL::ExceptionOr<JS::GCPtr<DOM::Document>> evaluate_javascript_url(URL::URL const&, URL::Origin const& new_document_origin, String navigation_id);
|
||||||
WebIDL::ExceptionOr<void> navigate_to_a_javascript_url(URL::URL const&, HistoryHandlingBehavior, Origin const& initiator_origin, CSPNavigationType csp_navigation_type, String navigation_id);
|
WebIDL::ExceptionOr<void> navigate_to_a_javascript_url(URL::URL const&, HistoryHandlingBehavior, URL::Origin const& initiator_origin, CSPNavigationType csp_navigation_type, String navigation_id);
|
||||||
|
|
||||||
bool allowed_by_sandboxing_to_navigate(Navigable const& target, SourceSnapshotParams const&);
|
bool allowed_by_sandboxing_to_navigate(Navigable const& target, SourceSnapshotParams const&);
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <LibURL/Origin.h>
|
||||||
#include <LibWeb/Bindings/MainThreadVM.h>
|
#include <LibWeb/Bindings/MainThreadVM.h>
|
||||||
#include <LibWeb/DOM/Document.h>
|
#include <LibWeb/DOM/Document.h>
|
||||||
#include <LibWeb/DOM/Event.h>
|
#include <LibWeb/DOM/Event.h>
|
||||||
|
@ -17,7 +18,6 @@
|
||||||
#include <LibWeb/HTML/Navigable.h>
|
#include <LibWeb/HTML/Navigable.h>
|
||||||
#include <LibWeb/HTML/NavigableContainer.h>
|
#include <LibWeb/HTML/NavigableContainer.h>
|
||||||
#include <LibWeb/HTML/NavigationParams.h>
|
#include <LibWeb/HTML/NavigationParams.h>
|
||||||
#include <LibWeb/HTML/Origin.h>
|
|
||||||
#include <LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.h>
|
#include <LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.h>
|
||||||
#include <LibWeb/HTML/TraversableNavigable.h>
|
#include <LibWeb/HTML/TraversableNavigable.h>
|
||||||
#include <LibWeb/HTML/Window.h>
|
#include <LibWeb/HTML/Window.h>
|
||||||
|
|
|
@ -9,12 +9,12 @@
|
||||||
#include <AK/Optional.h>
|
#include <AK/Optional.h>
|
||||||
#include <LibJS/Heap/CellAllocator.h>
|
#include <LibJS/Heap/CellAllocator.h>
|
||||||
#include <LibJS/Heap/GCPtr.h>
|
#include <LibJS/Heap/GCPtr.h>
|
||||||
|
#include <LibURL/Origin.h>
|
||||||
#include <LibWeb/Fetch/Infrastructure/HTTP/Requests.h>
|
#include <LibWeb/Fetch/Infrastructure/HTTP/Requests.h>
|
||||||
#include <LibWeb/Fetch/Infrastructure/HTTP/Responses.h>
|
#include <LibWeb/Fetch/Infrastructure/HTTP/Responses.h>
|
||||||
#include <LibWeb/Forward.h>
|
#include <LibWeb/Forward.h>
|
||||||
#include <LibWeb/HTML/CrossOrigin/OpenerPolicy.h>
|
#include <LibWeb/HTML/CrossOrigin/OpenerPolicy.h>
|
||||||
#include <LibWeb/HTML/CrossOrigin/OpenerPolicyEnforcementResult.h>
|
#include <LibWeb/HTML/CrossOrigin/OpenerPolicyEnforcementResult.h>
|
||||||
#include <LibWeb/HTML/Origin.h>
|
|
||||||
#include <LibWeb/HTML/PolicyContainers.h>
|
#include <LibWeb/HTML/PolicyContainers.h>
|
||||||
#include <LibWeb/HTML/SandboxingFlagSet.h>
|
#include <LibWeb/HTML/SandboxingFlagSet.h>
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ struct NavigationParams : JS::Cell {
|
||||||
Fetch::Infrastructure::Request::ReservedClientType reserved_environment;
|
Fetch::Infrastructure::Request::ReservedClientType reserved_environment;
|
||||||
|
|
||||||
// an origin to use for the new Document
|
// an origin to use for the new Document
|
||||||
Origin origin;
|
URL::Origin origin;
|
||||||
|
|
||||||
// a policy container to use for the new Document
|
// a policy container to use for the new Document
|
||||||
PolicyContainer policy_container;
|
PolicyContainer policy_container;
|
||||||
|
@ -90,7 +90,7 @@ struct NonFetchSchemeNavigationParams : JS::Cell {
|
||||||
bool source_snapshot_has_transient_activation = { false };
|
bool source_snapshot_has_transient_activation = { false };
|
||||||
|
|
||||||
// an origin possibly for use in a user-facing prompt to confirm the invocation of an external software package
|
// an origin possibly for use in a user-facing prompt to confirm the invocation of an external software package
|
||||||
Origin initiator_origin;
|
URL::Origin initiator_origin;
|
||||||
|
|
||||||
// FIXME: a NavigationTimingType used for creating the navigation timing entry for the new Document
|
// FIXME: a NavigationTimingType used for creating the navigation timing entry for the new Document
|
||||||
|
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2024, Andrew Kaster <akaster@serenityos.org>
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <LibIPC/Decoder.h>
|
|
||||||
#include <LibIPC/Encoder.h>
|
|
||||||
#include <LibWeb/HTML/Origin.h>
|
|
||||||
|
|
||||||
namespace IPC {
|
|
||||||
template<>
|
|
||||||
ErrorOr<void> encode(Encoder& encoder, Web::HTML::Origin const& origin)
|
|
||||||
{
|
|
||||||
TRY(encoder.encode<ByteString>(origin.scheme()));
|
|
||||||
TRY(encoder.encode(origin.host()));
|
|
||||||
TRY(encoder.encode(origin.port()));
|
|
||||||
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
template<>
|
|
||||||
ErrorOr<Web::HTML::Origin> decode(Decoder& decoder)
|
|
||||||
{
|
|
||||||
auto scheme = TRY(decoder.decode<ByteString>());
|
|
||||||
auto host = TRY(decoder.decode<URL::Host>());
|
|
||||||
u16 port = TRY(decoder.decode<u16>());
|
|
||||||
|
|
||||||
return Web::HTML::Origin { move(scheme), move(host), port };
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -25,14 +25,14 @@ public:
|
||||||
JS::GCPtr<DOM::Document> responsible_document() override { return nullptr; }
|
JS::GCPtr<DOM::Document> responsible_document() override { return nullptr; }
|
||||||
String api_url_character_encoding() override { return m_api_url_character_encoding; }
|
String api_url_character_encoding() override { return m_api_url_character_encoding; }
|
||||||
URL::URL api_base_url() override { return m_url; }
|
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; }
|
PolicyContainer policy_container() override { return m_policy_container; }
|
||||||
CanUseCrossOriginIsolatedAPIs cross_origin_isolated_capability() override { return CanUseCrossOriginIsolatedAPIs::No; }
|
CanUseCrossOriginIsolatedAPIs cross_origin_isolated_capability() override { return CanUseCrossOriginIsolatedAPIs::No; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
String m_api_url_character_encoding;
|
String m_api_url_character_encoding;
|
||||||
URL::URL m_url;
|
URL::URL m_url;
|
||||||
HTML::Origin m_origin;
|
URL::Origin m_origin;
|
||||||
HTML::PolicyContainer m_policy_container;
|
HTML::PolicyContainer m_policy_container;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <LibJS/Forward.h>
|
#include <LibJS/Forward.h>
|
||||||
|
#include <LibURL/Origin.h>
|
||||||
#include <LibURL/URL.h>
|
#include <LibURL/URL.h>
|
||||||
#include <LibWeb/Forward.h>
|
#include <LibWeb/Forward.h>
|
||||||
#include <LibWeb/HTML/EventLoop/EventLoop.h>
|
#include <LibWeb/HTML/EventLoop/EventLoop.h>
|
||||||
#include <LibWeb/HTML/Origin.h>
|
|
||||||
#include <LibWeb/HTML/Scripting/ModuleMap.h>
|
#include <LibWeb/HTML/Scripting/ModuleMap.h>
|
||||||
#include <LibWeb/HTML/Scripting/SerializedEnvironmentSettingsObject.h>
|
#include <LibWeb/HTML/Scripting/SerializedEnvironmentSettingsObject.h>
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ public:
|
||||||
URL::URL top_level_creation_url;
|
URL::URL top_level_creation_url;
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/webappapis.html#concept-environment-top-level-origin
|
// 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
|
// https://html.spec.whatwg.org/multipage/webappapis.html#concept-environment-target-browsing-context
|
||||||
JS::GCPtr<BrowsingContext> target_browsing_context;
|
JS::GCPtr<BrowsingContext> target_browsing_context;
|
||||||
|
@ -77,7 +77,7 @@ public:
|
||||||
virtual URL::URL api_base_url() = 0;
|
virtual URL::URL api_base_url() = 0;
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/webappapis.html#concept-settings-object-origin
|
// 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
|
// A policy container https://html.spec.whatwg.org/multipage/webappapis.html#concept-settings-object-policy-container
|
||||||
virtual PolicyContainer policy_container() = 0;
|
virtual PolicyContainer policy_container() = 0;
|
||||||
|
|
|
@ -34,10 +34,10 @@ ErrorOr<Web::HTML::SerializedEnvironmentSettingsObject> decode(Decoder& decoder)
|
||||||
object.id = TRY(decoder.decode<String>());
|
object.id = TRY(decoder.decode<String>());
|
||||||
object.creation_url = TRY(decoder.decode<URL::URL>());
|
object.creation_url = TRY(decoder.decode<URL::URL>());
|
||||||
object.top_level_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_url_character_encoding = TRY(decoder.decode<String>());
|
||||||
object.api_base_url = TRY(decoder.decode<URL::URL>());
|
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.policy_container = TRY(decoder.decode<Web::HTML::PolicyContainer>());
|
||||||
object.cross_origin_isolated_capability = TRY(decoder.decode<Web::HTML::CanUseCrossOriginIsolatedAPIs>());
|
object.cross_origin_isolated_capability = TRY(decoder.decode<Web::HTML::CanUseCrossOriginIsolatedAPIs>());
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
|
|
||||||
#include <AK/String.h>
|
#include <AK/String.h>
|
||||||
#include <LibIPC/Forward.h>
|
#include <LibIPC/Forward.h>
|
||||||
|
#include <LibURL/Origin.h>
|
||||||
#include <LibURL/URL.h>
|
#include <LibURL/URL.h>
|
||||||
#include <LibWeb/HTML/Origin.h>
|
|
||||||
#include <LibWeb/HTML/PolicyContainers.h>
|
#include <LibWeb/HTML/PolicyContainers.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
@ -23,11 +23,11 @@ struct SerializedEnvironmentSettingsObject {
|
||||||
String id;
|
String id;
|
||||||
URL::URL creation_url;
|
URL::URL creation_url;
|
||||||
URL::URL top_level_creation_url;
|
URL::URL top_level_creation_url;
|
||||||
Origin top_level_origin;
|
URL::Origin top_level_origin;
|
||||||
|
|
||||||
String api_url_character_encoding;
|
String api_url_character_encoding;
|
||||||
URL::URL api_base_url;
|
URL::URL api_base_url;
|
||||||
Origin origin;
|
URL::Origin origin;
|
||||||
PolicyContainer policy_container;
|
PolicyContainer policy_container;
|
||||||
CanUseCrossOriginIsolatedAPIs cross_origin_isolated_capability;
|
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
|
// 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.
|
// 1. Let realm be the value of execution context's Realm component.
|
||||||
auto realm = execution_context->realm;
|
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
|
// 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 the origin of window's associated Document.
|
||||||
return m_window->associated_document().origin();
|
return m_window->associated_document().origin();
|
||||||
|
|
|
@ -16,14 +16,14 @@ class WindowEnvironmentSettingsObject final : public EnvironmentSettingsObject {
|
||||||
JS_DECLARE_ALLOCATOR(WindowEnvironmentSettingsObject);
|
JS_DECLARE_ALLOCATOR(WindowEnvironmentSettingsObject);
|
||||||
|
|
||||||
public:
|
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 ~WindowEnvironmentSettingsObject() override;
|
||||||
|
|
||||||
virtual JS::GCPtr<DOM::Document> responsible_document() override;
|
virtual JS::GCPtr<DOM::Document> responsible_document() override;
|
||||||
virtual String api_url_character_encoding() override;
|
virtual String api_url_character_encoding() override;
|
||||||
virtual URL::URL api_base_url() override;
|
virtual URL::URL api_base_url() override;
|
||||||
virtual Origin origin() override;
|
virtual URL::Origin origin() override;
|
||||||
virtual PolicyContainer policy_container() override;
|
virtual PolicyContainer policy_container() override;
|
||||||
virtual CanUseCrossOriginIsolatedAPIs cross_origin_isolated_capability() override;
|
virtual CanUseCrossOriginIsolatedAPIs cross_origin_isolated_capability() override;
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ URL::URL WorkerEnvironmentSettingsObject::api_base_url()
|
||||||
return m_global_scope->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.
|
// FIXME: Return a unique opaque origin if worker global scope's url's scheme is "data", and inherited origin otherwise.
|
||||||
return m_origin;
|
return m_origin;
|
||||||
|
|
|
@ -31,7 +31,7 @@ public:
|
||||||
JS::GCPtr<DOM::Document> responsible_document() override { return nullptr; }
|
JS::GCPtr<DOM::Document> responsible_document() override { return nullptr; }
|
||||||
String api_url_character_encoding() override { return m_api_url_character_encoding; }
|
String api_url_character_encoding() override { return m_api_url_character_encoding; }
|
||||||
URL::URL api_base_url() override;
|
URL::URL api_base_url() override;
|
||||||
Origin origin() override;
|
URL::Origin origin() override;
|
||||||
PolicyContainer policy_container() override;
|
PolicyContainer policy_container() override;
|
||||||
CanUseCrossOriginIsolatedAPIs cross_origin_isolated_capability() override;
|
CanUseCrossOriginIsolatedAPIs cross_origin_isolated_capability() override;
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ private:
|
||||||
virtual void visit_edges(JS::Cell::Visitor&) override;
|
virtual void visit_edges(JS::Cell::Visitor&) override;
|
||||||
|
|
||||||
String m_api_url_character_encoding;
|
String m_api_url_character_encoding;
|
||||||
HTML::Origin m_origin;
|
URL::Origin m_origin;
|
||||||
|
|
||||||
JS::NonnullGCPtr<WorkerGlobalScope> m_global_scope;
|
JS::NonnullGCPtr<WorkerGlobalScope> m_global_scope;
|
||||||
};
|
};
|
||||||
|
|
|
@ -99,7 +99,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<TraversableNavigable>> TraversableNavigable
|
||||||
document_state->set_document(document);
|
document_state->set_document(document);
|
||||||
|
|
||||||
// initiator origin: null if opener is null; otherwise, document's origin
|
// initiator origin: null if opener is null; otherwise, document's origin
|
||||||
document_state->set_initiator_origin(opener ? Optional<Origin> {} : document->origin());
|
document_state->set_initiator_origin(opener ? Optional<URL::Origin> {} : document->origin());
|
||||||
|
|
||||||
// origin: document's origin
|
// origin: document's origin
|
||||||
document_state->set_origin(document->origin());
|
document_state->set_origin(document->origin());
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include <LibJS/Runtime/NativeFunction.h>
|
#include <LibJS/Runtime/NativeFunction.h>
|
||||||
#include <LibJS/Runtime/Shape.h>
|
#include <LibJS/Runtime/Shape.h>
|
||||||
#include <LibTextCodec/Decoder.h>
|
#include <LibTextCodec/Decoder.h>
|
||||||
|
#include <LibURL/Origin.h>
|
||||||
#include <LibWeb/Bindings/ExceptionOrUtils.h>
|
#include <LibWeb/Bindings/ExceptionOrUtils.h>
|
||||||
#include <LibWeb/Bindings/WindowExposedInterfaces.h>
|
#include <LibWeb/Bindings/WindowExposedInterfaces.h>
|
||||||
#include <LibWeb/Bindings/WindowPrototype.h>
|
#include <LibWeb/Bindings/WindowPrototype.h>
|
||||||
|
@ -45,7 +46,6 @@
|
||||||
#include <LibWeb/HTML/MessageEvent.h>
|
#include <LibWeb/HTML/MessageEvent.h>
|
||||||
#include <LibWeb/HTML/Navigation.h>
|
#include <LibWeb/HTML/Navigation.h>
|
||||||
#include <LibWeb/HTML/Navigator.h>
|
#include <LibWeb/HTML/Navigator.h>
|
||||||
#include <LibWeb/HTML/Origin.h>
|
|
||||||
#include <LibWeb/HTML/PageTransitionEvent.h>
|
#include <LibWeb/HTML/PageTransitionEvent.h>
|
||||||
#include <LibWeb/HTML/Parser/HTMLParser.h>
|
#include <LibWeb/HTML/Parser/HTMLParser.h>
|
||||||
#include <LibWeb/HTML/Scripting/Environments.h>
|
#include <LibWeb/HTML/Scripting/Environments.h>
|
||||||
|
@ -415,7 +415,7 @@ void Window::fire_a_page_transition_event(FlyString const& event_name, bool pers
|
||||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<Storage>> Window::local_storage()
|
WebIDL::ExceptionOr<JS::NonnullGCPtr<Storage>> Window::local_storage()
|
||||||
{
|
{
|
||||||
// FIXME: Implement according to spec.
|
// FIXME: Implement according to spec.
|
||||||
static HashMap<Origin, JS::Handle<Storage>> local_storage_per_origin;
|
static HashMap<URL::Origin, JS::Handle<Storage>> local_storage_per_origin;
|
||||||
auto storage = local_storage_per_origin.ensure(associated_document().origin(), [this]() -> JS::Handle<Storage> {
|
auto storage = local_storage_per_origin.ensure(associated_document().origin(), [this]() -> JS::Handle<Storage> {
|
||||||
return Storage::create(realm());
|
return Storage::create(realm());
|
||||||
});
|
});
|
||||||
|
@ -426,7 +426,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Storage>> Window::local_storage()
|
||||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<Storage>> Window::session_storage()
|
WebIDL::ExceptionOr<JS::NonnullGCPtr<Storage>> Window::session_storage()
|
||||||
{
|
{
|
||||||
// FIXME: Implement according to spec.
|
// FIXME: Implement according to spec.
|
||||||
static HashMap<Origin, JS::Handle<Storage>> session_storage_per_origin;
|
static HashMap<URL::Origin, JS::Handle<Storage>> session_storage_per_origin;
|
||||||
auto storage = session_storage_per_origin.ensure(associated_document().origin(), [this]() -> JS::Handle<Storage> {
|
auto storage = session_storage_per_origin.ensure(associated_document().origin(), [this]() -> JS::Handle<Storage> {
|
||||||
return Storage::create(realm());
|
return Storage::create(realm());
|
||||||
});
|
});
|
||||||
|
@ -1017,7 +1017,7 @@ WebIDL::ExceptionOr<void> Window::window_post_message_steps(JS::Value message, W
|
||||||
auto& incumbent_settings = incumbent_settings_object();
|
auto& incumbent_settings = incumbent_settings_object();
|
||||||
|
|
||||||
// 3. Let targetOrigin be options["targetOrigin"].
|
// 3. Let targetOrigin be options["targetOrigin"].
|
||||||
Variant<String, Origin> target_origin = options.target_origin;
|
Variant<String, URL::Origin> target_origin = options.target_origin;
|
||||||
|
|
||||||
// 4. If targetOrigin is a single U+002F SOLIDUS character (/), then set targetOrigin to incumbentSettings's origin.
|
// 4. If targetOrigin is a single U+002F SOLIDUS character (/), then set targetOrigin to incumbentSettings's origin.
|
||||||
if (options.target_origin == "/"sv) {
|
if (options.target_origin == "/"sv) {
|
||||||
|
@ -1048,7 +1048,7 @@ WebIDL::ExceptionOr<void> Window::window_post_message_steps(JS::Value message, W
|
||||||
// associated Document's origin is not same origin with targetOrigin, then return.
|
// associated Document's origin is not same origin with targetOrigin, then return.
|
||||||
// NOTE: Due to step 4 and 5 above, the only time it's not '*' is if target_origin contains an Origin.
|
// NOTE: Due to step 4 and 5 above, the only time it's not '*' is if target_origin contains an Origin.
|
||||||
if (!target_origin.has<String>()) {
|
if (!target_origin.has<String>()) {
|
||||||
auto const& actual_target_origin = target_origin.get<Origin>();
|
auto const& actual_target_origin = target_origin.get<URL::Origin>();
|
||||||
if (!document()->origin().is_same_origin(actual_target_origin))
|
if (!document()->origin().is_same_origin(actual_target_origin))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/String.h>
|
#include <AK/String.h>
|
||||||
|
#include <LibURL/Origin.h>
|
||||||
#include <LibURL/URL.h>
|
#include <LibURL/URL.h>
|
||||||
#include <LibWeb/DOM/Document.h>
|
#include <LibWeb/DOM/Document.h>
|
||||||
#include <LibWeb/DOMURL/DOMURL.h>
|
#include <LibWeb/DOMURL/DOMURL.h>
|
||||||
#include <LibWeb/HTML/Origin.h>
|
|
||||||
#include <LibWeb/PermissionsPolicy/AutoplayAllowlist.h>
|
#include <LibWeb/PermissionsPolicy/AutoplayAllowlist.h>
|
||||||
|
|
||||||
// FIXME: This is an ad-hoc implementation of the "autoplay" policy-controlled feature:
|
// FIXME: This is an ad-hoc implementation of the "autoplay" policy-controlled feature:
|
||||||
|
@ -26,7 +26,7 @@ AutoplayAllowlist::AutoplayAllowlist() = default;
|
||||||
AutoplayAllowlist::~AutoplayAllowlist() = default;
|
AutoplayAllowlist::~AutoplayAllowlist() = default;
|
||||||
|
|
||||||
// https://w3c.github.io/webappsec-permissions-policy/#is-feature-enabled
|
// https://w3c.github.io/webappsec-permissions-policy/#is-feature-enabled
|
||||||
Decision AutoplayAllowlist::is_allowed_for_origin(DOM::Document const& document, HTML::Origin const& origin) const
|
Decision AutoplayAllowlist::is_allowed_for_origin(DOM::Document const& document, URL::Origin const& origin) const
|
||||||
{
|
{
|
||||||
// FIXME: 1. Let policy be document’s Permissions Policy
|
// FIXME: 1. Let policy be document’s Permissions Policy
|
||||||
// FIXME: 2. If policy’s inherited policy for feature is Disabled, return "Disabled".
|
// FIXME: 2. If policy’s inherited policy for feature is Disabled, return "Disabled".
|
||||||
|
|
|
@ -18,7 +18,7 @@ class AutoplayAllowlist {
|
||||||
public:
|
public:
|
||||||
static AutoplayAllowlist& the();
|
static AutoplayAllowlist& the();
|
||||||
|
|
||||||
Decision is_allowed_for_origin(DOM::Document const&, HTML::Origin const&) const;
|
Decision is_allowed_for_origin(DOM::Document const&, URL::Origin const&) const;
|
||||||
|
|
||||||
void enable_globally();
|
void enable_globally();
|
||||||
ErrorOr<void> enable_for_origins(ReadonlySpan<String>);
|
ErrorOr<void> enable_for_origins(ReadonlySpan<String>);
|
||||||
|
@ -27,7 +27,7 @@ private:
|
||||||
AutoplayAllowlist();
|
AutoplayAllowlist();
|
||||||
~AutoplayAllowlist();
|
~AutoplayAllowlist();
|
||||||
|
|
||||||
using Patterns = Vector<HTML::Origin>;
|
using Patterns = Vector<URL::Origin>;
|
||||||
struct Global { };
|
struct Global { };
|
||||||
|
|
||||||
Optional<Variant<Patterns, Global>> m_allowlist;
|
Optional<Variant<Patterns, Global>> m_allowlist;
|
||||||
|
|
|
@ -38,7 +38,7 @@ ErrorOr<JS::NonnullGCPtr<SVGDecodedImageData>> SVGDecodedImageData::create(JS::R
|
||||||
auto navigation_params = navigable->heap().allocate_without_realm<HTML::NavigationParams>();
|
auto navigation_params = navigable->heap().allocate_without_realm<HTML::NavigationParams>();
|
||||||
navigation_params->navigable = navigable;
|
navigation_params->navigable = navigable;
|
||||||
navigation_params->response = response;
|
navigation_params->response = response;
|
||||||
navigation_params->origin = HTML::Origin {};
|
navigation_params->origin = URL::Origin {};
|
||||||
navigation_params->policy_container = HTML::PolicyContainer {};
|
navigation_params->policy_container = HTML::PolicyContainer {};
|
||||||
navigation_params->final_sandboxing_flag_set = HTML::SandboxingFlagSet {};
|
navigation_params->final_sandboxing_flag_set = HTML::SandboxingFlagSet {};
|
||||||
navigation_params->opener_policy = HTML::OpenerPolicy {};
|
navigation_params->opener_policy = HTML::OpenerPolicy {};
|
||||||
|
|
|
@ -6,15 +6,15 @@
|
||||||
|
|
||||||
#include <AK/IPv4Address.h>
|
#include <AK/IPv4Address.h>
|
||||||
#include <AK/IPv6Address.h>
|
#include <AK/IPv6Address.h>
|
||||||
|
#include <LibURL/Origin.h>
|
||||||
#include <LibURL/URL.h>
|
#include <LibURL/URL.h>
|
||||||
#include <LibWeb/DOMURL/DOMURL.h>
|
#include <LibWeb/DOMURL/DOMURL.h>
|
||||||
#include <LibWeb/HTML/Origin.h>
|
|
||||||
#include <LibWeb/SecureContexts/AbstractOperations.h>
|
#include <LibWeb/SecureContexts/AbstractOperations.h>
|
||||||
|
|
||||||
namespace Web::SecureContexts {
|
namespace Web::SecureContexts {
|
||||||
|
|
||||||
// https://w3c.github.io/webappsec-secure-contexts/#is-origin-trustworthy
|
// https://w3c.github.io/webappsec-secure-contexts/#is-origin-trustworthy
|
||||||
Trustworthiness is_origin_potentially_trustworthy(HTML::Origin const& origin)
|
Trustworthiness is_origin_potentially_trustworthy(URL::Origin const& origin)
|
||||||
{
|
{
|
||||||
// 1. If origin is an opaque origin, return "Not Trustworthy".
|
// 1. If origin is an opaque origin, return "Not Trustworthy".
|
||||||
if (origin.is_opaque())
|
if (origin.is_opaque())
|
||||||
|
|
|
@ -17,7 +17,7 @@ enum class Trustworthiness {
|
||||||
NotTrustworthy,
|
NotTrustworthy,
|
||||||
};
|
};
|
||||||
|
|
||||||
[[nodiscard]] Trustworthiness is_origin_potentially_trustworthy(HTML::Origin const&);
|
[[nodiscard]] Trustworthiness is_origin_potentially_trustworthy(URL::Origin const&);
|
||||||
[[nodiscard]] Trustworthiness is_url_potentially_trustworthy(URL::URL const&);
|
[[nodiscard]] Trustworthiness is_url_potentially_trustworthy(URL::URL const&);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <AK/Optional.h>
|
#include <AK/Optional.h>
|
||||||
|
#include <LibURL/Origin.h>
|
||||||
#include <LibWeb/Forward.h>
|
#include <LibWeb/Forward.h>
|
||||||
#include <LibWeb/HTML/Origin.h>
|
|
||||||
|
|
||||||
namespace Web::StorageAPI {
|
namespace Web::StorageAPI {
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ struct StorageKey {
|
||||||
|
|
||||||
// A storage key is a tuple consisting of an origin (an origin). [HTML]
|
// A storage key is a tuple consisting of an origin (an origin). [HTML]
|
||||||
// NOTE: This is expected to change; see Client-Side Storage Partitioning https://privacycg.github.io/storage-partitioning/.
|
// NOTE: This is expected to change; see Client-Side Storage Partitioning https://privacycg.github.io/storage-partitioning/.
|
||||||
HTML::Origin origin;
|
URL::Origin origin;
|
||||||
|
|
||||||
friend bool operator==(StorageKey const& a, StorageKey const& b)
|
friend bool operator==(StorageKey const& a, StorageKey const& b)
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <AK/QuickSort.h>
|
#include <AK/QuickSort.h>
|
||||||
#include <LibJS/Runtime/ArrayBuffer.h>
|
#include <LibJS/Runtime/ArrayBuffer.h>
|
||||||
#include <LibJS/Runtime/FunctionObject.h>
|
#include <LibJS/Runtime/FunctionObject.h>
|
||||||
|
#include <LibURL/Origin.h>
|
||||||
#include <LibWeb/Bindings/WebSocketPrototype.h>
|
#include <LibWeb/Bindings/WebSocketPrototype.h>
|
||||||
#include <LibWeb/DOM/Document.h>
|
#include <LibWeb/DOM/Document.h>
|
||||||
#include <LibWeb/DOM/Event.h>
|
#include <LibWeb/DOM/Event.h>
|
||||||
|
@ -19,7 +20,6 @@
|
||||||
#include <LibWeb/HTML/EventHandler.h>
|
#include <LibWeb/HTML/EventHandler.h>
|
||||||
#include <LibWeb/HTML/EventNames.h>
|
#include <LibWeb/HTML/EventNames.h>
|
||||||
#include <LibWeb/HTML/MessageEvent.h>
|
#include <LibWeb/HTML/MessageEvent.h>
|
||||||
#include <LibWeb/HTML/Origin.h>
|
|
||||||
#include <LibWeb/HTML/WindowOrWorkerGlobalScope.h>
|
#include <LibWeb/HTML/WindowOrWorkerGlobalScope.h>
|
||||||
#include <LibWeb/Loader/ResourceLoader.h>
|
#include <LibWeb/Loader/ResourceLoader.h>
|
||||||
#include <LibWeb/WebIDL/AbstractOperations.h>
|
#include <LibWeb/WebIDL/AbstractOperations.h>
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include <LibJS/Runtime/FunctionObject.h>
|
#include <LibJS/Runtime/FunctionObject.h>
|
||||||
#include <LibJS/Runtime/GlobalObject.h>
|
#include <LibJS/Runtime/GlobalObject.h>
|
||||||
#include <LibTextCodec/Decoder.h>
|
#include <LibTextCodec/Decoder.h>
|
||||||
|
#include <LibURL/Origin.h>
|
||||||
#include <LibWeb/Bindings/XMLHttpRequestPrototype.h>
|
#include <LibWeb/Bindings/XMLHttpRequestPrototype.h>
|
||||||
#include <LibWeb/DOM/Document.h>
|
#include <LibWeb/DOM/Document.h>
|
||||||
#include <LibWeb/DOM/DocumentLoading.h>
|
#include <LibWeb/DOM/DocumentLoading.h>
|
||||||
|
@ -35,7 +36,6 @@
|
||||||
#include <LibWeb/FileAPI/Blob.h>
|
#include <LibWeb/FileAPI/Blob.h>
|
||||||
#include <LibWeb/HTML/EventHandler.h>
|
#include <LibWeb/HTML/EventHandler.h>
|
||||||
#include <LibWeb/HTML/EventNames.h>
|
#include <LibWeb/HTML/EventNames.h>
|
||||||
#include <LibWeb/HTML/Origin.h>
|
|
||||||
#include <LibWeb/HTML/Parser/HTMLEncodingDetection.h>
|
#include <LibWeb/HTML/Parser/HTMLEncodingDetection.h>
|
||||||
#include <LibWeb/HTML/Parser/HTMLParser.h>
|
#include <LibWeb/HTML/Parser/HTMLParser.h>
|
||||||
#include <LibWeb/HTML/Scripting/TemporaryExecutionContext.h>
|
#include <LibWeb/HTML/Scripting/TemporaryExecutionContext.h>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue