mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:57:45 +00:00
LibJS: Convert internal_set_prototype_of() to ThrowCompletionOr
This commit is contained in:
parent
5148150e1c
commit
8c81c84c18
20 changed files with 43 additions and 50 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <AK/FlyString.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibJS/Runtime/Completion.h>
|
||||
#include <LibWeb/Bindings/LocationObject.h>
|
||||
#include <LibWeb/Bindings/WindowObject.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
|
@ -125,7 +126,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocationObject::reload)
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/history.html#location-setprototypeof
|
||||
bool LocationObject::internal_set_prototype_of(Object* prototype)
|
||||
JS::ThrowCompletionOr<bool> LocationObject::internal_set_prototype_of(Object* prototype)
|
||||
{
|
||||
// 1. Return ! SetImmutablePrototype(this, V).
|
||||
return set_immutable_prototype(prototype);
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <LibJS/Runtime/Completion.h>
|
||||
#include <LibJS/Runtime/Object.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
|
||||
|
@ -20,7 +21,7 @@ public:
|
|||
virtual void initialize(JS::GlobalObject&) override;
|
||||
virtual ~LocationObject() override;
|
||||
|
||||
virtual bool internal_set_prototype_of(Object* prototype) override;
|
||||
virtual JS::ThrowCompletionOr<bool> internal_set_prototype_of(Object* prototype) override;
|
||||
virtual bool internal_is_extensible() const override;
|
||||
virtual bool internal_prevent_extensions() override;
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <AK/Base64.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Utf8View.h>
|
||||
#include <LibJS/Runtime/Completion.h>
|
||||
#include <LibJS/Runtime/Error.h>
|
||||
#include <LibJS/Runtime/FunctionObject.h>
|
||||
#include <LibJS/Runtime/Shape.h>
|
||||
|
@ -52,7 +53,7 @@ void WindowObject::initialize_global_object()
|
|||
{
|
||||
Base::initialize_global_object();
|
||||
|
||||
auto success = Object::internal_set_prototype_of(&ensure_web_prototype<EventTargetPrototype>("EventTarget"));
|
||||
auto success = Object::internal_set_prototype_of(&ensure_web_prototype<EventTargetPrototype>("EventTarget")).release_value();
|
||||
VERIFY(success);
|
||||
|
||||
// FIXME: These should be native accessors, not properties
|
||||
|
@ -143,7 +144,7 @@ Origin WindowObject::origin() const
|
|||
}
|
||||
|
||||
// https://heycam.github.io/webidl/#platform-object-setprototypeof
|
||||
bool WindowObject::internal_set_prototype_of(JS::Object* prototype)
|
||||
JS::ThrowCompletionOr<bool> WindowObject::internal_set_prototype_of(JS::Object* prototype)
|
||||
{
|
||||
// 1. Return ? SetImmutablePrototype(O, V).
|
||||
return set_immutable_prototype(prototype);
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include <AK/TypeCasts.h>
|
||||
#include <AK/Weakable.h>
|
||||
#include <LibJS/Runtime/Completion.h>
|
||||
#include <LibJS/Runtime/GlobalObject.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/HTML/GlobalEventHandlers.h>
|
||||
|
@ -60,7 +61,7 @@ public:
|
|||
return *constructor;
|
||||
}
|
||||
|
||||
virtual bool internal_set_prototype_of(JS::Object* prototype) override;
|
||||
virtual JS::ThrowCompletionOr<bool> internal_set_prototype_of(JS::Object* prototype) override;
|
||||
|
||||
private:
|
||||
virtual void visit_edges(Visitor&) override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue