Commit c7ff5766 authored by ishell's avatar ishell Committed by Commit bot

Display a meaningfull error message when trying to capture a stack trace to a proxy.

... instead of RUNTIME_ASSERT pointing to V8 guts.

BUG=chromium:599067
LOG=N

Review URL: https://codereview.chromium.org/1844223004

Cr-Commit-Position: refs/heads/master@{#35227}
parent f70b3d3b
......@@ -355,7 +355,7 @@ static Handle<FixedArray> MaybeGrow(Isolate* isolate,
return elements;
}
Handle<Object> Isolate::CaptureSimpleStackTrace(Handle<JSObject> error_object,
Handle<Object> Isolate::CaptureSimpleStackTrace(Handle<JSReceiver> error_object,
Handle<Object> caller) {
// Get stack trace limit.
Handle<JSObject> error = error_function();
......@@ -456,8 +456,8 @@ Handle<Object> Isolate::CaptureSimpleStackTrace(Handle<JSObject> error_object,
return result;
}
MaybeHandle<JSObject> Isolate::CaptureAndSetDetailedStackTrace(
Handle<JSObject> error_object) {
MaybeHandle<JSReceiver> Isolate::CaptureAndSetDetailedStackTrace(
Handle<JSReceiver> error_object) {
if (capture_stack_trace_for_uncaught_exceptions_) {
// Capture stack trace for a detailed exception message.
Handle<Name> key = factory()->detailed_stack_trace_symbol();
......@@ -465,21 +465,20 @@ MaybeHandle<JSObject> Isolate::CaptureAndSetDetailedStackTrace(
stack_trace_for_uncaught_exceptions_frame_limit_,
stack_trace_for_uncaught_exceptions_options_);
RETURN_ON_EXCEPTION(
this, JSObject::SetProperty(error_object, key, stack_trace, STRICT),
JSObject);
this, JSReceiver::SetProperty(error_object, key, stack_trace, STRICT),
JSReceiver);
}
return error_object;
}
MaybeHandle<JSObject> Isolate::CaptureAndSetSimpleStackTrace(
Handle<JSObject> error_object, Handle<Object> caller) {
MaybeHandle<JSReceiver> Isolate::CaptureAndSetSimpleStackTrace(
Handle<JSReceiver> error_object, Handle<Object> caller) {
// Capture stack trace for simple stack trace string formatting.
Handle<Name> key = factory()->stack_trace_symbol();
Handle<Object> stack_trace = CaptureSimpleStackTrace(error_object, caller);
RETURN_ON_EXCEPTION(
this, JSObject::SetProperty(error_object, key, stack_trace, STRICT),
JSObject);
this, JSReceiver::SetProperty(error_object, key, stack_trace, STRICT),
JSReceiver);
return error_object;
}
......
......@@ -682,12 +682,12 @@ class Isolate {
Handle<JSArray> CaptureCurrentStackTrace(
int frame_limit,
StackTrace::StackTraceOptions options);
Handle<Object> CaptureSimpleStackTrace(Handle<JSObject> error_object,
Handle<Object> CaptureSimpleStackTrace(Handle<JSReceiver> error_object,
Handle<Object> caller);
MaybeHandle<JSObject> CaptureAndSetDetailedStackTrace(
Handle<JSObject> error_object);
MaybeHandle<JSObject> CaptureAndSetSimpleStackTrace(
Handle<JSObject> error_object, Handle<Object> caller);
MaybeHandle<JSReceiver> CaptureAndSetDetailedStackTrace(
Handle<JSReceiver> error_object);
MaybeHandle<JSReceiver> CaptureAndSetSimpleStackTrace(
Handle<JSReceiver> error_object, Handle<Object> caller);
Handle<JSArray> GetDetailedStackTrace(Handle<JSObject> error_object);
Handle<JSArray> GetDetailedFromSimpleStackTrace(
Handle<JSObject> error_object);
......
......@@ -263,7 +263,7 @@ RUNTIME_FUNCTION(Runtime_AllocateInTargetSpace) {
RUNTIME_FUNCTION(Runtime_CollectStackTrace) {
HandleScope scope(isolate);
DCHECK(args.length() == 2);
CONVERT_ARG_HANDLE_CHECKED(JSObject, error_object, 0);
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, error_object, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, caller, 1);
if (!isolate->bootstrapper()->IsActive()) {
......
// 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.
try {
var o = {};
var p = new Proxy({}, o);
Error.captureStackTrace(p);
} catch(e) {
assertEquals("Cannot pass private property name to proxy trap", e.message);
}
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