OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/inspector/v8-injected-script-host.h" | 5 #include "src/inspector/v8-injected-script-host.h" |
6 | 6 |
7 #include "src/base/macros.h" | 7 #include "src/base/macros.h" |
8 #include "src/inspector/injected-script-native.h" | 8 #include "src/inspector/injected-script-native.h" |
9 #include "src/inspector/string-util.h" | 9 #include "src/inspector/string-util.h" |
10 #include "src/inspector/v8-debugger.h" | 10 #include "src/inspector/v8-debugger.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 V8InjectedScriptHost::getInternalPropertiesCallback, | 73 V8InjectedScriptHost::getInternalPropertiesCallback, |
74 debuggerExternal); | 74 debuggerExternal); |
75 setFunctionProperty(context, injectedScriptHost, "objectHasOwnProperty", | 75 setFunctionProperty(context, injectedScriptHost, "objectHasOwnProperty", |
76 V8InjectedScriptHost::objectHasOwnPropertyCallback, | 76 V8InjectedScriptHost::objectHasOwnPropertyCallback, |
77 debuggerExternal); | 77 debuggerExternal); |
78 setFunctionProperty(context, injectedScriptHost, "bind", | 78 setFunctionProperty(context, injectedScriptHost, "bind", |
79 V8InjectedScriptHost::bindCallback, debuggerExternal); | 79 V8InjectedScriptHost::bindCallback, debuggerExternal); |
80 setFunctionProperty(context, injectedScriptHost, "proxyTargetValue", | 80 setFunctionProperty(context, injectedScriptHost, "proxyTargetValue", |
81 V8InjectedScriptHost::proxyTargetValueCallback, | 81 V8InjectedScriptHost::proxyTargetValueCallback, |
82 debuggerExternal); | 82 debuggerExternal); |
| 83 createDataProperty(context, injectedScriptHost, |
| 84 toV8StringInternalized(isolate, "keys"), |
| 85 v8::debug::GetBuiltin(isolate, v8::debug::kObjectKeys)); |
| 86 createDataProperty( |
| 87 context, injectedScriptHost, |
| 88 toV8StringInternalized(isolate, "getPrototypeOf"), |
| 89 v8::debug::GetBuiltin(isolate, v8::debug::kObjectGetPrototypeOf)); |
| 90 createDataProperty( |
| 91 context, injectedScriptHost, |
| 92 toV8StringInternalized(isolate, "getOwnPropertyDescriptor"), |
| 93 v8::debug::GetBuiltin(isolate, |
| 94 v8::debug::kObjectGetOwnPropertyDescriptor)); |
| 95 createDataProperty( |
| 96 context, injectedScriptHost, |
| 97 toV8StringInternalized(isolate, "getOwnPropertyNames"), |
| 98 v8::debug::GetBuiltin(isolate, v8::debug::kObjectGetOwnPropertyNames)); |
| 99 createDataProperty( |
| 100 context, injectedScriptHost, |
| 101 toV8StringInternalized(isolate, "getOwnPropertySymbols"), |
| 102 v8::debug::GetBuiltin(isolate, v8::debug::kObjectGetOwnPropertySymbols)); |
83 return injectedScriptHost; | 103 return injectedScriptHost; |
84 } | 104 } |
85 | 105 |
86 void V8InjectedScriptHost::nullifyPrototypeCallback( | 106 void V8InjectedScriptHost::nullifyPrototypeCallback( |
87 const v8::FunctionCallbackInfo<v8::Value>& info) { | 107 const v8::FunctionCallbackInfo<v8::Value>& info) { |
88 CHECK(info.Length() == 1 && info[0]->IsObject()); | 108 CHECK(info.Length() == 1 && info[0]->IsObject()); |
89 v8::Isolate* isolate = info.GetIsolate(); | 109 v8::Isolate* isolate = info.GetIsolate(); |
90 info[0] | 110 info[0] |
91 .As<v8::Object>() | 111 .As<v8::Object>() |
92 ->SetPrototype(isolate->GetCurrentContext(), v8::Null(isolate)) | 112 ->SetPrototype(isolate->GetCurrentContext(), v8::Null(isolate)) |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 UNREACHABLE(); | 326 UNREACHABLE(); |
307 return; | 327 return; |
308 } | 328 } |
309 v8::Local<v8::Object> target = info[0].As<v8::Proxy>(); | 329 v8::Local<v8::Object> target = info[0].As<v8::Proxy>(); |
310 while (target->IsProxy()) | 330 while (target->IsProxy()) |
311 target = v8::Local<v8::Proxy>::Cast(target)->GetTarget(); | 331 target = v8::Local<v8::Proxy>::Cast(target)->GetTarget(); |
312 info.GetReturnValue().Set(target); | 332 info.GetReturnValue().Set(target); |
313 } | 333 } |
314 | 334 |
315 } // namespace v8_inspector | 335 } // namespace v8_inspector |
OLD | NEW |