aboutsummaryrefslogtreecommitdiff
path: root/deps/v8/src/inspector
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2017-12-21 08:08:25 +0100
committerMichaël Zasso <targos@protonmail.com>2017-12-21 14:47:29 +0100
commitd1d6b54b698f964ae030414472db34ea45aecb39 (patch)
tree133b6b7e1150f8dcffccf73018a13bb3612ee664 /deps/v8/src/inspector
parentd50e1a291694ee96890c1734e7ed9b0295d5262c (diff)
downloadandroid-node-v8-d1d6b54b698f964ae030414472db34ea45aecb39.tar.gz
android-node-v8-d1d6b54b698f964ae030414472db34ea45aecb39.tar.bz2
android-node-v8-d1d6b54b698f964ae030414472db34ea45aecb39.zip
deps: cherry-pick 50f7455 from upstream V8
Original commit message: [inspector] added Runtime.globalLexicalScopeNames method The method returns names for all available top-level scope variables in giving context. R=dgozman@chromium.org,jgruber@chromium.org Bug: chromium:681333 Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel Change-Id: I2d0b600e1afbfef9087f53ea9c26abe1e112047c Reviewed-on: https://chromium-review.googlesource.com/719409 Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org> Reviewed-by: Yang Guo <yangguo@chromium.org> Reviewed-by: Jakob Gruber <jgruber@chromium.org> Reviewed-by: Dmitry Gozman <dgozman@chromium.org> Cr-Commit-Position: refs/heads/master@{#48618} Refs: https://github.com/v8/v8/commit/50f7455cd973864fe70cc04f97146f725b7c3e54 PR-URL: https://github.com/nodejs/node/pull/16591 Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'deps/v8/src/inspector')
-rw-r--r--deps/v8/src/inspector/js_protocol.json11
-rw-r--r--deps/v8/src/inspector/v8-runtime-agent-impl.cc21
-rw-r--r--deps/v8/src/inspector/v8-runtime-agent-impl.h3
3 files changed, 35 insertions, 0 deletions
diff --git a/deps/v8/src/inspector/js_protocol.json b/deps/v8/src/inspector/js_protocol.json
index df7db67cdb..2d493e5b74 100644
--- a/deps/v8/src/inspector/js_protocol.json
+++ b/deps/v8/src/inspector/js_protocol.json
@@ -355,6 +355,17 @@
{ "name": "objects", "$ref": "RemoteObject", "description": "Array with objects." }
],
"experimental": true
+ },
+ {
+ "name": "globalLexicalScopeNames",
+ "parameters": [
+ { "name": "executionContextId", "$ref": "ExecutionContextId", "optional": true, "description": "Specifies in which execution context to lookup global scope variables." }
+ ],
+ "returns": [
+ { "name": "names", "type": "array", "items": { "type": "string" } }
+ ],
+ "description": "Returns all let, const and class variables from global scope.",
+ "experimental": true
}
],
"events": [
diff --git a/deps/v8/src/inspector/v8-runtime-agent-impl.cc b/deps/v8/src/inspector/v8-runtime-agent-impl.cc
index 8ecfbc5791..22d48e23bf 100644
--- a/deps/v8/src/inspector/v8-runtime-agent-impl.cc
+++ b/deps/v8/src/inspector/v8-runtime-agent-impl.cc
@@ -586,6 +586,27 @@ Response V8RuntimeAgentImpl::queryObjects(
resultArray, scope.objectGroupName(), false, false, objects);
}
+Response V8RuntimeAgentImpl::globalLexicalScopeNames(
+ Maybe<int> executionContextId,
+ std::unique_ptr<protocol::Array<String16>>* outNames) {
+ int contextId = 0;
+ Response response = ensureContext(m_inspector, m_session->contextGroupId(),
+ std::move(executionContextId), &contextId);
+ if (!response.isSuccess()) return response;
+
+ InjectedScript::ContextScope scope(m_session, contextId);
+ response = scope.initialize();
+ if (!response.isSuccess()) return response;
+
+ v8::PersistentValueVector<v8::String> names(m_inspector->isolate());
+ v8::debug::GlobalLexicalScopeNames(scope.context(), &names);
+ *outNames = protocol::Array<String16>::create();
+ for (size_t i = 0; i < names.Size(); ++i) {
+ (*outNames)->addItem(toProtocolString(names.Get(i)));
+ }
+ return Response::OK();
+}
+
void V8RuntimeAgentImpl::restore() {
if (!m_state->booleanProperty(V8RuntimeAgentImplState::runtimeEnabled, false))
return;
diff --git a/deps/v8/src/inspector/v8-runtime-agent-impl.h b/deps/v8/src/inspector/v8-runtime-agent-impl.h
index 1d5067b560..cc63b697c9 100644
--- a/deps/v8/src/inspector/v8-runtime-agent-impl.h
+++ b/deps/v8/src/inspector/v8-runtime-agent-impl.h
@@ -101,6 +101,9 @@ class V8RuntimeAgentImpl : public protocol::Runtime::Backend {
Response queryObjects(
const String16& prototypeObjectId,
std::unique_ptr<protocol::Runtime::RemoteObject>* objects) override;
+ Response globalLexicalScopeNames(
+ Maybe<int> executionContextId,
+ std::unique_ptr<protocol::Array<String16>>* outNames) override;
void reset();
void reportExecutionContextCreated(InspectedContext*);