mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:27:45 +00:00
LibJS: Make Object.prototype.toString() fully spec compliant
- Fix evaluation order: IsArray(O) should always be called and before Get(O, @@toStringTag), previously it was the other way around and IsArray would only be called if @@toStringTag is not a string - Add missing exception checks to both function calls - Add missing builtin tag for arguments object Also, while we're here: - Update variable names to match spec - Add spec step comments
This commit is contained in:
parent
e1906d74b8
commit
339ccba354
5 changed files with 87 additions and 36 deletions
|
@ -151,6 +151,9 @@ public:
|
|||
// B.3.7 The [[IsHTMLDDA]] Internal Slot, https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
|
||||
virtual bool is_htmldda() const { return false; }
|
||||
|
||||
bool has_parameter_map() const { return m_has_parameter_map; }
|
||||
void set_has_parameter_map() { m_has_parameter_map = true; }
|
||||
|
||||
virtual const char* class_name() const override { return "Object"; }
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
virtual Value value_of() const { return Value(const_cast<Object*>(this)); }
|
||||
|
@ -194,8 +197,12 @@ protected:
|
|||
explicit Object(GlobalObjectTag);
|
||||
Object(ConstructWithoutPrototypeTag, GlobalObject&);
|
||||
|
||||
// [[Extensible]]
|
||||
bool m_is_extensible { true };
|
||||
|
||||
// [[ParameterMap]]
|
||||
bool m_has_parameter_map { false };
|
||||
|
||||
private:
|
||||
Value call_native_property_getter(NativeProperty& property, Value this_value) const;
|
||||
void call_native_property_setter(NativeProperty& property, Value this_value, Value) const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue