Commit b48b04ed authored by jgruber's avatar jgruber Committed by Commit bot

Handle missing scripts in CallSite.GetEvalOrigin

BUG=630950,631909

Review-Url: https://codereview.chromium.org/2184193004
Cr-Commit-Position: refs/heads/master@{#38133}
parent 7f1fa30e
......@@ -219,6 +219,10 @@ BUILTIN(CallSitePrototypeGetEvalOrigin) {
Handle<JSFunction> function = Handle<JSFunction>::cast(function_obj);
Handle<Object> script = handle(function->shared()->script(), isolate);
if (!script->IsScript()) {
return *isolate->factory()->undefined_value();
}
RETURN_RESULT_OR_FAILURE(
isolate, FormatEvalOrigin(isolate, Handle<Script>::cast(script)));
}
......
......@@ -400,3 +400,14 @@ assertThrows(() => Error.captureStackTrace(x));
var o = {};
Error.stackTraceLimit = "not a number";
Error.captureStackTrace(o);
// Check that we don't crash when a callsite's function's script is empty.
Error.prepareStackTrace = function(e, frames) {
assertEquals(undefined, frames[0].getEvalOrigin());
}
try {
DataView();
assertUnreachable();
} catch (e) {
assertEquals(undefined, e.stack);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment