Title: [216428] trunk/Source
Revision
216428
Author
mark....@apple.com
Date
2017-05-08 09:56:32 -0700 (Mon, 08 May 2017)

Log Message

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

Reviewed by Keith Miller.

Source/_javascript_Core:

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:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (216427 => 216428)


--- trunk/Source/_javascript_Core/ChangeLog	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,3 +1,114 @@
+2017-05-08  Mark Lam  <mark....@apple.com>
+
+        Introduce ExceptionScope::assertNoException() and releaseAssertNoException().
+        https://bugs.webkit.org/show_bug.cgi?id=171776
+
+        Reviewed by Keith Miller.
+
+        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):
+
 2017-05-06  Bill Ming  <mbb...@gmail.com>
 
         Fix 32bit Windows build by giving correct parameters to MASM

Modified: trunk/Source/_javascript_Core/debugger/Debugger.cpp (216427 => 216428)


--- trunk/Source/_javascript_Core/debugger/Debugger.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/debugger/Debugger.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -741,7 +741,7 @@
     {
         PauseReasonDeclaration reason(*this, didHitBreakpoint ? PausedForBreakpoint : m_reasonForPause);
         handlePause(vmEntryGlobalObject, m_reasonForPause);
-        RELEASE_ASSERT(!scope.exception());
+        scope.releaseAssertNoException();
     }
 
     m_pausingBreakpointID = noBreakpointID;

Modified: trunk/Source/_javascript_Core/dfg/DFGOperations.cpp (216427 => 216428)


--- trunk/Source/_javascript_Core/dfg/DFGOperations.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/dfg/DFGOperations.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1750,9 +1750,9 @@
     auto scope = DECLARE_THROW_SCOPE(vm);
 
     JSString* str1 = JSValue::decode(a).toString(exec);
-    ASSERT(!scope.exception()); // Impossible, since we must have been given primitives.
+    scope.assertNoException(); // Impossible, since we must have been given primitives.
     JSString* str2 = JSValue::decode(b).toString(exec);
-    ASSERT(!scope.exception());
+    scope.assertNoException();
 
     scope.release();
     return jsString(exec, str1, str2);
@@ -1765,11 +1765,11 @@
     auto scope = DECLARE_THROW_SCOPE(vm);
 
     JSString* str1 = JSValue::decode(a).toString(exec);
-    ASSERT(!scope.exception()); // Impossible, since we must have been given primitives.
+    scope.assertNoException(); // Impossible, since we must have been given primitives.
     JSString* str2 = JSValue::decode(b).toString(exec);
-    ASSERT(!scope.exception());
+    scope.assertNoException();
     JSString* str3 = JSValue::decode(c).toString(exec);
-    ASSERT(!scope.exception());
+    scope.assertNoException();
 
     scope.release();
     return jsString(exec, str1, str2, str3);

Modified: trunk/Source/_javascript_Core/interpreter/Interpreter.cpp (216427 => 216428)


--- trunk/Source/_javascript_Core/interpreter/Interpreter.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/interpreter/Interpreter.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -152,7 +152,7 @@
         }
         
         // If the literal parser bailed, it should not have thrown exceptions.
-        ASSERT(!scope.exception());
+        scope.assertNoException();
 
         VariableEnvironment variablesUnderTDZ;
         JSScope::collectClosureVariablesUnderTDZ(callerScopeChain, variablesUnderTDZ);
@@ -593,7 +593,7 @@
             debugger->unwindEvent(callFrame);
         else
             debugger->didExecuteProgram(callFrame);
-        ASSERT_UNUSED(catchScope, !catchScope.exception());
+        catchScope.assertNoException();
     }
 }
 
@@ -751,7 +751,7 @@
     ASSERT(throwScope.exception() || program);
     RETURN_IF_EXCEPTION(throwScope, { });
 
-    ASSERT(!throwScope.exception());
+    throwScope.assertNoException();
     ASSERT(!vm.isCollectorBusyOnCurrentThread());
     RELEASE_ASSERT(vm.currentThreadIsHoldingAPILock());
     if (vm.isCollectorBusyOnCurrentThread())
@@ -902,7 +902,7 @@
     VM& vm = callFrame->vm();
     auto throwScope = DECLARE_THROW_SCOPE(vm);
 
-    ASSERT(!throwScope.exception());
+    throwScope.assertNoException();
     ASSERT(!vm.isCollectorBusyOnCurrentThread());
     if (vm.isCollectorBusyOnCurrentThread())
         return jsNull();
@@ -967,7 +967,7 @@
     VM& vm = callFrame->vm();
     auto throwScope = DECLARE_THROW_SCOPE(vm);
 
-    ASSERT(!throwScope.exception());
+    throwScope.assertNoException();
     ASSERT(!vm.isCollectorBusyOnCurrentThread());
     // We throw in this case because we have to return something "valid" but we're
     // already in an invalid state.
@@ -1036,7 +1036,7 @@
 {
     VM& vm = *scope->vm();
     auto throwScope = DECLARE_THROW_SCOPE(vm);
-    ASSERT_UNUSED(throwScope, !throwScope.exception());
+    throwScope.assertNoException();
     
     if (vm.isCollectorBusyOnCurrentThread())
         return CallFrameClosure();
@@ -1088,7 +1088,7 @@
     auto throwScope = DECLARE_THROW_SCOPE(vm);
 
     ASSERT(scope->vm() == &callFrame->vm());
-    ASSERT(!throwScope.exception());
+    throwScope.assertNoException();
     ASSERT(!vm.isCollectorBusyOnCurrentThread());
     RELEASE_ASSERT(vm.currentThreadIsHoldingAPILock());
     if (vm.isCollectorBusyOnCurrentThread())
@@ -1231,7 +1231,7 @@
     auto throwScope = DECLARE_THROW_SCOPE(vm);
 
     ASSERT(scope->vm() == &callFrame->vm());
-    ASSERT(!throwScope.exception());
+    throwScope.assertNoException();
     ASSERT(!vm.isCollectorBusyOnCurrentThread());
     RELEASE_ASSERT(vm.currentThreadIsHoldingAPILock());
     if (vm.isCollectorBusyOnCurrentThread())
@@ -1284,7 +1284,7 @@
         return;
 
     ASSERT(callFrame->codeBlock()->hasDebuggerRequests());
-    ASSERT_UNUSED(scope, !scope.exception());
+    scope.assertNoException();
 
     switch (debugHookType) {
         case DidEnterCallFrame:
@@ -1309,7 +1309,7 @@
             debugger->didReachBreakpoint(callFrame);
             break;
     }
-    ASSERT(!scope.exception());
+    scope.assertNoException();
 }
 
 } // namespace JSC

Modified: trunk/Source/_javascript_Core/interpreter/ShadowChicken.cpp (216427 => 216428)


--- trunk/Source/_javascript_Core/interpreter/ShadowChicken.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/interpreter/ShadowChicken.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -457,7 +457,7 @@
         vm, exec,
         [&] (const Frame& frame) -> bool {
             result->push(exec, frame.callee);
-            RELEASE_ASSERT(!scope.exception()); // This function is only called from tests.
+            scope.releaseAssertNoException(); // This function is only called from tests.
             return true;
         });
     

Modified: trunk/Source/_javascript_Core/jsc.cpp (216427 => 216428)


--- trunk/Source/_javascript_Core/jsc.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/jsc.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1608,7 +1608,7 @@
     auto scope = DECLARE_CATCH_SCOPE(vm);
 
     JSInternalPromiseDeferred* deferred = JSInternalPromiseDeferred::create(exec, globalObject);
-    RELEASE_ASSERT(!scope.exception());
+    scope.releaseAssertNoException();
     const Identifier key = keyValue.toPropertyKey(exec);
     if (UNLIKELY(scope.exception())) {
         JSValue exception = scope.exception();
@@ -1645,7 +1645,7 @@
     if (!directoryName)
         return deferred->reject(exec, createError(exec, makeString("Could not resolve the referrer name '", String(referrer.impl()), "'.")));
     auto result = deferred->resolve(exec, jsString(exec, resolvePath(directoryName.value(), ModuleName(key.impl()))));
-    RELEASE_ASSERT(!scope.exception());
+    scope.releaseAssertNoException();
     return result;
 }
 
@@ -1735,7 +1735,7 @@
         return deferred->reject(exec, createError(exec, makeString("Could not open file '", moduleKey, "'.")));
 
     auto result = deferred->resolve(exec, JSSourceCode::create(exec->vm(), makeSource(stringFromUTF(utf8), SourceOrigin { moduleKey }, moduleKey, TextPosition(), SourceProviderSourceType::Module)));
