Commit 64c518d0 authored by jgruber's avatar jgruber Committed by Commit bot

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}
parent 3d617c16
......@@ -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:
......
// 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"));
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