diff options
author | Luke Wilde <lukew@serenityos.org> | 2021-09-26 15:26:30 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-26 18:59:56 +0200 |
commit | e0e41116a4d3414018b41fa476242f31bee3482d (patch) | |
tree | 1b13153fca39364e8c241c79f69e6cdabc37acd5 /Userland/Libraries | |
parent | f6b24a72ee60be994917d941e30c4fe7ccccfee6 (diff) | |
download | serenity-e0e41116a4d3414018b41fa476242f31bee3482d.zip |
LibWeb: Make WindowObject's prototype immutable
While I was implementing IDL special operations, I noticed that for
global platform objects (e.g. WindowObject), the IDL spec makes their
prototype immutable.
https://heycam.github.io/webidl/#platform-object-setprototypeof
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibWeb/Bindings/WindowObject.cpp | 7 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Bindings/WindowObject.h | 2 |
2 files changed, 9 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp b/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp index cf9ae65202..4ee9eea972 100644 --- a/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp +++ b/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp @@ -136,6 +136,13 @@ Origin WindowObject::origin() const return impl().associated_document().origin(); } +// https://heycam.github.io/webidl/#platform-object-setprototypeof +bool WindowObject::internal_set_prototype_of(JS::Object* prototype) +{ + // 1. Return ? SetImmutablePrototype(O, V). + return set_immutable_prototype(prototype); +} + static DOM::Window* impl_from(JS::VM& vm, JS::GlobalObject& global_object) { // Since this is a non built-in function we must treat it as non-strict mode diff --git a/Userland/Libraries/LibWeb/Bindings/WindowObject.h b/Userland/Libraries/LibWeb/Bindings/WindowObject.h index a148d95ee4..eda6c5d72a 100644 --- a/Userland/Libraries/LibWeb/Bindings/WindowObject.h +++ b/Userland/Libraries/LibWeb/Bindings/WindowObject.h @@ -60,6 +60,8 @@ public: return *constructor; } + virtual bool internal_set_prototype_of(JS::Object* prototype) override; + private: virtual void visit_edges(Visitor&) override; |