Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(590)

Unified Diff: src/inspector/v8-injected-script-host.cc

Issue 2767323002: [inspector] better isArrayLike for injected-script-source.js (Closed)
Patch Set: length on array should be own property Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/inspector/v8-injected-script-host.cc
diff --git a/src/inspector/v8-injected-script-host.cc b/src/inspector/v8-injected-script-host.cc
index 80c256fcb30d611f22ad7339693226d60a079420..07c7740e38d2d7fe5202e420822e55a3a6616505 100644
--- a/src/inspector/v8-injected-script-host.cc
+++ b/src/inspector/v8-injected-script-host.cc
@@ -58,6 +58,8 @@ v8::Local<v8::Object> V8InjectedScriptHost::create(
setFunctionProperty(context, injectedScriptHost, "nullifyPrototype",
V8InjectedScriptHost::nullifyPrototypeCallback,
debuggerExternal);
+ setFunctionProperty(context, injectedScriptHost, "get",
+ V8InjectedScriptHost::getCallback, debuggerExternal);
setFunctionProperty(context, injectedScriptHost, "internalConstructorName",
V8InjectedScriptHost::internalConstructorNameCallback,
debuggerExternal);
@@ -90,6 +92,24 @@ void V8InjectedScriptHost::nullifyPrototypeCallback(
.ToChecked();
}
+void V8InjectedScriptHost::getCallback(
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
+ CHECK(info.Length() == 2 && info[1]->IsString());
+ if (!info[0]->IsObject()) return;
+ v8::Isolate* isolate = info.GetIsolate();
+ v8::Local<v8::Context> context = isolate->GetCurrentContext();
+ v8::TryCatch tryCatch(isolate);
+ v8::Isolate::DisallowJavascriptExecutionScope throwJs(
+ isolate, v8::Isolate::DisallowJavascriptExecutionScope::THROW_ON_FAILURE);
+ v8::Local<v8::Value> property;
+ if (info[0]
+ .As<v8::Object>()
+ ->Get(context, v8::Local<v8::String>::Cast(info[1]))
+ .ToLocal(&property)) {
+ info.GetReturnValue().Set(property);
dgozman 2017/03/23 21:10:20 So, do we return undefined in case of JS execution
kozy 2017/03/24 00:40:37 yes, we do, in current use cases it looks like exp
+ }
+}
+
void V8InjectedScriptHost::internalConstructorNameCallback(
const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() < 1 || !info[0]->IsObject()) return;

Powered by Google App Engine
This is Rietveld 408576698