OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium 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 "platform/v8_inspector/V8InjectedScriptHost.h" | 5 #include "platform/v8_inspector/V8InjectedScriptHost.h" |
6 | 6 |
7 #include "platform/v8_inspector/InjectedScriptNative.h" | 7 #include "platform/v8_inspector/InjectedScriptNative.h" |
8 #include "platform/v8_inspector/V8Compat.h" | 8 #include "platform/v8_inspector/V8Compat.h" |
9 #include "platform/v8_inspector/V8Debugger.h" | 9 #include "platform/v8_inspector/V8Debugger.h" |
10 #include "platform/v8_inspector/V8InspectorImpl.h" | 10 #include "platform/v8_inspector/V8InspectorImpl.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 DCHECK(inspector); | 35 DCHECK(inspector); |
36 return inspector; | 36 return inspector; |
37 } | 37 } |
38 | 38 |
39 } // namespace | 39 } // namespace |
40 | 40 |
41 v8::Local<v8::Object> V8InjectedScriptHost::create(v8::Local<v8::Context> contex
t, V8InspectorImpl* inspector) | 41 v8::Local<v8::Object> V8InjectedScriptHost::create(v8::Local<v8::Context> contex
t, V8InspectorImpl* inspector) |
42 { | 42 { |
43 v8::Isolate* isolate = inspector->isolate(); | 43 v8::Isolate* isolate = inspector->isolate(); |
44 v8::Local<v8::Object> injectedScriptHost = v8::Object::New(isolate); | 44 v8::Local<v8::Object> injectedScriptHost = v8::Object::New(isolate); |
| 45 bool success = injectedScriptHost->SetPrototype(context, v8::Null(isolate)).
FromMaybe(false); |
| 46 DCHECK(success); |
45 v8::Local<v8::External> debuggerExternal = v8::External::New(isolate, inspec
tor); | 47 v8::Local<v8::External> debuggerExternal = v8::External::New(isolate, inspec
tor); |
46 setFunctionProperty(context, injectedScriptHost, "internalConstructorName",
V8InjectedScriptHost::internalConstructorNameCallback, debuggerExternal); | 48 setFunctionProperty(context, injectedScriptHost, "internalConstructorName",
V8InjectedScriptHost::internalConstructorNameCallback, debuggerExternal); |
47 setFunctionProperty(context, injectedScriptHost, "formatAccessorsAsPropertie
s", V8InjectedScriptHost::formatAccessorsAsProperties, debuggerExternal); | 49 setFunctionProperty(context, injectedScriptHost, "formatAccessorsAsPropertie
s", V8InjectedScriptHost::formatAccessorsAsProperties, debuggerExternal); |
48 setFunctionProperty(context, injectedScriptHost, "subtype", V8InjectedScript
Host::subtypeCallback, debuggerExternal); | 50 setFunctionProperty(context, injectedScriptHost, "subtype", V8InjectedScript
Host::subtypeCallback, debuggerExternal); |
49 setFunctionProperty(context, injectedScriptHost, "getInternalProperties", V8
InjectedScriptHost::getInternalPropertiesCallback, debuggerExternal); | 51 setFunctionProperty(context, injectedScriptHost, "getInternalProperties", V8
InjectedScriptHost::getInternalPropertiesCallback, debuggerExternal); |
50 setFunctionProperty(context, injectedScriptHost, "objectHasOwnProperty", V8I
njectedScriptHost::objectHasOwnPropertyCallback, debuggerExternal); | 52 setFunctionProperty(context, injectedScriptHost, "objectHasOwnProperty", V8I
njectedScriptHost::objectHasOwnPropertyCallback, debuggerExternal); |
51 setFunctionProperty(context, injectedScriptHost, "bind", V8InjectedScriptHos
t::bindCallback, debuggerExternal); | 53 setFunctionProperty(context, injectedScriptHost, "bind", V8InjectedScriptHos
t::bindCallback, debuggerExternal); |
52 setFunctionProperty(context, injectedScriptHost, "proxyTargetValue", V8Injec
tedScriptHost::proxyTargetValueCallback, debuggerExternal); | 54 setFunctionProperty(context, injectedScriptHost, "proxyTargetValue", V8Injec
tedScriptHost::proxyTargetValueCallback, debuggerExternal); |
53 return injectedScriptHost; | 55 return injectedScriptHost; |
54 } | 56 } |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 NOTREACHED(); | 178 NOTREACHED(); |
177 return; | 179 return; |
178 } | 180 } |
179 v8::Local<v8::Object> target = info[0].As<v8::Proxy>(); | 181 v8::Local<v8::Object> target = info[0].As<v8::Proxy>(); |
180 while (target->IsProxy()) | 182 while (target->IsProxy()) |
181 target = v8::Local<v8::Proxy>::Cast(target)->GetTarget(); | 183 target = v8::Local<v8::Proxy>::Cast(target)->GetTarget(); |
182 info.GetReturnValue().Set(target); | 184 info.GetReturnValue().Set(target); |
183 } | 185 } |
184 | 186 |
185 } // namespace v8_inspector | 187 } // namespace v8_inspector |
OLD | NEW |