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

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

Issue 2767323002: [inspector] better isArrayLike for injected-script-source.js (Closed)
Patch Set: addressed comments 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
« no previous file with comments | « src/inspector/v8-injected-script-host.h ('k') | test/inspector/protocol-test.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..02af51eb1205f2bb47dbe3e5185384f1c5ac6a35 100644
--- a/src/inspector/v8-injected-script-host.cc
+++ b/src/inspector/v8-injected-script-host.cc
@@ -58,6 +58,9 @@ v8::Local<v8::Object> V8InjectedScriptHost::create(
setFunctionProperty(context, injectedScriptHost, "nullifyPrototype",
V8InjectedScriptHost::nullifyPrototypeCallback,
debuggerExternal);
+ setFunctionProperty(context, injectedScriptHost, "getProperty",
+ V8InjectedScriptHost::getPropertyCallback,
+ debuggerExternal);
setFunctionProperty(context, injectedScriptHost, "internalConstructorName",
V8InjectedScriptHost::internalConstructorNameCallback,
debuggerExternal);
@@ -90,6 +93,24 @@ void V8InjectedScriptHost::nullifyPrototypeCallback(
.ToChecked();
}
+void V8InjectedScriptHost::getPropertyCallback(
+ 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);
+ }
+}
+
void V8InjectedScriptHost::internalConstructorNameCallback(
const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() < 1 || !info[0]->IsObject()) return;
« no previous file with comments | « src/inspector/v8-injected-script-host.h ('k') | test/inspector/protocol-test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698