mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
LibWeb: Make global prototype chains immutable
Per https://webidl.spec.whatwg.org/#interface-prototype-object any global platform object should reject prototype changes (besides from ShadowRealmGlobalScope), and interface prototype objects on global prototype chains must be immutable. We already handled parts of this on the globals themselves, but not the full chain. Also align some spec comments to the latest WebIDL spec.
This commit is contained in:
committed by
Shannon Booth
parent
ce4861156b
commit
379461e047
Notes:
github-actions[bot]
2026-04-03 16:35:00 +00:00
Author: https://github.com/shannonbooth Commit: https://github.com/LadybirdBrowser/ladybird/commit/379461e0477 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8723 Reviewed-by: https://github.com/gmta
@@ -37,6 +37,16 @@ WorkerGlobalScope::WorkerGlobalScope(JS::Realm& realm, GC::Ref<Web::Page> page)
|
||||
|
||||
WorkerGlobalScope::~WorkerGlobalScope() = default;
|
||||
|
||||
// https://webidl.spec.whatwg.org/#platform-object-setprototypeof
|
||||
JS::ThrowCompletionOr<bool> WorkerGlobalScope::internal_set_prototype_of(JS::Object* prototype)
|
||||
{
|
||||
// 1. If O’s associated realm’s is global prototype chain mutable is true, return ? OrdinarySetPrototypeOf(O, V).
|
||||
// NB: This is never the case for WorkerGlobalScope.
|
||||
|
||||
// 2. Return ? SetImmutablePrototype(O, V).
|
||||
return set_immutable_prototype(prototype);
|
||||
}
|
||||
|
||||
void WorkerGlobalScope::initialize_web_interfaces_impl()
|
||||
{
|
||||
auto& realm = this->realm();
|
||||
|
||||
Reference in New Issue
Block a user