Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (200647 => 200648)
--- trunk/Source/_javascript_Core/ChangeLog 2016-05-10 22:08:56 UTC (rev 200647)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-05-10 23:11:52 UTC (rev 200648)
@@ -1,3 +1,24 @@
+2016-05-10 Joseph Pecoraro <[email protected]>
+
+ Make the different evaluateWithScopeExtension implementations more consistent
+ https://bugs.webkit.org/show_bug.cgi?id=157536
+
+ Reviewed by Timothy Hatcher.
+
+ * inspector/JSInjectedScriptHost.cpp:
+ (Inspector::JSInjectedScriptHost::evaluateWithScopeExtension):
+ Throw the exception consistent with JSJavaScriptCallFrame.
+
+ * inspector/JSJavaScriptCallFrame.cpp:
+ (Inspector::JSJavaScriptCallFrame::evaluateWithScopeExtension):
+ Better error message consistent with InjectedScriptHost.
+
+ * runtime/Completion.h:
+ * runtime/Completion.cpp:
+ (JSC::evaluateWithScopeExtension):
+ Give this an Exception out parameter like other evaluations
+ so the caller can decide what to do with it.
+
2016-05-10 Benjamin Poulain <[email protected]>
[JSC] FTL can produce GetByVal nodes without proper bounds checking
Modified: trunk/Source/_javascript_Core/inspector/JSInjectedScriptHost.cpp (200647 => 200648)
--- trunk/Source/_javascript_Core/inspector/JSInjectedScriptHost.cpp 2016-05-10 22:08:56 UTC (rev 200647)
+++ trunk/Source/_javascript_Core/inspector/JSInjectedScriptHost.cpp 2016-05-10 23:11:52 UTC (rev 200648)
@@ -104,8 +104,13 @@
if (exec->hadException())
return jsUndefined();
+ NakedPtr<Exception> exception;
JSObject* scopeExtension = exec->argument(1).getObject();
- return JSC::evaluateWithScopeExtension(exec, makeSource(program), scopeExtension);
+ JSValue result = JSC::evaluateWithScopeExtension(exec, makeSource(program), scopeExtension, exception);
+ if (exception)
+ exec->vm().throwException(exec, exception);
+
+ return result;
}
JSValue JSInjectedScriptHost::internalConstructorName(ExecState* exec)
Modified: trunk/Source/_javascript_Core/inspector/JSJavaScriptCallFrame.cpp (200647 => 200648)
--- trunk/Source/_javascript_Core/inspector/JSJavaScriptCallFrame.cpp 2016-05-10 22:08:56 UTC (rev 200647)
+++ trunk/Source/_javascript_Core/inspector/JSJavaScriptCallFrame.cpp 2016-05-10 23:11:52 UTC (rev 200648)
@@ -75,7 +75,11 @@
JSValue JSJavaScriptCallFrame::evaluateWithScopeExtension(ExecState* exec)
{
- String script = exec->argument(0).toString(exec)->value(exec);
+ JSValue scriptValue = exec->argument(0);
+ if (!scriptValue.isString())
+ return throwTypeError(exec, "JSJavaScriptCallFrame.evaluateWithScopeExtension first argument must be a string.");
+
+ String script = scriptValue.toString(exec)->value(exec);
if (exec->hadException())
return jsUndefined();
Modified: trunk/Source/_javascript_Core/runtime/Completion.cpp (200647 => 200648)
--- trunk/Source/_javascript_Core/runtime/Completion.cpp 2016-05-10 22:08:56 UTC (rev 200647)
+++ trunk/Source/_javascript_Core/runtime/Completion.cpp 2016-05-10 23:11:52 UTC (rev 200648)
@@ -122,7 +122,7 @@
return evaluate(exec, source, thisValue, returnedException);
}
-JSValue evaluateWithScopeExtension(ExecState* exec, const SourceCode& source, JSObject* scopeExtensionObject)
+JSValue evaluateWithScopeExtension(ExecState* exec, const SourceCode& source, JSObject* scopeExtensionObject, NakedPtr<Exception>& returnedException)
{
JSGlobalObject* globalObject = exec->vmEntryGlobalObject();
@@ -131,13 +131,8 @@
globalObject->setGlobalScopeExtension(JSWithScope::create(exec->vm(), globalObject, scopeExtensionObject, ignoredPreviousScope));
}
- NakedPtr<Exception> exception;
- JSValue returnValue = JSC::evaluate(globalObject->globalExec(), source, globalObject, exception);
+ JSValue returnValue = JSC::evaluate(globalObject->globalExec(), source, globalObject, returnedException);
- // Don't swallow the exception.
- if (exception)
- globalObject->vm().restorePreviousException(exception);
-
if (scopeExtensionObject)
globalObject->clearGlobalScopeExtension();
Modified: trunk/Source/_javascript_Core/runtime/Completion.h (200647 => 200648)
--- trunk/Source/_javascript_Core/runtime/Completion.h 2016-05-10 22:08:56 UTC (rev 200647)
+++ trunk/Source/_javascript_Core/runtime/Completion.h 2016-05-10 23:11:52 UTC (rev 200648)
@@ -55,7 +55,7 @@
return profiledEvaluate(exec, reason, sourceCode, thisValue, unused);
}
-JS_EXPORT_PRIVATE JSValue evaluateWithScopeExtension(ExecState*, const SourceCode&, JSObject* scopeExtension);
+JS_EXPORT_PRIVATE JSValue evaluateWithScopeExtension(ExecState*, const SourceCode&, JSObject* scopeExtension, NakedPtr<Exception>& returnedException);
// Load the module source and evaluate it.
JS_EXPORT_PRIVATE JSInternalPromise* loadAndEvaluateModule(ExecState*, const String& moduleName);