1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:48:14 +00:00
serenity/Userland/Libraries/LibJS/Runtime
Linus Groh da177c6517 LibJS: Make Errors fully spec compliant
The previous handling of the name and message properties specifically
was breaking websites that created their own error types and relied on
the error prototype working correctly - not assuming an JS::Error this
object, that is.

The way it works now, and it is supposed to work, is:

- Error.prototype.name and Error.prototype.message just have initial
  string values and are no longer getters/setters
- When constructing an error with a message, we create a regular
  property on the newly created object, so a lookup of the message
  property will either get it from the object directly or go though the
  prototype chain
- Internal m_name/m_message properties are no longer needed and removed

This makes printing errors slightly more complicated, as we can no
longer rely on the (safe) internal properties, and cannot trust a
property lookup either - get_without_side_effects() is used to solve
this, it's not perfect but something we can revisit later.

I did some refactoring along the way, there was some really old stuff in
there - accessing vm.call_frame().arguments[0] is not something we (have
to) do anymore :^)

Fixes #6245.
2021-04-12 09:38:57 +02:00
..
Accessor.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
Array.cpp LibJS: Use MarkedValueList for internal own properties getter functions 2021-04-07 09:05:01 +02:00
Array.h LibJS: Use MarkedValueList for internal own properties getter functions 2021-04-07 09:05:01 +02:00
ArrayBuffer.cpp LibJS: ArrayBuffer.prototype.slice 2021-04-03 16:24:44 +02:00
ArrayBuffer.h LibJS: ArrayBuffer.prototype.slice 2021-04-03 16:24:44 +02:00
ArrayBufferConstructor.cpp Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
ArrayBufferConstructor.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
ArrayBufferPrototype.cpp LibJS: ArrayBuffer.prototype.slice 2021-04-03 16:24:44 +02:00
ArrayBufferPrototype.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
ArrayConstructor.cpp LibJS: Support mapFn argument of Array.from 2021-04-06 22:25:05 +02:00
ArrayConstructor.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
ArrayIterator.cpp Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
ArrayIterator.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
ArrayIteratorPrototype.cpp Everywhere: Rename ASSERT => VERIFY 2021-02-23 20:56:54 +01:00
ArrayIteratorPrototype.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
ArrayPrototype.cpp LibJS: Implement 'Relative Indexing Method' proposal (.at()) 2021-03-12 19:01:08 +01:00
ArrayPrototype.h LibJS: Implement 'Relative Indexing Method' proposal (.at()) 2021-03-12 19:01:08 +01:00
BigInt.cpp Everywhere: Rename ASSERT => VERIFY 2021-02-23 20:56:54 +01:00
BigInt.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
BigIntConstructor.cpp LibJS: Support @@toPrimitive in ToPrimitive abstract operation 2021-03-03 11:04:06 +01:00
BigIntConstructor.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
BigIntObject.cpp LibJS: Remove a whole bunch of unnecessary #includes 2021-02-10 09:13:29 +01:00
BigIntObject.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
BigIntPrototype.cpp Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
BigIntPrototype.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
BooleanConstructor.cpp Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
BooleanConstructor.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
BooleanObject.cpp Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
BooleanObject.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
BooleanPrototype.cpp Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
BooleanPrototype.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
BoundFunction.cpp Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
BoundFunction.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
Cell.cpp LibJS: Always inline Cell::vm() and Cell::heap() 2021-03-21 21:39:39 +01:00
Cell.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
CommonPropertyNames.h LibJS: Implement Object.create() 2021-04-10 21:00:04 +02:00
ConsoleObject.cpp LibJS: Remove a whole bunch of unnecessary #includes 2021-02-10 09:13:29 +01:00
ConsoleObject.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
Date.cpp LibJS Date: Added "Invalid Date". 2021-03-22 20:58:22 +01:00
Date.h WindowServer+LibGUI: Rename WindowType::MenuApplet => Applet 2021-04-04 17:55:50 +02:00
DateConstructor.cpp LibJS Date: Added "Invalid Date". 2021-03-22 20:58:22 +01:00
DateConstructor.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
DatePrototype.cpp LibJS: Don't static_cast<double>() various Date getter values 2021-03-23 20:57:31 +01:00
DatePrototype.h LibJS Date: Added toUTCString() 2021-03-22 20:58:22 +01:00
Error.cpp LibJS: Make Errors fully spec compliant 2021-04-12 09:38:57 +02:00
Error.h LibJS: Make Errors fully spec compliant 2021-04-12 09:38:57 +02:00
ErrorConstructor.cpp LibJS: Make Errors fully spec compliant 2021-04-12 09:38:57 +02:00
ErrorConstructor.h LibJS: Make Errors fully spec compliant 2021-04-12 09:38:57 +02:00
ErrorPrototype.cpp LibJS: Make Errors fully spec compliant 2021-04-12 09:38:57 +02:00
ErrorPrototype.h LibJS: Make Errors fully spec compliant 2021-04-12 09:38:57 +02:00
ErrorTypes.cpp Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
ErrorTypes.h LibJS: Implement Object.freeze() and Object.seal() 2021-04-07 09:05:01 +02:00
Exception.cpp LibJS: Don't track executing AST nodes in a Vector 2021-03-21 21:39:39 +01:00
Exception.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
Function.cpp LibJS: Function must mark its home object 2021-02-07 10:57:07 +01:00
Function.h LibJS: Function must mark its home object 2021-02-07 10:57:07 +01:00
FunctionConstructor.cpp LibJS: Remove a whole bunch of unnecessary #includes 2021-02-10 09:13:29 +01:00
FunctionConstructor.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
FunctionPrototype.cpp LibJS: Change non-ScriptFunction source string to "[native code]" 2021-03-14 19:22:16 +01:00
FunctionPrototype.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
GlobalObject.cpp LibJS: Add initial support for Promises 2021-04-02 10:47:40 +02:00
GlobalObject.h LibJS: Add fast_is<T> for StringObject and GlobalObject 2021-03-19 23:12:47 +01:00
IndexedProperties.cpp LibJS: Fix two issues with array (length > INT32_MAX) 2021-03-30 13:52:56 +02:00
IndexedProperties.h LibJS: Don't punish large arrays with generic indexed property storage 2021-03-21 11:37:10 +01:00
IteratorOperations.cpp Everywhere: Rename ASSERT => VERIFY 2021-02-23 20:56:54 +01:00
IteratorOperations.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
IteratorPrototype.cpp Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
IteratorPrototype.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
JobCallback.h LibJS: Add initial support for Promises 2021-04-02 10:47:40 +02:00
JSONObject.cpp Everywhere: Rename ASSERT => VERIFY 2021-02-23 20:56:54 +01:00
JSONObject.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
LexicalEnvironment.cpp Everywhere: Rename ASSERT => VERIFY 2021-02-23 20:56:54 +01:00
LexicalEnvironment.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
MarkedValueList.cpp Everywhere: Remove a bunch of redundant 'AK::' namespace prefixes 2021-02-26 16:59:56 +01:00
MarkedValueList.h Everywhere: Remove a bunch of redundant 'AK::' namespace prefixes 2021-02-26 16:59:56 +01:00
MathObject.cpp LibJS: Remove a whole bunch of unnecessary #includes 2021-02-10 09:13:29 +01:00
MathObject.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
NativeFunction.cpp Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
NativeFunction.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
NativeProperty.cpp Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
NativeProperty.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
NumberConstructor.cpp Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
NumberConstructor.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
NumberObject.cpp LibJS: Remove a whole bunch of unnecessary #includes 2021-02-10 09:13:29 +01:00
NumberObject.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
NumberPrototype.cpp Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
NumberPrototype.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
Object.cpp LibJS: Add Object::get_without_side_effects() 2021-04-12 09:38:57 +02:00
Object.h LibJS: Add Object::get_without_side_effects() 2021-04-12 09:38:57 +02:00
ObjectConstructor.cpp LibJS: Implement Object.create() 2021-04-10 21:00:04 +02:00
ObjectConstructor.h LibJS: Implement Object.create() 2021-04-10 21:00:04 +02:00
ObjectPrototype.cpp LibJS: Remove a whole bunch of unnecessary #includes 2021-02-10 09:13:29 +01:00
ObjectPrototype.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
PrimitiveString.cpp Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
PrimitiveString.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
Promise.cpp LibJS: Add initial support for Promises 2021-04-02 10:47:40 +02:00
Promise.h LibJS: Add initial support for Promises 2021-04-02 10:47:40 +02:00
PromiseConstructor.cpp LibJS: Add initial support for Promises 2021-04-02 10:47:40 +02:00
PromiseConstructor.h LibJS: Add initial support for Promises 2021-04-02 10:47:40 +02:00
PromiseJobs.cpp LibJS: Add initial support for Promises 2021-04-02 10:47:40 +02:00
PromiseJobs.h LibJS: Add initial support for Promises 2021-04-02 10:47:40 +02:00
PromisePrototype.cpp LibJS: Add initial support for Promises 2021-04-02 10:47:40 +02:00
PromisePrototype.h LibJS: Add initial support for Promises 2021-04-02 10:47:40 +02:00
PromiseReaction.cpp LibJS: Add initial support for Promises 2021-04-02 10:47:40 +02:00
PromiseReaction.h LibJS: Add initial support for Promises 2021-04-02 10:47:40 +02:00
PromiseResolvingFunction.cpp LibJS: Add initial support for Promises 2021-04-02 10:47:40 +02:00
PromiseResolvingFunction.h LibJS: Add initial support for Promises 2021-04-02 10:47:40 +02:00
PropertyAttributes.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
PropertyName.h Everywhere: Rename ASSERT => VERIFY 2021-02-23 20:56:54 +01:00
ProxyConstructor.cpp Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
ProxyConstructor.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
ProxyObject.cpp LibJS: Add Object::get_without_side_effects() 2021-04-12 09:38:57 +02:00
ProxyObject.h LibJS: Add Object::get_without_side_effects() 2021-04-12 09:38:57 +02:00
Reference.cpp LibJS: Use empty value for Reference unresolvable state, not undefined 2021-04-02 22:24:30 +02:00
Reference.h LibJS: Use empty value for Reference unresolvable state, not undefined 2021-04-02 22:24:30 +02:00
ReflectObject.cpp LibJS: Let Object::delete_property() return a bool, not Value 2021-04-10 21:00:04 +02:00
ReflectObject.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
RegExpConstructor.cpp Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
RegExpConstructor.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
RegExpObject.cpp LibJS: Keep RegExp.exec() results in correct order 2021-04-03 16:34:34 +02:00
RegExpObject.h LibJS: Implement (mostly) String.prototype.match 2021-03-14 11:04:50 +01:00
RegExpPrototype.cpp LibJS: Replace Vector with MarkedValueList in RegExpPrototype::symbol_replace 2021-04-11 00:32:59 +02:00
RegExpPrototype.h LibJS: Implement most of String.prototype.replace 2021-04-02 10:48:40 +02:00
ScopeObject.cpp Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
ScopeObject.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
ScriptFunction.cpp LibJS: Respect declaration kind for variables inside functions 2021-02-26 16:59:37 +01:00
ScriptFunction.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
Shape.cpp Everywhere: Rename ASSERT => VERIFY 2021-02-23 20:56:54 +01:00
Shape.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
StringConstructor.cpp Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
StringConstructor.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
StringIterator.cpp Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
StringIterator.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
StringIteratorPrototype.cpp Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
StringIteratorPrototype.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
StringObject.cpp LibJS: Remove a whole bunch of unnecessary #includes 2021-02-10 09:13:29 +01:00
StringObject.h LibJS: Add fast_is<T> for StringObject and GlobalObject 2021-03-19 23:12:47 +01:00
StringOrSymbol.h Everywhere: Rename ASSERT => VERIFY 2021-02-23 20:56:54 +01:00
StringPrototype.cpp LibJS: Implement most of String.prototype.replace 2021-04-02 10:48:40 +02:00
StringPrototype.h LibJS: Implement most of String.prototype.replace 2021-04-02 10:48:40 +02:00
Symbol.cpp Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
Symbol.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
SymbolConstructor.cpp LibJS: Remove a whole bunch of unnecessary #includes 2021-02-10 09:13:29 +01:00
SymbolConstructor.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
SymbolObject.cpp Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
SymbolObject.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
SymbolPrototype.cpp Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
SymbolPrototype.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
TypedArray.cpp LibJS: Added construction of TypedArray from another 2021-04-09 09:05:19 +02:00
TypedArray.h AK+Everywhere: Make StdLibExtras templates less wrapper-y 2021-04-10 21:01:31 +02:00
TypedArrayConstructor.cpp Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
TypedArrayConstructor.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
TypedArrayPrototype.cpp LibJS: Implement 'Relative Indexing Method' proposal (.at()) 2021-03-12 19:01:08 +01:00
TypedArrayPrototype.h LibJS: Implement 'Relative Indexing Method' proposal (.at()) 2021-03-12 19:01:08 +01:00
Uint8ClampedArray.cpp Everywhere: Rename ASSERT => VERIFY 2021-02-23 20:56:54 +01:00
Uint8ClampedArray.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
Value.cpp LibJS: Move 'typeof' string functionality from AST to Value 2021-04-02 22:24:30 +02:00
Value.h LibJS: Move 'typeof' string functionality from AST to Value 2021-04-02 22:24:30 +02:00
VM.cpp LibJS: Make Errors fully spec compliant 2021-04-12 09:38:57 +02:00
VM.h LibJS: Make Errors fully spec compliant 2021-04-12 09:38:57 +02:00
WithScope.cpp Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
WithScope.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00