Commit 8758245a authored by ishell's avatar ishell Committed by Commit bot

Don't crash when load eval origin of a call site.

BUG=chromium:610207
LOG=N

Review-Url: https://codereview.chromium.org/1958043002
Cr-Commit-Position: refs/heads/master@{#36101}
parent aee1824a
......@@ -680,14 +680,16 @@ void Accessors::ScriptEvalFromFunctionNameGetter(
Handle<Object> object = Utils::OpenHandle(*info.This());
Handle<Script> script(
Script::cast(Handle<JSValue>::cast(object)->value()), isolate);
Handle<Object> result;
Handle<SharedFunctionInfo> shared(
SharedFunctionInfo::cast(script->eval_from_shared()));
// Find the name of the function calling eval.
if (!shared->name()->IsUndefined()) {
result = Handle<Object>(shared->name(), isolate);
} else {
result = Handle<Object>(shared->inferred_name(), isolate);
Handle<Object> result = isolate->factory()->undefined_value();
if (!script->eval_from_shared()->IsUndefined()) {
Handle<SharedFunctionInfo> shared(
SharedFunctionInfo::cast(script->eval_from_shared()));
// Find the name of the function calling eval.
if (!shared->name()->IsUndefined()) {
result = Handle<Object>(shared->name(), isolate);
} else {
result = Handle<Object>(shared->inferred_name(), isolate);
}
}
info.GetReturnValue().Set(Utils::ToLocal(result));
}
......
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
Error.prepareStackTrace = function(exception, frames) {
return frames[0].getEvalOrigin();
}
try {
Realm.eval(0, "throw new Error('boom');");
} catch(e) {
print(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