Changeset 274552 in webkit


Ignore:
Timestamp:
Mar 16, 2021 11:02:42 PM (16 months ago)
Author:
Ross Kirsling
Message:

[JSC] Implement Error#cause
https://bugs.webkit.org/show_bug.cgi?id=223302

Reviewed by Yusuke Suzuki.

JSTests:

Add tests. test262 doesn't currently have any, but the spec is exceedingly simple anyway.

  • stress/error-cause.js: Added.

Source/JavaScriptCore:

This patch implements the Error.prototype.cause proposal, which reached Stage 3 at last week's TC39 meeting:
https://github.com/tc39/proposal-error-cause

This very simple proposal allows to one reference the "error that caused this one" in a cascading scenario.
It does so by adding an options bag parameter to the Error, _NativeError_, and AggregateError constructors.
If it is an object with a cause property, the property will be used; if not, nothing happens at all.

  • API/JSObjectRef.cpp:

(JSObjectMakeError):

  • runtime/AggregateError.cpp:

(JSC::AggregateError::finishCreation):
(JSC::AggregateError::create):

  • runtime/AggregateError.h:
  • runtime/AggregateErrorConstructor.cpp:

(JSC::JSC_DEFINE_HOST_FUNCTION):

  • runtime/CommonIdentifiers.h:
  • runtime/Error.cpp:

(JSC::createError):
(JSC::createEvalError):
(JSC::createRangeError):
(JSC::createReferenceError):
(JSC::createSyntaxError):
(JSC::createTypeError):
(JSC::createURIError):
(JSC::createGetterTypeError):

  • runtime/ErrorConstructor.cpp:

(JSC::JSC_DEFINE_HOST_FUNCTION):

  • runtime/ErrorInstance.cpp:

(JSC::ErrorInstance::create):
(JSC::ErrorInstance::finishCreation):

  • runtime/ErrorInstance.h:

(JSC::ErrorInstance::create):

  • runtime/JSGlobalObjectFunctions.cpp:

(JSC::JSC_DEFINE_HOST_FUNCTION):

  • runtime/NativeErrorConstructor.cpp:

(JSC::NativeErrorConstructor<errorType>::constructImpl):
(JSC::NativeErrorConstructor<errorType>::callImpl):

  • runtime/NullSetterFunction.cpp:

(JSC::NullSetterFunctionInternal::JSC_DEFINE_HOST_FUNCTION):

  • wasm/js/JSWebAssemblyCompileError.cpp:

(JSC::JSWebAssemblyCompileError::create):

  • wasm/js/JSWebAssemblyLinkError.cpp:

(JSC::JSWebAssemblyLinkError::create):

  • wasm/js/JSWebAssemblyRuntimeError.cpp:

(JSC::JSWebAssemblyRuntimeError::create):

  • wasm/js/WebAssemblyCompileErrorConstructor.cpp:

(JSC::JSC_DEFINE_HOST_FUNCTION):

  • wasm/js/WebAssemblyLinkErrorConstructor.cpp:

(JSC::JSC_DEFINE_HOST_FUNCTION):

  • wasm/js/WebAssemblyRuntimeErrorConstructor.cpp:

(JSC::JSC_DEFINE_HOST_FUNCTION):