-    RELEASE_ASSERT(!scope.exception());
+    scope.releaseAssertNoException();
     return result;
 }
 
@@ -3014,7 +3014,7 @@
 
     String jsonString = snapshotBuilder.json();
     EncodedJSValue result = JSValue::encode(JSONParse(exec, jsonString));
-    RELEASE_ASSERT(!scope.exception());
+    scope.releaseAssertNoException();
     return result;
 }
 
@@ -3053,7 +3053,7 @@
 
     String jsonString = vm.samplingProfiler()->stackTracesAsJSON();
     EncodedJSValue result = JSValue::encode(JSONParse(exec, jsonString));
-    RELEASE_ASSERT(!scope.exception());
+    scope.releaseAssertNoException();
     return result;
 }
 #endif // ENABLE(SAMPLING_PROFILER)
@@ -3101,9 +3101,9 @@
     auto scope = DECLARE_CATCH_SCOPE(vm);
 
     JSString* type = asString(wasmValue.get(exec, makeIdentifier(vm, "type")));
-    ASSERT_UNUSED(scope, !scope.exception());
+    scope.assertNoException();
     JSValue value = wasmValue.get(exec, makeIdentifier(vm, "value"));
-    ASSERT(!scope.exception());
+    scope.assertNoException();
 
     auto unboxString = [&] (const char* hexFormat, const char* decFormat, auto& result) {
         if (!value.isString())
@@ -3489,7 +3489,7 @@
 
             if (isModule) {
                 promise = loadAndEvaluateModule(globalObject->globalExec(), fileName);
-                RELEASE_ASSERT(!scope.exception());
+                scope.releaseAssertNoException();
             } else {
                 if (!fetchScriptFromLocalFileSystem(fileName, scriptBuffer))
                     return false; // fail early so we can catch missing files
@@ -3518,12 +3518,12 @@
             });
 
             promise->then(globalObject->globalExec(), fulfillHandler, rejectHandler);
-            RELEASE_ASSERT(!scope.exception());
+            scope.releaseAssertNoException();
             vm.drainMicrotasks();
         } else {
             NakedPtr<Exception> evaluationException;
             JSValue returnValue = evaluate(globalObject->globalExec(), jscSource(scriptBuffer, SourceOrigin { absolutePath(fileName) }, fileName), JSValue(), evaluationException);
-            ASSERT(!scope.exception());
+            scope.assertNoException();
             if (evaluationException)
                 returnValue = evaluationException->value();
             checkException(globalObject, isLastFile, evaluationException, returnValue, uncaughtExceptionName, alwaysDumpUncaughtException, dump, success);

Modified: trunk/Source/_javascript_Core/runtime/AbstractModuleRecord.cpp (216427 => 216428)


--- trunk/Source/_javascript_Core/runtime/AbstractModuleRecord.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/runtime/AbstractModuleRecord.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -59,7 +59,7 @@
 
     auto scope = DECLARE_THROW_SCOPE(vm);
     JSMap* map = JSMap::create(exec, vm, globalObject()->mapStructure());
-    RELEASE_ASSERT(!scope.exception());
+    scope.releaseAssertNoException();
     m_dependenciesMap.set(vm, this, map);
     putDirect(vm, Identifier::fromString(&vm, ASCIILiteral("dependenciesMap")), m_dependenciesMap.get());
 }

Modified: trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp (216427 => 216428)


--- trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1395,7 +1395,7 @@
 
     PropertySlot constructorSlot(this, PropertySlot::InternalMethodType::VMInquiry);
     this->getOwnPropertySlot(this, exec, vm.propertyNames->constructor, constructorSlot);
-    ASSERT_UNUSED(scope, !scope.exception());
+    scope.assertNoException();
     if (constructorSlot.slotBase() != this
         || !constructorSlot.isCacheableValue()
         || constructorSlot.getValue(exec, vm.propertyNames->constructor) != arrayConstructor) {
@@ -1409,7 +1409,7 @@
 
     PropertySlot speciesSlot(arrayConstructor, PropertySlot::InternalMethodType::VMInquiry);
     arrayConstructor->getOwnPropertySlot(arrayConstructor, exec, vm.propertyNames->speciesSymbol, speciesSlot);
-    ASSERT_UNUSED(scope, !scope.exception());
+    scope.assertNoException();
     if (speciesSlot.slotBase() != arrayConstructor
         || !speciesSlot.isCacheableGetter()
         || speciesSlot.getterSetter() != globalObject->speciesGetterSetter()) {

Modified: trunk/Source/_javascript_Core/runtime/Completion.cpp (216427 => 216428)


--- trunk/Source/_javascript_Core/runtime/Completion.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/runtime/Completion.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,7 +1,7 @@
 /*
  *  Copyright (C) 1999-2001 Harri Porten (por...@kde.org)
  *  Copyright (C) 2001 Peter Kelly (p...@post.com)
- *  Copyright (C) 2003, 2007, 2013, 2016 Apple Inc.
+ *  Copyright (C) 2003-2017 Apple Inc.
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Library General Public
@@ -145,7 +145,7 @@
 {
     VM& vm = exec->vm();
     auto scope = DECLARE_CATCH_SCOPE(vm);
-    ASSERT(scope.exception());
+    scope.assertNoException();
     JSValue exception = scope.exception()->value();
     scope.clearException();
     JSInternalPromiseDeferred* deferred = JSInternalPromiseDeferred::create(exec, globalObject);

Modified: trunk/Source/_javascript_Core/runtime/ErrorInstance.cpp (216427 => 216428)


--- trunk/Source/_javascript_Core/runtime/ErrorInstance.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/runtime/ErrorInstance.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,6 +1,6 @@
 /*
  *  Copyright (C) 1999-2000 Harri Porten (por...@kde.org)
- *  Copyright (C) 2003, 2008, 2016 Apple Inc. All rights reserved.
+ *  Copyright (C) 2003-2017 Apple Inc. All rights reserved.
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
@@ -189,7 +189,7 @@
         }
         currentObj = obj->getPrototypeDirect();
     }
-    ASSERT(!scope.exception());
+    scope.assertNoException();
 
     String nameString;
     if (!nameValue)
@@ -204,7 +204,7 @@
     PropertySlot messageSlot(this, PropertySlot::InternalMethodType::VMInquiry);
     if (JSObject::getOwnPropertySlot(this, exec, messagePropertName, messageSlot) && messageSlot.isValue())
         messageValue = messageSlot.getValue(exec, messagePropertName);
-    ASSERT(!scope.exception());
+    scope.assertNoException();
 
     String messageString;
     if (!messageValue)

Modified: trunk/Source/_javascript_Core/runtime/ExceptionHelpers.cpp (216427 => 216428)


--- trunk/Source/_javascript_Core/runtime/ExceptionHelpers.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/runtime/ExceptionHelpers.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2009, 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2008-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -259,7 +259,7 @@
     auto scope = DECLARE_CATCH_SCOPE(vm);
 
     String errorMessage = makeString(errorDescriptionForValue(exec, value)->value(exec), ' ', message);
-    ASSERT_UNUSED(scope, !scope.exception());
+    scope.assertNoException();
     JSObject* exception = createTypeError(exec, errorMessage, appender, runtimeTypeForValue(value));
     ASSERT(exception->isErrorInstance());
     return exception;

Modified: trunk/Source/_javascript_Core/runtime/ExceptionScope.cpp (216427 => 216428)


--- trunk/Source/_javascript_Core/runtime/ExceptionScope.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/runtime/ExceptionScope.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -27,6 +27,8 @@
 #include "ExceptionScope.h"
 
 #include "Exception.h"
+#include <wtf/StackTrace.h>
+#include <wtf/StringPrintStream.h>
 
 namespace JSC {
     
@@ -47,6 +49,23 @@
     m_vm.m_topExceptionScope = m_previousScope;
 }
 
+CString ExceptionScope::unexpectedExceptionMessage()
+{
+    StringPrintStream out;
+
+    out.println("Unexpected exception observed at:");
+    auto currentStack = std::unique_ptr<StackTrace>(StackTrace::captureStackTrace(25, 1));
+    currentStack->dump(out, "    ");
+
+    if (!m_vm.nativeStackTraceOfLastThrow())
+        return CString();
+    
+    out.println("The exception was thrown from:");
+    m_vm.nativeStackTraceOfLastThrow()->dump(out, "    ");
+
+    return out.toCString();
+}
+
 #endif // ENABLE(EXCEPTION_SCOPE_VERIFICATION)
     
 } // namespace JSC

Modified: trunk/Source/_javascript_Core/runtime/ExceptionScope.h (216427 => 216428)


--- trunk/Source/_javascript_Core/runtime/ExceptionScope.h	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/runtime/ExceptionScope.h	2017-05-08 16:56:32 UTC (rev 216428)
@@ -38,7 +38,10 @@
     VM& vm() const { return m_vm; }
     unsigned recursionDepth() const { return m_recursionDepth; }
     Exception* exception() { return m_vm.exception(); }
-    
+
+    ALWAYS_INLINE void assertNoException() { ASSERT_WITH_MESSAGE(!exception(), "%s", unexpectedExceptionMessage().data()); }
+    ALWAYS_INLINE void releaseAssertNoException() { RELEASE_ASSERT_WITH_MESSAGE(!exception(), "%s", unexpectedExceptionMessage().data()); }
+
 protected:
     ExceptionScope(VM&, ExceptionEventLocation);
     ExceptionScope(const ExceptionScope&) = delete;
@@ -45,6 +48,8 @@
     ExceptionScope(ExceptionScope&&) = default;
     ~ExceptionScope();
 
+    JS_EXPORT_PRIVATE CString unexpectedExceptionMessage();
+
     VM& m_vm;
     ExceptionScope* m_previousScope;
     ExceptionEventLocation m_location;
@@ -57,7 +62,11 @@
 public:
     ALWAYS_INLINE VM& vm() const { return m_vm; }
     ALWAYS_INLINE Exception* exception() { return m_vm.exception(); }
+    ALWAYS_INLINE CString unexpectedExceptionMessage() { return { }; }
 
+    ALWAYS_INLINE void assertNoException() { ASSERT(!exception()); }
+    ALWAYS_INLINE void releaseAssertNoException() { RELEASE_ASSERT(!exception()); }
+
 protected:
     ALWAYS_INLINE ExceptionScope(VM& vm)
         : m_vm(vm)

Modified: trunk/Source/_javascript_Core/runtime/GenericArgumentsInlines.h (216427 => 216428)


--- trunk/Source/_javascript_Core/runtime/GenericArgumentsInlines.h	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/runtime/GenericArgumentsInlines.h	2017-05-08 16:56:32 UTC (rev 216428)
@@ -227,7 +227,7 @@
                     JSValue value = thisObject->getIndexQuickly(index);
                     ASSERT(value);
                     object->putDirectMayBeIndex(exec, ident, value);
-                    ASSERT(!scope.exception());
+                    scope.assertNoException();
 
                     thisObject->setModifiedArgumentDescriptor(vm, index);
                 }

Modified: trunk/Source/_javascript_Core/runtime/IntlCollator.cpp (216427 => 216428)


--- trunk/Source/_javascript_Core/runtime/IntlCollator.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/runtime/IntlCollator.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,7 +1,7 @@
 /*
  * Copyright (C) 2015 Andy VanWagoner (thetalecraf...@gmail.com)
  * Copyright (C) 2015 Sukolsak Sakshuwong (sukol...@gmail.com)
- * Copyright (C) 2016 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2016-2017 Apple Inc. All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -343,7 +343,7 @@
 
     if (!m_initializedCollator) {
         initializeCollator(state, jsUndefined(), jsUndefined());
-        ASSERT_UNUSED(scope, !scope.exception());
+        scope.assertNoException();
     }
 
     UErrorCode status = U_ZERO_ERROR;
@@ -475,7 +475,7 @@
 
     if (!m_initializedCollator) {
         initializeCollator(state, jsUndefined(), jsUndefined());
-        ASSERT_UNUSED(scope, !scope.exception());
+        scope.assertNoException();
     }
 
     JSObject* options = constructEmptyObject(&state);

Modified: trunk/Source/_javascript_Core/runtime/IntlDateTimeFormat.cpp (216427 => 216428)


--- trunk/Source/_javascript_Core/runtime/IntlDateTimeFormat.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/runtime/IntlDateTimeFormat.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2015 Andy VanWagoner (thetalecraf...@gmail.com)
- * Copyright (C) 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -832,7 +832,7 @@
     // Note: In this version of the ECMAScript 2015 Internationalization API, the timeZone property will be the name of the default time zone if no timeZone property was provided in the options object provided to the Intl.DateTimeFormat constructor. The previous version left the timeZone property undefined in this case.
     if (!m_initializedDateTimeFormat) {
         initializeDateTimeFormat(exec, jsUndefined(), jsUndefined());
-        ASSERT_UNUSED(scope, !scope.exception());
+        scope.assertNoException();
     }
 
     JSObject* options = constructEmptyObject(&exec);
@@ -881,7 +881,7 @@
     // 12.3.4 FormatDateTime abstract operation (ECMA-402 2.0)
     if (!m_initializedDateTimeFormat) {
         initializeDateTimeFormat(exec, jsUndefined(), jsUndefined());
-        ASSERT(!scope.exception());
+        scope.assertNoException();
     }
 
     // 1. If x is not a finite Number, then throw a RangeError exception.

Modified: trunk/Source/_javascript_Core/runtime/IntlNumberFormat.cpp (216427 => 216428)


--- trunk/Source/_javascript_Core/runtime/IntlNumberFormat.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/runtime/IntlNumberFormat.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,7 +1,7 @@
 /*
  * Copyright (C) 2015 Andy VanWagoner (thetalecraf...@gmail.com)
  * Copyright (C) 2016 Sukolsak Sakshuwong (sukol...@gmail.com)
- * Copyright (C) 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -358,7 +358,7 @@
 
     if (!m_initializedNumberFormat) {
         initializeNumberFormat(state, jsUndefined(), jsUndefined());
-        ASSERT_UNUSED(scope, !scope.exception());
+        scope.assertNoException();
     }
 
     UNumberFormatStyle style;
@@ -486,7 +486,7 @@
 
     if (!m_initializedNumberFormat) {
         initializeNumberFormat(state, jsUndefined(), jsUndefined());
-        ASSERT_UNUSED(scope, !scope.exception());
+        scope.assertNoException();
     }
 
     JSObject* options = constructEmptyObject(&state);

Modified: trunk/Source/_javascript_Core/runtime/JSCJSValue.cpp (216427 => 216428)


--- trunk/Source/_javascript_Core/runtime/JSCJSValue.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/runtime/JSCJSValue.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,7 +1,7 @@
 /*
  *  Copyright (C) 1999-2001 Harri Porten (por...@kde.org)
  *  Copyright (C) 2001 Peter Kelly (p...@post.com)
- *  Copyright (C) 2003, 2007-2008, 2012, 2016 Apple Inc. All rights reserved.
+ *  Copyright (C) 2003-2017 Apple Inc. All rights reserved.
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Library General Public
@@ -207,10 +207,9 @@
     }
     
     JSObject* prototype = synthesizePrototype(exec);
-    if (UNLIKELY(!prototype)) {
-        ASSERT(scope.exception());
+    ASSERT(!prototype == !!scope.exception());
+    if (UNLIKELY(!prototype))
         return false;
-    }
     bool putResult = false;
     if (prototype->attemptToInterceptPutByIndexOnHoleForPrototype(exec, *this, propertyName, value, shouldThrow, putResult))
         return putResult;

Modified: trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewPrototypeFunctions.h (216427 => 216428)


--- trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewPrototypeFunctions.h	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewPrototypeFunctions.h	2017-05-08 16:56:32 UTC (rev 216428)
@@ -206,7 +206,7 @@
     if (!targetOption)
         return JSValue::encode(jsBoolean(false));
 
-    ASSERT(!scope.exception());
+    scope.assertNoException();
     RELEASE_ASSERT(!thisObject->isNeutered());
 
     if (std::isnan(static_cast<double>(*targetOption))) {
@@ -250,7 +250,7 @@
     auto targetOption = ViewClass::toAdaptorNativeFromValueWithoutCoercion(valueToFind);
     if (!targetOption)
         return JSValue::encode(jsNumber(-1));
-    ASSERT(!scope.exception());
+    scope.assertNoException();
     RELEASE_ASSERT(!thisObject->isNeutered());
 
     for (; index < length; ++index) {
@@ -341,7 +341,7 @@
         return JSValue::encode(jsNumber(-1));
 
     typename ViewClass::ElementType* array = thisObject->typedVector();
-    ASSERT(!scope.exception());
+    scope.assertNoException();
     RELEASE_ASSERT(!thisObject->isNeutered());
 
     for (; index >= 0; --index) {
@@ -531,9 +531,9 @@
     ASSERT(exec->argument(0).isNumber());
     ASSERT(exec->argument(1).isUndefined() || exec->argument(1).isNumber());
     unsigned begin = argumentClampedIndexFromStartOrEnd(exec, 0, thisLength);
-    ASSERT(!scope.exception());
+    scope.assertNoException();
     unsigned end = argumentClampedIndexFromStartOrEnd(exec, 1, thisLength, thisLength);
-    ASSERT(!scope.exception());
+    scope.assertNoException();
 
     RELEASE_ASSERT(!thisObject->isNeutered());
 

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp (216427 => 216428)


--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -743,20 +743,20 @@
     JSFunction* privateFuncConcatSlowPath = JSFunction::createBuiltinFunction(vm, arrayPrototypeConcatSlowPathCodeGenerator(vm), this);
 
     JSObject* regExpProtoFlagsGetterObject = getGetterById(exec, m_regExpPrototype.get(), vm.propertyNames->flags);
-    ASSERT_UNUSED(catchScope, !catchScope.exception());
+    catchScope.assertNoException();
     JSObject* regExpProtoGlobalGetterObject = getGetterById(exec, m_regExpPrototype.get(), vm.propertyNames->global);
-    ASSERT(!catchScope.exception());
+    catchScope.assertNoException();
     m_regExpProtoGlobalGetter.set(vm, this, regExpProtoGlobalGetterObject);
     JSObject* regExpProtoIgnoreCaseGetterObject = getGetterById(exec, m_regExpPrototype.get(), vm.propertyNames->ignoreCase);
-    ASSERT(!catchScope.exception());
+    catchScope.assertNoException();
     JSObject* regExpProtoMultilineGetterObject = getGetterById(exec, m_regExpPrototype.get(), vm.propertyNames->multiline);
-    ASSERT(!catchScope.exception());
+    catchScope.assertNoException();
     JSObject* regExpProtoSourceGetterObject = getGetterById(exec, m_regExpPrototype.get(), vm.propertyNames->source);
-    ASSERT(!catchScope.exception());
+    catchScope.assertNoException();
     JSObject* regExpProtoStickyGetterObject = getGetterById(exec, m_regExpPrototype.get(), vm.propertyNames->sticky);
-    ASSERT(!catchScope.exception());
+    catchScope.assertNoException();
     JSObject* regExpProtoUnicodeGetterObject = getGetterById(exec, m_regExpPrototype.get(), vm.propertyNames->unicode);
-    ASSERT(!catchScope.exception());
+    catchScope.assertNoException();
     m_regExpProtoUnicodeGetter.set(vm, this, regExpProtoUnicodeGetterObject);
     JSObject* builtinRegExpExec = asObject(m_regExpPrototype->getDirect(vm, vm.propertyNames->exec).asCell());
     m_regExpProtoExec.set(vm, this, builtinRegExpExec);
@@ -913,10 +913,10 @@
             PropertySlot slot(base, PropertySlot::InternalMethodType::Get);
             bool result = base->getOwnPropertySlot(base, exec, ident, slot);
             ASSERT_UNUSED(result, result);
-            ASSERT(!catchScope.exception());
+            catchScope.assertNoException();
             RELEASE_ASSERT(slot.isCacheableValue());
             JSValue functionValue = slot.getValue(exec, ident);
-            ASSERT(!catchScope.exception());
+            catchScope.assertNoException();
             ASSERT(jsDynamicCast<JSFunction*>(vm, functionValue));
 
             ObjectPropertyCondition condition = generateConditionForSelfEquivalence(m_vm, nullptr, base, ident.impl());

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.cpp (216427 => 216428)


--- trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,7 +1,7 @@
 /*
  *  Copyright (C) 1999-2002 Harri Porten (por...@kde.org)
  *  Copyright (C) 2001 Peter Kelly (p...@post.com)
- *  Copyright (C) 2003-2009, 2012, 2016 Apple Inc. All rights reserved.
+ *  Copyright (C) 2003-2017 Apple Inc. All rights reserved.
  *  Copyright (C) 2007 Cameron Zwarich (cwzwar...@uwaterloo.ca)
  *  Copyright (C) 2007 Maks Orlovich
  *
@@ -753,7 +753,7 @@
     ASSERT(operationValue.isNumber());
     auto operation = static_cast<JSPromiseRejectionOperation>(operationValue.toUInt32(exec));
     ASSERT(operation == JSPromiseRejectionOperation::Reject || operation == JSPromiseRejectionOperation::Handle);
-    ASSERT(!scope.exception());
+    scope.assertNoException();
 
     globalObject->globalObjectMethodTable()->promiseRejectionTracker(globalObject, exec, promise, operation);
     RETURN_IF_EXCEPTION(scope, { });

Modified: trunk/Source/_javascript_Core/runtime/JSModuleEnvironment.cpp (216427 => 216428)


--- trunk/Source/_javascript_Core/runtime/JSModuleEnvironment.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/runtime/JSModuleEnvironment.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -91,7 +91,7 @@
         ASSERT_UNUSED(result, result);
         ASSERT(redirectSlot.isValue());
         JSValue value = redirectSlot.getValue(exec, resolution.localName);
-        ASSERT_UNUSED(scope, !scope.exception());
+        scope.assertNoException();
         slot.setValue(thisObject, redirectSlot.attributes(), value);
         return true;
     }

Modified: trunk/Source/_javascript_Core/runtime/JSModuleLoader.cpp (216427 => 216428)


--- trunk/Source/_javascript_Core/runtime/JSModuleLoader.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/runtime/JSModuleLoader.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -63,7 +63,7 @@
     Base::finishCreation(vm);
     ASSERT(inherits(vm, info()));
     JSMap* map = JSMap::create(exec, vm, globalObject->mapStructure());
-    RELEASE_ASSERT(!scope.exception());
+    scope.releaseAssertNoException();
     putDirect(vm, Identifier::fromString(&vm, "registry"), map);
 }
 

Modified: trunk/Source/_javascript_Core/runtime/JSModuleNamespaceObject.cpp (216427 => 216428)


--- trunk/Source/_javascript_Core/runtime/JSModuleNamespaceObject.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/runtime/JSModuleNamespaceObject.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -80,7 +80,7 @@
     // http://www.ecma-international.org/ecma-262/6.0/#sec-module-namespace-exotic-objects-isextensible
     // http://www.ecma-international.org/ecma-262/6.0/#sec-module-namespace-exotic-objects-preventextensions
     methodTable(vm)->preventExtensions(this, exec);
-    ASSERT_UNUSED(scope, !scope.exception());
+    scope.assertNoException();
 }
 
 void JSModuleNamespaceObject::destroy(JSCell* cell)

Modified: trunk/Source/_javascript_Core/runtime/JSONObject.cpp (216427 => 216428)


--- trunk/Source/_javascript_Core/runtime/JSONObject.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/runtime/JSONObject.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009, 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2009-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -287,7 +287,7 @@
 {
     VM& vm = m_exec->vm();
     auto scope = DECLARE_THROW_SCOPE(vm);
-    ASSERT(!scope.exception());
+    scope.assertNoException();
     if (!value.isObject())
         return value;
     

Modified: trunk/Source/_javascript_Core/runtime/JSObject.cpp (216427 => 216428)


--- trunk/Source/_javascript_Core/runtime/JSObject.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/runtime/JSObject.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1963,7 +1963,7 @@
             return value;
     }
 
-    ASSERT(!scope.exception());
+    scope.assertNoException();
 
     return throwTypeError(exec, scope, ASCIILiteral("No default value"));
 }

Modified: trunk/Source/_javascript_Core/runtime/JSPropertyNameEnumerator.h (216427 => 216428)


--- trunk/Source/_javascript_Core/runtime/JSPropertyNameEnumerator.h	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/runtime/JSPropertyNameEnumerator.h	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014, 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -117,12 +117,12 @@
 
     if (structure->canAccessPropertiesQuicklyForEnumeration() && indexedLength == base->getArrayLength()) {
         base->methodTable(vm)->getStructurePropertyNames(base, exec, propertyNames, EnumerationMode());
-        ASSERT(!scope.exception());
+        scope.assertNoException();
 
         numberStructureProperties = propertyNames.size();
 
         base->methodTable(vm)->getGenericPropertyNames(base, exec, propertyNames, EnumerationMode());
-        ASSERT(!scope.exception());
+        scope.assertNoException();
     } else {
         // Generic property names vector contains all indexed property names.
         // So disable indexed property enumeration phase by setting |indexedLength| to 0.

Modified: trunk/Source/_javascript_Core/runtime/ObjectConstructor.cpp (216427 => 216428)


--- trunk/Source/_javascript_Core/runtime/ObjectConstructor.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/runtime/ObjectConstructor.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,6 +1,6 @@
 /*
  *  Copyright (C) 1999-2000 Harri Porten (por...@kde.org)
- *  Copyright (C) 2008, 2016 Apple Inc. All rights reserved.
+ *  Copyright (C) 2008-2017 Apple Inc. All rights reserved.
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
@@ -235,7 +235,7 @@
 
         PutPropertySlot slot(descriptors);
         descriptors->putOwnDataPropertyMayBeIndex(exec, propertyName, fromDescriptor, slot);
-        ASSERT(!scope.exception());
+        scope.assertNoException();
     }
 
     return descriptors;
@@ -419,7 +419,7 @@
     if (!success)
         return JSValue::encode(jsNull());
     ASSERT((descriptor.attributes() & Accessor) || (!descriptor.isAccessorDescriptor()));
-    ASSERT(!scope.exception());
+    scope.assertNoException();
     obj->methodTable(vm)->defineOwnProperty(obj, exec, propertyName, descriptor, true);
     scope.release();
     return JSValue::encode(obj);

Modified: trunk/Source/_javascript_Core/runtime/ObjectPrototype.cpp (216427 => 216428)


--- trunk/Source/_javascript_Core/runtime/ObjectPrototype.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/runtime/ObjectPrototype.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,6 +1,6 @@
 /*
  *  Copyright (C) 1999-2000 Harri Porten (por...@kde.org)
- *  Copyright (C) 2008, 2011, 2016 Apple Inc. All rights reserved.
+ *  Copyright (C) 2008-2017 Apple Inc. All rights reserved.
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
@@ -105,7 +105,7 @@
     HasOwnPropertyCache* hasOwnPropertyCache = vm.ensureHasOwnPropertyCache();
     if (std::optional<bool> result = hasOwnPropertyCache->get(structure, propertyName)) {
         ASSERT(*result == thisObject->hasOwnProperty(exec, propertyName));
-        ASSERT(!scope.exception());
+        scope.assertNoException();
         return JSValue::encode(jsBoolean(*result));
     }
 

Modified: trunk/Source/_javascript_Core/runtime/ProgramExecutable.cpp (216427 => 216428)


--- trunk/Source/_javascript_Core/runtime/ProgramExecutable.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/runtime/ProgramExecutable.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009, 2010, 2013, 2015-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2009-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -177,7 +177,7 @@
     for (auto& entry : variableDeclarations) {
         ASSERT(entry.value.isVar());
         globalObject->addVar(callFrame, Identifier::fromUid(&vm, entry.key.get()));
-        ASSERT(!throwScope.exception());
+        throwScope.assertNoException();
     }
 
     {

Modified: trunk/Source/_javascript_Core/runtime/ReflectObject.cpp (216427 => 216428)


--- trunk/Source/_javascript_Core/runtime/ReflectObject.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/runtime/ReflectObject.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015-2016 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2015-2017 Apple Inc. All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -147,7 +147,7 @@
     if (UNLIKELY(!success))
         return encodedJSValue();
     ASSERT((descriptor.attributes() & Accessor) || (!descriptor.isAccessorDescriptor()));
-    ASSERT(!scope.exception());
+    scope.assertNoException();
 
     // Reflect.defineProperty should not throw an error when the defineOwnProperty operation fails.
     bool shouldThrow = false;

Modified: trunk/Source/_javascript_Core/runtime/SamplingProfiler.cpp (216427 => 216428)


--- trunk/Source/_javascript_Core/runtime/SamplingProfiler.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/runtime/SamplingProfiler.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -719,7 +719,7 @@
         PropertySlot slot(callee, PropertySlot::InternalMethodType::VMInquiry);
         PropertyName propertyName(ident);
         bool hasProperty = callee->getPropertySlot(exec, propertyName, slot);
-        ASSERT_UNUSED(scope, !scope.exception());
+        scope.assertNoException();
         if (hasProperty) {
             if (slot.isValue()) {
                 JSValue nameValue = slot.getValue(exec, propertyName);

Modified: trunk/Source/_javascript_Core/runtime/StringPrototype.cpp (216427 => 216428)


--- trunk/Source/_javascript_Core/runtime/StringPrototype.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/runtime/StringPrototype.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -818,7 +818,8 @@
 
     auto viewWithString = string->viewWithUnderlyingString(*exec);
     StringView view = viewWithString.view;
-    ASSERT(view.length() == 1 && !scope.exception());
+    ASSERT(view.length() == 1);
+    scope.assertNoException();
     UChar character = view[0];
     scope.release();
     if (!(character & ~0xff))

Modified: trunk/Source/_javascript_Core/runtime/TemplateRegistry.cpp (216427 => 216428)


--- trunk/Source/_javascript_Core/runtime/TemplateRegistry.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/runtime/TemplateRegistry.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2015 Yusuke Suzuki <utatane....@gmail.com>.
- * Copyright (C) 2016 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2016-2017 Apple Inc. All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -70,7 +70,7 @@
     }
 
     objectConstructorFreeze(exec, rawObject);
-    ASSERT(!scope.exception());
+    scope.assertNoException();
 
     templateObject->putDirect(vm, vm.propertyNames->raw, rawObject, ReadOnly | DontEnum | DontDelete);
 
@@ -79,7 +79,7 @@
     templateObject->putDirect(vm, vm.propertyNames->builtinNames().templateRegistryKeyPrivateName(), templateKeyObject, ReadOnly | DontEnum | DontDelete);
 
     objectConstructorFreeze(exec, templateObject);
-    ASSERT(!scope.exception());
+    scope.assertNoException();
 
     m_templateMap.set(&templateKey, templateObject);
 

Modified: trunk/Source/_javascript_Core/runtime/VM.cpp (216427 => 216428)


--- trunk/Source/_javascript_Core/runtime/VM.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/runtime/VM.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -614,6 +614,10 @@
     interpreter->notifyDebuggerOfExceptionToBeThrown(*this, exec, exception);
 
     setException(exception);
+
+#if ENABLE(EXCEPTION_SCOPE_VERIFICATION)
+    m_nativeStackTraceOfLastThrow = std::unique_ptr<StackTrace>(StackTrace::captureStackTrace(25));
+#endif
 }
 
 JSValue VM::throwException(ExecState* exec, JSValue thrownValue)

Modified: trunk/Source/_javascript_Core/runtime/VM.h (216427 => 216428)


--- trunk/Source/_javascript_Core/runtime/VM.h	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/runtime/VM.h	2017-05-08 16:56:32 UTC (rev 216428)
@@ -78,6 +78,10 @@
 #include <wtf/ListHashSet.h>
 #endif
 
+#if ENABLE(EXCEPTION_SCOPE_VERIFICATION)
+#include <wtf/StackTrace.h>
+#endif
+
 namespace WTF {
 class SimpleStats;
 } // namespace WTF
@@ -674,6 +678,10 @@
     void notifyNeedTermination() { m_traps.fireTrap(VMTraps::NeedTermination); }
     void notifyNeedWatchdogCheck() { m_traps.fireTrap(VMTraps::NeedWatchdogCheck); }
 
+#if ENABLE(EXCEPTION_SCOPE_VERIFICATION)
+    StackTrace* nativeStackTraceOfLastThrow() const { return m_nativeStackTraceOfLastThrow.get(); }
+#endif
+
 private:
     friend class LLIntOffsetsExtractor;
 
@@ -706,6 +714,7 @@
     {
 #if ENABLE(EXCEPTION_SCOPE_VERIFICATION)
         m_needExceptionCheck = false;
+        m_nativeStackTraceOfLastThrow = nullptr;
 #endif
         m_exception = nullptr;
     }
@@ -752,6 +761,7 @@
     ExceptionEventLocation m_simulatedThrowPointLocation;
     unsigned m_simulatedThrowPointRecursionDepth { 0 };
     mutable bool m_needExceptionCheck { false };
+    std::unique_ptr<StackTrace> m_nativeStackTraceOfLastThrow;
 #endif
 
     bool m_failNextNewCodeBlock { false };

Modified: trunk/Source/_javascript_Core/wasm/WasmB3IRGenerator.cpp (216427 => 216428)


--- trunk/Source/_javascript_Core/wasm/WasmB3IRGenerator.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/wasm/WasmB3IRGenerator.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -504,7 +504,7 @@
         // grow() does not require ExecState* if it doesn't throw exceptions.
         ExecState* exec = nullptr; 
         PageCount result = wasmMemory->grow(vm, exec, static_cast<uint32_t>(delta), shouldThrowExceptionsOnFailure);
-        RELEASE_ASSERT(!scope.exception());
+        scope.releaseAssertNoException();
         if (!result)
             return -1;
 

Modified: trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyInstance.cpp (216427 => 216428)


--- trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyInstance.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyInstance.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -292,7 +292,7 @@
             default:
                 RELEASE_ASSERT_NOT_REACHED();
             }
-            ASSERT(!throwScope.exception());
+            throwScope.assertNoException();
             break;
         }
         }
@@ -330,7 +330,7 @@
                 moduleInformation.tableInformation.initial(), moduleInformation.tableInformation.maximum());
             // We should always be able to allocate a JSWebAssemblyTable we've defined.
             // If it's defined to be too large, we should have thrown a validation error.
-            ASSERT(!throwScope.exception());
+            throwScope.assertNoException();
             ASSERT(table);
             instance->m_table.set(vm, instance, table);
         }

Modified: trunk/Source/WTF/ChangeLog (216427 => 216428)


--- trunk/Source/WTF/ChangeLog	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/WTF/ChangeLog	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,3 +1,18 @@
+2017-05-08  Mark Lam  <mark....@apple.com>
+
+        Introduce ExceptionScope::assertNoException() and releaseAssertNoException().
+        https://bugs.webkit.org/show_bug.cgi?id=171776
+
+        Reviewed by Keith Miller.
+
+        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:
+
 2017-05-05  Yusuke Suzuki  <utatane....@gmail.com>
 
         [WTF] Use memoryFootprint for MemoryUsage retrieval in Linux

Modified: trunk/Source/WTF/wtf/StackTrace.cpp (216427 => 216428)


--- trunk/Source/WTF/wtf/StackTrace.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/WTF/wtf/StackTrace.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -44,17 +44,18 @@
     return sizeof(StackTrace) + (capacity - 1) * sizeof(void*);
 }
 
-StackTrace* StackTrace::captureStackTrace(int maxFrames)
+StackTrace* StackTrace::captureStackTrace(int maxFrames, int framesToSkip)
 {
     maxFrames = std::max(1, maxFrames);
     size_t sizeToAllocate = instanceSize(maxFrames);
     StackTrace* trace = new (NotNull, fastMalloc(sizeToAllocate)) StackTrace();
 
-    static const int framesToSkip = 2;
+    // Skip 2 additional frames i.e. StackTrace::captureStackTrace and WTFGetBacktrace.
+    framesToSkip += 2;
     int numberOfFrames = maxFrames + framesToSkip;
 
     WTFGetBacktrace(&trace->m_skippedFrame0, &numberOfFrames);
-    ASSERT(numberOfFrames > framesToSkip);
+    RELEASE_ASSERT(numberOfFrames >= framesToSkip);
     trace->m_size = numberOfFrames - framesToSkip;
     trace->m_capacity = maxFrames;
 
@@ -80,7 +81,7 @@
     return std::nullopt;
 }
 
-void StackTrace::dump(PrintStream& out) const
+void StackTrace::dump(PrintStream& out, const char* indentString) const
 {
     const auto* stack = this->stack();
 #if HAVE(BACKTRACE_SYMBOLS)
@@ -89,6 +90,8 @@
         return;
 #endif
 
+    if (!indentString)
+        indentString = "";
     for (int i = 0; i < m_size; ++i) {
         const char* mangledName = nullptr;
         const char* cxaDemangled = nullptr;
@@ -103,9 +106,9 @@
 #endif
         const int frameNumber = i + 1;
         if (mangledName || cxaDemangled)
-            out.printf("%-3d %p %s\n", frameNumber, stack[i], cxaDemangled ? cxaDemangled : mangledName);
+            out.printf("%s%-3d %p %s\n", indentString, frameNumber, stack[i], cxaDemangled ? cxaDemangled : mangledName);
         else
-            out.printf("%-3d %p\n", frameNumber, stack[i]);
+            out.printf("%s%-3d %p\n", indentString, frameNumber, stack[i]);
     }
 
 #if HAVE(BACKTRACE_SYMBOLS)

Modified: trunk/Source/WTF/wtf/StackTrace.h (216427 => 216428)


--- trunk/Source/WTF/wtf/StackTrace.h	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/WTF/wtf/StackTrace.h	2017-05-08 16:56:32 UTC (rev 216428)
@@ -36,7 +36,7 @@
 class StackTrace {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static StackTrace* captureStackTrace(int maxFrames);
+    static StackTrace* captureStackTrace(int maxFrames, int framesToSkip = 0);
 
     // Borrowed stack trace.
     StackTrace(void** stack, int size)
@@ -71,7 +71,7 @@
 
     WTF_EXPORT_PRIVATE static std::optional<DemangleEntry> demangle(void*);
 
-    WTF_EXPORT_PRIVATE void dump(PrintStream&) const;
+    WTF_EXPORT_PRIVATE void dump(PrintStream&, const char* indentString = nullptr) const;
 
 private:
     inline static size_t instanceSize(int capacity);

Modified: trunk/Source/WebCore/ChangeLog (216427 => 216428)


--- trunk/Source/WebCore/ChangeLog	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/WebCore/ChangeLog	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,3 +1,67 @@
+2017-05-08  Mark Lam  <mark....@apple.com>
+
+        Introduce ExceptionScope::assertNoException() and releaseAssertNoException().
+        https://bugs.webkit.org/show_bug.cgi?id=171776
+
+        Reviewed by Keith Miller.
+
+        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):
+
 2017-05-08  Chris Dumez  <cdu...@apple.com>
 
         Move 'style' from Element to HTMLElement / SVGElement and make it settable

Modified: trunk/Source/WebCore/Modules/plugins/QuickTimePluginReplacement.mm (216427 => 216428)


--- trunk/Source/WebCore/Modules/plugins/QuickTimePluginReplacement.mm	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/WebCore/Modules/plugins/QuickTimePluginReplacement.mm	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013-2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -200,7 +200,7 @@
     if (replacementFunction.isUndefinedOrNull())
         return false;
     JSC::JSObject* replacementObject = replacementFunction.toObject(exec);
-    ASSERT(!scope.exception());
+    scope.assertNoException();
     JSC::CallData callData;
     JSC::CallType callType = replacementObject->methodTable()->getCallData(replacementObject, callData);
     if (callType == JSC::CallType::None)
@@ -233,7 +233,7 @@
     value = replacement.get(exec, JSC::Identifier::fromString(exec, "scriptObject"));
     if (!scope.exception() && !value.isUndefinedOrNull()) {
         m_scriptObject = value.toObject(exec);
-        ASSERT(!scope.exception());
+        scope.assertNoException();
     }
 
     if (!m_scriptObject) {

Modified: trunk/Source/WebCore/bindings/js/JSCryptoKeySerializationJWK.cpp (216427 => 216428)


--- trunk/Source/WebCore/bindings/js/JSCryptoKeySerializationJWK.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/WebCore/bindings/js/JSCryptoKeySerializationJWK.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013, 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -62,7 +62,7 @@
         return false;
 
     JSValue value = slot.getValue(exec, identifier);
-    ASSERT(!scope.exception());
+    scope.assertNoException();
     if (!isJSArray(value)) {
         throwTypeError(exec, scope, String::format("Expected an array for \"%s\" JSON key",  key));
         return false;
@@ -85,7 +85,7 @@
         return false;
 
     JSValue jsValue = slot.getValue(exec, identifier);
-    ASSERT(!scope.exception());
+    scope.assertNoException();
     if (!jsValue.getString(exec, result)) {
         // Can get an out of memory exception.
         RETURN_IF_EXCEPTION(scope, false);
@@ -108,7 +108,7 @@
         return false;
 
     JSValue jsValue = slot.getValue(exec, identifier);
-    ASSERT(!scope.exception());
+    scope.assertNoException();
     if (!jsValue.isBoolean()) {
         throwTypeError(exec, scope, String::format("Expected a boolean value for \"%s\" JSON key",  key));
         return false;

Modified: trunk/Source/WebCore/bindings/js/JSCustomElementRegistryCustom.cpp (216427 => 216428)


--- trunk/Source/WebCore/bindings/js/JSCustomElementRegistryCustom.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/WebCore/bindings/js/JSCustomElementRegistryCustom.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015, 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -206,7 +206,7 @@
 
     if (UNLIKELY(scope.exception())) {
         rejectPromiseWithExceptionIfAny(state, *globalObject(), *promiseDeferred);
-        ASSERT(!scope.exception());
+        scope.assertNoException();
         return promiseDeferred->promise();
     }
 

Modified: trunk/Source/WebCore/bindings/js/JSDOMExceptionHandling.cpp (216427 => 216428)


--- trunk/Source/WebCore/bindings/js/JSDOMExceptionHandling.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/WebCore/bindings/js/JSDOMExceptionHandling.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,6 +1,6 @@
 /*
  *  Copyright (C) 1999-2001 Harri Porten (por...@kde.org)
- *  Copyright (C) 2004-2011, 2013, 2016 Apple Inc. All rights reserved.
+ *  Copyright (C) 2004-2017 Apple Inc. All rights reserved.
  *  Copyright (C) 2007 Samuel Weinig <s...@webkit.org>
  *  Copyright (C) 2013 Michael Pruett <mich...@68k.org>
  *
@@ -205,7 +205,7 @@
 
 void propagateExceptionSlowPath(JSC::ExecState& state, JSC::ThrowScope& throwScope, Exception&& exception)
 {
-    ASSERT(!throwScope.exception());
+    throwScope.assertNoException();
     throwException(&state, throwScope, createDOMException(state, WTFMove(exception)));
 }
     
@@ -248,13 +248,13 @@
 
 void throwNotSupportedError(JSC::ExecState& state, JSC::ThrowScope& scope)
 {
-    ASSERT(!scope.exception());
+    scope.assertNoException();
     throwException(&state, scope, createDOMException(&state, NOT_SUPPORTED_ERR));
 }
 
 void throwNotSupportedError(JSC::ExecState& state, JSC::ThrowScope& scope, const char* message)
 {
-    ASSERT(!scope.exception());
+    scope.assertNoException();
     String messageString(message);
     throwException(&state, scope, createDOMException(&state, NOT_SUPPORTED_ERR, &messageString));
 }
@@ -261,7 +261,7 @@
 
 void throwInvalidStateError(JSC::ExecState& state, JSC::ThrowScope& scope, const char* message)
 {
-    ASSERT(!scope.exception());
+    scope.assertNoException();
     String messageString(message);
     throwException(&state, scope, createDOMException(&state, INVALID_STATE_ERR, &messageString));
 }
@@ -268,7 +268,7 @@
 
 void throwSecurityError(JSC::ExecState& state, JSC::ThrowScope& scope, const String& message)
 {
-    ASSERT(!scope.exception());
+    scope.assertNoException();
     throwException(&state, scope, createDOMException(&state, SECURITY_ERR, message));
 }
 
@@ -379,25 +379,25 @@
 
 void throwDOMSyntaxError(JSC::ExecState& state, JSC::ThrowScope& scope)
 {
-    ASSERT(!scope.exception());
+    scope.assertNoException();
     throwException(&state, scope, createDOMException(&state, SYNTAX_ERR));
 }
 
 void throwDataCloneError(JSC::ExecState& state, JSC::ThrowScope& scope)
 {
-    ASSERT(!scope.exception());
+    scope.assertNoException();
     throwException(&state, scope, createDOMException(&state, DATA_CLONE_ERR));
 }
 
 void throwIndexSizeError(JSC::ExecState& state, JSC::ThrowScope& scope)
 {
-    ASSERT(!scope.exception());
+    scope.assertNoException();
     throwException(&state, scope, createDOMException(&state, INDEX_SIZE_ERR));
 }
 
 void throwTypeMismatchError(JSC::ExecState& state, JSC::ThrowScope& scope)
 {
-    ASSERT(!scope.exception());
+    scope.assertNoException();
     throwException(&state, scope, createDOMException(&state, TYPE_MISMATCH_ERR));
 }
 

Modified: trunk/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp (216427 => 216428)


--- trunk/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008, 2009 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2008-2017 Apple Inc. All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -81,9 +81,9 @@
     auto scope = DECLARE_CATCH_SCOPE(vm);
 
     auto interfaceName = execState->uncheckedArgument(0).getString(execState);
-    ASSERT_UNUSED(scope, !scope.exception());
+    scope.assertNoException();
     auto functionName = execState->uncheckedArgument(1).getString(execState);
-    ASSERT(!scope.exception());
+    scope.assertNoException();
     return JSValue::encode(createTypeError(execState, makeThisTypeErrorMessage(interfaceName.utf8().data(), functionName.utf8().data())));
 }
 
@@ -95,9 +95,9 @@
     auto scope = DECLARE_CATCH_SCOPE(vm);
 
     auto interfaceName = execState->uncheckedArgument(0).getString(execState);
-    ASSERT_UNUSED(scope, !scope.exception());
+    scope.assertNoException();
     auto attributeName = execState->uncheckedArgument(1).getString(execState);
-    ASSERT(!scope.exception());
+    scope.assertNoException();
     return JSValue::encode(createTypeError(execState, makeGetterTypeErrorMessage(interfaceName.utf8().data(), attributeName.utf8().data())));
 }
 

Modified: trunk/Source/WebCore/bindings/js/JSDOMGlobalObjectTask.cpp (216427 => 216428)


--- trunk/Source/WebCore/bindings/js/JSDOMGlobalObjectTask.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/WebCore/bindings/js/JSDOMGlobalObjectTask.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -66,7 +66,7 @@
             JSMainThreadExecState::runTask(exec, m_task);
         else
             m_task->run(exec);
-        ASSERT_UNUSED(scope, !scope.exception());
+        scope.assertNoException();
     }
 
 private:

Modified: trunk/Source/WebCore/bindings/js/JSDOMPromise.h (216427 => 216428)


--- trunk/Source/WebCore/bindings/js/JSDOMPromise.h	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/WebCore/bindings/js/JSDOMPromise.h	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -235,7 +235,7 @@
     promiseFunction(state, DeferredPromise::create(globalObject, *promiseDeferred));
 
     rejectPromiseWithExceptionIfAny(state, globalObject, *promiseDeferred);
-    ASSERT_UNUSED(scope, !scope.exception());
+    scope.assertNoException();
     return promiseDeferred->promise();
 }
 

Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp (216427 => 216428)


--- trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,7 +1,7 @@
 /*
  *  Copyright (C) 2000 Harri Porten (por...@kde.org)
  *  Copyright (C) 2006 Jon Shier (jsh...@iastate.edu)
- *  Copyright (C) 2003-2009, 2014, 2016 Apple Inc. All rights reseved.
+ *  Copyright (C) 2003-2017 Apple Inc. All rights reseved.
  *  Copyright (C) 2006 Alexey Proskuryakov (a...@webkit.org)
  *  Copyright (c) 2015 Canon Inc. All rights reserved.
  *
@@ -216,7 +216,7 @@
 
         JSMainThreadExecState::runTask(exec, m_task);
 
-        ASSERT_UNUSED(scope, !scope.exception());
+        scope.assertNoException();
     }
 
 private:

Modified: trunk/Source/WebCore/bindings/js/JSMainThreadExecState.h (216427 => 216428)


--- trunk/Source/WebCore/bindings/js/JSMainThreadExecState.h	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/WebCore/bindings/js/JSMainThreadExecState.h	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2010 Google Inc. All rights reserved.
- * Copyright (C) 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -133,7 +133,7 @@
         JSC::VM& vm = s_mainThreadState->vm();
         auto scope = DECLARE_CATCH_SCOPE(vm);
         ASSERT(isMainThread());
-        ASSERT_UNUSED(scope, !scope.exception());
+        scope.assertNoException();
 
         JSC::ExecState* state = s_mainThreadState;
         bool didExitJavaScript = s_mainThreadState && !m_previousState;

Modified: trunk/Source/WebCore/bindings/js/ReadableStreamDefaultController.cpp (216427 => 216428)


--- trunk/Source/WebCore/bindings/js/ReadableStreamDefaultController.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/WebCore/bindings/js/ReadableStreamDefaultController.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2016 Canon Inc.
- * Copyright (C) 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted, provided that the following conditions
@@ -78,7 +78,7 @@
 
     auto& clientData = *static_cast<JSVMClientData*>(vm.clientData);
     auto readableStream = m_jsController->get(&state, clientData.builtinNames().controlledReadableStreamPrivateName());
-    ASSERT_UNUSED(scope, !scope.exception());
+    scope.assertNoException();
 
     auto* isLocked = globalObject.builtinInternalFunctions().readableStreamInternals().m_isReadableStreamLockedFunction.get();
     ASSERT(isLocked);
@@ -86,7 +86,7 @@
     JSC::MarkedArgumentBuffer arguments;
     arguments.append(readableStream);
     auto result = callFunction(state, isLocked, JSC::jsUndefined(), arguments);
-    ASSERT(!scope.exception());
+    scope.assertNoException();
 
     return result.isTrue();
 }

Modified: trunk/Source/WebCore/bindings/js/ReadableStreamDefaultController.h (216427 => 216428)


--- trunk/Source/WebCore/bindings/js/ReadableStreamDefaultController.h	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/WebCore/bindings/js/ReadableStreamDefaultController.h	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2016 Canon Inc.
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted, provided that the following conditions
@@ -102,7 +103,7 @@
     auto chunk = JSC::Uint8Array::create(WTFMove(buffer), 0, length);
     ASSERT(chunk);
     enqueue(state, toJS(&state, &globalObject, chunk.get()));
-    ASSERT_UNUSED(scope, !scope.exception());
+    scope.assertNoException();
     return true;
 }
 

Modified: trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp (216427 => 216428)


--- trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009, 2013, 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2009-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -2542,7 +2542,7 @@
             // Since we are cloning a JSWebAssemblyModule, it's impossible for that
             // module to not have been a valid module. Therefore, createStub should
             // not trow.
-            RELEASE_ASSERT(!scope.exception());
+            scope.releaseAssertNoException();
             m_gcBuffer.append(result);
             return result;
         }

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (216427 => 216428)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2017-05-08 16:56:32 UTC (rev 216428)
@@ -4552,7 +4552,7 @@
         my $name = $attribute->name;
         my $getFunctionName = GetAttributeGetterName($interface, $className, $attribute);
         push(@implContent, "    auto ${name}Value = ${getFunctionName}Getter(*state, *thisObject, throwScope);\n");
-        push(@implContent, "    ASSERT(!throwScope.exception());\n");
+        push(@implContent, "    throwScope.assertNoException();\n");
         push(@implContent, "    result->putDirect(vm, Identifier::fromString(&vm, \"${name}\"), ${name}Value);\n");
         push(@implContent, "\n");
     }

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp (216427 => 216428)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -343,7 +343,7 @@
     auto* result = constructEmptyObject(state);
 
     auto nameValue = jsTestNodeNameGetter(*state, *thisObject, throwScope);
-    ASSERT(!throwScope.exception());
+    throwScope.assertNoException();
     result->putDirect(vm, Identifier::fromString(&vm, "name"), nameValue);
 
     return result;

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (216427 => 216428)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -8784,19 +8784,19 @@
     auto* result = constructEmptyObject(state);
 
     auto createValue = jsTestObjCreateGetter(*state, *thisObject, throwScope);
-    ASSERT(!throwScope.exception());
+    throwScope.assertNoException();
     result->putDirect(vm, Identifier::fromString(&vm, "create"), createValue);
 
     auto readOnlyStringAttrValue = jsTestObjReadOnlyStringAttrGetter(*state, *thisObject, throwScope);
-    ASSERT(!throwScope.exception());
+    throwScope.assertNoException();
     result->putDirect(vm, Identifier::fromString(&vm, "readOnlyStringAttr"), readOnlyStringAttrValue);
 
     auto enumAttrValue = jsTestObjEnumAttrGetter(*state, *thisObject, throwScope);
-    ASSERT(!throwScope.exception());
+    throwScope.assertNoException();
     result->putDirect(vm, Identifier::fromString(&vm, "enumAttr"), enumAttrValue);
 
     auto longAttrValue = jsTestObjLongAttrGetter(*state, *thisObject, throwScope);
-    ASSERT(!throwScope.exception());
+    throwScope.assertNoException();
     result->putDirect(vm, Identifier::fromString(&vm, "longAttr"), longAttrValue);
 
     return result;

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerialization.cpp (216427 => 216428)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerialization.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerialization.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -406,23 +406,23 @@
     auto* result = constructEmptyObject(state);
 
     auto firstStringAttributeValue = jsTestSerializationFirstStringAttributeGetter(*state, *thisObject, throwScope);
-    ASSERT(!throwScope.exception());
+    throwScope.assertNoException();
     result->putDirect(vm, Identifier::fromString(&vm, "firstStringAttribute"), firstStringAttributeValue);
 
     auto secondLongAttributeValue = jsTestSerializationSecondLongAttributeGetter(*state, *thisObject, throwScope);
-    ASSERT(!throwScope.exception());
+    throwScope.assertNoException();
     result->putDirect(vm, Identifier::fromString(&vm, "secondLongAttribute"), secondLongAttributeValue);
 
     auto fourthUnrestrictedDoubleAttributeValue = jsTestSerializationFourthUnrestrictedDoubleAttributeGetter(*state, *thisObject, throwScope);
-    ASSERT(!throwScope.exception());
+    throwScope.assertNoException();
     result->putDirect(vm, Identifier::fromString(&vm, "fourthUnrestrictedDoubleAttribute"), fourthUnrestrictedDoubleAttributeValue);
 
     auto fifthLongAttributeValue = jsTestSerializationFifthLongAttributeGetter(*state, *thisObject, throwScope);
-    ASSERT(!throwScope.exception());
+    throwScope.assertNoException();
     result->putDirect(vm, Identifier::fromString(&vm, "fifthLongAttribute"), fifthLongAttributeValue);
 
     auto sixthTypedefAttributeValue = jsTestSerializationSixthTypedefAttributeGetter(*state, *thisObject, throwScope);
-    ASSERT(!throwScope.exception());
+    throwScope.assertNoException();
     result->putDirect(vm, Identifier::fromString(&vm, "sixthTypedefAttribute"), sixthTypedefAttributeValue);
 
     return result;

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInherit.cpp (216427 => 216428)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInherit.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInherit.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -207,7 +207,7 @@
     auto* result = JSTestSerialization::serialize(state, thisObject, throwScope);
 
     auto inheritLongAttributeValue = jsTestSerializationInheritInheritLongAttributeGetter(*state, *thisObject, throwScope);
-    ASSERT(!throwScope.exception());
+    throwScope.assertNoException();
     result->putDirect(vm, Identifier::fromString(&vm, "inheritLongAttribute"), inheritLongAttributeValue);
 
     return result;

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp (216427 => 216428)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -245,7 +245,7 @@
     auto* result = JSTestSerializationInherit::serialize(state, thisObject, throwScope);
 
     auto finalLongAttributeBarValue = jsTestSerializationInheritFinalFinalLongAttributeBarGetter(*state, *thisObject, throwScope);
-    ASSERT(!throwScope.exception());
+    throwScope.assertNoException();
     result->putDirect(vm, Identifier::fromString(&vm, "finalLongAttributeBar"), finalLongAttributeBarValue);
 
     return result;

Modified: trunk/Source/WebCore/contentextensions/ContentExtensionParser.cpp (216427 => 216428)


--- trunk/Source/WebCore/contentextensions/ContentExtensionParser.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionParser.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -106,7 +106,7 @@
         return { };
 
     const JSObject* object = typeValue.toObject(&exec);
-    ASSERT(!scope.exception());
+    scope.assertNoException();
     if (!isJSArray(object))
         return ContentExtensionError::JSONInvalidTriggerFlagsArray;
 

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (216427 => 216428)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -6810,7 +6810,7 @@
     argList.append(mediaControlsHostJSWrapper);
 
     JSC::JSObject* function = functionValue.toObject(exec);
-    ASSERT(!scope.exception());
+    scope.assertNoException();
     JSC::CallData callData;
     JSC::CallType callType = function->methodTable()->getCallData(function, callData);
     if (callType == JSC::CallType::None)
@@ -6824,7 +6824,7 @@
 
     // Connect the Media, MediaControllerHost, and Controller so the GC knows about their relationship
     JSC::JSObject* mediaJSWrapperObject = mediaJSWrapper.toObject(exec);
-    ASSERT(!scope.exception());
+    scope.assertNoException();
     JSC::Identifier controlsHost = JSC::Identifier::fromString(&exec->vm(), "controlsHost");
     
     ASSERT(!mediaJSWrapperObject->hasProperty(exec, controlsHost));
@@ -6894,7 +6894,7 @@
         return;
 
     JSC::JSObject* function = functionValue.toObject(exec);
-    ASSERT(!scope.exception());
+    scope.assertNoException();
     JSC::CallData callData;
     JSC::CallType callType = function->methodTable()->getCallData(function, callData);
     if (callType == JSC::CallType::None)
@@ -6936,7 +6936,7 @@
         return emptyString();
 
     JSC::JSObject* function = functionValue.toObject(exec);
-    ASSERT(!scope.exception());
+    scope.assertNoException();
     JSC::CallData callData;
     JSC::CallType callType = function->methodTable()->getCallData(function, callData);
     JSC::MarkedArgumentBuffer argList;

Modified: trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp (216427 => 216428)


--- trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp	2017-05-08 16:55:31 UTC (rev 216427)
+++ trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp	2017-05-08 16:56:32 UTC (rev 216428)
@@ -366,8 +366,8 @@
 
     // It is expected the JS file provides a createOverlay(shadowRoot, title, subtitle) function.
     auto* overlay = globalObject.get(&state, JSC::Identifier::fromString(&state, "createOverlay")).toObject(&state);
+    ASSERT(!overlay == !!scope.exception());
     if (!overlay) {
-        ASSERT(scope.exception());
         scope.clearException();
         return;
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to