Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (208951 => 208952)
--- trunk/Source/_javascript_Core/ChangeLog 2016-11-21 20:32:42 UTC (rev 208951)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-11-21 23:24:18 UTC (rev 208952)
@@ -1,5 +1,20 @@
2016-11-21 Mark Lam <[email protected]>
+ Fix exception scope verification failures in runtime/Error* files.
+ https://bugs.webkit.org/show_bug.cgi?id=164998
+
+ Reviewed by Darin Adler.
+
+ * runtime/ErrorConstructor.cpp:
+ (JSC::Interpreter::constructWithErrorConstructor):
+ * runtime/ErrorInstance.cpp:
+ (JSC::ErrorInstance::create):
+ * runtime/ErrorInstance.h:
+ * runtime/ErrorPrototype.cpp:
+ (JSC::errorProtoFuncToString):
+
+2016-11-21 Mark Lam <[email protected]>
+
Fix exception scope verification failures in *Executable.cpp files.
https://bugs.webkit.org/show_bug.cgi?id=164996
Modified: trunk/Source/_javascript_Core/runtime/ErrorConstructor.cpp (208951 => 208952)
--- trunk/Source/_javascript_Core/runtime/ErrorConstructor.cpp 2016-11-21 20:32:42 UTC (rev 208951)
+++ trunk/Source/_javascript_Core/runtime/ErrorConstructor.cpp 2016-11-21 23:24:18 UTC (rev 208952)
@@ -55,6 +55,7 @@
JSValue message = exec->argument(0);
Structure* errorStructure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), asInternalFunction(exec->callee())->globalObject()->errorStructure());
RETURN_IF_EXCEPTION(scope, encodedJSValue());
+ scope.release();
return JSValue::encode(ErrorInstance::create(exec, errorStructure, message, nullptr, TypeNothing, false));
}
Modified: trunk/Source/_javascript_Core/runtime/ErrorInstance.cpp (208951 => 208952)
--- trunk/Source/_javascript_Core/runtime/ErrorInstance.cpp 2016-11-21 20:32:42 UTC (rev 208951)
+++ trunk/Source/_javascript_Core/runtime/ErrorInstance.cpp 2016-11-21 23:24:18 UTC (rev 208952)
@@ -39,6 +39,15 @@
{
}
+ErrorInstance* ErrorInstance::create(ExecState* state, Structure* structure, JSValue message, SourceAppender appender, RuntimeType type, bool useCurrentFrame)
+{
+ VM& vm = state->vm();
+ auto scope = DECLARE_THROW_SCOPE(vm);
+ String messageString = message.isUndefined() ? String() : message.toWTFString(state);
+ RETURN_IF_EXCEPTION(scope, nullptr);
+ return create(state, vm, structure, messageString, appender, type, useCurrentFrame);
+}
+
static void appendSourceToError(CallFrame* callFrame, ErrorInstance* exception, unsigned bytecodeOffset)
{
ErrorInstance::SourceAppender appender = exception->sourceAppender();
Modified: trunk/Source/_javascript_Core/runtime/ErrorInstance.h (208951 => 208952)
--- trunk/Source/_javascript_Core/runtime/ErrorInstance.h 2016-11-21 20:32:42 UTC (rev 208951)
+++ trunk/Source/_javascript_Core/runtime/ErrorInstance.h 2016-11-21 23:24:18 UTC (rev 208952)
@@ -49,10 +49,7 @@
return instance;
}
- static ErrorInstance* create(ExecState* exec, Structure* structure, JSValue message, SourceAppender appender = nullptr, RuntimeType type = TypeNothing, bool useCurrentFrame = true)
- {
- return create(exec, exec->vm(), structure, message.isUndefined() ? String() : message.toString(exec)->value(exec), appender, type, useCurrentFrame);
- }
+ static ErrorInstance* create(ExecState*, Structure*, JSValue message, SourceAppender = nullptr, RuntimeType = TypeNothing, bool useCurrentFrame = true);
static void addErrorInfo(ExecState*, VM&, JSObject*, bool = true);
Modified: trunk/Source/_javascript_Core/runtime/ErrorPrototype.cpp (208951 => 208952)
--- trunk/Source/_javascript_Core/runtime/ErrorPrototype.cpp 2016-11-21 20:32:42 UTC (rev 208951)
+++ trunk/Source/_javascript_Core/runtime/ErrorPrototype.cpp 2016-11-21 23:24:18 UTC (rev 208952)
@@ -80,6 +80,7 @@
// Guard against recursion!
StringRecursionChecker checker(exec, thisObj);
+ ASSERT(!scope.exception() || checker.earlyReturnValue());
if (JSValue earlyReturnValue = checker.earlyReturnValue())
return JSValue::encode(earlyReturnValue);