mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 13:36:13 +03:00
LibWeb: Add spec comments to WorkerEnvironmentSettingsObject::setup()
No behavior change.
This commit is contained in:
parent
b3f63f35e5
commit
2d487ee5ab
Notes:
sideshowbarker
2024-07-16 23:51:07 +09:00
Author: https://github.com/tcl3 Commit: https://github.com/SerenityOS/serenity/commit/2d487ee5ab Pull-request: https://github.com/SerenityOS/serenity/pull/24423 Reviewed-by: https://github.com/alimpfard
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2023, Andrew Kaster <akaster@serenityos.org>
|
||||
* Copyright (c) 2024, Tim Ledbetter <timledbetter@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
@ -11,16 +12,28 @@ namespace Web::HTML {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(WorkerEnvironmentSettingsObject);
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/workers.html#set-up-a-worker-environment-settings-object
|
||||
JS::NonnullGCPtr<WorkerEnvironmentSettingsObject> WorkerEnvironmentSettingsObject::setup(JS::NonnullGCPtr<Page> page, NonnullOwnPtr<JS::ExecutionContext> execution_context /* FIXME: null or an environment reservedEnvironment, a URL topLevelCreationURL, and an origin topLevelOrigin */)
|
||||
{
|
||||
// 1. FIXME: Let inherited origin be outside settings's origin.
|
||||
|
||||
// 2. Let realm be the value of execution context's Realm component.
|
||||
auto realm = execution_context->realm;
|
||||
VERIFY(realm);
|
||||
|
||||
// 3. Let worker global scope be realm's global object.
|
||||
auto& worker = verify_cast<HTML::WorkerGlobalScope>(realm->global_object());
|
||||
|
||||
// 4. Let settings object be a new environment settings object whose algorithms are defined as follows:
|
||||
// NOTE: See the functions defined for this class.
|
||||
auto settings_object = realm->heap().allocate<WorkerEnvironmentSettingsObject>(*realm, move(execution_context), worker);
|
||||
settings_object->target_browsing_context = nullptr;
|
||||
|
||||
// FIXME: 5. Set settings object's id to a new unique opaque string, creation URL to worker global scope's url, top-level creation URL to null, target browsing context to null, and active service worker to null.
|
||||
// FIXME: 6. If worker global scope is a DedicatedWorkerGlobalScope object, then set settings object's top-level origin to outside settings's top-level origin.
|
||||
// FIXME: 7. Otherwise, set settings object's top-level origin to an implementation-defined value.
|
||||
|
||||
// 8. Set realm's [[HostDefined]] field to settings object.
|
||||
auto intrinsics = realm->heap().allocate<Bindings::Intrinsics>(*realm, *realm);
|
||||
auto host_defined = make<Bindings::HostDefined>(settings_object, intrinsics, page);
|
||||
realm->set_host_defined(move(host_defined));
|
||||
@ -29,6 +42,7 @@ JS::NonnullGCPtr<WorkerEnvironmentSettingsObject> WorkerEnvironmentSettingsObjec
|
||||
// the realm's [[HostDefined]] internal slot as the internal slot contains the web platform intrinsics
|
||||
worker.initialize_web_interfaces({});
|
||||
|
||||
// 9. Return settings object.
|
||||
return settings_object;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user