mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-19 14:40:18 +00:00
LibWeb/HTML: Add cross-site ancestor flag to environment
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Corresponds to baec061a70
This commit is contained in:
parent
cfdc4bad7c
commit
4bcfc4bacc
Notes:
github-actions[bot]
2025-08-11 11:23:58 +00:00
Author: https://github.com/AtkinsSJ
Commit: 4bcfc4bacc
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5763
10 changed files with 73 additions and 16 deletions
|
@ -30,7 +30,8 @@ GC::Ref<WorkerEnvironmentSettingsObject> WorkerEnvironmentSettingsObject::setup(
|
|||
|
||||
// 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->create<WorkerEnvironmentSettingsObject>(move(execution_context), worker, move(inherited_origin), unsafe_worker_creation_time);
|
||||
// FIXME: Is it enough to cache the has_cross_site_ancestor of outside_settings, or do we need to check the live object somehow?
|
||||
auto settings_object = realm->create<WorkerEnvironmentSettingsObject>(move(execution_context), worker, move(inherited_origin), outside_settings.has_cross_site_ancestor, unsafe_worker_creation_time);
|
||||
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.
|
||||
|
@ -53,12 +54,14 @@ GC::Ref<WorkerEnvironmentSettingsObject> WorkerEnvironmentSettingsObject::setup(
|
|||
return settings_object;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/workers.html#script-settings-for-workers:api-base-url
|
||||
URL::URL WorkerEnvironmentSettingsObject::api_base_url() const
|
||||
{
|
||||
// Return worker global scope's url.
|
||||
return m_global_scope->url();
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/workers.html#script-settings-for-workers:concept-settings-object-origin-2
|
||||
URL::Origin WorkerEnvironmentSettingsObject::origin() const
|
||||
{
|
||||
// Return a unique opaque origin if worker global scope's url's scheme is "data", and inherited origin otherwise.
|
||||
|
@ -67,18 +70,36 @@ URL::Origin WorkerEnvironmentSettingsObject::origin() const
|
|||
return m_origin;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/workers.html#script-settings-for-workers:concept-settings-object-has-cross-site-ancestor
|
||||
bool WorkerEnvironmentSettingsObject::has_cross_site_ancestor() const
|
||||
{
|
||||
// 1. If outside settings's has cross-site ancestor is true, then return true.
|
||||
if (m_outside_settings_has_cross_site_ancestor)
|
||||
return true;
|
||||
|
||||
// 2. If worker global scope's url's scheme is "data", then return true.
|
||||
if (m_global_scope->url().scheme() == "data"sv)
|
||||
return true;
|
||||
|
||||
// 3. Return false.
|
||||
return false;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/workers.html#script-settings-for-workers:concept-settings-object-policy-container
|
||||
GC::Ref<PolicyContainer> WorkerEnvironmentSettingsObject::policy_container() const
|
||||
{
|
||||
// Return worker global scope's policy container.
|
||||
return m_global_scope->policy_container();
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/workers.html#script-settings-for-workers:concept-settings-object-cross-origin-isolated-capability
|
||||
CanUseCrossOriginIsolatedAPIs WorkerEnvironmentSettingsObject::cross_origin_isolated_capability() const
|
||||
{
|
||||
// FIXME: Return worker global scope's cross-origin isolated capability.
|
||||
return CanUseCrossOriginIsolatedAPIs::No;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/workers.html#script-settings-for-workers:concept-settings-object-time-origin
|
||||
double WorkerEnvironmentSettingsObject::time_origin() const
|
||||
{
|
||||
// Return the result of coarsening unsafeWorkerCreationTime with worker global scope's cross-origin isolated capability.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue