Changeset 216428 in webkit


Ignore:
Timestamp:
May 8, 2017 9:56:32 AM (7 years ago)
Author:
mark.lam@apple.com
Message:

Introduce ExceptionScope::assertNoException() and releaseAssertNoException().
https://bugs.webkit.org/show_bug.cgi?id=171776

Reviewed by Keith Miller.

Source/JavaScriptCore:

Instead of ASSERT(!scope.exception()), we can now do scope.assertNoException().
Ditto for RELEASE_ASSERT and scope.releaseAssertNoException().

The advantage of using ExceptionScope::assertNoException() and
releaseAssertNoException() is that if the assertion fails, these utility
functions will print the stack trace for where the unexpected exception is
detected as well as where the unexpected exception was thrown from. This makes
it much easier to debug the source of unhandled exceptions.

  • debugger/Debugger.cpp:

(JSC::Debugger::pauseIfNeeded):

  • dfg/DFGOperations.cpp:
  • interpreter/Interpreter.cpp:

(JSC::eval):
(JSC::notifyDebuggerOfUnwinding):
(JSC::Interpreter::executeProgram):
(JSC::Interpreter::executeCall):
(JSC::Interpreter::executeConstruct):
(JSC::Interpreter::prepareForRepeatCall):
(JSC::Interpreter::execute):
(JSC::Interpreter::debug):

  • interpreter/ShadowChicken.cpp:

(JSC::ShadowChicken::functionsOnStack):

  • jsc.cpp:

(GlobalObject::moduleLoaderResolve):
(GlobalObject::moduleLoaderFetch):
(functionGenerateHeapSnapshot):
(functionSamplingProfilerStackTraces):
(box):
(runWithScripts):

  • runtime/AbstractModuleRecord.cpp:

(JSC::AbstractModuleRecord::finishCreation):

  • runtime/ArrayPrototype.cpp:

(JSC::ArrayPrototype::tryInitializeSpeciesWatchpoint):

  • runtime/Completion.cpp:

(JSC::rejectPromise):

  • runtime/ErrorInstance.cpp:

(JSC::ErrorInstance::sanitizedToString):

  • runtime/ExceptionHelpers.cpp:

(JSC::createError):

  • runtime/ExceptionScope.cpp:

(JSC::ExceptionScope::unexpectedExceptionMessage):

  • runtime/ExceptionScope.h:

(JSC::ExceptionScope::assertNoException):
(JSC::ExceptionScope::releaseAssertNoException):
(JSC::ExceptionScope::unexpectedExceptionMessage):

  • runtime/GenericArgumentsInlines.h:

(JSC::GenericArguments<Type>::defineOwnProperty):

  • runtime/IntlCollator.cpp:

(JSC::IntlCollator::createCollator):
(JSC::IntlCollator::resolvedOptions):

  • runtime/IntlDateTimeFormat.cpp:

(JSC::IntlDateTimeFormat::resolvedOptions):
(JSC::IntlDateTimeFormat::format):

  • runtime/IntlNumberFormat.cpp:

(JSC::IntlNumberFormat::createNumberFormat):
(JSC::IntlNumberFormat::resolvedOptions):

  • runtime/JSCJSValue.cpp:

(JSC::JSValue::putToPrimitiveByIndex):

  • runtime/JSGenericTypedArrayViewPrototypeFunctions.h:

(JSC::genericTypedArrayViewProtoFuncIncludes):
(JSC::genericTypedArrayViewProtoFuncIndexOf):
(JSC::genericTypedArrayViewProtoFuncLastIndexOf):
(JSC::genericTypedArrayViewPrivateFuncSubarrayCreate):

  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::init):

  • runtime/JSGlobalObjectFunctions.cpp:

(JSC::globalFuncHostPromiseRejectionTracker):

  • runtime/JSModuleEnvironment.cpp:

(JSC::JSModuleEnvironment::getOwnPropertySlot):

  • runtime/JSModuleLoader.cpp:

(JSC::JSModuleLoader::finishCreation):

  • runtime/JSModuleNamespaceObject.cpp:

(JSC::JSModuleNamespaceObject::finishCreation):

  • runtime/JSONObject.cpp:

(JSC::Stringifier::toJSON):

  • runtime/JSObject.cpp:

(JSC::JSObject::ordinaryToPrimitive):

  • runtime/JSPropertyNameEnumerator.h:

(JSC::propertyNameEnumerator):

  • runtime/ObjectConstructor.cpp:

(JSC::objectConstructorGetOwnPropertyDescriptors):
(JSC::objectConstructorDefineProperty):

  • runtime/ObjectPrototype.cpp:

(JSC::objectProtoFuncHasOwnProperty):

  • runtime/ProgramExecutable.cpp:

(JSC::ProgramExecutable::initializeGlobalProperties):

  • runtime/ReflectObject.cpp:

(JSC::reflectObjectDefineProperty):

  • runtime/SamplingProfiler.cpp:

(JSC::SamplingProfiler::StackFrame::nameFromCallee):

  • runtime/StringPrototype.cpp:

(JSC::stringProtoFuncRepeatCharacter):

  • runtime/TemplateRegistry.cpp:

(JSC::TemplateRegistry::getTemplateObject):

  • runtime/VM.cpp:

(JSC::VM::throwException):

  • runtime/VM.h:

(JSC::VM::nativeStackTraceOfLastThrow):
(JSC::VM::clearException):

  • wasm/WasmB3IRGenerator.cpp:
  • wasm/js/JSWebAssemblyInstance.cpp:

(JSC::JSWebAssemblyInstance::create):

Source/WebCore:

No new tests because there's no behavior change in functionality. We're only
refactoring the code to use the new assertion utility function.

  • Modules/plugins/QuickTimePluginReplacement.mm:

(WebCore::QuickTimePluginReplacement::installReplacement):

  • bindings/js/JSCryptoKeySerializationJWK.cpp:

(WebCore::getJSArrayFromJSON):
(WebCore::getStringFromJSON):
(WebCore::getBooleanFromJSON):

  • bindings/js/JSCustomElementRegistryCustom.cpp:

(WebCore::JSCustomElementRegistry::whenDefined):

  • bindings/js/JSDOMExceptionHandling.cpp:

(WebCore::propagateExceptionSlowPath):
(WebCore::throwNotSupportedError):
(WebCore::throwInvalidStateError):
(WebCore::throwSecurityError):
(WebCore::throwDOMSyntaxError):
(WebCore::throwDataCloneError):
(WebCore::throwIndexSizeError):
(WebCore::throwTypeMismatchError):

  • bindings/js/JSDOMGlobalObject.cpp:

(WebCore::makeThisTypeErrorForBuiltins):
(WebCore::makeGetterTypeErrorForBuiltins):

  • bindings/js/JSDOMGlobalObjectTask.cpp:
  • bindings/js/JSDOMPromise.h:

(WebCore::callPromiseFunction):

  • bindings/js/JSDOMWindowBase.cpp:

(WebCore::JSDOMWindowMicrotaskCallback::call):

  • bindings/js/JSMainThreadExecState.h:

(WebCore::JSMainThreadExecState::~JSMainThreadExecState):

  • bindings/js/ReadableStreamDefaultController.cpp:

(WebCore::ReadableStreamDefaultController::isControlledReadableStreamLocked):

  • bindings/js/ReadableStreamDefaultController.h:

(WebCore::ReadableStreamDefaultController::enqueue):

  • bindings/js/SerializedScriptValue.cpp:

(WebCore::CloneDeserializer::readTerminal):

  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateSerializerFunction):

  • bindings/scripts/test/JS/JSTestNode.cpp:

(WebCore::JSTestNode::serialize):

  • bindings/scripts/test/JS/JSTestObj.cpp:

(WebCore::JSTestObj::serialize):

  • bindings/scripts/test/JS/JSTestSerialization.cpp:

(WebCore::JSTestSerialization::serialize):

  • bindings/scripts/test/JS/JSTestSerializationInherit.cpp:

(WebCore::JSTestSerializationInherit::serialize):

  • bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:

(WebCore::JSTestSerializationInheritFinal::serialize):

  • contentextensions/ContentExtensionParser.cpp:

(WebCore::ContentExtensions::getTypeFlags):

  • html/HTMLMediaElement.cpp:

(WebCore::HTMLMediaElement::didAddUserAgentShadowRoot):
(WebCore::HTMLMediaElement::updateMediaControlsAfterPresentationModeChange):
(WebCore::HTMLMediaElement::getCurrentMediaControlsStatus):

  • html/HTMLPlugInImageElement.cpp:

(WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot):

Source/WTF:

  1. Add an option to skip some number of top frames when capturing the StackTrace.
  2. Add an option to use an indentation string when dumping the StackTrace.
  • wtf/StackTrace.cpp:

(WTF::StackTrace::captureStackTrace):
(WTF::StackTrace::dump):

  • wtf/StackTrace.h:
