| 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/V8InjectedScriptHost.h" | 5 #include "src/inspector/V8InjectedScriptHost.h" |
| 6 | 6 |
| 7 #include "src/base/macros.h" | 7 #include "src/base/macros.h" |
| 8 #include "src/inspector/InjectedScriptNative.h" | 8 #include "src/inspector/InjectedScriptNative.h" |
| 9 #include "src/inspector/StringUtil.h" | 9 #include "src/inspector/StringUtil.h" |
| 10 #include "src/inspector/V8Debugger.h" | 10 #include "src/inspector/V8Debugger.h" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 ->HasOwnProperty(info.GetIsolate()->GetCurrentContext(), | 182 ->HasOwnProperty(info.GetIsolate()->GetCurrentContext(), |
| 183 v8::Local<v8::String>::Cast(info[1])) | 183 v8::Local<v8::String>::Cast(info[1])) |
| 184 .FromMaybe(false); | 184 .FromMaybe(false); |
| 185 info.GetReturnValue().Set(v8::Boolean::New(info.GetIsolate(), result)); | 185 info.GetReturnValue().Set(v8::Boolean::New(info.GetIsolate(), result)); |
| 186 } | 186 } |
| 187 | 187 |
| 188 void V8InjectedScriptHost::bindCallback( | 188 void V8InjectedScriptHost::bindCallback( |
| 189 const v8::FunctionCallbackInfo<v8::Value>& info) { | 189 const v8::FunctionCallbackInfo<v8::Value>& info) { |
| 190 if (info.Length() < 2 || !info[1]->IsString()) return; | 190 if (info.Length() < 2 || !info[1]->IsString()) return; |
| 191 InjectedScriptNative* injectedScriptNative = | 191 InjectedScriptNative* injectedScriptNative = |
| 192 InjectedScriptNative::fromInjectedScriptHost(info.Holder()); | 192 InjectedScriptNative::fromInjectedScriptHost(info.GetIsolate(), |
| 193 info.Holder()); |
| 193 if (!injectedScriptNative) return; | 194 if (!injectedScriptNative) return; |
| 194 | 195 |
| 195 v8::Local<v8::String> v8groupName = info[1]->ToString(info.GetIsolate()); | 196 v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext(); |
| 197 v8::Local<v8::String> v8groupName = |
| 198 info[1]->ToString(context).ToLocalChecked(); |
| 196 String16 groupName = toProtocolStringWithTypeCheck(v8groupName); | 199 String16 groupName = toProtocolStringWithTypeCheck(v8groupName); |
| 197 int id = injectedScriptNative->bind(info[0], groupName); | 200 int id = injectedScriptNative->bind(info[0], groupName); |
| 198 info.GetReturnValue().Set(id); | 201 info.GetReturnValue().Set(id); |
| 199 } | 202 } |
| 200 | 203 |
| 201 void V8InjectedScriptHost::proxyTargetValueCallback( | 204 void V8InjectedScriptHost::proxyTargetValueCallback( |
| 202 const v8::FunctionCallbackInfo<v8::Value>& info) { | 205 const v8::FunctionCallbackInfo<v8::Value>& info) { |
| 203 if (info.Length() != 1 || !info[0]->IsProxy()) { | 206 if (info.Length() != 1 || !info[0]->IsProxy()) { |
| 204 UNREACHABLE(); | 207 UNREACHABLE(); |
| 205 return; | 208 return; |
| 206 } | 209 } |
| 207 v8::Local<v8::Object> target = info[0].As<v8::Proxy>(); | 210 v8::Local<v8::Object> target = info[0].As<v8::Proxy>(); |
| 208 while (target->IsProxy()) | 211 while (target->IsProxy()) |
| 209 target = v8::Local<v8::Proxy>::Cast(target)->GetTarget(); | 212 target = v8::Local<v8::Proxy>::Cast(target)->GetTarget(); |
| 210 info.GetReturnValue().Set(target); | 213 info.GetReturnValue().Set(target); |
| 211 } | 214 } |
| 212 | 215 |
| 213 } // namespace v8_inspector | 216 } // namespace v8_inspector |
| OLD | NEW |