mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-22 17:24:48 -05:00
LibWeb: Rename current settings object to 'current principal'
Aligning the name with the the PR implementing the javascript shadow realm proposal into the web platform. This commit simply performs the rename before implementing the behaviour change. The actual change to the behaviour of the AO is not implemented in this commit to support 'synthetic' shadow realms as the surrounding infrastructure is not in place yet. Not all specs have a MR open to align with this proposed change to the HTML standard. But in this case we can just apply the same mechanical change everywhere.
This commit is contained in:
parent
72f5fac2ff
commit
b2f3ed8b5a
Notes:
github-actions[bot]
2024-11-01 19:17:08 +00:00
Author: https://github.com/shannonbooth Commit: https://github.com/LadybirdBrowser/ladybird/commit/b2f3ed8b5a9 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1932 Reviewed-by: https://github.com/ADKaster ✅
16 changed files with 50 additions and 39 deletions
|
@ -124,6 +124,7 @@ ErrorOr<void> initialize_main_thread_vm(HTML::EventLoop::Type type)
|
||||||
// FIXME: Implement 8.1.5.2 HostEnsureCanCompileStrings(callerRealm, calleeRealm), https://html.spec.whatwg.org/multipage/webappapis.html#hostensurecancompilestrings(callerrealm,-calleerealm)
|
// FIXME: Implement 8.1.5.2 HostEnsureCanCompileStrings(callerRealm, calleeRealm), https://html.spec.whatwg.org/multipage/webappapis.html#hostensurecancompilestrings(callerrealm,-calleerealm)
|
||||||
|
|
||||||
// 8.1.5.3 HostPromiseRejectionTracker(promise, operation), https://html.spec.whatwg.org/multipage/webappapis.html#the-hostpromiserejectiontracker-implementation
|
// 8.1.5.3 HostPromiseRejectionTracker(promise, operation), https://html.spec.whatwg.org/multipage/webappapis.html#the-hostpromiserejectiontracker-implementation
|
||||||
|
// https://whatpr.org/html/9893/webappapis.html#the-hostpromiserejectiontracker-implementation
|
||||||
s_main_thread_vm->host_promise_rejection_tracker = [](JS::Promise& promise, JS::Promise::RejectionOperation operation) {
|
s_main_thread_vm->host_promise_rejection_tracker = [](JS::Promise& promise, JS::Promise::RejectionOperation operation) {
|
||||||
// 1. Let script be the running script.
|
// 1. Let script be the running script.
|
||||||
// The running script is the script in the [[HostDefined]] field in the ScriptOrModule component of the running JavaScript execution context.
|
// The running script is the script in the [[HostDefined]] field in the ScriptOrModule component of the running JavaScript execution context.
|
||||||
|
@ -147,8 +148,8 @@ ErrorOr<void> initialize_main_thread_vm(HTML::EventLoop::Type type)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Let settings object be the current settings object.
|
// 3. Let settings object be the current settings object.
|
||||||
// 4. If script is not null, then set settings object to script's settings object.
|
// 4. If script is not null, then set settings object to script's principal settings object.
|
||||||
auto& settings_object = script ? script->settings_object() : HTML::current_settings_object();
|
auto& settings_object = script ? script->settings_object() : HTML::current_principal_settings_object();
|
||||||
|
|
||||||
// 5. Let global be settingsObject's global object.
|
// 5. Let global be settingsObject's global object.
|
||||||
auto* global_mixin = dynamic_cast<HTML::WindowOrWorkerGlobalScopeMixin*>(&settings_object.global_object());
|
auto* global_mixin = dynamic_cast<HTML::WindowOrWorkerGlobalScopeMixin*>(&settings_object.global_object());
|
||||||
|
@ -414,12 +415,13 @@ ErrorOr<void> initialize_main_thread_vm(HTML::EventLoop::Type type)
|
||||||
};
|
};
|
||||||
|
|
||||||
// 8.1.6.7.3 HostLoadImportedModule(referrer, moduleRequest, loadState, payload), https://html.spec.whatwg.org/multipage/webappapis.html#hostloadimportedmodule
|
// 8.1.6.7.3 HostLoadImportedModule(referrer, moduleRequest, loadState, payload), https://html.spec.whatwg.org/multipage/webappapis.html#hostloadimportedmodule
|
||||||
|
// https://whatpr.org/html/9893/webappapis.html#hostloadimportedmodule
|
||||||
s_main_thread_vm->host_load_imported_module = [](JS::ImportedModuleReferrer referrer, JS::ModuleRequest const& module_request, JS::GCPtr<JS::GraphLoadingState::HostDefined> load_state, JS::ImportedModulePayload payload) -> void {
|
s_main_thread_vm->host_load_imported_module = [](JS::ImportedModuleReferrer referrer, JS::ModuleRequest const& module_request, JS::GCPtr<JS::GraphLoadingState::HostDefined> load_state, JS::ImportedModulePayload payload) -> void {
|
||||||
auto& vm = *s_main_thread_vm;
|
auto& vm = *s_main_thread_vm;
|
||||||
auto& realm = *vm.current_realm();
|
auto& realm = *vm.current_realm();
|
||||||
|
|
||||||
// 1. Let settingsObject be the current settings object.
|
// 1. Let settingsObject be the current principal settings object.
|
||||||
Optional<HTML::EnvironmentSettingsObject&> settings_object = HTML::current_settings_object();
|
Optional<HTML::EnvironmentSettingsObject&> settings_object = HTML::current_principal_settings_object();
|
||||||
|
|
||||||
// FIXME: 2. If settingsObject's global object implements WorkletGlobalScope or ServiceWorkerGlobalScope and loadState is undefined, then:
|
// FIXME: 2. If settingsObject's global object implements WorkletGlobalScope or ServiceWorkerGlobalScope and loadState is undefined, then:
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,7 @@ WebIDL::ExceptionOr<void> DOMURL::revoke_object_url(JS::VM& vm, StringView url)
|
||||||
auto origin = url_record.origin();
|
auto origin = url_record.origin();
|
||||||
|
|
||||||
// 4. Let settings be the current settings object.
|
// 4. Let settings be the current settings object.
|
||||||
auto& settings = HTML::current_settings_object();
|
auto& settings = HTML::current_principal_settings_object();
|
||||||
|
|
||||||
// 5. If origin is not same origin with settings’s origin, return.
|
// 5. If origin is not same origin with settings’s origin, return.
|
||||||
if (!origin.is_same_origin(settings.origin()))
|
if (!origin.is_same_origin(settings.origin()))
|
||||||
|
|
|
@ -168,7 +168,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Response>> Response::redirect(JS::VM& vm, S
|
||||||
auto& realm = *vm.current_realm();
|
auto& realm = *vm.current_realm();
|
||||||
|
|
||||||
// 1. Let parsedURL be the result of parsing url with current settings object’s API base URL.
|
// 1. Let parsedURL be the result of parsing url with current settings object’s API base URL.
|
||||||
auto api_base_url = HTML::current_settings_object().api_base_url();
|
auto api_base_url = HTML::current_principal_settings_object().api_base_url();
|
||||||
auto parsed_url = DOMURL::parse(url, api_base_url);
|
auto parsed_url = DOMURL::parse(url, api_base_url);
|
||||||
|
|
||||||
// 2. If parsedURL is failure, then throw a TypeError.
|
// 2. If parsedURL is failure, then throw a TypeError.
|
||||||
|
|
|
@ -33,7 +33,7 @@ ErrorOr<String> generate_new_blob_url()
|
||||||
TRY(result.try_append("blob:"sv));
|
TRY(result.try_append("blob:"sv));
|
||||||
|
|
||||||
// 3. Let settings be the current settings object
|
// 3. Let settings be the current settings object
|
||||||
auto& settings = HTML::current_settings_object();
|
auto& settings = HTML::current_principal_settings_object();
|
||||||
|
|
||||||
// 4. Let origin be settings’s origin.
|
// 4. Let origin be settings’s origin.
|
||||||
auto origin = settings.origin();
|
auto origin = settings.origin();
|
||||||
|
@ -69,7 +69,7 @@ ErrorOr<String> add_entry_to_blob_url_store(JS::NonnullGCPtr<Blob> object)
|
||||||
auto url = TRY(generate_new_blob_url());
|
auto url = TRY(generate_new_blob_url());
|
||||||
|
|
||||||
// 3. Let entry be a new blob URL entry consisting of object and the current settings object.
|
// 3. Let entry be a new blob URL entry consisting of object and the current settings object.
|
||||||
BlobURLEntry entry { object, HTML::current_settings_object() };
|
BlobURLEntry entry { object, HTML::current_principal_settings_object() };
|
||||||
|
|
||||||
// 4. Set store[url] to entry.
|
// 4. Set store[url] to entry.
|
||||||
TRY(store.try_set(url, move(entry)));
|
TRY(store.try_set(url, move(entry)));
|
||||||
|
|
|
@ -81,23 +81,25 @@ JS::ThrowCompletionOr<JS::PropertyDescriptor> cross_origin_property_fallback(JS:
|
||||||
return throw_completion(WebIDL::SecurityError::create(*vm.current_realm(), MUST(String::formatted("Can't access property '{}' on cross-origin object", property_key))));
|
return throw_completion(WebIDL::SecurityError::create(*vm.current_realm(), MUST(String::formatted("Can't access property '{}' on cross-origin object", property_key))));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 7.2.3.3 IsPlatformObjectSameOrigin ( O ), https://html.spec.whatwg.org/multipage/browsers.html#isplatformobjectsameorigin-(-o-)
|
// 7.2.3.3 IsPlatformObjectSameOrigin ( O ), https://html.spec.whatwg.org/multipage/nav-history-apis.html#isplatformobjectsameorigin-(-o-)
|
||||||
|
// https://whatpr.org/html/9893/nav-history-apis.html#isplatformobjectsameorigin-(-o-)
|
||||||
bool is_platform_object_same_origin(JS::Object const& object)
|
bool is_platform_object_same_origin(JS::Object const& object)
|
||||||
{
|
{
|
||||||
// 1. Return true if the current settings object's origin is same origin-domain with O's relevant settings object's origin, and false otherwise.
|
// 1. Return true if the current principal settings object's origin is same origin-domain with O's relevant settings object's origin, and false otherwise.
|
||||||
return HTML::current_settings_object().origin().is_same_origin_domain(HTML::relevant_settings_object(object).origin());
|
return HTML::current_principal_settings_object().origin().is_same_origin_domain(HTML::relevant_settings_object(object).origin());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 7.2.3.4 CrossOriginGetOwnPropertyHelper ( O, P ), https://html.spec.whatwg.org/multipage/browsers.html#crossorigingetownpropertyhelper-(-o,-p-)
|
// 7.2.3.4 CrossOriginGetOwnPropertyHelper ( O, P ), https://html.spec.whatwg.org/multipage/nav-history-apis.html#crossorigingetownpropertyhelper-(-o,-p-)
|
||||||
|
// https://whatpr.org/html/9893/nav-history-apis.html#crossorigingetownpropertyhelper-(-o,-p-)
|
||||||
Optional<JS::PropertyDescriptor> cross_origin_get_own_property_helper(Variant<HTML::Location*, HTML::Window*> const& object, JS::PropertyKey const& property_key)
|
Optional<JS::PropertyDescriptor> cross_origin_get_own_property_helper(Variant<HTML::Location*, HTML::Window*> const& object, JS::PropertyKey const& property_key)
|
||||||
{
|
{
|
||||||
auto& realm = *Bindings::main_thread_vm().current_realm();
|
auto& realm = *Bindings::main_thread_vm().current_realm();
|
||||||
auto const* object_ptr = object.visit([](auto* o) { return static_cast<JS::Object const*>(o); });
|
auto const* object_ptr = object.visit([](auto* o) { return static_cast<JS::Object const*>(o); });
|
||||||
auto const object_const_variant = object.visit([](auto* o) { return Variant<HTML::Location const*, HTML::Window const*> { o }; });
|
auto const object_const_variant = object.visit([](auto* o) { return Variant<HTML::Location const*, HTML::Window const*> { o }; });
|
||||||
|
|
||||||
// 1. Let crossOriginKey be a tuple consisting of the current settings object, O's relevant settings object, and P.
|
// 1. Let crossOriginKey be a tuple consisting of the current principal settings object, O's relevant settings object, and P.
|
||||||
auto cross_origin_key = CrossOriginKey {
|
auto cross_origin_key = CrossOriginKey {
|
||||||
.current_settings_object = (FlatPtr)&HTML::current_settings_object(),
|
.current_principal_settings_object = (FlatPtr)&HTML::current_principal_settings_object(),
|
||||||
.relevant_settings_object = (FlatPtr)&HTML::relevant_settings_object(*object_ptr),
|
.relevant_settings_object = (FlatPtr)&HTML::relevant_settings_object(*object_ptr),
|
||||||
.property_key = property_key,
|
.property_key = property_key,
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,7 +22,7 @@ struct CrossOriginProperty {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CrossOriginKey {
|
struct CrossOriginKey {
|
||||||
FlatPtr current_settings_object;
|
FlatPtr current_principal_settings_object;
|
||||||
FlatPtr relevant_settings_object;
|
FlatPtr relevant_settings_object;
|
||||||
JS::PropertyKey property_key;
|
JS::PropertyKey property_key;
|
||||||
};
|
};
|
||||||
|
@ -39,12 +39,12 @@ struct Traits<Web::HTML::CrossOriginKey> : public DefaultTraits<Web::HTML::Cross
|
||||||
{
|
{
|
||||||
return pair_int_hash(
|
return pair_int_hash(
|
||||||
Traits<JS::PropertyKey>::hash(key.property_key),
|
Traits<JS::PropertyKey>::hash(key.property_key),
|
||||||
pair_int_hash(ptr_hash(key.current_settings_object), ptr_hash(key.relevant_settings_object)));
|
pair_int_hash(ptr_hash(key.current_principal_settings_object), ptr_hash(key.relevant_settings_object)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool equals(Web::HTML::CrossOriginKey const& a, Web::HTML::CrossOriginKey const& b)
|
static bool equals(Web::HTML::CrossOriginKey const& a, Web::HTML::CrossOriginKey const& b)
|
||||||
{
|
{
|
||||||
return a.current_settings_object == b.current_settings_object
|
return a.current_principal_settings_object == b.current_principal_settings_object
|
||||||
&& a.relevant_settings_object == b.relevant_settings_object
|
&& a.relevant_settings_object == b.relevant_settings_object
|
||||||
&& Traits<JS::PropertyKey>::equals(a.property_key, b.property_key);
|
&& Traits<JS::PropertyKey>::equals(a.property_key, b.property_key);
|
||||||
}
|
}
|
||||||
|
|
|
@ -301,7 +301,7 @@ JS::Object& incumbent_global_object()
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/webappapis.html#current-settings-object
|
// https://html.spec.whatwg.org/multipage/webappapis.html#current-settings-object
|
||||||
EnvironmentSettingsObject& current_settings_object()
|
EnvironmentSettingsObject& current_principal_settings_object()
|
||||||
{
|
{
|
||||||
auto& event_loop = HTML::main_thread_event_loop();
|
auto& event_loop = HTML::main_thread_event_loop();
|
||||||
auto& vm = event_loop.vm();
|
auto& vm = event_loop.vm();
|
||||||
|
|
|
@ -142,7 +142,7 @@ private:
|
||||||
EnvironmentSettingsObject& incumbent_settings_object();
|
EnvironmentSettingsObject& incumbent_settings_object();
|
||||||
JS::Realm& incumbent_realm();
|
JS::Realm& incumbent_realm();
|
||||||
JS::Object& incumbent_global_object();
|
JS::Object& incumbent_global_object();
|
||||||
EnvironmentSettingsObject& current_settings_object();
|
EnvironmentSettingsObject& current_principal_settings_object();
|
||||||
JS::Object& current_global_object();
|
JS::Object& current_global_object();
|
||||||
JS::Realm& relevant_realm(JS::Object const&);
|
JS::Realm& relevant_realm(JS::Object const&);
|
||||||
EnvironmentSettingsObject& relevant_settings_object(JS::Object const&);
|
EnvironmentSettingsObject& relevant_settings_object(JS::Object const&);
|
||||||
|
|
|
@ -81,6 +81,7 @@ ByteString module_type_from_module_request(JS::ModuleRequest const& module_reque
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/webappapis.html#resolve-a-module-specifier
|
// https://html.spec.whatwg.org/multipage/webappapis.html#resolve-a-module-specifier
|
||||||
|
// https://whatpr.org/html/9893/webappapis.html#resolve-a-module-specifier
|
||||||
WebIDL::ExceptionOr<URL::URL> resolve_module_specifier(Optional<Script&> referring_script, ByteString const& specifier)
|
WebIDL::ExceptionOr<URL::URL> resolve_module_specifier(Optional<Script&> referring_script, ByteString const& specifier)
|
||||||
{
|
{
|
||||||
// 1. Let settingsObject and baseURL be null.
|
// 1. Let settingsObject and baseURL be null.
|
||||||
|
@ -97,11 +98,11 @@ WebIDL::ExceptionOr<URL::URL> resolve_module_specifier(Optional<Script&> referri
|
||||||
}
|
}
|
||||||
// 3. Otherwise:
|
// 3. Otherwise:
|
||||||
else {
|
else {
|
||||||
// 1. Assert: there is a current settings object.
|
// 1. Assert: there is a current principal settings object.
|
||||||
// NOTE: This is handled by the current_settings_object() accessor.
|
// NOTE: This is handled by the current_principal_settings_object() accessor.
|
||||||
|
|
||||||
// 2. Set settingsObject to the current settings object.
|
// 2. Set settingsObject to the current principal settings object.
|
||||||
settings_object = current_settings_object();
|
settings_object = current_principal_settings_object();
|
||||||
|
|
||||||
// 3. Set baseURL to settingsObject's API base URL.
|
// 3. Set baseURL to settingsObject's API base URL.
|
||||||
base_url = settings_object->api_base_url();
|
base_url = settings_object->api_base_url();
|
||||||
|
|
|
@ -157,6 +157,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializeinternal
|
// https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializeinternal
|
||||||
|
// https://whatpr.org/html/9893/structured-data.html#structuredserializeinternal
|
||||||
WebIDL::ExceptionOr<SerializationRecord> serialize(JS::Value value)
|
WebIDL::ExceptionOr<SerializationRecord> serialize(JS::Value value)
|
||||||
{
|
{
|
||||||
// 2. If memory[value] exists, then return memory[value].
|
// 2. If memory[value] exists, then return memory[value].
|
||||||
|
@ -565,10 +566,10 @@ WebIDL::ExceptionOr<void> serialize_array_buffer(JS::VM& vm, Vector<u32>& vector
|
||||||
|
|
||||||
// FIXME: 1. If IsSharedArrayBuffer(value) is true, then:
|
// FIXME: 1. If IsSharedArrayBuffer(value) is true, then:
|
||||||
if (false) {
|
if (false) {
|
||||||
// 1. If the current settings object's cross-origin isolated capability is false, then throw a "DataCloneError" DOMException.
|
// 1. If the current principal settings object's cross-origin isolated capability is false, then throw a "DataCloneError" DOMException.
|
||||||
// NOTE: This check is only needed when serializing (and not when deserializing) as the cross-origin isolated capability cannot change
|
// NOTE: This check is only needed when serializing (and not when deserializing) as the cross-origin isolated capability cannot change
|
||||||
// over time and a SharedArrayBuffer cannot leave an agent cluster.
|
// over time and a SharedArrayBuffer cannot leave an agent cluster.
|
||||||
if (current_settings_object().cross_origin_isolated_capability() == CanUseCrossOriginIsolatedAPIs::No)
|
if (current_principal_settings_object().cross_origin_isolated_capability() == CanUseCrossOriginIsolatedAPIs::No)
|
||||||
return WebIDL::DataCloneError::create(*vm.current_realm(), "Cannot serialize SharedArrayBuffer when cross-origin isolated"_string);
|
return WebIDL::DataCloneError::create(*vm.current_realm(), "Cannot serialize SharedArrayBuffer when cross-origin isolated"_string);
|
||||||
|
|
||||||
// 2. If forStorage is true, then throw a "DataCloneError" DOMException.
|
// 2. If forStorage is true, then throw a "DataCloneError" DOMException.
|
||||||
|
|
|
@ -994,6 +994,7 @@ JS::GCPtr<WindowProxy const> Window::parent() const
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-frameelement
|
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-frameelement
|
||||||
|
// https://whatpr.org/html/9893/nav-history-apis.html#dom-frameelement
|
||||||
JS::GCPtr<DOM::Element const> Window::frame_element() const
|
JS::GCPtr<DOM::Element const> Window::frame_element() const
|
||||||
{
|
{
|
||||||
// 1. Let current be this's node navigable.
|
// 1. Let current be this's node navigable.
|
||||||
|
@ -1010,8 +1011,8 @@ JS::GCPtr<DOM::Element const> Window::frame_element() const
|
||||||
if (!container)
|
if (!container)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
// 5. If container's node document's origin is not same origin-domain with the current settings object's origin, then return null.
|
// 5. If container's node document's origin is not same origin-domain with the current principal settings object's origin, then return null.
|
||||||
if (!container->document().origin().is_same_origin_domain(current_settings_object().origin()))
|
if (!container->document().origin().is_same_origin_domain(current_principal_settings_object().origin()))
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
// 6. Return container.
|
// 6. Return container.
|
||||||
|
|
|
@ -152,15 +152,16 @@ JS::ThrowCompletionOr<bool> WindowProxy::internal_define_own_property(JS::Proper
|
||||||
return throw_completion(WebIDL::SecurityError::create(m_window->realm(), MUST(String::formatted("Can't define property '{}' on cross-origin object", property_key))));
|
return throw_completion(WebIDL::SecurityError::create(m_window->realm(), MUST(String::formatted("Can't define property '{}' on cross-origin object", property_key))));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 7.4.7 [[Get]] ( P, Receiver ), https://html.spec.whatwg.org/multipage/window-object.html#windowproxy-get
|
// 7.4.7 [[Get]] ( P, Receiver ), https://html.spec.whatwg.org/multipage/nav-history-apis.html#windowproxy-get
|
||||||
|
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#windowproxy-get
|
||||||
JS::ThrowCompletionOr<JS::Value> WindowProxy::internal_get(JS::PropertyKey const& property_key, JS::Value receiver, JS::CacheablePropertyMetadata*, PropertyLookupPhase) const
|
JS::ThrowCompletionOr<JS::Value> WindowProxy::internal_get(JS::PropertyKey const& property_key, JS::Value receiver, JS::CacheablePropertyMetadata*, PropertyLookupPhase) const
|
||||||
{
|
{
|
||||||
auto& vm = this->vm();
|
auto& vm = this->vm();
|
||||||
|
|
||||||
// 1. Let W be the value of the [[Window]] internal slot of this.
|
// 1. Let W be the value of the [[Window]] internal slot of this.
|
||||||
|
|
||||||
// 2. Check if an access between two browsing contexts should be reported, given the current global object's browsing context, W's browsing context, P, and the current settings object.
|
// 2. Check if an access between two browsing contexts should be reported, given the current global object's browsing context, W's browsing context, P, and the current principal settings object.
|
||||||
check_if_access_between_two_browsing_contexts_should_be_reported(*verify_cast<Window>(current_global_object()).browsing_context(), m_window->browsing_context(), property_key, current_settings_object());
|
check_if_access_between_two_browsing_contexts_should_be_reported(*verify_cast<Window>(current_global_object()).browsing_context(), m_window->browsing_context(), property_key, current_principal_settings_object());
|
||||||
|
|
||||||
// 3. If IsPlatformObjectSameOrigin(W) is true, then return ? OrdinaryGet(this, P, Receiver).
|
// 3. If IsPlatformObjectSameOrigin(W) is true, then return ? OrdinaryGet(this, P, Receiver).
|
||||||
// NOTE: this is passed rather than W as OrdinaryGet and CrossOriginGet will invoke the [[GetOwnProperty]] internal method.
|
// NOTE: this is passed rather than W as OrdinaryGet and CrossOriginGet will invoke the [[GetOwnProperty]] internal method.
|
||||||
|
@ -172,15 +173,16 @@ JS::ThrowCompletionOr<JS::Value> WindowProxy::internal_get(JS::PropertyKey const
|
||||||
return cross_origin_get(vm, *this, property_key, receiver);
|
return cross_origin_get(vm, *this, property_key, receiver);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 7.4.8 [[Set]] ( P, V, Receiver ), https://html.spec.whatwg.org/multipage/window-object.html#windowproxy-set
|
// 7.4.8 [[Set]] ( P, V, Receiver ), https://html.spec.whatwg.org/multipage/nav-history-apis.html#windowproxy-set
|
||||||
|
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#windowproxy-set
|
||||||
JS::ThrowCompletionOr<bool> WindowProxy::internal_set(JS::PropertyKey const& property_key, JS::Value value, JS::Value receiver, JS::CacheablePropertyMetadata*)
|
JS::ThrowCompletionOr<bool> WindowProxy::internal_set(JS::PropertyKey const& property_key, JS::Value value, JS::Value receiver, JS::CacheablePropertyMetadata*)
|
||||||
{
|
{
|
||||||
auto& vm = this->vm();
|
auto& vm = this->vm();
|
||||||
|
|
||||||
// 1. Let W be the value of the [[Window]] internal slot of this.
|
// 1. Let W be the value of the [[Window]] internal slot of this.
|
||||||
|
|
||||||
// 2. Check if an access between two browsing contexts should be reported, given the current global object's browsing context, W's browsing context, P, and the current settings object.
|
// 2. Check if an access between two browsing contexts should be reported, given the current global object's browsing context, W's browsing context, P, and the current principal settings object.
|
||||||
check_if_access_between_two_browsing_contexts_should_be_reported(*verify_cast<Window>(current_global_object()).browsing_context(), m_window->browsing_context(), property_key, current_settings_object());
|
check_if_access_between_two_browsing_contexts_should_be_reported(*verify_cast<Window>(current_global_object()).browsing_context(), m_window->browsing_context(), property_key, current_principal_settings_object());
|
||||||
|
|
||||||
// 3. If IsPlatformObjectSameOrigin(W) is true, then:
|
// 3. If IsPlatformObjectSameOrigin(W) is true, then:
|
||||||
if (is_platform_object_same_origin(*m_window)) {
|
if (is_platform_object_same_origin(*m_window)) {
|
||||||
|
|
|
@ -40,6 +40,7 @@ void Worker::visit_edges(Cell::Visitor& visitor)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/workers.html#dom-worker
|
// https://html.spec.whatwg.org/multipage/workers.html#dom-worker
|
||||||
|
// https://whatpr.org/html/9893/workers.html#dom-worker
|
||||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<Worker>> Worker::create(String const& script_url, WorkerOptions const& options, DOM::Document& document)
|
WebIDL::ExceptionOr<JS::NonnullGCPtr<Worker>> Worker::create(String const& script_url, WorkerOptions const& options, DOM::Document& document)
|
||||||
{
|
{
|
||||||
dbgln_if(WEB_WORKER_DEBUG, "WebWorker: Creating worker with script_url = {}", script_url);
|
dbgln_if(WEB_WORKER_DEBUG, "WebWorker: Creating worker with script_url = {}", script_url);
|
||||||
|
@ -55,8 +56,8 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Worker>> Worker::create(String const& scrip
|
||||||
// a policy decision (e.g. if the user agent is configured to not allow the page to start dedicated workers).
|
// a policy decision (e.g. if the user agent is configured to not allow the page to start dedicated workers).
|
||||||
// Technically not a fixme if our policy is not to throw errors :^)
|
// Technically not a fixme if our policy is not to throw errors :^)
|
||||||
|
|
||||||
// 2. Let outside settings be the current settings object.
|
// 2. Let outside settings be the current principal settings object.
|
||||||
auto& outside_settings = current_settings_object();
|
auto& outside_settings = current_principal_settings_object();
|
||||||
|
|
||||||
// 3. Parse the scriptURL argument relative to outside settings.
|
// 3. Parse the scriptURL argument relative to outside settings.
|
||||||
auto url = document.parse_url(script_url);
|
auto url = document.parse_url(script_url);
|
||||||
|
|
|
@ -79,6 +79,7 @@ void WorkerGlobalScope::close_a_worker()
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/workers.html#importing-scripts-and-libraries
|
// https://html.spec.whatwg.org/multipage/workers.html#importing-scripts-and-libraries
|
||||||
|
// https://whatpr.org/html/9893/workers.html#importing-scripts-and-libraries
|
||||||
WebIDL::ExceptionOr<void> WorkerGlobalScope::import_scripts(Vector<String> const& urls, PerformTheFetchHook perform_fetch)
|
WebIDL::ExceptionOr<void> WorkerGlobalScope::import_scripts(Vector<String> const& urls, PerformTheFetchHook perform_fetch)
|
||||||
{
|
{
|
||||||
// The algorithm may optionally be customized by supplying custom perform the fetch hooks,
|
// The algorithm may optionally be customized by supplying custom perform the fetch hooks,
|
||||||
|
@ -87,8 +88,8 @@ WebIDL::ExceptionOr<void> WorkerGlobalScope::import_scripts(Vector<String> const
|
||||||
|
|
||||||
// FIXME: 1. If worker global scope's type is "module", throw a TypeError exception.
|
// FIXME: 1. If worker global scope's type is "module", throw a TypeError exception.
|
||||||
|
|
||||||
// 2. Let settings object be the current settings object.
|
// 2. Let settings object be the current principal settings object.
|
||||||
auto& settings_object = HTML::current_settings_object();
|
auto& settings_object = HTML::current_principal_settings_object();
|
||||||
|
|
||||||
// 3. If urls is empty, return.
|
// 3. If urls is empty, return.
|
||||||
if (urls.is_empty())
|
if (urls.is_empty())
|
||||||
|
|
|
@ -264,7 +264,7 @@ void Page::did_update_window_rect()
|
||||||
template<typename ResponseType>
|
template<typename ResponseType>
|
||||||
static ResponseType spin_event_loop_until_dialog_closed(PageClient& client, Optional<ResponseType>& response, SourceLocation location = SourceLocation::current())
|
static ResponseType spin_event_loop_until_dialog_closed(PageClient& client, Optional<ResponseType>& response, SourceLocation location = SourceLocation::current())
|
||||||
{
|
{
|
||||||
auto& event_loop = Web::HTML::current_settings_object().responsible_event_loop();
|
auto& event_loop = Web::HTML::current_principal_settings_object().responsible_event_loop();
|
||||||
|
|
||||||
ScopeGuard guard { [&] { event_loop.set_execution_paused(false); } };
|
ScopeGuard guard { [&] { event_loop.set_execution_paused(false); } };
|
||||||
event_loop.set_execution_paused(true);
|
event_loop.set_execution_paused(true);
|
||||||
|
|
|
@ -123,7 +123,7 @@ WebIDL::ExceptionOr<void> BaseAudioContext::verify_audio_options_inside_nominal_
|
||||||
|
|
||||||
void BaseAudioContext::queue_a_media_element_task(JS::NonnullGCPtr<JS::HeapFunction<void()>> steps)
|
void BaseAudioContext::queue_a_media_element_task(JS::NonnullGCPtr<JS::HeapFunction<void()>> steps)
|
||||||
{
|
{
|
||||||
auto task = HTML::Task::create(vm(), m_media_element_event_task_source.source, HTML::current_settings_object().responsible_document(), steps);
|
auto task = HTML::Task::create(vm(), m_media_element_event_task_source.source, HTML::current_principal_settings_object().responsible_document(), steps);
|
||||||
HTML::main_thread_event_loop().task_queue().add(task);
|
HTML::main_thread_event_loop().task_queue().add(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue