Chromium Code Reviews| Index: test/inspector/inspector-test.cc |
| diff --git a/test/inspector/inspector-test.cc b/test/inspector/inspector-test.cc |
| index d2d44402d76cdca0272d663ab9a5dbf123522aa1..62a45e34e0fd34a0943c8cd7f3c44f970869e6d7 100644 |
| --- a/test/inspector/inspector-test.cc |
| +++ b/test/inspector/inspector-test.cc |
| @@ -382,7 +382,8 @@ class InspectorExtension : public v8::Extension { |
| "native function setMaxAsyncTaskStacks();" |
| "native function breakProgram();" |
| "native function createObjectWithStrictCheck();" |
| - "native function callWithScheduledBreak();") {} |
| + "native function callWithScheduledBreak();" |
| + "native function allowAccessorFormatting();") {} |
| virtual v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate( |
| v8::Isolate* isolate, v8::Local<v8::String> name) { |
| @@ -427,6 +428,13 @@ class InspectorExtension : public v8::Extension { |
| .FromJust()) { |
| return v8::FunctionTemplate::New( |
| isolate, InspectorExtension::CallWithScheduledBreak); |
| + } else if (name->Equals(context, v8::String::NewFromUtf8( |
| + isolate, "allowAccessorFormatting", |
| + v8::NewStringType::kNormal) |
| + .ToLocalChecked()) |
| + .FromJust()) { |
| + return v8::FunctionTemplate::New( |
| + isolate, InspectorExtension::AllowAccessorFormatting); |
| } |
| return v8::Local<v8::FunctionTemplate>(); |
| } |
| @@ -525,6 +533,25 @@ class InspectorExtension : public v8::Extension { |
| nullptr); |
| session->cancelPauseOnNextStatement(); |
| } |
| + |
| + static void AllowAccessorFormatting( |
| + const v8::FunctionCallbackInfo<v8::Value>& args) { |
| + if (args.Length() != 1) { |
|
kozy
2017/03/03 18:20:35
&& args[0]->IsObject()
luoe
2017/03/03 18:56:21
Replaced the CHECK on L544 with a condition as you
|
| + fprintf(stderr, "Internal error: allowAccessorFormatting('object')."); |
| + Exit(); |
| + } |
| + v8::Local<v8::Object> object = args[0].As<v8::Object>(); |
| + CHECK(object->IsObject()); |
| + v8::Isolate* isolate = args.GetIsolate(); |
| + v8::Local<v8::Private> shouldFormatAccessorsPrivate = v8::Private::ForApi( |
| + isolate, v8::String::NewFromUtf8(isolate, "allowAccessorFormatting", |
| + v8::NewStringType::kNormal) |
| + .ToLocalChecked()); |
| + object |
| + ->SetPrivate(isolate->GetCurrentContext(), shouldFormatAccessorsPrivate, |
| + v8::Null(isolate)) |
| + .ToChecked(); |
| + } |
| }; |
| v8::Local<v8::String> ToString(v8::Isolate* isolate, |