mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:27:44 +00:00
Meta+LibHTTP through LibWeb: Make clang-format-10 clean
This commit is contained in:
parent
ede5dbd7b3
commit
08f9bc26a6
65 changed files with 297 additions and 273 deletions
|
@ -58,38 +58,38 @@
|
|||
__JS_ENUMERATE(StringObject, string, StringPrototype, StringConstructor) \
|
||||
__JS_ENUMERATE(SymbolObject, symbol, SymbolPrototype, SymbolConstructor)
|
||||
|
||||
#define JS_ENUMERATE_ERROR_SUBCLASSES \
|
||||
__JS_ENUMERATE(EvalError, eval_error, EvalErrorPrototype, EvalErrorConstructor) \
|
||||
__JS_ENUMERATE(InternalError, internal_error, InternalErrorPrototype, InternalErrorConstructor) \
|
||||
__JS_ENUMERATE(InvalidCharacterError, invalid_character_error, InvalidCharacterErrorPrototype, InvalidCharacterErrorConstructor) \
|
||||
__JS_ENUMERATE(RangeError, range_error, RangeErrorPrototype, RangeErrorConstructor) \
|
||||
__JS_ENUMERATE(ReferenceError, reference_error, ReferenceErrorPrototype, ReferenceErrorConstructor) \
|
||||
__JS_ENUMERATE(SyntaxError, syntax_error, SyntaxErrorPrototype, SyntaxErrorConstructor) \
|
||||
__JS_ENUMERATE(TypeError, type_error, TypeErrorPrototype, TypeErrorConstructor) \
|
||||
#define JS_ENUMERATE_ERROR_SUBCLASSES \
|
||||
__JS_ENUMERATE(EvalError, eval_error, EvalErrorPrototype, EvalErrorConstructor) \
|
||||
__JS_ENUMERATE(InternalError, internal_error, InternalErrorPrototype, InternalErrorConstructor) \
|
||||
__JS_ENUMERATE(InvalidCharacterError, invalid_character_error, InvalidCharacterErrorPrototype, InvalidCharacterErrorConstructor) \
|
||||
__JS_ENUMERATE(RangeError, range_error, RangeErrorPrototype, RangeErrorConstructor) \
|
||||
__JS_ENUMERATE(ReferenceError, reference_error, ReferenceErrorPrototype, ReferenceErrorConstructor) \
|
||||
__JS_ENUMERATE(SyntaxError, syntax_error, SyntaxErrorPrototype, SyntaxErrorConstructor) \
|
||||
__JS_ENUMERATE(TypeError, type_error, TypeErrorPrototype, TypeErrorConstructor) \
|
||||
__JS_ENUMERATE(URIError, uri_error, URIErrorPrototype, URIErrorConstructor)
|
||||
|
||||
#define JS_ENUMERATE_ITERATOR_PROTOTYPES \
|
||||
__JS_ENUMERATE(Iterator, iterator) \
|
||||
__JS_ENUMERATE(ArrayIterator, array_iterator) \
|
||||
#define JS_ENUMERATE_ITERATOR_PROTOTYPES \
|
||||
__JS_ENUMERATE(Iterator, iterator) \
|
||||
__JS_ENUMERATE(ArrayIterator, array_iterator) \
|
||||
__JS_ENUMERATE(StringIterator, string_iterator)
|
||||
|
||||
#define JS_ENUMERATE_BUILTIN_TYPES \
|
||||
JS_ENUMERATE_NATIVE_OBJECTS \
|
||||
JS_ENUMERATE_ERROR_SUBCLASSES
|
||||
|
||||
#define JS_ENUMERATE_WELL_KNOWN_SYMBOLS \
|
||||
__JS_ENUMERATE(iterator, iterator) \
|
||||
__JS_ENUMERATE(asyncIterator, async_iterator) \
|
||||
__JS_ENUMERATE(match, match) \
|
||||
__JS_ENUMERATE(matchAll, match_all) \
|
||||
__JS_ENUMERATE(replace, replace) \
|
||||
__JS_ENUMERATE(search, search) \
|
||||
__JS_ENUMERATE(split, split) \
|
||||
__JS_ENUMERATE(hasInstance, has_instance) \
|
||||
__JS_ENUMERATE(isConcatSpreadable, is_concat_spreadable) \
|
||||
__JS_ENUMERATE(unscopables, unscopables) \
|
||||
__JS_ENUMERATE(species, species) \
|
||||
__JS_ENUMERATE(toPrimitive, to_primitive) \
|
||||
#define JS_ENUMERATE_WELL_KNOWN_SYMBOLS \
|
||||
__JS_ENUMERATE(iterator, iterator) \
|
||||
__JS_ENUMERATE(asyncIterator, async_iterator) \
|
||||
__JS_ENUMERATE(match, match) \
|
||||
__JS_ENUMERATE(matchAll, match_all) \
|
||||
__JS_ENUMERATE(replace, replace) \
|
||||
__JS_ENUMERATE(search, search) \
|
||||
__JS_ENUMERATE(split, split) \
|
||||
__JS_ENUMERATE(hasInstance, has_instance) \
|
||||
__JS_ENUMERATE(isConcatSpreadable, is_concat_spreadable) \
|
||||
__JS_ENUMERATE(unscopables, unscopables) \
|
||||
__JS_ENUMERATE(species, species) \
|
||||
__JS_ENUMERATE(toPrimitive, to_primitive) \
|
||||
__JS_ENUMERATE(toStringTag, to_string_tag)
|
||||
|
||||
namespace JS {
|
||||
|
|
|
@ -55,7 +55,7 @@ private:
|
|||
template<class T>
|
||||
class Handle {
|
||||
public:
|
||||
Handle() {}
|
||||
Handle() { }
|
||||
|
||||
static Handle create(T* cell)
|
||||
{
|
||||
|
|
|
@ -45,7 +45,7 @@ ArrayIterator::~ArrayIterator()
|
|||
{
|
||||
}
|
||||
|
||||
void ArrayIterator::visit_children(Cell::Visitor & visitor)
|
||||
void ArrayIterator::visit_children(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_children(visitor);
|
||||
visitor.visit(m_array);
|
||||
|
|
|
@ -37,7 +37,8 @@
|
|||
|
||||
namespace JS {
|
||||
|
||||
static Value parse_simplified_iso8601(const String& iso_8601) {
|
||||
static Value parse_simplified_iso8601(const String& iso_8601)
|
||||
{
|
||||
// Date.parse() is allowed to accept many formats. We strictly only accept things matching
|
||||
// http://www.ecma-international.org/ecma-262/#sec-date-time-string-format
|
||||
GenericLexer lexer(iso_8601);
|
||||
|
|
|
@ -32,6 +32,7 @@ namespace JS {
|
|||
|
||||
class DatePrototype final : public Object {
|
||||
JS_OBJECT(DatePrototype, Object);
|
||||
|
||||
public:
|
||||
explicit DatePrototype(GlobalObject&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
|
|
|
@ -56,7 +56,7 @@ Error::~Error()
|
|||
: Error(#ClassName, message, prototype) \
|
||||
{ \
|
||||
} \
|
||||
ClassName::~ClassName() { } \
|
||||
ClassName::~ClassName() { }
|
||||
|
||||
JS_ENUMERATE_ERROR_SUBCLASSES
|
||||
#undef __JS_ENUMERATE
|
||||
|
|
|
@ -68,16 +68,16 @@ Value ErrorConstructor::construct(Interpreter& interpreter, Function&)
|
|||
: NativeFunction(*global_object.function_prototype()) \
|
||||
{ \
|
||||
} \
|
||||
void ConstructorName::initialize(GlobalObject& global_object) \
|
||||
void ConstructorName::initialize(GlobalObject& global_object) \
|
||||
{ \
|
||||
NativeFunction::initialize(global_object); \
|
||||
NativeFunction::initialize(global_object); \
|
||||
define_property("prototype", global_object.snake_name##_prototype(), 0); \
|
||||
define_property("length", Value(1), Attribute::Configurable); \
|
||||
} \
|
||||
ConstructorName::~ConstructorName() { } \
|
||||
Value ConstructorName::call(Interpreter& interpreter) \
|
||||
{ \
|
||||
return construct(interpreter, *this); \
|
||||
return construct(interpreter, *this); \
|
||||
} \
|
||||
Value ConstructorName::construct(Interpreter& interpreter, Function&) \
|
||||
{ \
|
||||
|
|
|
@ -52,7 +52,7 @@ private:
|
|||
\
|
||||
public: \
|
||||
explicit ConstructorName(GlobalObject&); \
|
||||
virtual void initialize(GlobalObject&) override; \
|
||||
virtual void initialize(GlobalObject&) override; \
|
||||
virtual ~ConstructorName() override; \
|
||||
virtual Value call(Interpreter&) override; \
|
||||
virtual Value construct(Interpreter&, Function& new_target) override; \
|
||||
|
|
|
@ -132,7 +132,7 @@ JS_DEFINE_NATIVE_FUNCTION(ErrorPrototype::to_string)
|
|||
: Object(*global_object.error_prototype()) \
|
||||
{ \
|
||||
} \
|
||||
PrototypeName::~PrototypeName() {}
|
||||
PrototypeName::~PrototypeName() { }
|
||||
|
||||
JS_ENUMERATE_ERROR_SUBCLASSES
|
||||
#undef __JS_ENUMERATE
|
||||
|
|
|
@ -53,7 +53,7 @@ private:
|
|||
\
|
||||
public: \
|
||||
explicit PrototypeName(GlobalObject&); \
|
||||
virtual void initialize(GlobalObject&) override { } \
|
||||
virtual void initialize(GlobalObject&) override { } \
|
||||
virtual ~PrototypeName() override; \
|
||||
};
|
||||
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
namespace JS {
|
||||
|
||||
#define __ENUMERATE_JS_ERROR(name, message) \
|
||||
const ErrorType ErrorType::name = ErrorType(message);
|
||||
JS_ENUMERATE_ERROR_TYPES(__ENUMERATE_JS_ERROR)
|
||||
const ErrorType ErrorType::name = ErrorType(message);
|
||||
JS_ENUMERATE_ERROR_TYPES(__ENUMERATE_JS_ERROR)
|
||||
#undef __ENUMERATE_JS_ERROR
|
||||
|
||||
}
|
||||
|
|
|
@ -26,138 +26,137 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#define JS_ENUMERATE_ERROR_TYPES(M) \
|
||||
M(ArrayInvalidLength, "Invalid array length") \
|
||||
M(ArrayMaxSize, "Maximum array size exceeded") \
|
||||
M(ArrayPrototypeOneArg, "Array.prototype.%s() requires at least one argument") \
|
||||
M(AccessorBadField, "Accessor descriptor's '%s' field must be a function or undefined") \
|
||||
M(AccessorValueOrWritable, "Accessor property descriptor cannot specify a value or writable key") \
|
||||
M(BigIntBadOperator, "Cannot use %s operator with BigInt") \
|
||||
M(BigIntBadOperatorOtherType, "Cannot use %s operator with BigInt and other type") \
|
||||
M(BigIntIntArgument, "BigInt argument must be an integer") \
|
||||
M(BigIntInvalidValue, "Invalid value for BigInt: %s") \
|
||||
M(ClassDoesNotExtendAConstructorOrNull, "Class extends value %s is not a constructor or null") \
|
||||
M(Convert, "Cannot convert %s to %s") \
|
||||
M(ConvertUndefinedToObject, "Cannot convert undefined to object") \
|
||||
M(DescChangeNonConfigurable, "Cannot change attributes of non-configurable property '%s'") \
|
||||
M(FunctionArgsNotObject, "Argument array must be an object") \
|
||||
M(InOperatorWithObject, "'in' operator must be used on an object") \
|
||||
M(InstanceOfOperatorBadPrototype, "'prototype' property of %s is not an object") \
|
||||
M(InvalidAssignToConst, "Invalid assignment to const variable") \
|
||||
M(InvalidLeftHandAssignment, "Invalid left-hand side in assignment") \
|
||||
M(InvalidRadix, "Radix must be an integer no less than 2, and no greater than 36") \
|
||||
M(IsNotA, "%s is not a %s") \
|
||||
M(IsNotAEvaluatedFrom, "%s is not a %s (evaluated from '%s')") \
|
||||
M(IterableNextBadReturn, "iterator.next() returned a non-object value") \
|
||||
M(IterableNextNotAFunction, "'next' property on returned object from Symbol.iterator method is " \
|
||||
"not a function") \
|
||||
M(JsonBigInt, "Cannot serialize BigInt value to JSON") \
|
||||
M(JsonCircular, "Cannot stringify circular object") \
|
||||
M(JsonMalformed, "Malformed JSON string") \
|
||||
M(NotA, "Not a %s object") \
|
||||
M(NotAConstructor, "%s is not a constructor") \
|
||||
M(NotAFunction, "%s is not a function") \
|
||||
M(NotAFunctionNoParam, "Not a function") \
|
||||
M(NotAn, "Not an %s object") \
|
||||
M(NotAnObject, "%s is not an object") \
|
||||
M(NotASymbol, "%s is not a symbol") \
|
||||
M(NotIterable, "%s is not iterable") \
|
||||
M(NonExtensibleDefine, "Cannot define property %s on non-extensible object") \
|
||||
M(NumberIncompatibleThis, "Number.prototype.%s method called with incompatible this target") \
|
||||
M(ObjectDefinePropertyReturnedFalse, "Object's [[DefineProperty]] method returned false") \
|
||||
M(ObjectSetPrototypeOfReturnedFalse, "Object's [[SetPrototypeOf]] method returned false") \
|
||||
M(ObjectSetPrototypeOfTwoArgs, "Object.setPrototypeOf requires at least two arguments") \
|
||||
M(ObjectPreventExtensionsReturnedFalse, "Object's [[PreventExtensions]] method returned false") \
|
||||
M(ObjectPrototypeNullOrUndefinedOnSuperPropertyAccess, \
|
||||
"Object prototype must not be %s on a super property access") \
|
||||
M(ObjectPrototypeWrongType, "Prototype must be an object or null") \
|
||||
M(ProxyCallWithNew, "Proxy must be called with the 'new' operator") \
|
||||
M(ProxyConstructBadReturnType, "Proxy handler's construct trap violates invariant: must return " \
|
||||
"an object") \
|
||||
M(ProxyConstructorBadType, "Expected %s argument of Proxy constructor to be object, got %s") \
|
||||
M(ProxyDefinePropExistingConfigurable, "Proxy handler's defineProperty trap violates " \
|
||||
"invariant: a property cannot be defined as non-configurable if it already exists on the " \
|
||||
"target object as a configurable property") \
|
||||
M(ProxyDefinePropIncompatibleDescriptor, "Proxy handler's defineProperty trap violates " \
|
||||
"invariant: the new descriptor is not compatible with the existing descriptor of the " \
|
||||
"property on the target") \
|
||||
M(ProxyDefinePropNonConfigurableNonExisting, "Proxy handler's defineProperty trap " \
|
||||
"violates invariant: a property cannot be defined as non-configurable if it does not " \
|
||||
"already exist on the target object") \
|
||||
M(ProxyDefinePropNonExtensible, "Proxy handler's defineProperty trap violates invariant: " \
|
||||
"a property cannot be reported as being defined if the property does not exist on " \
|
||||
"the target and the target is non-extensible") \
|
||||
M(ProxyDeleteNonConfigurable, "Proxy handler's deleteProperty trap violates invariant: " \
|
||||
"cannot report a non-configurable own property of the target as deleted") \
|
||||
M(ProxyGetImmutableDataProperty, "Proxy handler's get trap violates invariant: the " \
|
||||
"returned value must match the value on the target if the property exists on the " \
|
||||
"target as a non-writable, non-configurable own data property") \
|
||||
M(ProxyGetNonConfigurableAccessor, "Proxy handler's get trap violates invariant: the " \
|
||||
"returned value must be undefined if the property exists on the target as a " \
|
||||
"non-configurable accessor property with an undefined get attribute") \
|
||||
M(ProxyGetOwnDescriptorExistingConfigurable, "Proxy handler's getOwnPropertyDescriptor " \
|
||||
"trap violates invariant: a property cannot be defined as non-configurable if it " \
|
||||
"already exists on the target object as a configurable property") \
|
||||
M(ProxyGetOwnDescriptorInvalidDescriptor, "Proxy handler's getOwnPropertyDescriptor trap " \
|
||||
"violates invariant: invalid property descriptor for existing property on the target") \
|
||||
M(ProxyGetOwnDescriptorInvalidNonConfig, "Proxy handler's getOwnPropertyDescriptor trap " \
|
||||
"violates invariant: cannot report target's property as non-configurable if the " \
|
||||
"property does not exist, or if it is configurable") \
|
||||
M(ProxyGetOwnDescriptorNonConfigurable, "Proxy handler's getOwnPropertyDescriptor trap " \
|
||||
"violates invariant: cannot return undefined for a property on the target which is " \
|
||||
"a non-configurable property") \
|
||||
M(ProxyGetOwnDescriptorReturn, "Proxy handler's getOwnPropertyDescriptor trap violates " \
|
||||
"invariant: must return an object or undefined") \
|
||||
M(ProxyGetOwnDescriptorUndefReturn, "Proxy handler's getOwnPropertyDescriptor trap " \
|
||||
"violates invariant: cannot report a property as being undefined if it exists as an " \
|
||||
"own property of the target and the target is non-extensible") \
|
||||
M(ProxyGetPrototypeOfNonExtensible, "Proxy handler's getPrototypeOf trap violates " \
|
||||
"invariant: cannot return a different prototype object for a non-extensible target") \
|
||||
M(ProxyGetPrototypeOfReturn, "Proxy handler's getPrototypeOf trap violates invariant: " \
|
||||
"must return an object or null") \
|
||||
M(ProxyHasExistingNonConfigurable, "Proxy handler's has trap violates invariant: a " \
|
||||
"property cannot be reported as non-existent if it exists on the target as a " \
|
||||
"non-configurable property") \
|
||||
M(ProxyHasExistingNonExtensible, "Proxy handler's has trap violates invariant: a property " \
|
||||
"cannot be reported as non-existent if it exists on the target and the target is " \
|
||||
"non-extensible") \
|
||||
M(ProxyInvalidTrap, "Proxy handler's %s trap wasn't undefined, null, or callable") \
|
||||
M(ProxyIsExtensibleReturn, "Proxy handler's isExtensible trap violates invariant: " \
|
||||
"return value must match the target's extensibility") \
|
||||
M(ProxyPreventExtensionsReturn, "Proxy handler's preventExtensions trap violates " \
|
||||
"invariant: cannot return true if the target object is extensible") \
|
||||
M(ProxyRevoked, "An operation was performed on a revoked Proxy object") \
|
||||
M(ProxySetImmutableDataProperty, "Proxy handler's set trap violates invariant: cannot " \
|
||||
"return true for a property on the target which is a non-configurable, non-writable " \
|
||||
"own data property") \
|
||||
M(ProxySetNonConfigurableAccessor, "Proxy handler's set trap violates invariant: cannot " \
|
||||
"return true for a property on the target which is a non-configurable own accessor " \
|
||||
"property with an undefined set attribute") \
|
||||
M(ProxySetPrototypeOfNonExtensible, "Proxy handler's setPrototypeOf trap violates " \
|
||||
"invariant: the argument must match the prototype of the target if the " \
|
||||
"target is non-extensible") \
|
||||
M(ProxyTwoArguments, "Proxy constructor requires at least two arguments") \
|
||||
M(ReduceNoInitial, "Reduce of empty array with no initial value") \
|
||||
M(ReferencePrimitiveAssignment, "Cannot assign property %s to primitive value") \
|
||||
M(ReferenceUnresolvable, "Unresolvable reference") \
|
||||
M(ReflectArgumentMustBeAFunction, "First argument of Reflect.%s() must be a function") \
|
||||
M(ReflectArgumentMustBeAnObject, "First argument of Reflect.%s() must be an object") \
|
||||
M(ReflectBadArgumentsList, "Arguments list must be an object") \
|
||||
M(ReflectBadNewTarget, "Optional third argument of Reflect.construct() must be a constructor") \
|
||||
M(ReflectBadDescriptorArgument, "Descriptor argument is not an object") \
|
||||
M(StringRawCannotConvert, "Cannot convert property 'raw' to object from %s") \
|
||||
M(StringRepeatCountMustBe, "repeat count must be a %s number") \
|
||||
M(ThisHasNotBeenInitialized, "|this| has not been initialized") \
|
||||
M(ThisIsAlreadyInitialized, "|this| is already initialized") \
|
||||
M(ToObjectNullOrUndef, "ToObject on null or undefined") \
|
||||
M(UnknownIdentifier, "'%s' is not defined") \
|
||||
/* LibWeb bindings */ \
|
||||
M(NotAByteString, "Argument to %s() must be a byte string") \
|
||||
M(BadArgCountOne, "%s() needs one argument") \
|
||||
M(BadArgCountAtLeastOne, "%s() needs at least one argument") \
|
||||
#define JS_ENUMERATE_ERROR_TYPES(M) \
|
||||
M(ArrayInvalidLength, "Invalid array length") \
|
||||
M(ArrayMaxSize, "Maximum array size exceeded") \
|
||||
M(ArrayPrototypeOneArg, "Array.prototype.%s() requires at least one argument") \
|
||||
M(AccessorBadField, "Accessor descriptor's '%s' field must be a function or undefined") \
|
||||
M(AccessorValueOrWritable, "Accessor property descriptor cannot specify a value or writable key") \
|
||||
M(BigIntBadOperator, "Cannot use %s operator with BigInt") \
|
||||
M(BigIntBadOperatorOtherType, "Cannot use %s operator with BigInt and other type") \
|
||||
M(BigIntIntArgument, "BigInt argument must be an integer") \
|
||||
M(BigIntInvalidValue, "Invalid value for BigInt: %s") \
|
||||
M(ClassDoesNotExtendAConstructorOrNull, "Class extends value %s is not a constructor or null") \
|
||||
M(Convert, "Cannot convert %s to %s") \
|
||||
M(ConvertUndefinedToObject, "Cannot convert undefined to object") \
|
||||
M(DescChangeNonConfigurable, "Cannot change attributes of non-configurable property '%s'") \
|
||||
M(FunctionArgsNotObject, "Argument array must be an object") \
|
||||
M(InOperatorWithObject, "'in' operator must be used on an object") \
|
||||
M(InstanceOfOperatorBadPrototype, "'prototype' property of %s is not an object") \
|
||||
M(InvalidAssignToConst, "Invalid assignment to const variable") \
|
||||
M(InvalidLeftHandAssignment, "Invalid left-hand side in assignment") \
|
||||
M(InvalidRadix, "Radix must be an integer no less than 2, and no greater than 36") \
|
||||
M(IsNotA, "%s is not a %s") \
|
||||
M(IsNotAEvaluatedFrom, "%s is not a %s (evaluated from '%s')") \
|
||||
M(IterableNextBadReturn, "iterator.next() returned a non-object value") \
|
||||
M(IterableNextNotAFunction, "'next' property on returned object from Symbol.iterator method is " \
|
||||
"not a function") \
|
||||
M(JsonBigInt, "Cannot serialize BigInt value to JSON") \
|
||||
M(JsonCircular, "Cannot stringify circular object") \
|
||||
M(JsonMalformed, "Malformed JSON string") \
|
||||
M(NotA, "Not a %s object") \
|
||||
M(NotAConstructor, "%s is not a constructor") \
|
||||
M(NotAFunction, "%s is not a function") \
|
||||
M(NotAFunctionNoParam, "Not a function") \
|
||||
M(NotAn, "Not an %s object") \
|
||||
M(NotAnObject, "%s is not an object") \
|
||||
M(NotASymbol, "%s is not a symbol") \
|
||||
M(NotIterable, "%s is not iterable") \
|
||||
M(NonExtensibleDefine, "Cannot define property %s on non-extensible object") \
|
||||
M(NumberIncompatibleThis, "Number.prototype.%s method called with incompatible this target") \
|
||||
M(ObjectDefinePropertyReturnedFalse, "Object's [[DefineProperty]] method returned false") \
|
||||
M(ObjectSetPrototypeOfReturnedFalse, "Object's [[SetPrototypeOf]] method returned false") \
|
||||
M(ObjectSetPrototypeOfTwoArgs, "Object.setPrototypeOf requires at least two arguments") \
|
||||
M(ObjectPreventExtensionsReturnedFalse, "Object's [[PreventExtensions]] method returned false") \
|
||||
M(ObjectPrototypeNullOrUndefinedOnSuperPropertyAccess, \
|
||||
"Object prototype must not be %s on a super property access") \
|
||||
M(ObjectPrototypeWrongType, "Prototype must be an object or null") \
|
||||
M(ProxyCallWithNew, "Proxy must be called with the 'new' operator") \
|
||||
M(ProxyConstructBadReturnType, "Proxy handler's construct trap violates invariant: must return " \
|
||||
"an object") \
|
||||
M(ProxyConstructorBadType, "Expected %s argument of Proxy constructor to be object, got %s") \
|
||||
M(ProxyDefinePropExistingConfigurable, "Proxy handler's defineProperty trap violates " \
|
||||
"invariant: a property cannot be defined as non-configurable if it already exists on the " \
|
||||
"target object as a configurable property") \
|
||||
M(ProxyDefinePropIncompatibleDescriptor, "Proxy handler's defineProperty trap violates " \
|
||||
"invariant: the new descriptor is not compatible with the existing descriptor of the " \
|
||||
"property on the target") \
|
||||
M(ProxyDefinePropNonConfigurableNonExisting, "Proxy handler's defineProperty trap " \
|
||||
"violates invariant: a property cannot be defined as non-configurable if it does not " \
|
||||
"already exist on the target object") \
|
||||
M(ProxyDefinePropNonExtensible, "Proxy handler's defineProperty trap violates invariant: " \
|
||||
"a property cannot be reported as being defined if the property does not exist on " \
|
||||
"the target and the target is non-extensible") \
|
||||
M(ProxyDeleteNonConfigurable, "Proxy handler's deleteProperty trap violates invariant: " \
|
||||
"cannot report a non-configurable own property of the target as deleted") \
|
||||
M(ProxyGetImmutableDataProperty, "Proxy handler's get trap violates invariant: the " \
|
||||
"returned value must match the value on the target if the property exists on the " \
|
||||
"target as a non-writable, non-configurable own data property") \
|
||||
M(ProxyGetNonConfigurableAccessor, "Proxy handler's get trap violates invariant: the " \
|
||||
"returned value must be undefined if the property exists on the target as a " \
|
||||
"non-configurable accessor property with an undefined get attribute") \
|
||||
M(ProxyGetOwnDescriptorExistingConfigurable, "Proxy handler's getOwnPropertyDescriptor " \
|
||||
"trap violates invariant: a property cannot be defined as non-configurable if it " \
|
||||
"already exists on the target object as a configurable property") \
|
||||
M(ProxyGetOwnDescriptorInvalidDescriptor, "Proxy handler's getOwnPropertyDescriptor trap " \
|
||||
"violates invariant: invalid property descriptor for existing property on the target") \
|
||||
M(ProxyGetOwnDescriptorInvalidNonConfig, "Proxy handler's getOwnPropertyDescriptor trap " \
|
||||
"violates invariant: cannot report target's property as non-configurable if the " \
|
||||
"property does not exist, or if it is configurable") \
|
||||
M(ProxyGetOwnDescriptorNonConfigurable, "Proxy handler's getOwnPropertyDescriptor trap " \
|
||||
"violates invariant: cannot return undefined for a property on the target which is " \
|
||||
"a non-configurable property") \
|
||||
M(ProxyGetOwnDescriptorReturn, "Proxy handler's getOwnPropertyDescriptor trap violates " \
|
||||
"invariant: must return an object or undefined") \
|
||||
M(ProxyGetOwnDescriptorUndefReturn, "Proxy handler's getOwnPropertyDescriptor trap " \
|
||||
"violates invariant: cannot report a property as being undefined if it exists as an " \
|
||||
"own property of the target and the target is non-extensible") \
|
||||
M(ProxyGetPrototypeOfNonExtensible, "Proxy handler's getPrototypeOf trap violates " \
|
||||
"invariant: cannot return a different prototype object for a non-extensible target") \
|
||||
M(ProxyGetPrototypeOfReturn, "Proxy handler's getPrototypeOf trap violates invariant: " \
|
||||
"must return an object or null") \
|
||||
M(ProxyHasExistingNonConfigurable, "Proxy handler's has trap violates invariant: a " \
|
||||
"property cannot be reported as non-existent if it exists on the target as a " \
|
||||
"non-configurable property") \
|
||||
M(ProxyHasExistingNonExtensible, "Proxy handler's has trap violates invariant: a property " \
|
||||
"cannot be reported as non-existent if it exists on the target and the target is " \
|
||||
"non-extensible") \
|
||||
M(ProxyInvalidTrap, "Proxy handler's %s trap wasn't undefined, null, or callable") \
|
||||
M(ProxyIsExtensibleReturn, "Proxy handler's isExtensible trap violates invariant: " \
|
||||
"return value must match the target's extensibility") \
|
||||
M(ProxyPreventExtensionsReturn, "Proxy handler's preventExtensions trap violates " \
|
||||
"invariant: cannot return true if the target object is extensible") \
|
||||
M(ProxyRevoked, "An operation was performed on a revoked Proxy object") \
|
||||
M(ProxySetImmutableDataProperty, "Proxy handler's set trap violates invariant: cannot " \
|
||||
"return true for a property on the target which is a non-configurable, non-writable " \
|
||||
"own data property") \
|
||||
M(ProxySetNonConfigurableAccessor, "Proxy handler's set trap violates invariant: cannot " \
|
||||
"return true for a property on the target which is a non-configurable own accessor " \
|
||||
"property with an undefined set attribute") \
|
||||
M(ProxySetPrototypeOfNonExtensible, "Proxy handler's setPrototypeOf trap violates " \
|
||||
"invariant: the argument must match the prototype of the target if the " \
|
||||
"target is non-extensible") \
|
||||
M(ProxyTwoArguments, "Proxy constructor requires at least two arguments") \
|
||||
M(ReduceNoInitial, "Reduce of empty array with no initial value") \
|
||||
M(ReferencePrimitiveAssignment, "Cannot assign property %s to primitive value") \
|
||||
M(ReferenceUnresolvable, "Unresolvable reference") \
|
||||
M(ReflectArgumentMustBeAFunction, "First argument of Reflect.%s() must be a function") \
|
||||
M(ReflectArgumentMustBeAnObject, "First argument of Reflect.%s() must be an object") \
|
||||
M(ReflectBadArgumentsList, "Arguments list must be an object") \
|
||||
M(ReflectBadNewTarget, "Optional third argument of Reflect.construct() must be a constructor") \
|
||||
M(ReflectBadDescriptorArgument, "Descriptor argument is not an object") \
|
||||
M(StringRawCannotConvert, "Cannot convert property 'raw' to object from %s") \
|
||||
M(StringRepeatCountMustBe, "repeat count must be a %s number") \
|
||||
M(ThisHasNotBeenInitialized, "|this| has not been initialized") \
|
||||
M(ThisIsAlreadyInitialized, "|this| is already initialized") \
|
||||
M(ToObjectNullOrUndef, "ToObject on null or undefined") \
|
||||
M(UnknownIdentifier, "'%s' is not defined") \
|
||||
/* LibWeb bindings */ \
|
||||
M(NotAByteString, "Argument to %s() must be a byte string") \
|
||||
M(BadArgCountOne, "%s() needs one argument") \
|
||||
M(BadArgCountAtLeastOne, "%s() needs at least one argument") \
|
||||
M(BadArgCountMany, "%s() needs %s arguments")
|
||||
|
||||
|
||||
namespace JS {
|
||||
|
||||
class ErrorType {
|
||||
|
@ -167,7 +166,10 @@ public:
|
|||
JS_ENUMERATE_ERROR_TYPES(__ENUMERATE_JS_ERROR)
|
||||
#undef __ENUMERATE_JS_ERROR
|
||||
|
||||
const char* message() const { return m_message; };
|
||||
const char* message() const
|
||||
{
|
||||
return m_message;
|
||||
}
|
||||
|
||||
private:
|
||||
explicit ErrorType(const char* message)
|
||||
|
@ -179,4 +181,3 @@ private:
|
|||
};
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,6 @@ private:
|
|||
Object* m_##snake_name##_prototype { nullptr };
|
||||
JS_ENUMERATE_ITERATOR_PROTOTYPES
|
||||
#undef __JS_ENUMERATE
|
||||
|
||||
};
|
||||
|
||||
template<typename ConstructorType>
|
||||
|
|
|
@ -33,10 +33,12 @@
|
|||
namespace JS {
|
||||
|
||||
static const u8 max_precision_for_radix[37] = {
|
||||
// clang-format off
|
||||
0, 0, 52, 32, 26, 22, 20, 18, 17, 16,
|
||||
15, 15, 14, 14, 13, 13, 13, 12, 12, 12,
|
||||
12, 11, 11, 11, 11, 11, 11, 10, 10, 10,
|
||||
10, 10, 10, 10, 10, 10, 10,
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
static char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz";
|
||||
|
|
|
@ -81,7 +81,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::to_string)
|
|||
|
||||
String tag;
|
||||
auto to_string_tag = this_object->get(global_object.vm().well_known_symbol_to_string_tag());
|
||||
|
||||
|
||||
if (to_string_tag.is_string()) {
|
||||
tag = to_string_tag.as_string().string();
|
||||
} else if (this_object->is_array()) {
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Types.h>
|
||||
#include <AK/LogStream.h>
|
||||
#include <AK/Types.h>
|
||||
|
||||
namespace JS {
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include <LibJS/Runtime/RegExpObject.h>
|
||||
#include <LibJS/Runtime/Value.h>
|
||||
|
||||
|
||||
namespace JS {
|
||||
|
||||
RegExpObject* RegExpObject::create(GlobalObject& global_object, String content, String flags)
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
*/
|
||||
|
||||
#include <AK/Utf8View.h>
|
||||
#include <LibJS/Runtime/StringIterator.h>
|
||||
#include <LibJS/Runtime/GlobalObject.h>
|
||||
#include <LibJS/Runtime/StringIterator.h>
|
||||
|
||||
namespace JS {
|
||||
|
||||
|
|
|
@ -25,11 +25,11 @@
|
|||
*/
|
||||
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibJS/Runtime/StringIterator.h>
|
||||
#include <LibJS/Runtime/StringIteratorPrototype.h>
|
||||
#include <LibJS/Runtime/Error.h>
|
||||
#include <LibJS/Runtime/GlobalObject.h>
|
||||
#include <LibJS/Runtime/IteratorOperations.h>
|
||||
#include <LibJS/Runtime/StringIterator.h>
|
||||
#include <LibJS/Runtime/StringIteratorPrototype.h>
|
||||
|
||||
namespace JS {
|
||||
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
#include <LibJS/Runtime/Error.h>
|
||||
#include <LibJS/Runtime/GlobalObject.h>
|
||||
#include <LibJS/Runtime/PrimitiveString.h>
|
||||
#include <LibJS/Runtime/StringObject.h>
|
||||
#include <LibJS/Runtime/StringIterator.h>
|
||||
#include <LibJS/Runtime/StringObject.h>
|
||||
#include <LibJS/Runtime/StringPrototype.h>
|
||||
#include <LibJS/Runtime/Value.h>
|
||||
#include <string.h>
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
|
||||
namespace JS {
|
||||
|
||||
|
||||
SymbolObject* SymbolObject::create(GlobalObject& global_object, Symbol& primitive_symbol)
|
||||
{
|
||||
return global_object.heap().allocate<SymbolObject>(global_object, primitive_symbol, *global_object.symbol_prototype());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue