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

Unified Diff: third_party/WebKit/Source/platform/v8_inspector/InjectedScriptSource.js

Issue 2122423002: [DevTools] Remove functionDetails from protocol.json (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-generator-details-from-protocol
Patch Set: a Created 4 years, 5 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: third_party/WebKit/Source/platform/v8_inspector/InjectedScriptSource.js
diff --git a/third_party/WebKit/Source/platform/v8_inspector/InjectedScriptSource.js b/third_party/WebKit/Source/platform/v8_inspector/InjectedScriptSource.js
index a310ea81d0110b369d1adf509c7cf8c4dce5878a..d2b3b2725ee665c3b6a7762d6cdabc06d3afdf1e 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/InjectedScriptSource.js
+++ b/third_party/WebKit/Source/platform/v8_inspector/InjectedScriptSource.js
@@ -199,6 +199,20 @@ InjectedScript.primitiveTypes = {
__proto__: null
}
+/**
+ * @type {!Map<string, string>}
+ * @const
+ */
+InjectedScript.closureTypes = new Map([
pfeldman 2016/08/10 16:02:09 You redefine Object and push for safety, but intro
dgozman 2016/08/10 16:17:51 Good catch!
+ ["local", "Local"],
+ ["closure", "Closure"],
+ ["catch", "Catch"],
+ ["block", "Block"],
+ ["script", "Script"],
+ ["with", "With Block"],
+ ["global", "Global"]
+]);
+
InjectedScript.prototype = {
/**
* @param {*} object
@@ -324,10 +338,20 @@ InjectedScript.prototype = {
*/
getProperties: function(object, objectGroupName, ownProperties, accessorPropertiesOnly, generatePreview)
{
+ var subtype = this._subtype(object);
+ if (subtype === "internal#scope") {
+ // Internally, scope contains object with scope variables and additional information like type,
+ // we use additional information for preview and would like to report variables as scope
+ // properties.
+ object = object.object;
+ }
+
var descriptors = [];
var iter = this._propertyDescriptors(object, ownProperties, accessorPropertiesOnly, undefined);
// Go over properties, wrap object values.
for (var descriptor of iter) {
+ if (subtype === "internal#scopeList" && descriptor.name === "length")
+ continue;
if ("get" in descriptor)
descriptor.get = this._wrapObject(descriptor.get, objectGroupName);
if ("set" in descriptor)
@@ -627,6 +651,12 @@ InjectedScript.prototype = {
return this._describeIncludingPrimitives(obj.value);
}
+ if (subtype === "internal#scopeList")
+ return "Scopes[" + obj.length + "]";
+
+ if (subtype === "internal#scope")
+ return (InjectedScript.closureTypes.get(obj.type) || "Unknown") + (obj.name ? " (" + obj.name + ")" : "");
+
return className;
},

Powered by Google App Engine
This is Rietveld 408576698