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}
This commit is contained in:
parent
aee1824adb
commit
8758245a62
@ -680,14 +680,16 @@ void Accessors::ScriptEvalFromFunctionNameGetter(
|
|||||||
Handle<Object> object = Utils::OpenHandle(*info.This());
|
Handle<Object> object = Utils::OpenHandle(*info.This());
|
||||||
Handle<Script> script(
|
Handle<Script> script(
|
||||||
Script::cast(Handle<JSValue>::cast(object)->value()), isolate);
|
Script::cast(Handle<JSValue>::cast(object)->value()), isolate);
|
||||||
Handle<Object> result;
|
Handle<Object> result = isolate->factory()->undefined_value();
|
||||||
Handle<SharedFunctionInfo> shared(
|
if (!script->eval_from_shared()->IsUndefined()) {
|
||||||
SharedFunctionInfo::cast(script->eval_from_shared()));
|
Handle<SharedFunctionInfo> shared(
|
||||||
// Find the name of the function calling eval.
|
SharedFunctionInfo::cast(script->eval_from_shared()));
|
||||||
if (!shared->name()->IsUndefined()) {
|
// Find the name of the function calling eval.
|
||||||
result = Handle<Object>(shared->name(), isolate);
|
if (!shared->name()->IsUndefined()) {
|
||||||
} else {
|
result = Handle<Object>(shared->name(), isolate);
|
||||||
result = Handle<Object>(shared->inferred_name(), isolate);
|
} else {
|
||||||
|
result = Handle<Object>(shared->inferred_name(), isolate);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
info.GetReturnValue().Set(Utils::ToLocal(result));
|
info.GetReturnValue().Set(Utils::ToLocal(result));
|
||||||
}
|
}
|
||||||
|
13
test/mjsunit/regress/regress-crbug-610207.js
Normal file
13
test/mjsunit/regress/regress-crbug-610207.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// 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);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user