Location:
trunk
Files:
1 added
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r274539 r274552  
     12021-03-16  Ross Kirsling  <ross.kirsling@sony.com>
     2
     3        [JSC] Implement Error#cause
     4        https://bugs.webkit.org/show_bug.cgi?id=223302
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        Add tests. test262 doesn't currently have any, but the spec is exceedingly simple anyway.
     9
     10        * stress/error-cause.js: Added.
     11
    1122021-03-16  Saam Barati  <sbarati@apple.com>
    213
  • trunk/Source/JavaScriptCore/API/JSObjectRef.cpp

    r271269 r274552  
    232232
    233233    JSValue message = argumentCount ? toJS(globalObject, arguments[0]) : jsUndefined();
     234    JSValue options = argumentCount > 1 ? toJS(globalObject, arguments[1]) : jsUndefined();
    234235    Structure* errorStructure = globalObject->errorStructure();
    235     JSObject* result = ErrorInstance::create(globalObject, errorStructure, message);
     236    JSObject* result = ErrorInstance::create(globalObject, errorStructure, message, options);
    236237
    237238    if (handleExceptionIfNeeded(scope, ctx, exception) == ExceptionStatus::DidThrow)
  • trunk/Source/JavaScriptCore/ChangeLog

    r274539 r274552  
     12021-03-16  Ross Kirsling  <ross.kirsling@sony.com>
     2
     3        [JSC] Implement Error#cause
     4        https://bugs.webkit.org/show_bug.cgi?id=223302
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        This patch implements the Error.prototype.cause proposal, which reached Stage 3 at last week's TC39 meeting:
     9        https://github.com/tc39/proposal-error-cause
     10
     11        This very simple proposal allows to one reference the "error that caused this one" in a cascading scenario.
     12        It does so by adding an options bag parameter to the Error, _NativeError_, and AggregateError constructors.
     13        If it is an object with a `cause` property, the property will be used; if not, nothing happens at all.
     14
     15        * API/JSObjectRef.cpp:
     16        (JSObjectMakeError):
     17        * runtime/AggregateError.cpp:
     18        (JSC::AggregateError::finishCreation):
     19        (JSC::AggregateError::create):
     20        * runtime/AggregateError.h:
     21        * runtime/AggregateErrorConstructor.cpp:
     22        (JSC::JSC_DEFINE_HOST_FUNCTION):
     23        * runtime/CommonIdentifiers.h:
     24        * runtime/Error.cpp:
     25        (JSC::createError):
     26        (JSC::createEvalError):
     27        (JSC::createRangeError):
     28        (JSC::createReferenceError):
     29        (JSC::createSyntaxError):
     30        (JSC::createTypeError):
     31        (JSC::createURIError):
     32        (JSC::createGetterTypeError):
     33        * runtime/ErrorConstructor.cpp:
     34        (JSC::JSC_DEFINE_HOST_FUNCTION):
     35        * runtime/ErrorInstance.cpp:
     36        (JSC::ErrorInstance::create):
     37        (JSC::ErrorInstance::finishCreation):
     38        * runtime/ErrorInstance.h:
     39        (JSC::ErrorInstance::create):
     40        * runtime/JSGlobalObjectFunctions.cpp:
     41        (JSC::JSC_DEFINE_HOST_FUNCTION):
     42        * runtime/NativeErrorConstructor.cpp:
     43        (JSC::NativeErrorConstructor<errorType>::constructImpl):
     44        (JSC::NativeErrorConstructor<errorType>::callImpl):
     45        * runtime/NullSetterFunction.cpp:
     46        (JSC::NullSetterFunctionInternal::JSC_DEFINE_HOST_FUNCTION):
     47        * wasm/js/JSWebAssemblyCompileError.cpp:
     48        (JSC::JSWebAssemblyCompileError::create):
     49        * wasm/js/JSWebAssemblyLinkError.cpp:
     50        (JSC::JSWebAssemblyLinkError::create):
     51        * wasm/js/JSWebAssemblyRuntimeError.cpp:
     52        (JSC::JSWebAssemblyRuntimeError::create):
     53        * wasm/js/WebAssemblyCompileErrorConstructor.cpp:
     54        (JSC::JSC_DEFINE_HOST_FUNCTION):
     55        * wasm/js/WebAssemblyLinkErrorConstructor.cpp:
     56        (JSC::JSC_DEFINE_HOST_FUNCTION):
     57        * wasm/js/WebAssemblyRuntimeErrorConstructor.cpp:
     58        (JSC::JSC_DEFINE_HOST_FUNCTION):
     59
    1602021-03-16  Saam Barati  <sbarati@apple.com>
    261
  • trunk/Source/JavaScriptCore/runtime/AggregateError.cpp

    r273203 r274552  
    4141}
    4242
    43 void AggregateError::finishCreation(VM& vm, JSGlobalObject* globalObject, const MarkedArgumentBuffer& errors, const String& message, SourceAppender appender, RuntimeType type, bool useCurrentFrame)
     43void AggregateError::finishCreation(VM& vm, JSGlobalObject* globalObject, const MarkedArgumentBuffer& errors, const String& message, JSValue cause, SourceAppender appender, RuntimeType type, bool useCurrentFrame)
    4444{
    45     Base::finishCreation(vm, globalObject, message, appender, type, useCurrentFrame);
     45    Base::finishCreation(vm, globalObject, message, cause, appender, type, useCurrentFrame);
    4646    ASSERT(inherits(vm, info()));
    4747
     
    5151}
    5252
    53 AggregateError* AggregateError::create(JSGlobalObject* globalObject, VM& vm, Structure* structure, JSValue errors, JSValue message, SourceAppender appender, RuntimeType type, bool useCurrentFrame)
     53AggregateError* AggregateError::create(JSGlobalObject* globalObject, VM& vm, Structure* structure, JSValue errors, JSValue message, JSValue options, SourceAppender appender, RuntimeType type, bool useCurrentFrame)
    5454{
    5555    auto scope = DECLARE_THROW_SCOPE(vm);
    5656
    57     String messageString;
    58     if (!message.isUndefined()) {
    59         messageString = message.toWTFString(globalObject);
    60         RETURN_IF_EXCEPTION(scope, nullptr);
    61     }
     57    String messageString = message.isUndefined() ? String() : message.toWTFString(globalObject);
     58    RETURN_IF_EXCEPTION(scope, nullptr);
     59
     60    JSValue cause = !options.isObject() ? jsUndefined() : options.get(globalObject, vm.propertyNames->cause);
     61    RETURN_IF_EXCEPTION(scope, nullptr);
    6262
    6363    MarkedArgumentBuffer errorsList;
     
    6969    RETURN_IF_EXCEPTION(scope, nullptr);
    7070
    71     RELEASE_AND_RETURN(scope, create(globalObject, vm, structure, errorsList, messageString, appender, type, useCurrentFrame));
     71    RELEASE_AND_RETURN(scope, create(globalObject, vm, structure, errorsList, messageString, cause, appender, type, useCurrentFrame));
    7272}
    7373
  • trunk/Source/JavaScriptCore/runtime/AggregateError.h

    r263006 r274552  
    5050    }
    5151
    52     static AggregateError* create(JSGlobalObject* globalObject, VM& vm, Structure* structure, const MarkedArgumentBuffer& errors, const String& message, SourceAppender appender = nullptr, RuntimeType type = TypeNothing, bool useCurrentFrame = true)
     52    static AggregateError* create(JSGlobalObject* globalObject, VM& vm, Structure* structure, const MarkedArgumentBuffer& errors, const String& message, JSValue cause, SourceAppender appender = nullptr, RuntimeType type = TypeNothing, bool useCurrentFrame = true)
    5353    {
    5454        auto* instance = new (NotNull, allocateCell<AggregateError>(vm.heap)) AggregateError(vm, structure);
    55         instance->finishCreation(vm, globalObject, errors, message, appender, type, useCurrentFrame);
     55        instance->finishCreation(vm, globalObject, errors, message, cause, appender, type, useCurrentFrame);
    5656        return instance;
    5757    }
    5858
    59     static AggregateError* create(JSGlobalObject*, VM&, Structure*, JSValue errors, JSValue message, SourceAppender = nullptr, RuntimeType = TypeNothing, bool useCurrentFrame = true);
     59    static AggregateError* create(JSGlobalObject*, VM&, Structure*, JSValue errors, JSValue message, JSValue options, SourceAppender = nullptr, RuntimeType = TypeNothing, bool useCurrentFrame = true);
    6060
    61     void finishCreation(VM&, JSGlobalObject*, const MarkedArgumentBuffer& errors, const String& message, SourceAppender = nullptr, RuntimeType = TypeNothing, bool useCurrentFrame = true);
     61    void finishCreation(VM&, JSGlobalObject*, const MarkedArgumentBuffer& errors, const String& message, JSValue cause, SourceAppender = nullptr, RuntimeType = TypeNothing, bool useCurrentFrame = true);
    6262
    6363private:
  • trunk/Source/JavaScriptCore/runtime/AggregateErrorConstructor.cpp

    r273661 r274552  
    6161    JSValue errors = callFrame->argument(0);
    6262    JSValue message = callFrame->argument(1);
     63    JSValue options = callFrame->argument(2);
    6364    Structure* errorStructure = globalObject->errorStructure(ErrorType::AggregateError);
    64     return JSValue::encode(AggregateError::create(globalObject, vm, errorStructure, errors, message, nullptr, TypeNothing, false));
     65    return JSValue::encode(AggregateError::create(globalObject, vm, errorStructure, errors, message, options, nullptr, TypeNothing, false));
    6566}
    6667
     
    7172    JSValue errors = callFrame->argument(0);
    7273    JSValue message = callFrame->argument(1);
     74    JSValue options = callFrame->argument(2);
    7375
    7476    JSObject* newTarget = asObject(callFrame->newTarget());
     
    7779    ASSERT(errorStructure);
    7880
    79     RELEASE_AND_RETURN(scope, JSValue::encode(AggregateError::create(globalObject, vm, errorStructure, errors, message, nullptr, TypeNothing, false)));
     81    RELEASE_AND_RETURN(scope, JSValue::encode(AggregateError::create(globalObject, vm, errorStructure, errors, message, options, nullptr, TypeNothing, false)));
    8082}
    8183
  • trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h

    r273086 r274552  
    8585    macro(caller) \
    8686    macro(caseFirst) \
     87    macro(cause) \
    8788    macro(clear) \
    8889    macro(collation) \
  • trunk/Source/JavaScriptCore/runtime/Error.cpp

    r273203 r274552  
    3636{
    3737    ASSERT(!message.isEmpty());
    38     return ErrorInstance::create(globalObject, globalObject->vm(), globalObject->errorStructure(), message, appender, TypeNothing, ErrorType::Error, true);
     38    return ErrorInstance::create(globalObject, globalObject->vm(), globalObject->errorStructure(), message, jsUndefined(), appender, TypeNothing, ErrorType::Error, true);
    3939}
    4040
     
    4242{
    4343    ASSERT(!message.isEmpty());
    44     return ErrorInstance::create(globalObject, globalObject->vm(), globalObject->errorStructure(ErrorType::EvalError), message, appender, TypeNothing, ErrorType::EvalError, true);
     44    return ErrorInstance::create(globalObject, globalObject->vm(), globalObject->errorStructure(ErrorType::EvalError), message, jsUndefined(), appender, TypeNothing, ErrorType::EvalError, true);
    4545}
    4646
     
    4848{
    4949    ASSERT(!message.isEmpty());
    50     return ErrorInstance::create(globalObject, globalObject->vm(), globalObject->errorStructure(ErrorType::RangeError), message, appender, TypeNothing, ErrorType::RangeError, true);
     50    return ErrorInstance::create(globalObject, globalObject->vm(), globalObject->errorStructure(ErrorType::RangeError), message, jsUndefined(), appender, TypeNothing, ErrorType::RangeError, true);
    5151}
    5252
     
    5454{
    5555    ASSERT(!message.isEmpty());
    56     return ErrorInstance::create(globalObject, globalObject->vm(), globalObject->errorStructure(ErrorType::ReferenceError), message, appender, TypeNothing, ErrorType::ReferenceError, true);
     56    return ErrorInstance::create(globalObject, globalObject->vm(), globalObject->errorStructure(ErrorType::ReferenceError), message, jsUndefined(), appender, TypeNothing, ErrorType::ReferenceError, true);
    5757}
    5858
     
    6060{
    6161    ASSERT(!message.isEmpty());
    62     return ErrorInstance::create(globalObject, globalObject->vm(), globalObject->errorStructure(ErrorType::SyntaxError), message, appender, TypeNothing, ErrorType::SyntaxError, true);
     62    return ErrorInstance::create(globalObject, globalObject->vm(), globalObject->errorStructure(ErrorType::SyntaxError), message, jsUndefined(), appender, TypeNothing, ErrorType::SyntaxError, true);
    6363}
    6464
     
    6666{
    6767    ASSERT(!message.isEmpty());
    68     return ErrorInstance::create(globalObject, globalObject->vm(), globalObject->errorStructure(ErrorType::TypeError), message, appender, type, ErrorType::TypeError, true);
     68    return ErrorInstance::create(globalObject, globalObject->vm(), globalObject->errorStructure(ErrorType::TypeError), message, jsUndefined(), appender, type, ErrorType::TypeError, true);
    6969}
    7070
     
    7777{
    7878    ASSERT(!message.isEmpty());
    79     return ErrorInstance::create(globalObject, globalObject->vm(), globalObject->errorStructure(ErrorType::URIError), message, appender, TypeNothing, ErrorType::URIError, true);
     79    return ErrorInstance::create(globalObject, globalObject->vm(), globalObject->errorStructure(ErrorType::URIError), message, jsUndefined(), appender, TypeNothing, ErrorType::URIError, true);
    8080}
    8181
     
    114114{
    115115    ASSERT(!message.isEmpty());
    116     auto* error = ErrorInstance::create(globalObject, globalObject->vm(), globalObject->errorStructure(ErrorType::TypeError), message, nullptr, TypeNothing, ErrorType::TypeError);
     116    auto* error = ErrorInstance::create(globalObject, globalObject->vm(), globalObject->errorStructure(ErrorType::TypeError), message, jsUndefined(), nullptr, TypeNothing, ErrorType::TypeError);
    117117    error->setNativeGetterTypeError();
    118118    return error;
  • trunk/Source/JavaScriptCore/runtime/ErrorConstructor.cpp

    r273661 r274552  
    5454    auto scope = DECLARE_THROW_SCOPE(vm);
    5555    JSValue message = callFrame->argument(0);
     56    JSValue options = callFrame->argument(1);
    5657
    5758    JSObject* newTarget = asObject(callFrame->newTarget());
     
    5960    RETURN_IF_EXCEPTION(scope, { });
    6061
    61     RELEASE_AND_RETURN(scope, JSValue::encode(ErrorInstance::create(globalObject, errorStructure, message, nullptr, TypeNothing, ErrorType::Error, false)));
     62    RELEASE_AND_RETURN(scope, JSValue::encode(ErrorInstance::create(globalObject, errorStructure, message, options, nullptr, TypeNothing, ErrorType::Error, false)));
    6263}
    6364
     
    6566{
    6667    JSValue message = callFrame->argument(0);
     68    JSValue options = callFrame->argument(1);
    6769    Structure* errorStructure = globalObject->errorStructure();
    68     return JSValue::encode(ErrorInstance::create(globalObject, errorStructure, message, nullptr, TypeNothing, ErrorType::Error, false));
     70    return JSValue::encode(ErrorInstance::create(globalObject, errorStructure, message, options, nullptr, TypeNothing, ErrorType::Error, false));
    6971}
    7072
  • trunk/Source/JavaScriptCore/runtime/ErrorInstance.cpp

    r273203 r274552  
    4545}
    4646
    47 ErrorInstance* ErrorInstance::create(JSGlobalObject* globalObject, Structure* structure, JSValue message, SourceAppender appender, RuntimeType type, ErrorType errorType, bool useCurrentFrame)
     47ErrorInstance* ErrorInstance::create(JSGlobalObject* globalObject, Structure* structure, JSValue message, JSValue options, SourceAppender appender, RuntimeType type, ErrorType errorType, bool useCurrentFrame)
    4848{
    4949    VM& vm = globalObject->vm();
    5050    auto scope = DECLARE_THROW_SCOPE(vm);
     51
    5152    String messageString = message.isUndefined() ? String() : message.toWTFString(globalObject);
    5253    RETURN_IF_EXCEPTION(scope, nullptr);
    53     return create(globalObject, vm, structure, messageString, appender, type, errorType, useCurrentFrame);
     54
     55    JSValue cause = !options.isObject() ? jsUndefined() : options.get(globalObject, vm.propertyNames->cause);
     56    RETURN_IF_EXCEPTION(scope, nullptr);
     57
     58    return create(globalObject, vm, structure, messageString, cause, appender, type, errorType, useCurrentFrame);
    5459}
    5560
     
    106111}
    107112
    108 void ErrorInstance::finishCreation(VM& vm, JSGlobalObject* globalObject, const String& message, SourceAppender appender, RuntimeType type, bool useCurrentFrame)
     113void ErrorInstance::finishCreation(VM& vm, JSGlobalObject* globalObject, const String& message, JSValue cause, SourceAppender appender, RuntimeType type, bool useCurrentFrame)
    109114{
    110115    Base::finishCreation(vm);
     
    132137    if (!messageWithSource.isNull())
    133138        putDirect(vm, vm.propertyNames->message, jsString(vm, messageWithSource), static_cast<unsigned>(PropertyAttribute::DontEnum));
     139
     140    if (!cause.isUndefined())
     141        putDirect(vm, vm.propertyNames->cause, cause, static_cast<unsigned>(PropertyAttribute::DontEnum));
    134142}
    135143
  • trunk/Source/JavaScriptCore/runtime/ErrorInstance.h

    r273203 r274552  
    5555    }
    5656
    57     static ErrorInstance* create(JSGlobalObject* globalObject, VM& vm, Structure* structure, const String& message, SourceAppender appender = nullptr, RuntimeType type = TypeNothing, ErrorType errorType = ErrorType::Error, bool useCurrentFrame = true)
     57    static ErrorInstance* create(JSGlobalObject* globalObject, VM& vm, Structure* structure, const String& message, JSValue cause, SourceAppender appender = nullptr, RuntimeType type = TypeNothing, ErrorType errorType = ErrorType::Error, bool useCurrentFrame = true)
    5858    {
    5959        ErrorInstance* instance = new (NotNull, allocateCell<ErrorInstance>(vm.heap)) ErrorInstance(vm, structure, errorType);
    60         instance->finishCreation(vm, globalObject, message, appender, type, useCurrentFrame);
     60        instance->finishCreation(vm, globalObject, message, cause, appender, type, useCurrentFrame);
    6161        return instance;
    6262    }
    6363
    64     static ErrorInstance* create(JSGlobalObject*, Structure*, JSValue message, SourceAppender = nullptr, RuntimeType = TypeNothing, ErrorType = ErrorType::Error, bool useCurrentFrame = true);
     64    static ErrorInstance* create(JSGlobalObject*, Structure*, JSValue message, JSValue options, SourceAppender = nullptr, RuntimeType = TypeNothing, ErrorType = ErrorType::Error, bool useCurrentFrame = true);
    6565
    6666    bool hasSourceAppender() const { return !!m_sourceAppender; }
     
    9595    explicit ErrorInstance(VM&, Structure*, ErrorType);
    9696
    97     void finishCreation(VM&, JSGlobalObject*, const String&, SourceAppender = nullptr, RuntimeType = TypeNothing, bool useCurrentFrame = true);
     97    void finishCreation(VM&, JSGlobalObject*, const String& message, JSValue cause, SourceAppender = nullptr, RuntimeType = TypeNothing, bool useCurrentFrame = true);
    9898
    9999    static bool getOwnPropertySlot(JSObject*, JSGlobalObject*, PropertyName, PropertySlot&);
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp

    r273203 r274552  
    696696{
    697697    Structure* errorStructure = globalObject->errorStructure(ErrorType::TypeError);
    698     return JSValue::encode(ErrorInstance::create(globalObject, errorStructure, callFrame->argument(0), nullptr, TypeNothing, ErrorType::TypeError, false));
     698    return JSValue::encode(ErrorInstance::create(globalObject, errorStructure, callFrame->argument(0), jsUndefined(), nullptr, TypeNothing, ErrorType::TypeError, false));
    699699}
    700700
  • trunk/Source/JavaScriptCore/runtime/NativeErrorConstructor.cpp

    r273661 r274552  
    5151    auto scope = DECLARE_THROW_SCOPE(vm);
    5252    JSValue message = callFrame->argument(0);
     53    JSValue options = callFrame->argument(1);
    5354
    5455    JSObject* newTarget = asObject(callFrame->newTarget());
    5556    Structure* errorStructure = JSC_GET_DERIVED_STRUCTURE(vm, errorStructureWithErrorType<errorType>, newTarget, callFrame->jsCallee());
    5657    RETURN_IF_EXCEPTION(scope, { });
    57     RELEASE_AND_RETURN(scope, JSValue::encode(ErrorInstance::create(globalObject, errorStructure, message, nullptr, TypeNothing, errorType, false)));
     58    RELEASE_AND_RETURN(scope, JSValue::encode(ErrorInstance::create(globalObject, errorStructure, message, options, nullptr, TypeNothing, errorType, false)));
    5859}
    5960
     
    6263{
    6364    JSValue message = callFrame->argument(0);
     65    JSValue options = callFrame->argument(1);
    6466    Structure* errorStructure = globalObject->errorStructure(errorType);
    65     return JSValue::encode(ErrorInstance::create(globalObject, errorStructure, message, nullptr, TypeNothing, errorType, false));
     67    return JSValue::encode(ErrorInstance::create(globalObject, errorStructure, message, options, nullptr, TypeNothing, errorType, false));
    6668}
    6769
  • trunk/Source/JavaScriptCore/runtime/NullSetterFunction.cpp

    r273203 r274552  
    9595    // This function is only called from IC. And we do not want to include this frame in Error's stack.
    9696    constexpr bool useCurrentFrame = false;
    97     throwException(globalObject, scope, ErrorInstance::create(globalObject, vm, globalObject->errorStructure(ErrorType::TypeError), ReadonlyPropertyWriteError, nullptr, TypeNothing, ErrorType::TypeError, useCurrentFrame));
     97    throwException(globalObject, scope, ErrorInstance::create(globalObject, vm, globalObject->errorStructure(ErrorType::TypeError), ReadonlyPropertyWriteError, jsUndefined(), nullptr, TypeNothing, ErrorType::TypeError, useCurrentFrame));
    9898    return { };
    9999}
  • trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyCompileError.cpp

    r273203 r274552  
    3737    auto* instance = new (NotNull, allocateCell<JSWebAssemblyCompileError>(vm.heap)) JSWebAssemblyCompileError(vm, structure);
    3838    bool useCurrentFrame = true;
    39     instance->finishCreation(vm, globalObject, message, defaultSourceAppender, TypeNothing, useCurrentFrame);
     39    instance->finishCreation(vm, globalObject, message, jsUndefined(), defaultSourceAppender, TypeNothing, useCurrentFrame);
    4040    return instance;
    4141}
  • trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyLinkError.cpp

    r273203 r274552  
    3737    auto* instance = new (NotNull, allocateCell<JSWebAssemblyLinkError>(vm.heap)) JSWebAssemblyLinkError(vm, structure);
    3838    bool useCurrentFrame = true;
    39     instance->finishCreation(vm, globalObject, message, defaultSourceAppender, TypeNothing, useCurrentFrame);
     39    instance->finishCreation(vm, globalObject, message, jsUndefined(), defaultSourceAppender, TypeNothing, useCurrentFrame);
    4040    return instance;
    4141}
  • trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyRuntimeError.cpp

    r273203 r274552  
    3737    auto* instance = new (NotNull, allocateCell<JSWebAssemblyRuntimeError>(vm.heap)) JSWebAssemblyRuntimeError(vm, structure);
    3838    bool useCurrentFrame = true;
    39     instance->finishCreation(vm, globalObject, message, defaultSourceAppender, TypeNothing, useCurrentFrame);
     39    instance->finishCreation(vm, globalObject, message, jsUndefined(), defaultSourceAppender, TypeNothing, useCurrentFrame);
    4040    return instance;
    4141}
  • trunk/Source/JavaScriptCore/wasm/js/WebAssemblyCompileErrorConstructor.cpp

    r273661 r274552  
    6464    JSValue message = callFrame->argument(0);
    6565    Structure* errorStructure = globalObject->webAssemblyCompileErrorStructure();
    66     return JSValue::encode(ErrorInstance::create(globalObject, errorStructure, message, nullptr, TypeNothing, ErrorType::Error, false));
     66    return JSValue::encode(ErrorInstance::create(globalObject, errorStructure, message, jsUndefined(), nullptr, TypeNothing, ErrorType::Error, false));
    6767}
    6868
  • trunk/Source/JavaScriptCore/wasm/js/WebAssemblyLinkErrorConstructor.cpp

    r273661 r274552  
    6464    JSValue message = callFrame->argument(0);
    6565    Structure* errorStructure = globalObject->webAssemblyLinkErrorStructure();
    66     return JSValue::encode(ErrorInstance::create(globalObject, errorStructure, message, nullptr, TypeNothing, ErrorType::Error, false));
     66    return JSValue::encode(ErrorInstance::create(globalObject, errorStructure, message, jsUndefined(), nullptr, TypeNothing, ErrorType::Error, false));
    6767}
    6868
  • trunk/Source/JavaScriptCore/wasm/js/WebAssemblyRuntimeErrorConstructor.cpp

    r273661 r274552  
    6666    JSValue message = callFrame->argument(0);
    6767    Structure* errorStructure = globalObject->webAssemblyRuntimeErrorStructure();
    68     return JSValue::encode(ErrorInstance::create(globalObject, errorStructure, message, nullptr, TypeNothing, ErrorType::Error, false));
     68    return JSValue::encode(ErrorInstance::create(globalObject, errorStructure, message, jsUndefined(), nullptr, TypeNothing, ErrorType::Error, false));
    6969}
    7070
Note: See TracChangeset for help on using the changeset viewer.