| Index: src/messages.cc
|
| diff --git a/src/messages.cc b/src/messages.cc
|
| index 02c42eaa66c9b15a4b923a492fd9190683b258c3..aa453ed50eb55c00bfd1d2db12160e58a70e809e 100644
|
| --- a/src/messages.cc
|
| +++ b/src/messages.cc
|
| @@ -502,9 +502,19 @@ MaybeHandle<Object> ConstructError(Isolate* isolate, Handle<JSFunction> target,
|
| RETURN_ON_EXCEPTION(isolate, isolate->CaptureAndSetDetailedStackTrace(err),
|
| Object);
|
| }
|
| +
|
| + // When we're passed a JSFunction as new target, we can skip frames until that
|
| + // specific function is seen instead of unconditionally skipping the first
|
| + // frame.
|
| + Handle<Object> caller;
|
| + if (mode == SKIP_FIRST && new_target->IsJSFunction()) {
|
| + mode = SKIP_UNTIL_SEEN;
|
| + caller = new_target;
|
| + }
|
| +
|
| // Capture a simple stack trace for the stack property.
|
| - RETURN_ON_EXCEPTION(isolate, isolate->CaptureAndSetSimpleStackTrace(
|
| - err, mode, Handle<Object>()),
|
| + RETURN_ON_EXCEPTION(isolate,
|
| + isolate->CaptureAndSetSimpleStackTrace(err, mode, caller),
|
| Object);
|
|
|
| return err;
|
|
|