Location:
trunk/Source
Files:
63 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r216332 r216428  
     12017-05-08  Mark Lam  <mark.lam@apple.com>
     2
     3        Introduce ExceptionScope::assertNoException() and releaseAssertNoException().
     4        https://bugs.webkit.org/show_bug.cgi?id=171776
     5
     6        Reviewed by Keith Miller.
     7
     8        Instead of ASSERT(!scope.exception()), we can now do scope.assertNoException().
     9        Ditto for RELEASE_ASSERT and scope.releaseAssertNoException(). 
     10
     11        The advantage of using ExceptionScope::assertNoException() and
     12        releaseAssertNoException() is that if the assertion fails, these utility
     13        functions will print the stack trace for where the unexpected exception is
     14        detected as well as where the unexpected exception was thrown from.  This makes
     15        it much easier to debug the source of unhandled exceptions.
     16
     17        * debugger/Debugger.cpp:
     18        (JSC::Debugger::pauseIfNeeded):
     19        * dfg/DFGOperations.cpp:
     20        * interpreter/Interpreter.cpp:
     21        (JSC::eval):
     22        (JSC::notifyDebuggerOfUnwinding):
     23        (JSC::Interpreter::executeProgram):
     24        (JSC::Interpreter::executeCall):
     25        (JSC::Interpreter::executeConstruct):
     26        (JSC::Interpreter::prepareForRepeatCall):
     27        (JSC::Interpreter::execute):
     28        (JSC::Interpreter::debug):
     29        * interpreter/ShadowChicken.cpp:
     30        (JSC::ShadowChicken::functionsOnStack):
     31        * jsc.cpp:
     32        (GlobalObject::moduleLoaderResolve):
     33        (GlobalObject::moduleLoaderFetch):
     34        (functionGenerateHeapSnapshot):
     35        (functionSamplingProfilerStackTraces):
     36        (box):
     37        (runWithScripts):
     38        * runtime/AbstractModuleRecord.cpp:
     39        (JSC::AbstractModuleRecord::finishCreation):
     40        * runtime/ArrayPrototype.cpp:
     41        (JSC::ArrayPrototype::tryInitializeSpeciesWatchpoint):
     42        * runtime/Completion.cpp:
     43        (JSC::rejectPromise):
     44        * runtime/ErrorInstance.cpp:
     45        (JSC::ErrorInstance::sanitizedToString):
     46        * runtime/ExceptionHelpers.cpp:
     47        (JSC::createError):
     48        * runtime/ExceptionScope.cpp:
     49        (JSC::ExceptionScope::unexpectedExceptionMessage):
     50        * runtime/ExceptionScope.h:
     51        (JSC::ExceptionScope::assertNoException):
     52        (JSC::ExceptionScope::releaseAssertNoException):
     53        (JSC::ExceptionScope::unexpectedExceptionMessage):
     54        * runtime/GenericArgumentsInlines.h:
     55        (JSC::GenericArguments<Type>::defineOwnProperty):
     56        * runtime/IntlCollator.cpp:
     57        (JSC::IntlCollator::createCollator):
     58        (JSC::IntlCollator::resolvedOptions):
     59        * runtime/IntlDateTimeFormat.cpp:
     60        (JSC::IntlDateTimeFormat::resolvedOptions):
     61        (JSC::IntlDateTimeFormat::format):
     62        * runtime/IntlNumberFormat.cpp:
     63        (JSC::IntlNumberFormat::createNumberFormat):
     64        (JSC::IntlNumberFormat::resolvedOptions):
     65        * runtime/JSCJSValue.cpp:
     66        (JSC::JSValue::putToPrimitiveByIndex):
     67        * runtime/JSGenericTypedArrayViewPrototypeFunctions.h:
     68        (JSC::genericTypedArrayViewProtoFuncIncludes):
     69        (JSC::genericTypedArrayViewProtoFuncIndexOf):
     70        (JSC::genericTypedArrayViewProtoFuncLastIndexOf):
     71        (JSC::genericTypedArrayViewPrivateFuncSubarrayCreate):
     72        * runtime/JSGlobalObject.cpp:
     73        (JSC::JSGlobalObject::init):
     74        * runtime/JSGlobalObjectFunctions.cpp:
     75        (JSC::globalFuncHostPromiseRejectionTracker):
     76        * runtime/JSModuleEnvironment.cpp:
     77        (JSC::JSModuleEnvironment::getOwnPropertySlot):
     78        * runtime/JSModuleLoader.cpp:
     79        (JSC::JSModuleLoader::finishCreation):
     80        * runtime/JSModuleNamespaceObject.cpp:
     81        (JSC::JSModuleNamespaceObject::finishCreation):
     82        * runtime/JSONObject.cpp:
     83        (JSC::Stringifier::toJSON):
     84        * runtime/JSObject.cpp:
     85        (JSC::JSObject::ordinaryToPrimitive):
     86        * runtime/JSPropertyNameEnumerator.h:
     87        (JSC::propertyNameEnumerator):
     88        * runtime/ObjectConstructor.cpp:
     89        (JSC::objectConstructorGetOwnPropertyDescriptors):
     90        (JSC::objectConstructorDefineProperty):
     91        * runtime/ObjectPrototype.cpp:
     92        (JSC::objectProtoFuncHasOwnProperty):
     93        * runtime/ProgramExecutable.cpp:
     94        (JSC::ProgramExecutable::initializeGlobalProperties):
     95        * runtime/ReflectObject.cpp:
     96        (JSC::reflectObjectDefineProperty):
     97        * runtime/SamplingProfiler.cpp:
     98        (JSC::SamplingProfiler::StackFrame::nameFromCallee):
     99        * runtime/StringPrototype.cpp:
     100        (JSC::stringProtoFuncRepeatCharacter):
     101        * runtime/TemplateRegistry.cpp:
     102        (JSC::TemplateRegistry::getTemplateObject):
     103        * runtime/VM.cpp:
     104        (JSC::VM::throwException):
     105        * runtime/VM.h:
     106        (JSC::VM::nativeStackTraceOfLastThrow):
     107        (JSC::VM::clearException):
     108        * wasm/WasmB3IRGenerator.cpp:
     109        * wasm/js/JSWebAssemblyInstance.cpp:
     110        (JSC::JSWebAssemblyInstance::create):
     111
    11122017-05-06  Bill Ming  <mbbill@gmail.com>
    2113
  • trunk/Source/JavaScriptCore/debugger/Debugger.cpp

    r214905 r216428  
    742742        PauseReasonDeclaration reason(*this, didHitBreakpoint ? PausedForBreakpoint : m_reasonForPause);
    743743        handlePause(vmEntryGlobalObject, m_reasonForPause);
    744         RELEASE_ASSERT(!scope.exception());
     744        scope.releaseAssertNoException();
    745745    }
    746746
  • trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp

    r216178 r216428  
    17511751
    17521752    JSString* str1 = JSValue::decode(a).toString(exec);
    1753     ASSERT(!scope.exception()); // Impossible, since we must have been given primitives.
     1753    scope.assertNoException(); // Impossible, since we must have been given primitives.
    17541754    JSString* str2 = JSValue::decode(b).toString(exec);
    1755     ASSERT(!scope.exception());
     1755    scope.assertNoException();
    17561756
    17571757    scope.release();
     
    17661766
    17671767    JSString* str1 = JSValue::decode(a).toString(exec);
    1768     ASSERT(!scope.exception()); // Impossible, since we must have been given primitives.
     1768    scope.assertNoException(); // Impossible, since we must have been given primitives.
    17691769    JSString* str2 = JSValue::decode(b).toString(exec);
    1770     ASSERT(!scope.exception());
     1770    scope.assertNoException();
    17711771    JSString* str3 = JSValue::decode(c).toString(exec);
    1772     ASSERT(!scope.exception());
     1772    scope.assertNoException();
    17731773
    17741774    scope.release();
  • trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp

    r215986 r216428  
    153153       
    154154        // If the literal parser bailed, it should not have thrown exceptions.
    155         ASSERT(!scope.exception());
     155        scope.assertNoException();
    156156
    157157        VariableEnvironment variablesUnderTDZ;
     
    594594        else
    595595            debugger->didExecuteProgram(callFrame);
    596         ASSERT_UNUSED(catchScope, !catchScope.exception());
     596        catchScope.assertNoException();
    597597    }
    598598}
     
    752752    RETURN_IF_EXCEPTION(throwScope, { });
    753753
    754     ASSERT(!throwScope.exception());
     754    throwScope.assertNoException();
    755755    ASSERT(!vm.isCollectorBusyOnCurrentThread());
    756756    RELEASE_ASSERT(vm.currentThreadIsHoldingAPILock());
     
    903903    auto throwScope = DECLARE_THROW_SCOPE(vm);
    904904
    905     ASSERT(!throwScope.exception());
     905    throwScope.assertNoException();
    906906    ASSERT(!vm.isCollectorBusyOnCurrentThread());
    907907    if (vm.isCollectorBusyOnCurrentThread())
     
    968968    auto throwScope = DECLARE_THROW_SCOPE(vm);
    969969
    970     ASSERT(!throwScope.exception());
     970    throwScope.assertNoException();
    971971    ASSERT(!vm.isCollectorBusyOnCurrentThread());
    972972    // We throw in this case because we have to return something "valid" but we're
     
    10371037    VM& vm = *scope->vm();
    10381038    auto throwScope = DECLARE_THROW_SCOPE(vm);
    1039     ASSERT_UNUSED(throwScope, !throwScope.exception());
     1039    throwScope.assertNoException();
    10401040   
    10411041    if (vm.isCollectorBusyOnCurrentThread())
     
    10891089
    10901090    ASSERT(scope->vm() == &callFrame->vm());
    1091     ASSERT(!throwScope.exception());
     1091    throwScope.assertNoException();
    10921092    ASSERT(!vm.isCollectorBusyOnCurrentThread());
    10931093    RELEASE_ASSERT(vm.currentThreadIsHoldingAPILock());
     
    12321232
    12331233    ASSERT(scope->vm() == &callFrame->vm());
    1234     ASSERT(!throwScope.exception());
     1234    throwScope.assertNoException();
    12351235    ASSERT(!vm.isCollectorBusyOnCurrentThread());
    12361236    RELEASE_ASSERT(vm.currentThreadIsHoldingAPILock());
     
    12851285
    12861286    ASSERT(callFrame->codeBlock()->hasDebuggerRequests());
    1287     ASSERT_UNUSED(scope, !scope.exception());
     1287    scope.assertNoException();
    12881288
    12891289    switch (debugHookType) {
     
    13101310            break;
    13111311    }
    1312     ASSERT(!scope.exception());
     1312    scope.assertNoException();
    13131313}
    13141314
  • trunk/Source/JavaScriptCore/interpreter/ShadowChicken.cpp

    r214905 r216428  
    458458        [&] (const Frame& frame) -> bool {
    459459            result->push(exec, frame.callee);
    460             RELEASE_ASSERT(!scope.exception()); // This function is only called from tests.
     460            scope.releaseAssertNoException(); // This function is only called from tests.
    461461            return true;
    462462        });
  • trunk/Source/JavaScriptCore/jsc.cpp

    r216218 r216428  
    16091609
    16101610    JSInternalPromiseDeferred* deferred = JSInternalPromiseDeferred::create(exec, globalObject);
    1611     RELEASE_ASSERT(!scope.exception());
     1611    scope.releaseAssertNoException();
    16121612    const Identifier key = keyValue.toPropertyKey(exec);
    16131613    if (UNLIKELY(scope.exception())) {
     
    16461646        return deferred->reject(exec, createError(exec, makeString("Could not resolve the referrer name '", String(referrer.impl()), "'.")));
    16471647    auto result = deferred->resolve(exec, jsString(exec, resolvePath(directoryName.value(), ModuleName(key.impl()))));
    1648     RELEASE_ASSERT(!scope.exception());
     1648    scope.releaseAssertNoException();
    16491649    return result;
    16501650}
     
    17361736
    17371737    auto result = deferred->resolve(exec, JSSourceCode::create(exec->vm(), makeSource(stringFromUTF(utf8), SourceOrigin { moduleKey }, moduleKey, TextPosition(), SourceProviderSourceType::Module)));
    1738     RELEASE_ASSERT(!scope.exception());
     1738    scope.releaseAssertNoException();
    17391739    return result;
    17401740}
     
    30153015    String jsonString = snapshotBuilder.json();
    30163016    EncodedJSValue result = JSValue::encode(JSONParse(exec, jsonString));
    3017     RELEASE_ASSERT(!scope.exception());
     3017    scope.releaseAssertNoException();
    30183018    return result;
    30193019}
     
    30543054    String jsonString = vm.samplingProfiler()->stackTracesAsJSON();
    30553055    EncodedJSValue result = JSValue::encode(JSONParse(exec, jsonString));
    3056     RELEASE_ASSERT(!scope.exception());
     3056    scope.releaseAssertNoException();
    30573057    return result;
    30583058}
     
    31023102
    31033103    JSString* type = asString(wasmValue.get(exec, makeIdentifier(vm, "type")));
    3104     ASSERT_UNUSED(scope, !scope.exception());
     3104    scope.assertNoException();
    31053105    JSValue value = wasmValue.get(exec, makeIdentifier(vm, "value"));
    3106     ASSERT(!scope.exception());
     3106    scope.assertNoException();
    31073107
    31083108    auto unboxString = [&] (const char* hexFormat, const char* decFormat, auto& result) {
     
    34903490            if (isModule) {
    34913491                promise = loadAndEvaluateModule(globalObject->globalExec(), fileName);
    3492                 RELEASE_ASSERT(!scope.exception());
     3492                scope.releaseAssertNoException();
    34933493            } else {
    34943494                if (!fetchScriptFromLocalFileSystem(fileName, scriptBuffer))
     
    35193519
    35203520            promise->then(globalObject->globalExec(), fulfillHandler, rejectHandler);
    3521             RELEASE_ASSERT(!scope.exception());
     3521            scope.releaseAssertNoException();
    35223522            vm.drainMicrotasks();
    35233523        } else {
    35243524            NakedPtr<Exception> evaluationException;
    35253525            JSValue returnValue = evaluate(globalObject->globalExec(), jscSource(scriptBuffer, SourceOrigin { absolutePath(fileName) }, fileName), JSValue(), evaluationException);
    3526             ASSERT(!scope.exception());
     3526            scope.assertNoException();
    35273527            if (evaluationException)
    35283528                returnValue = evaluationException->value();
  • trunk/Source/JavaScriptCore/runtime/AbstractModuleRecord.cpp

    r212818 r216428  
    11/*
    2  * Copyright (C) 2015-2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015-2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    6060    auto scope = DECLARE_THROW_SCOPE(vm);
    6161    JSMap* map = JSMap::create(exec, vm, globalObject()->mapStructure());
    62     RELEASE_ASSERT(!scope.exception());
     62    scope.releaseAssertNoException();
    6363    m_dependenciesMap.set(vm, this, map);
    6464    putDirect(vm, Identifier::fromString(&vm, ASCIILiteral("dependenciesMap")), m_dependenciesMap.get());
  • trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp

    r216279 r216428  
    13961396    PropertySlot constructorSlot(this, PropertySlot::InternalMethodType::VMInquiry);
    13971397    this->getOwnPropertySlot(this, exec, vm.propertyNames->constructor, constructorSlot);
    1398     ASSERT_UNUSED(scope, !scope.exception());
     1398    scope.assertNoException();
    13991399    if (constructorSlot.slotBase() != this
    14001400        || !constructorSlot.isCacheableValue()
     
    14101410    PropertySlot speciesSlot(arrayConstructor, PropertySlot::InternalMethodType::VMInquiry);
    14111411    arrayConstructor->getOwnPropertySlot(arrayConstructor, exec, vm.propertyNames->speciesSymbol, speciesSlot);
    1412     ASSERT_UNUSED(scope, !scope.exception());
     1412    scope.assertNoException();
    14131413    if (speciesSlot.slotBase() != arrayConstructor
    14141414        || !speciesSlot.isCacheableGetter()
  • trunk/Source/JavaScriptCore/runtime/Completion.cpp

    r211642 r216428  
    22 *  Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
    33 *  Copyright (C) 2001 Peter Kelly (pmk@post.com)
    4  *  Copyright (C) 2003, 2007, 2013, 2016 Apple Inc.
     4 *  Copyright (C) 2003-2017 Apple Inc.
    55 *
    66 *  This library is free software; you can redistribute it and/or
     
    146146    VM& vm = exec->vm();
    147147    auto scope = DECLARE_CATCH_SCOPE(vm);
    148     ASSERT(scope.exception());
     148    scope.assertNoException();
    149149    JSValue exception = scope.exception()->value();
    150150    scope.clearException();
  • trunk/Source/JavaScriptCore/runtime/ErrorInstance.cpp

    r214905 r216428  
    11/*
    22 *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
    3  *  Copyright (C) 2003, 2008, 2016 Apple Inc. All rights reserved.
     3 *  Copyright (C) 2003-2017 Apple Inc. All rights reserved.
    44 *
    55 *  This library is free software; you can redistribute it and/or
     
    190190        currentObj = obj->getPrototypeDirect();
    191191    }
    192     ASSERT(!scope.exception());
     192    scope.assertNoException();
    193193
    194194    String nameString;
     
    205205    if (JSObject::getOwnPropertySlot(this, exec, messagePropertName, messageSlot) && messageSlot.isValue())
    206206        messageValue = messageSlot.getValue(exec, messagePropertName);
    207     ASSERT(!scope.exception());
     207    scope.assertNoException();
    208208
    209209    String messageString;
  • trunk/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp

    r215852 r216428  
    11/*
    2  * Copyright (C) 2008-2009, 2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2008-2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    260260
    261261    String errorMessage = makeString(errorDescriptionForValue(exec, value)->value(exec), ' ', message);
    262     ASSERT_UNUSED(scope, !scope.exception());
     262    scope.assertNoException();
    263263    JSObject* exception = createTypeError(exec, errorMessage, appender, runtimeTypeForValue(value));
    264264    ASSERT(exception->isErrorInstance());
  • trunk/Source/JavaScriptCore/runtime/ExceptionScope.cpp

    r205569 r216428  
    2828
    2929#include "Exception.h"
     30#include <wtf/StackTrace.h>
     31#include <wtf/StringPrintStream.h>
    3032
    3133namespace JSC {
     
    4850}
    4951
     52CString ExceptionScope::unexpectedExceptionMessage()
     53{
     54    StringPrintStream out;
     55
     56    out.println("Unexpected exception observed at:");
     57    auto currentStack = std::unique_ptr<StackTrace>(StackTrace::captureStackTrace(25, 1));
     58    currentStack->dump(out, "    ");
     59
     60    if (!m_vm.nativeStackTraceOfLastThrow())
     61        return CString();
     62   
     63    out.println("The exception was thrown from:");
     64    m_vm.nativeStackTraceOfLastThrow()->dump(out, "    ");
     65
     66    return out.toCString();
     67}
     68
    5069#endif // ENABLE(EXCEPTION_SCOPE_VERIFICATION)
    5170   
  • trunk/Source/JavaScriptCore/runtime/ExceptionScope.h

    r206525 r216428  
    3939    unsigned recursionDepth() const { return m_recursionDepth; }
    4040    Exception* exception() { return m_vm.exception(); }
    41    
     41
     42    ALWAYS_INLINE void assertNoException() { ASSERT_WITH_MESSAGE(!exception(), "%s", unexpectedExceptionMessage().data()); }
     43    ALWAYS_INLINE void releaseAssertNoException() { RELEASE_ASSERT_WITH_MESSAGE(!exception(), "%s", unexpectedExceptionMessage().data()); }
     44
    4245protected:
    4346    ExceptionScope(VM&, ExceptionEventLocation);
     
    4548    ExceptionScope(ExceptionScope&&) = default;
    4649    ~ExceptionScope();
     50
     51    JS_EXPORT_PRIVATE CString unexpectedExceptionMessage();
    4752
    4853    VM& m_vm;
     
    5863    ALWAYS_INLINE VM& vm() const { return m_vm; }
    5964    ALWAYS_INLINE Exception* exception() { return m_vm.exception(); }
     65    ALWAYS_INLINE CString unexpectedExceptionMessage() { return { }; }
     66
     67    ALWAYS_INLINE void assertNoException() { ASSERT(!exception()); }
     68    ALWAYS_INLINE void releaseAssertNoException() { RELEASE_ASSERT(!exception()); }
    6069
    6170protected:
  • trunk/Source/JavaScriptCore/runtime/GenericArgumentsInlines.h

    r214085 r216428  
    228228                    ASSERT(value);
    229229                    object->putDirectMayBeIndex(exec, ident, value);
    230                     ASSERT(!scope.exception());
     230                    scope.assertNoException();
    231231
    232232                    thisObject->setModifiedArgumentDescriptor(vm, index);
  • trunk/Source/JavaScriptCore/runtime/IntlCollator.cpp

    r215921 r216428  
    22 * Copyright (C) 2015 Andy VanWagoner (thetalecrafter@gmail.com)
    33 * Copyright (C) 2015 Sukolsak Sakshuwong (sukolsak@gmail.com)
    4  * Copyright (C) 2016 Apple Inc. All Rights Reserved.
     4 * Copyright (C) 2016-2017 Apple Inc. All Rights Reserved.
    55 *
    66 * Redistribution and use in source and binary forms, with or without
     
    344344    if (!m_initializedCollator) {
    345345        initializeCollator(state, jsUndefined(), jsUndefined());
    346         ASSERT_UNUSED(scope, !scope.exception());
     346        scope.assertNoException();
    347347    }
    348348
     
    476476    if (!m_initializedCollator) {
    477477        initializeCollator(state, jsUndefined(), jsUndefined());
    478         ASSERT_UNUSED(scope, !scope.exception());
     478        scope.assertNoException();
    479479    }
    480480
  • trunk/Source/JavaScriptCore/runtime/IntlDateTimeFormat.cpp

    r215792 r216428  
    11/*
    22 * Copyright (C) 2015 Andy VanWagoner (thetalecrafter@gmail.com)
    3  * Copyright (C) 2016 Apple Inc. All rights reserved.
     3 * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
    44 *
    55 * Redistribution and use in source and binary forms, with or without
     
    833833    if (!m_initializedDateTimeFormat) {
    834834        initializeDateTimeFormat(exec, jsUndefined(), jsUndefined());
    835         ASSERT_UNUSED(scope, !scope.exception());
     835        scope.assertNoException();
    836836    }
    837837
     
    882882    if (!m_initializedDateTimeFormat) {
    883883        initializeDateTimeFormat(exec, jsUndefined(), jsUndefined());
    884         ASSERT(!scope.exception());
     884        scope.assertNoException();
    885885    }
    886886
  • trunk/Source/JavaScriptCore/runtime/IntlNumberFormat.cpp

    r214020 r216428  
    22 * Copyright (C) 2015 Andy VanWagoner (thetalecrafter@gmail.com)
    33 * Copyright (C) 2016 Sukolsak Sakshuwong (sukolsak@gmail.com)
    4  * Copyright (C) 2016 Apple Inc. All rights reserved.
     4 * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
    55 *
    66 * Redistribution and use in source and binary forms, with or without
     
    359359    if (!m_initializedNumberFormat) {
    360360        initializeNumberFormat(state, jsUndefined(), jsUndefined());
    361         ASSERT_UNUSED(scope, !scope.exception());
     361        scope.assertNoException();
    362362    }
    363363
     
    487487    if (!m_initializedNumberFormat) {
    488488        initializeNumberFormat(state, jsUndefined(), jsUndefined());
    489         ASSERT_UNUSED(scope, !scope.exception());
     489        scope.assertNoException();
    490490    }
    491491
  • trunk/Source/JavaScriptCore/runtime/JSCJSValue.cpp

    r216309 r216428  
    22 *  Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
    33 *  Copyright (C) 2001 Peter Kelly (pmk@post.com)
    4  *  Copyright (C) 2003, 2007-2008, 2012, 2016 Apple Inc. All rights reserved.
     4 *  Copyright (C) 2003-2017 Apple Inc. All rights reserved.
    55 *
    66 *  This library is free software; you can redistribute it and/or
     
    208208   
    209209    JSObject* prototype = synthesizePrototype(exec);
    210     if (UNLIKELY(!prototype)) {
    211         ASSERT(scope.exception());
     210    ASSERT(!prototype == !!scope.exception());
     211    if (UNLIKELY(!prototype))
    212212        return false;
    213     }
    214213    bool putResult = false;
    215214    if (prototype->attemptToInterceptPutByIndexOnHoleForPrototype(exec, *this, propertyName, value, shouldThrow, putResult))
  • trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeFunctions.h

    r212535 r216428  
    207207        return JSValue::encode(jsBoolean(false));
    208208
    209     ASSERT(!scope.exception());
     209    scope.assertNoException();
    210210    RELEASE_ASSERT(!thisObject->isNeutered());
    211211
     
    251251    if (!targetOption)
    252252        return JSValue::encode(jsNumber(-1));
    253     ASSERT(!scope.exception());
     253    scope.assertNoException();
    254254    RELEASE_ASSERT(!thisObject->isNeutered());
    255255
     
    342342
    343343    typename ViewClass::ElementType* array = thisObject->typedVector();
    344     ASSERT(!scope.exception());
     344    scope.assertNoException();
    345345    RELEASE_ASSERT(!thisObject->isNeutered());
    346346
     
    532532    ASSERT(exec->argument(1).isUndefined() || exec->argument(1).isNumber());
    533533    unsigned begin = argumentClampedIndexFromStartOrEnd(exec, 0, thisLength);
    534     ASSERT(!scope.exception());
     534    scope.assertNoException();
    535535    unsigned end = argumentClampedIndexFromStartOrEnd(exec, 1, thisLength, thisLength);
    536     ASSERT(!scope.exception());
     536    scope.assertNoException();
    537537
    538538    RELEASE_ASSERT(!thisObject->isNeutered());
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp

    r215916 r216428  
    744744
    745745    JSObject* regExpProtoFlagsGetterObject = getGetterById(exec, m_regExpPrototype.get(), vm.propertyNames->flags);
    746     ASSERT_UNUSED(catchScope, !catchScope.exception());
     746    catchScope.assertNoException();
    747747    JSObject* regExpProtoGlobalGetterObject = getGetterById(exec, m_regExpPrototype.get(), vm.propertyNames->global);
    748     ASSERT(!catchScope.exception());
     748    catchScope.assertNoException();
    749749    m_regExpProtoGlobalGetter.set(vm, this, regExpProtoGlobalGetterObject);
    750750    JSObject* regExpProtoIgnoreCaseGetterObject = getGetterById(exec, m_regExpPrototype.get(), vm.propertyNames->ignoreCase);
    751     ASSERT(!catchScope.exception());
     751    catchScope.assertNoException();
    752752    JSObject* regExpProtoMultilineGetterObject = getGetterById(exec, m_regExpPrototype.get(), vm.propertyNames->multiline);
    753     ASSERT(!catchScope.exception());
     753    catchScope.assertNoException();
    754754    JSObject* regExpProtoSourceGetterObject = getGetterById(exec, m_regExpPrototype.get(), vm.propertyNames->source);
    755     ASSERT(!catchScope.exception());
     755    catchScope.assertNoException();
    756756    JSObject* regExpProtoStickyGetterObject = getGetterById(exec, m_regExpPrototype.get(), vm.propertyNames->sticky);
    757     ASSERT(!catchScope.exception());
     757    catchScope.assertNoException();
    758758    JSObject* regExpProtoUnicodeGetterObject = getGetterById(exec, m_regExpPrototype.get(), vm.propertyNames->unicode);
    759     ASSERT(!catchScope.exception());
     759    catchScope.assertNoException();
    760760    m_regExpProtoUnicodeGetter.set(vm, this, regExpProtoUnicodeGetterObject);
    761761    JSObject* builtinRegExpExec = asObject(m_regExpPrototype->getDirect(vm, vm.propertyNames->exec).asCell());
     
    914914            bool result = base->getOwnPropertySlot(base, exec, ident, slot);
    915915            ASSERT_UNUSED(result, result);
    916             ASSERT(!catchScope.exception());
     916            catchScope.assertNoException();
    917917            RELEASE_ASSERT(slot.isCacheableValue());
    918918            JSValue functionValue = slot.getValue(exec, ident);
    919             ASSERT(!catchScope.exception());
     919            catchScope.assertNoException();
    920920            ASSERT(jsDynamicCast<JSFunction*>(vm, functionValue));
    921921
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp

    r215916 r216428  
    22 *  Copyright (C) 1999-2002 Harri Porten (porten@kde.org)
    33 *  Copyright (C) 2001 Peter Kelly (pmk@post.com)
    4  *  Copyright (C) 2003-2009, 2012, 2016 Apple Inc. All rights reserved.
     4 *  Copyright (C) 2003-2017 Apple Inc. All rights reserved.
    55 *  Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca)
    66 *  Copyright (C) 2007 Maks Orlovich
     
    754754    auto operation = static_cast<JSPromiseRejectionOperation>(operationValue.toUInt32(exec));
    755755    ASSERT(operation == JSPromiseRejectionOperation::Reject || operation == JSPromiseRejectionOperation::Handle);
    756     ASSERT(!scope.exception());
     756    scope.assertNoException();
    757757
    758758    globalObject->globalObjectMethodTable()->promiseRejectionTracker(globalObject, exec, promise, operation);
  • trunk/Source/JavaScriptCore/runtime/JSModuleEnvironment.cpp

    r209897 r216428  
    11/*
    2  * Copyright (C) 2015-2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015-2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    9292        ASSERT(redirectSlot.isValue());
    9393        JSValue value = redirectSlot.getValue(exec, resolution.localName);
    94         ASSERT_UNUSED(scope, !scope.exception());
     94        scope.assertNoException();
    9595        slot.setValue(thisObject, redirectSlot.attributes(), value);
    9696        return true;
  • trunk/Source/JavaScriptCore/runtime/JSModuleLoader.cpp

    r211247 r216428  
    6464    ASSERT(inherits(vm, info()));
    6565    JSMap* map = JSMap::create(exec, vm, globalObject->mapStructure());
    66     RELEASE_ASSERT(!scope.exception());
     66    scope.releaseAssertNoException();
    6767    putDirect(vm, Identifier::fromString(&vm, "registry"), map);
    6868}
  • trunk/Source/JavaScriptCore/runtime/JSModuleNamespaceObject.cpp

    r213453 r216428  
    11/*
    2  * Copyright (C) 2015-2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015-2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    8181    // http://www.ecma-international.org/ecma-262/6.0/#sec-module-namespace-exotic-objects-preventextensions
    8282    methodTable(vm)->preventExtensions(this, exec);
    83     ASSERT_UNUSED(scope, !scope.exception());
     83    scope.assertNoException();
    8484}
    8585
  • trunk/Source/JavaScriptCore/runtime/JSONObject.cpp

    r211247 r216428  
    11/*
    2  * Copyright (C) 2009, 2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2009-2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    288288    VM& vm = m_exec->vm();
    289289    auto scope = DECLARE_THROW_SCOPE(vm);
    290     ASSERT(!scope.exception());
     290    scope.assertNoException();
    291291    if (!value.isObject())
    292292        return value;
  • trunk/Source/JavaScriptCore/runtime/JSObject.cpp

    r216309 r216428  
    19641964    }
    19651965
    1966     ASSERT(!scope.exception());
     1966    scope.assertNoException();
    19671967
    19681968    return throwTypeError(exec, scope, ASCIILiteral("No default value"));
  • trunk/Source/JavaScriptCore/runtime/JSPropertyNameEnumerator.h

    r212365 r216428  
    11/*
    2  * Copyright (C) 2014, 2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2014-2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    118118    if (structure->canAccessPropertiesQuicklyForEnumeration() && indexedLength == base->getArrayLength()) {
    119119        base->methodTable(vm)->getStructurePropertyNames(base, exec, propertyNames, EnumerationMode());
    120         ASSERT(!scope.exception());
     120        scope.assertNoException();
    121121
    122122        numberStructureProperties = propertyNames.size();
    123123
    124124        base->methodTable(vm)->getGenericPropertyNames(base, exec, propertyNames, EnumerationMode());
    125         ASSERT(!scope.exception());
     125        scope.assertNoException();
    126126    } else {
    127127        // Generic property names vector contains all indexed property names.
  • trunk/Source/JavaScriptCore/runtime/ObjectConstructor.cpp

    r215810 r216428  
    11/*
    22 *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
    3  *  Copyright (C) 2008, 2016 Apple Inc. All rights reserved.
     3 *  Copyright (C) 2008-2017 Apple Inc. All rights reserved.
    44 *
    55 *  This library is free software; you can redistribute it and/or
     
    236236        PutPropertySlot slot(descriptors);
    237237        descriptors->putOwnDataPropertyMayBeIndex(exec, propertyName, fromDescriptor, slot);
    238         ASSERT(!scope.exception());
     238        scope.assertNoException();
    239239    }
    240240
     
    420420        return JSValue::encode(jsNull());
    421421    ASSERT((descriptor.attributes() & Accessor) || (!descriptor.isAccessorDescriptor()));
    422     ASSERT(!scope.exception());
     422    scope.assertNoException();
    423423    obj->methodTable(vm)->defineOwnProperty(obj, exec, propertyName, descriptor, true);
    424424    scope.release();
  • trunk/Source/JavaScriptCore/runtime/ObjectPrototype.cpp

    r215405 r216428  
    11/*
    22 *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
    3  *  Copyright (C) 2008, 2011, 2016 Apple Inc. All rights reserved.
     3 *  Copyright (C) 2008-2017 Apple Inc. All rights reserved.
    44 *
    55 *  This library is free software; you can redistribute it and/or
     
    106106    if (std::optional<bool> result = hasOwnPropertyCache->get(structure, propertyName)) {
    107107        ASSERT(*result == thisObject->hasOwnProperty(exec, propertyName));
    108         ASSERT(!scope.exception());
     108        scope.assertNoException();
    109109        return JSValue::encode(jsBoolean(*result));
    110110    }
  • trunk/Source/JavaScriptCore/runtime/ProgramExecutable.cpp

    r214145 r216428  
    11/*
    2  * Copyright (C) 2009, 2010, 2013, 2015-2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2009-2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    178178        ASSERT(entry.value.isVar());
    179179        globalObject->addVar(callFrame, Identifier::fromUid(&vm, entry.key.get()));
    180         ASSERT(!throwScope.exception());
     180        throwScope.assertNoException();
    181181    }
    182182
  • trunk/Source/JavaScriptCore/runtime/ReflectObject.cpp

    r211247 r216428  
    11/*
    2  * Copyright (C) 2015-2016 Apple Inc. All Rights Reserved.
     2 * Copyright (C) 2015-2017 Apple Inc. All Rights Reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    148148        return encodedJSValue();
    149149    ASSERT((descriptor.attributes() & Accessor) || (!descriptor.isAccessorDescriptor()));
    150     ASSERT(!scope.exception());
     150    scope.assertNoException();
    151151
    152152    // Reflect.defineProperty should not throw an error when the defineOwnProperty operation fails.
  • trunk/Source/JavaScriptCore/runtime/SamplingProfiler.cpp

    r215715 r216428  
    11/*
    2  * Copyright (C) 2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    720720        PropertyName propertyName(ident);
    721721        bool hasProperty = callee->getPropertySlot(exec, propertyName, slot);
    722         ASSERT_UNUSED(scope, !scope.exception());
     722        scope.assertNoException();
    723723        if (hasProperty) {
    724724            if (slot.isValue()) {
  • trunk/Source/JavaScriptCore/runtime/StringPrototype.cpp

    r216301 r216428  
    819819    auto viewWithString = string->viewWithUnderlyingString(*exec);
    820820    StringView view = viewWithString.view;
    821     ASSERT(view.length() == 1 && !scope.exception());
     821    ASSERT(view.length() == 1);
     822    scope.assertNoException();
    822823    UChar character = view[0];
    823824    scope.release();
  • trunk/Source/JavaScriptCore/runtime/TemplateRegistry.cpp

    r211319 r216428  
    11/*
    22 * Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>.
    3  * Copyright (C) 2016 Apple Inc. All Rights Reserved.
     3 * Copyright (C) 2016-2017 Apple Inc. All Rights Reserved.
    44 *
    55 * Redistribution and use in source and binary forms, with or without
     
    7171
    7272    objectConstructorFreeze(exec, rawObject);
    73     ASSERT(!scope.exception());
     73    scope.assertNoException();
    7474
    7575    templateObject->putDirect(vm, vm.propertyNames->raw, rawObject, ReadOnly | DontEnum | DontDelete);
     
    8080
    8181    objectConstructorFreeze(exec, templateObject);
    82     ASSERT(!scope.exception());
     82    scope.assertNoException();
    8383
    8484    m_templateMap.set(&templateKey, templateObject);
  • trunk/Source/JavaScriptCore/runtime/VM.cpp

    r215642 r216428  
    615615
    616616    setException(exception);
     617
     618#if ENABLE(EXCEPTION_SCOPE_VERIFICATION)
     619    m_nativeStackTraceOfLastThrow = std::unique_ptr<StackTrace>(StackTrace::captureStackTrace(25));
     620#endif
    617621}
    618622
  • trunk/Source/JavaScriptCore/runtime/VM.h

    r215345 r216428  
    7979#endif
    8080
     81#if ENABLE(EXCEPTION_SCOPE_VERIFICATION)
     82#include <wtf/StackTrace.h>
     83#endif
     84
    8185namespace WTF {
    8286class SimpleStats;
     
    675679    void notifyNeedWatchdogCheck() { m_traps.fireTrap(VMTraps::NeedWatchdogCheck); }
    676680
     681#if ENABLE(EXCEPTION_SCOPE_VERIFICATION)
     682    StackTrace* nativeStackTraceOfLastThrow() const { return m_nativeStackTraceOfLastThrow.get(); }
     683#endif
     684
    677685private:
    678686    friend class LLIntOffsetsExtractor;
     
    707715#if ENABLE(EXCEPTION_SCOPE_VERIFICATION)
    708716        m_needExceptionCheck = false;
     717        m_nativeStackTraceOfLastThrow = nullptr;
    709718#endif
    710719        m_exception = nullptr;
     
    753762    unsigned m_simulatedThrowPointRecursionDepth { 0 };
    754763    mutable bool m_needExceptionCheck { false };
     764    std::unique_ptr<StackTrace> m_nativeStackTraceOfLastThrow;
    755765#endif
    756766
  • trunk/Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp

    r215898 r216428  
    505505        ExecState* exec = nullptr;
    506506        PageCount result = wasmMemory->grow(vm, exec, static_cast<uint32_t>(delta), shouldThrowExceptionsOnFailure);
    507         RELEASE_ASSERT(!scope.exception());
     507        scope.releaseAssertNoException();
    508508        if (!result)
    509509            return -1;
  • trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyInstance.cpp

    r216173 r216428  
    293293                RELEASE_ASSERT_NOT_REACHED();
    294294            }
    295             ASSERT(!throwScope.exception());
     295            throwScope.assertNoException();
    296296            break;
    297297        }
     
    331331            // We should always be able to allocate a JSWebAssemblyTable we've defined.
    332332            // If it's defined to be too large, we should have thrown a validation error.
    333             ASSERT(!throwScope.exception());
     333            throwScope.assertNoException();
    334334            ASSERT(table);
    335335            instance->m_table.set(vm, instance, table);
  • trunk/Source/WTF/ChangeLog

    r216308 r216428  
     12017-05-08  Mark Lam  <mark.lam@apple.com>
     2
     3        Introduce ExceptionScope::assertNoException() and releaseAssertNoException().
     4        https://bugs.webkit.org/show_bug.cgi?id=171776
     5
     6        Reviewed by Keith Miller.
     7
     8        1. Add an option to skip some number of top frames when capturing the StackTrace.
     9        2. Add an option to use an indentation string when dumping the StackTrace.
     10
     11        * wtf/StackTrace.cpp:
     12        (WTF::StackTrace::captureStackTrace):
     13        (WTF::StackTrace::dump):
     14        * wtf/StackTrace.h:
     15
    1162017-05-05  Yusuke Suzuki  <utatane.tea@gmail.com>
    217
  • trunk/Source/WTF/wtf/StackTrace.cpp

    r215715 r216428  
    4545}
    4646
    47 StackTrace* StackTrace::captureStackTrace(int maxFrames)
     47StackTrace* StackTrace::captureStackTrace(int maxFrames, int framesToSkip)
    4848{
    4949    maxFrames = std::max(1, maxFrames);
     
    5151    StackTrace* trace = new (NotNull, fastMalloc(sizeToAllocate)) StackTrace();
    5252
    53     static const int framesToSkip = 2;
     53    // Skip 2 additional frames i.e. StackTrace::captureStackTrace and WTFGetBacktrace.
     54    framesToSkip += 2;
    5455    int numberOfFrames = maxFrames + framesToSkip;
    5556
    5657    WTFGetBacktrace(&trace->m_skippedFrame0, &numberOfFrames);
    57     ASSERT(numberOfFrames > framesToSkip);
     58    RELEASE_ASSERT(numberOfFrames >= framesToSkip);
    5859    trace->m_size = numberOfFrames - framesToSkip;
    5960    trace->m_capacity = maxFrames;
     
    8182}
    8283
    83 void StackTrace::dump(PrintStream& out) const
     84void StackTrace::dump(PrintStream& out, const char* indentString) const
    8485{
    8586    const auto* stack = this->stack();
     
    9091#endif
    9192
     93    if (!indentString)
     94        indentString = "";
    9295    for (int i = 0; i < m_size; ++i) {
    9396        const char* mangledName = nullptr;
     
    104107        const int frameNumber = i + 1;
    105108        if (mangledName || cxaDemangled)
    106             out.printf("%-3d %p %s\n", frameNumber, stack[i], cxaDemangled ? cxaDemangled : mangledName);
     109            out.printf("%s%-3d %p %s\n", indentString, frameNumber, stack[i], cxaDemangled ? cxaDemangled : mangledName);
    107110        else
    108             out.printf("%-3d %p\n", frameNumber, stack[i]);
     111            out.printf("%s%-3d %p\n", indentString, frameNumber, stack[i]);
    109112    }
    110113
  • trunk/Source/WTF/wtf/StackTrace.h

    r215717 r216428  
    3737    WTF_MAKE_FAST_ALLOCATED;
    3838public:
    39     static StackTrace* captureStackTrace(int maxFrames);
     39    static StackTrace* captureStackTrace(int maxFrames, int framesToSkip = 0);
    4040
    4141    // Borrowed stack trace.
     
    7272    WTF_EXPORT_PRIVATE static std::optional<DemangleEntry> demangle(void*);
    7373
    74     WTF_EXPORT_PRIVATE void dump(PrintStream&) const;
     74    WTF_EXPORT_PRIVATE void dump(PrintStream&, const char* indentString = nullptr) const;
    7575
    7676private:
  • trunk/Source/WebCore/ChangeLog

    r216426 r216428  
     12017-05-08  Mark Lam  <mark.lam@apple.com>
     2
     3        Introduce ExceptionScope::assertNoException() and releaseAssertNoException().
     4        https://bugs.webkit.org/show_bug.cgi?id=171776
     5
     6        Reviewed by Keith Miller.
     7
     8        No new tests because there's no behavior change in functionality.  We're only
     9        refactoring the code to use the new assertion utility function.
     10
     11        * Modules/plugins/QuickTimePluginReplacement.mm:
     12        (WebCore::QuickTimePluginReplacement::installReplacement):
     13        * bindings/js/JSCryptoKeySerializationJWK.cpp:
     14        (WebCore::getJSArrayFromJSON):
     15        (WebCore::getStringFromJSON):
     16        (WebCore::getBooleanFromJSON):
     17        * bindings/js/JSCustomElementRegistryCustom.cpp:
     18        (WebCore::JSCustomElementRegistry::whenDefined):
     19        * bindings/js/JSDOMExceptionHandling.cpp:
     20        (WebCore::propagateExceptionSlowPath):
     21        (WebCore::throwNotSupportedError):
     22        (WebCore::throwInvalidStateError):
     23        (WebCore::throwSecurityError):
     24        (WebCore::throwDOMSyntaxError):
     25        (WebCore::throwDataCloneError):
     26        (WebCore::throwIndexSizeError):
     27        (WebCore::throwTypeMismatchError):
     28        * bindings/js/JSDOMGlobalObject.cpp:
     29        (WebCore::makeThisTypeErrorForBuiltins):
     30        (WebCore::makeGetterTypeErrorForBuiltins):
     31        * bindings/js/JSDOMGlobalObjectTask.cpp:
     32        * bindings/js/JSDOMPromise.h:
     33        (WebCore::callPromiseFunction):
     34        * bindings/js/JSDOMWindowBase.cpp:
     35        (WebCore::JSDOMWindowMicrotaskCallback::call):
     36        * bindings/js/JSMainThreadExecState.h:
     37        (WebCore::JSMainThreadExecState::~JSMainThreadExecState):
     38        * bindings/js/ReadableStreamDefaultController.cpp:
     39        (WebCore::ReadableStreamDefaultController::isControlledReadableStreamLocked):
     40        * bindings/js/ReadableStreamDefaultController.h:
     41        (WebCore::ReadableStreamDefaultController::enqueue):
     42        * bindings/js/SerializedScriptValue.cpp:
     43        (WebCore::CloneDeserializer::readTerminal):
     44        * bindings/scripts/CodeGeneratorJS.pm:
     45        (GenerateSerializerFunction):
     46        * bindings/scripts/test/JS/JSTestNode.cpp:
     47        (WebCore::JSTestNode::serialize):
     48        * bindings/scripts/test/JS/JSTestObj.cpp:
     49        (WebCore::JSTestObj::serialize):
     50        * bindings/scripts/test/JS/JSTestSerialization.cpp:
     51        (WebCore::JSTestSerialization::serialize):
     52        * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
     53        (WebCore::JSTestSerializationInherit::serialize):
     54        * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
     55        (WebCore::JSTestSerializationInheritFinal::serialize):
     56        * contentextensions/ContentExtensionParser.cpp:
     57        (WebCore::ContentExtensions::getTypeFlags):
     58        * html/HTMLMediaElement.cpp:
     59        (WebCore::HTMLMediaElement::didAddUserAgentShadowRoot):
     60        (WebCore::HTMLMediaElement::updateMediaControlsAfterPresentationModeChange):
     61        (WebCore::HTMLMediaElement::getCurrentMediaControlsStatus):
     62        * html/HTMLPlugInImageElement.cpp:
     63        (WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot):
     64
    1652017-05-08  Chris Dumez  <cdumez@apple.com>
    266
  • trunk/Source/WebCore/Modules/plugins/QuickTimePluginReplacement.mm

    r211964 r216428  
    11/*
    2  * Copyright (C) 2013-2015 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    201201        return false;
    202202    JSC::JSObject* replacementObject = replacementFunction.toObject(exec);
    203     ASSERT(!scope.exception());
     203    scope.assertNoException();
    204204    JSC::CallData callData;
    205205    JSC::CallType callType = replacementObject->methodTable()->getCallData(replacementObject, callData);
     
    234234    if (!scope.exception() && !value.isUndefinedOrNull()) {
    235235        m_scriptObject = value.toObject(exec);
    236         ASSERT(!scope.exception());
     236        scope.assertNoException();
    237237    }
    238238
  • trunk/Source/WebCore/bindings/js/JSCryptoKeySerializationJWK.cpp

    r209025 r216428  
    11/*
    2  * Copyright (C) 2013, 2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    6363
    6464    JSValue value = slot.getValue(exec, identifier);
    65     ASSERT(!scope.exception());
     65    scope.assertNoException();
    6666    if (!isJSArray(value)) {
    6767        throwTypeError(exec, scope, String::format("Expected an array for \"%s\" JSON key",  key));
     
    8686
    8787    JSValue jsValue = slot.getValue(exec, identifier);
    88     ASSERT(!scope.exception());
     88    scope.assertNoException();
    8989    if (!jsValue.getString(exec, result)) {
    9090        // Can get an out of memory exception.
     
    109109
    110110    JSValue jsValue = slot.getValue(exec, identifier);
    111     ASSERT(!scope.exception());
     111    scope.assertNoException();
    112112    if (!jsValue.isBoolean()) {
    113113        throwTypeError(exec, scope, String::format("Expected a boolean value for \"%s\" JSON key",  key));
  • trunk/Source/WebCore/bindings/js/JSCustomElementRegistryCustom.cpp

    r211309 r216428  
    11/*
    2  * Copyright (C) 2015, 2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015-2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    207207    if (UNLIKELY(scope.exception())) {
    208208        rejectPromiseWithExceptionIfAny(state, *globalObject(), *promiseDeferred);
    209         ASSERT(!scope.exception());
     209        scope.assertNoException();
    210210        return promiseDeferred->promise();
    211211    }
  • trunk/Source/WebCore/bindings/js/JSDOMExceptionHandling.cpp

    r211403 r216428  
    11/*
    22 *  Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
    3  *  Copyright (C) 2004-2011, 2013, 2016 Apple Inc. All rights reserved.
     3 *  Copyright (C) 2004-2017 Apple Inc. All rights reserved.
    44 *  Copyright (C) 2007 Samuel Weinig <sam@webkit.org>
    55 *  Copyright (C) 2013 Michael Pruett <michael@68k.org>
     
    206206void propagateExceptionSlowPath(JSC::ExecState& state, JSC::ThrowScope& throwScope, Exception&& exception)
    207207{
    208     ASSERT(!throwScope.exception());
     208    throwScope.assertNoException();
    209209    throwException(&state, throwScope, createDOMException(state, WTFMove(exception)));
    210210}
     
    249249void throwNotSupportedError(JSC::ExecState& state, JSC::ThrowScope& scope)
    250250{
    251     ASSERT(!scope.exception());
     251    scope.assertNoException();
    252252    throwException(&state, scope, createDOMException(&state, NOT_SUPPORTED_ERR));
    253253}
     
    255255void throwNotSupportedError(JSC::ExecState& state, JSC::ThrowScope& scope, const char* message)
    256256{
    257     ASSERT(!scope.exception());
     257    scope.assertNoException();
    258258    String messageString(message);
    259259    throwException(&state, scope, createDOMException(&state, NOT_SUPPORTED_ERR, &messageString));
     
    262262void throwInvalidStateError(JSC::ExecState& state, JSC::ThrowScope& scope, const char* message)
    263263{
    264     ASSERT(!scope.exception());
     264    scope.assertNoException();
    265265    String messageString(message);
    266266    throwException(&state, scope, createDOMException(&state, INVALID_STATE_ERR, &messageString));
     
    269269void throwSecurityError(JSC::ExecState& state, JSC::ThrowScope& scope, const String& message)
    270270{
    271     ASSERT(!scope.exception());
     271    scope.assertNoException();
    272272    throwException(&state, scope, createDOMException(&state, SECURITY_ERR, message));
    273273}
     
    380380void throwDOMSyntaxError(JSC::ExecState& state, JSC::ThrowScope& scope)
    381381{
    382     ASSERT(!scope.exception());
     382    scope.assertNoException();
    383383    throwException(&state, scope, createDOMException(&state, SYNTAX_ERR));
    384384}
     
    386386void throwDataCloneError(JSC::ExecState& state, JSC::ThrowScope& scope)
    387387{
    388     ASSERT(!scope.exception());
     388    scope.assertNoException();
    389389    throwException(&state, scope, createDOMException(&state, DATA_CLONE_ERR));
    390390}
     
    392392void throwIndexSizeError(JSC::ExecState& state, JSC::ThrowScope& scope)
    393393{
    394     ASSERT(!scope.exception());
     394    scope.assertNoException();
    395395    throwException(&state, scope, createDOMException(&state, INDEX_SIZE_ERR));
    396396}
     
    398398void throwTypeMismatchError(JSC::ExecState& state, JSC::ThrowScope& scope)
    399399{
    400     ASSERT(!scope.exception());
     400    scope.assertNoException();
    401401    throwException(&state, scope, createDOMException(&state, TYPE_MISMATCH_ERR));
    402402}
  • trunk/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp

    r215429 r216428  
    11/*
    2  * Copyright (C) 2008, 2009 Apple Inc. All Rights Reserved.
     2 * Copyright (C) 2008-2017 Apple Inc. All Rights Reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    8282
    8383    auto interfaceName = execState->uncheckedArgument(0).getString(execState);
    84     ASSERT_UNUSED(scope, !scope.exception());
     84    scope.assertNoException();
    8585    auto functionName = execState->uncheckedArgument(1).getString(execState);
    86     ASSERT(!scope.exception());
     86    scope.assertNoException();
    8787    return JSValue::encode(createTypeError(execState, makeThisTypeErrorMessage(interfaceName.utf8().data(), functionName.utf8().data())));
    8888}
     
    9696
    9797    auto interfaceName = execState->uncheckedArgument(0).getString(execState);
    98     ASSERT_UNUSED(scope, !scope.exception());
     98    scope.assertNoException();
    9999    auto attributeName = execState->uncheckedArgument(1).getString(execState);
    100     ASSERT(!scope.exception());
     100    scope.assertNoException();
    101101    return JSValue::encode(createTypeError(execState, makeGetterTypeErrorMessage(interfaceName.utf8().data(), attributeName.utf8().data())));
    102102}
  • trunk/Source/WebCore/bindings/js/JSDOMGlobalObjectTask.cpp

    r205569 r216428  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    6767        else
    6868            m_task->run(exec);
    69         ASSERT_UNUSED(scope, !scope.exception());
     69        scope.assertNoException();
    7070    }
    7171
  • trunk/Source/WebCore/bindings/js/JSDOMPromise.h

    r214806 r216428  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    236236
    237237    rejectPromiseWithExceptionIfAny(state, globalObject, *promiseDeferred);
    238     ASSERT_UNUSED(scope, !scope.exception());
     238    scope.assertNoException();
    239239    return promiseDeferred->promise();
    240240}
  • trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp

    r215916 r216428  
    22 *  Copyright (C) 2000 Harri Porten (porten@kde.org)
    33 *  Copyright (C) 2006 Jon Shier (jshier@iastate.edu)
    4  *  Copyright (C) 2003-2009, 2014, 2016 Apple Inc. All rights reseved.
     4 *  Copyright (C) 2003-2017 Apple Inc. All rights reseved.
    55 *  Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
    66 *  Copyright (c) 2015 Canon Inc. All rights reserved.
     
    217217        JSMainThreadExecState::runTask(exec, m_task);
    218218
    219         ASSERT_UNUSED(scope, !scope.exception());
     219        scope.assertNoException();
    220220    }
    221221
  • trunk/Source/WebCore/bindings/js/JSMainThreadExecState.h

    r215916 r216428  
    11/*
    22 * Copyright (C) 2010 Google Inc. All rights reserved.
    3  * Copyright (C) 2016 Apple Inc. All rights reserved.
     3 * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
    44 *
    55 * Redistribution and use in source and binary forms, with or without
     
    134134        auto scope = DECLARE_CATCH_SCOPE(vm);
    135135        ASSERT(isMainThread());
    136         ASSERT_UNUSED(scope, !scope.exception());
     136        scope.assertNoException();
    137137
    138138        JSC::ExecState* state = s_mainThreadState;
  • trunk/Source/WebCore/bindings/js/ReadableStreamDefaultController.cpp

    r215429 r216428  
    11/*
    22 * Copyright (C) 2016 Canon Inc.
    3  * Copyright (C) 2016 Apple Inc. All rights reserved.
     3 * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
    44 *
    55 * Redistribution and use in source and binary forms, with or without
     
    7979    auto& clientData = *static_cast<JSVMClientData*>(vm.clientData);
    8080    auto readableStream = m_jsController->get(&state, clientData.builtinNames().controlledReadableStreamPrivateName());
    81     ASSERT_UNUSED(scope, !scope.exception());
     81    scope.assertNoException();
    8282
    8383    auto* isLocked = globalObject.builtinInternalFunctions().readableStreamInternals().m_isReadableStreamLockedFunction.get();
     
    8787    arguments.append(readableStream);
    8888    auto result = callFunction(state, isLocked, JSC::jsUndefined(), arguments);
    89     ASSERT(!scope.exception());
     89    scope.assertNoException();
    9090
    9191    return result.isTrue();
  • trunk/Source/WebCore/bindings/js/ReadableStreamDefaultController.h

    r215429 r216428  
    11/*
    22 * Copyright (C) 2016 Canon Inc.
     3 * Copyright (C) 2017 Apple Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    103104    ASSERT(chunk);
    104105    enqueue(state, toJS(&state, &globalObject, chunk.get()));
    105     ASSERT_UNUSED(scope, !scope.exception());
     106    scope.assertNoException();
    106107    return true;
    107108}
  • trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp

    r215382 r216428  
    11/*
    2  * Copyright (C) 2009, 2013, 2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2009-2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    25432543            // module to not have been a valid module. Therefore, createStub should
    25442544            // not trow.
    2545             RELEASE_ASSERT(!scope.exception());
     2545            scope.releaseAssertNoException();
    25462546            m_gcBuffer.append(result);
    25472547            return result;
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r216198 r216428  
    45534553        my $getFunctionName = GetAttributeGetterName($interface, $className, $attribute);
    45544554        push(@implContent, "    auto ${name}Value = ${getFunctionName}Getter(*state, *thisObject, throwScope);\n");
    4555         push(@implContent, "    ASSERT(!throwScope.exception());\n");
     4555        push(@implContent, "    throwScope.assertNoException();\n");
    45564556        push(@implContent, "    result->putDirect(vm, Identifier::fromString(&vm, \"${name}\"), ${name}Value);\n");
    45574557        push(@implContent, "\n");
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp

    r216198 r216428  
    344344
    345345    auto nameValue = jsTestNodeNameGetter(*state, *thisObject, throwScope);
    346     ASSERT(!throwScope.exception());
     346    throwScope.assertNoException();
    347347    result->putDirect(vm, Identifier::fromString(&vm, "name"), nameValue);
    348348
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp

    r216198 r216428  
    87858785
    87868786    auto createValue = jsTestObjCreateGetter(*state, *thisObject, throwScope);
    8787     ASSERT(!throwScope.exception());
     8787    throwScope.assertNoException();
    87888788    result->putDirect(vm, Identifier::fromString(&vm, "create"), createValue);
    87898789
    87908790    auto readOnlyStringAttrValue = jsTestObjReadOnlyStringAttrGetter(*state, *thisObject, throwScope);
    8791     ASSERT(!throwScope.exception());
     8791    throwScope.assertNoException();
    87928792    result->putDirect(vm, Identifier::fromString(&vm, "readOnlyStringAttr"), readOnlyStringAttrValue);
    87938793
    87948794    auto enumAttrValue = jsTestObjEnumAttrGetter(*state, *thisObject, throwScope);
    8795     ASSERT(!throwScope.exception());
     8795    throwScope.assertNoException();
    87968796    result->putDirect(vm, Identifier::fromString(&vm, "enumAttr"), enumAttrValue);
    87978797
    87988798    auto longAttrValue = jsTestObjLongAttrGetter(*state, *thisObject, throwScope);
    8799     ASSERT(!throwScope.exception());
     8799    throwScope.assertNoException();
    88008800    result->putDirect(vm, Identifier::fromString(&vm, "longAttr"), longAttrValue);
    88018801
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerialization.cpp

    r216198 r216428  
    407407
    408408    auto firstStringAttributeValue = jsTestSerializationFirstStringAttributeGetter(*state, *thisObject, throwScope);
    409     ASSERT(!throwScope.exception());
     409    throwScope.assertNoException();
    410410    result->putDirect(vm, Identifier::fromString(&vm, "firstStringAttribute"), firstStringAttributeValue);
    411411
    412412    auto secondLongAttributeValue = jsTestSerializationSecondLongAttributeGetter(*state, *thisObject, throwScope);
    413     ASSERT(!throwScope.exception());
     413    throwScope.assertNoException();
    414414    result->putDirect(vm, Identifier::fromString(&vm, "secondLongAttribute"), secondLongAttributeValue);
    415415
    416416    auto fourthUnrestrictedDoubleAttributeValue = jsTestSerializationFourthUnrestrictedDoubleAttributeGetter(*state, *thisObject, throwScope);
    417     ASSERT(!throwScope.exception());
     417    throwScope.assertNoException();
    418418    result->putDirect(vm, Identifier::fromString(&vm, "fourthUnrestrictedDoubleAttribute"), fourthUnrestrictedDoubleAttributeValue);
    419419
    420420    auto fifthLongAttributeValue = jsTestSerializationFifthLongAttributeGetter(*state, *thisObject, throwScope);
    421     ASSERT(!throwScope.exception());
     421    throwScope.assertNoException();
    422422    result->putDirect(vm, Identifier::fromString(&vm, "fifthLongAttribute"), fifthLongAttributeValue);
    423423
    424424    auto sixthTypedefAttributeValue = jsTestSerializationSixthTypedefAttributeGetter(*state, *thisObject, throwScope);
    425     ASSERT(!throwScope.exception());
     425    throwScope.assertNoException();
    426426    result->putDirect(vm, Identifier::fromString(&vm, "sixthTypedefAttribute"), sixthTypedefAttributeValue);
    427427
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInherit.cpp

    r216198 r216428  
    208208
    209209    auto inheritLongAttributeValue = jsTestSerializationInheritInheritLongAttributeGetter(*state, *thisObject, throwScope);
    210     ASSERT(!throwScope.exception());
     210    throwScope.assertNoException();
    211211    result->putDirect(vm, Identifier::fromString(&vm, "inheritLongAttribute"), inheritLongAttributeValue);
    212212
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp

    r216198 r216428  
    246246
    247247    auto finalLongAttributeBarValue = jsTestSerializationInheritFinalFinalLongAttributeBarGetter(*state, *thisObject, throwScope);
    248     ASSERT(!throwScope.exception());
     248    throwScope.assertNoException();
    249249    result->putDirect(vm, Identifier::fromString(&vm, "finalLongAttributeBar"), finalLongAttributeBarValue);
    250250
  • trunk/Source/WebCore/contentextensions/ContentExtensionParser.cpp

    r214358 r216428  
    11/*
    2  * Copyright (C) 2014 Apple Inc. All rights reserved.
     2 * Copyright (C) 2014-2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    107107
    108108    const JSObject* object = typeValue.toObject(&exec);
    109     ASSERT(!scope.exception());
     109    scope.assertNoException();
    110110    if (!isJSArray(object))
    111111        return ContentExtensionError::JSONInvalidTriggerFlagsArray;
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r216050 r216428  
    68116811
    68126812    JSC::JSObject* function = functionValue.toObject(exec);
    6813     ASSERT(!scope.exception());
     6813    scope.assertNoException();
    68146814    JSC::CallData callData;
    68156815    JSC::CallType callType = function->methodTable()->getCallData(function, callData);
     
    68256825    // Connect the Media, MediaControllerHost, and Controller so the GC knows about their relationship
    68266826    JSC::JSObject* mediaJSWrapperObject = mediaJSWrapper.toObject(exec);
    6827     ASSERT(!scope.exception());
     6827    scope.assertNoException();
    68286828    JSC::Identifier controlsHost = JSC::Identifier::fromString(&exec->vm(), "controlsHost");
    68296829   
     
    68956895
    68966896    JSC::JSObject* function = functionValue.toObject(exec);
    6897     ASSERT(!scope.exception());
     6897    scope.assertNoException();
    68986898    JSC::CallData callData;
    68996899    JSC::CallType callType = function->methodTable()->getCallData(function, callData);
     
    69376937
    69386938    JSC::JSObject* function = functionValue.toObject(exec);
    6939     ASSERT(!scope.exception());
     6939    scope.assertNoException();
    69406940    JSC::CallData callData;
    69416941    JSC::CallType callType = function->methodTable()->getCallData(function, callData);
  • trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp

    r215152 r216428  
    367367    // It is expected the JS file provides a createOverlay(shadowRoot, title, subtitle) function.
    368368    auto* overlay = globalObject.get(&state, JSC::Identifier::fromString(&state, "createOverlay")).toObject(&state);
     369    ASSERT(!overlay == !!scope.exception());
    369370    if (!overlay) {
    370         ASSERT(scope.exception());
    371371        scope.clearException();
    372372        return;
Note: See TracChangeset for help on using the changeset viewer.