Do not include Error.captureStackTrace in the trace
BUG=v8:5342 Review-Url: https://codereview.chromium.org/2307783002 Cr-Commit-Position: refs/heads/master@{#39124}
This commit is contained in:
parent
3d617c1661
commit
64c518d06d
@ -44,7 +44,7 @@ BUILTIN(ErrorCaptureStackTrace) {
|
||||
}
|
||||
Handle<JSObject> object = Handle<JSObject>::cast(object_obj);
|
||||
Handle<Object> caller = args.atOrUndefined(isolate, 2);
|
||||
FrameSkipMode mode = caller->IsJSFunction() ? SKIP_UNTIL_SEEN : SKIP_NONE;
|
||||
FrameSkipMode mode = caller->IsJSFunction() ? SKIP_UNTIL_SEEN : SKIP_FIRST;
|
||||
|
||||
// Collect the stack trace.
|
||||
|
||||
|
@ -324,17 +324,8 @@ class StackTraceHelper {
|
||||
mode_(mode),
|
||||
caller_(caller),
|
||||
skip_next_frame_(true) {
|
||||
// The caller parameter can be used to skip a specific set of frames in the
|
||||
// stack trace. It can be:
|
||||
// * null, when called from a standard error constructor. We unconditionally
|
||||
// skip the top frame, which is always a builtin-exit frame for the error
|
||||
// constructor builtin.
|
||||
// * a JSFunction, when called by the user from Error.captureStackTrace().
|
||||
// We skip each frame until encountering the caller function.
|
||||
// * For any other value, all frames are included in the trace.
|
||||
switch (mode_) {
|
||||
case SKIP_FIRST:
|
||||
DCHECK(caller_.is_null());
|
||||
skip_next_frame_ = true;
|
||||
break;
|
||||
case SKIP_UNTIL_SEEN:
|
||||
|
7
test/mjsunit/regress/regress-5342.js
Normal file
7
test/mjsunit/regress/regress-5342.js
Normal file
@ -0,0 +1,7 @@
|
||||
// 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.
|
||||
|
||||
var o = {}
|
||||
Error.captureStackTrace(o);
|
||||
assertEquals(-1, o.stack.indexOf("captureStackTrace"));
|
Loading…
Reference in New Issue
Block a user