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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 v8::debug::GetBuiltin(isolate, v8::debug::kObjectGetOwnPropertyNames)); | 98 v8::debug::GetBuiltin(isolate, v8::debug::kObjectGetOwnPropertyNames)); |
99 createDataProperty( | 99 createDataProperty( |
100 context, injectedScriptHost, | 100 context, injectedScriptHost, |
101 toV8StringInternalized(isolate, "getOwnPropertySymbols"), | 101 toV8StringInternalized(isolate, "getOwnPropertySymbols"), |
102 v8::debug::GetBuiltin(isolate, v8::debug::kObjectGetOwnPropertySymbols)); | 102 v8::debug::GetBuiltin(isolate, v8::debug::kObjectGetOwnPropertySymbols)); |
103 return injectedScriptHost; | 103 return injectedScriptHost; |
104 } | 104 } |
105 | 105 |
106 void V8InjectedScriptHost::nullifyPrototypeCallback( | 106 void V8InjectedScriptHost::nullifyPrototypeCallback( |
107 const v8::FunctionCallbackInfo<v8::Value>& info) { | 107 const v8::FunctionCallbackInfo<v8::Value>& info) { |
108 CHECK(info.Length() == 1 && info[0]->IsObject()); | 108 CHECK(info.Length() == 1); |
| 109 DCHECK(info[0]->IsObject()); |
| 110 if (!info[0]->IsObject()) return; |
109 v8::Isolate* isolate = info.GetIsolate(); | 111 v8::Isolate* isolate = info.GetIsolate(); |
110 info[0] | 112 info[0] |
111 .As<v8::Object>() | 113 .As<v8::Object>() |
112 ->SetPrototype(isolate->GetCurrentContext(), v8::Null(isolate)) | 114 ->SetPrototype(isolate->GetCurrentContext(), v8::Null(isolate)) |
113 .ToChecked(); | 115 .ToChecked(); |
114 } | 116 } |
115 | 117 |
116 void V8InjectedScriptHost::getPropertyCallback( | 118 void V8InjectedScriptHost::getPropertyCallback( |
117 const v8::FunctionCallbackInfo<v8::Value>& info) { | 119 const v8::FunctionCallbackInfo<v8::Value>& info) { |
118 CHECK(info.Length() == 2 && info[1]->IsString()); | 120 CHECK(info.Length() == 2 && info[1]->IsString()); |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 UNREACHABLE(); | 328 UNREACHABLE(); |
327 return; | 329 return; |
328 } | 330 } |
329 v8::Local<v8::Object> target = info[0].As<v8::Proxy>(); | 331 v8::Local<v8::Object> target = info[0].As<v8::Proxy>(); |
330 while (target->IsProxy()) | 332 while (target->IsProxy()) |
331 target = v8::Local<v8::Proxy>::Cast(target)->GetTarget(); | 333 target = v8::Local<v8::Proxy>::Cast(target)->GetTarget(); |
332 info.GetReturnValue().Set(target); | 334 info.GetReturnValue().Set(target); |
333 } | 335 } |
334 | 336 |
335 } // namespace v8_inspector | 337 } // namespace v8_inspector |
OLD | NEW |