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

Unified Diff: Source/core/inspector/InjectedScriptSource.js

Issue 19064004: Support re-reading scope variables in protocol and on backed. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: follow code review Created 7 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
« no previous file with comments | « Source/core/inspector/InjectedScriptExterns.js ('k') | Source/core/inspector/InspectorDebuggerAgent.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/InjectedScriptSource.js
diff --git a/Source/core/inspector/InjectedScriptSource.js b/Source/core/inspector/InjectedScriptSource.js
index c59c45e6587de18b83ccb4ed306b6cbb9873513f..34898c719ee33fd95ab50bd0fa5a9ac9ce0c5fdb 100644
--- a/Source/core/inspector/InjectedScriptSource.js
+++ b/Source/core/inspector/InjectedScriptSource.js
@@ -339,7 +339,7 @@ InjectedScript.prototype = {
value: this._wrapObject(property.value, objectGroupName)
};
descriptors.push(descriptor);
- }
+ }
}
return descriptors;
},
@@ -415,7 +415,7 @@ InjectedScript.prototype = {
continue;
try {
descriptor = { name: name, value: o[name], writable: false, configurable: false, enumerable: false};
- if (o === object)
+ if (o === object)
descriptor.isOwn = true;
descriptors.push(descriptor);
} catch (e) {
@@ -432,7 +432,7 @@ InjectedScript.prototype = {
}
descriptor.name = name;
- if (o === object)
+ if (o === object)
descriptor.isOwn = true;
descriptors.push(descriptor);
}
@@ -497,7 +497,7 @@ InjectedScript.prototype = {
return this._createThrownValue(e, objectGroup);
}
},
-
+
/**
* Resolves a value from CallArgument description.
* @param {RuntimeAgent.CallArgument} callArgumentJson
@@ -635,7 +635,7 @@ InjectedScript.prototype = {
return "Could not find call frame with given id";
var result = callFrame.restart();
if (result === false)
- result = "Restart frame is not supported";
+ result = "Restart frame is not supported";
return result;
},
@@ -646,23 +646,23 @@ InjectedScript.prototype = {
* @param {string|boolean} functionObjectId or false
* @param {number} scopeNumber
* @param {string} variableName
- * @param {string} newValueJsonString RuntimeAgent.CallArgument structure serialized as string
- * @return {string|undefined} undefined if success or an error message
+ * @param {string} newValueJsonString RuntimeAgent.CallArgument structure serialized as string
+ * @return {string|undefined} undefined if success or an error message
*/
setVariableValue: function(topCallFrame, callFrameId, functionObjectId, scopeNumber, variableName, newValueJsonString)
- {
+ {
var setter;
if (typeof callFrameId === "string") {
var callFrame = this._callFrameForId(topCallFrame, callFrameId);
if (!callFrame)
return "Could not find call frame with given id";
- setter = callFrame.setVariableValue.bind(callFrame);
+ setter = callFrame.setVariableValue.bind(callFrame);
} else {
var parsedFunctionId = this._parseObjectId(/** @type {string} */ (functionObjectId));
var func = this._objectForId(parsedFunctionId);
if (typeof func !== "function")
return "Cannot resolve function by id.";
- setter = InjectedScriptHost.setFunctionVariableValue.bind(InjectedScriptHost, func);
+ setter = InjectedScriptHost.setFunctionVariableValue.bind(InjectedScriptHost, func);
}
var newValueJson;
try {
@@ -684,6 +684,15 @@ InjectedScript.prototype = {
return undefined;
},
+ getCallFrameScopes: function(topCallFrame, callFrameId)
+ {
+ var callFrame = this._callFrameForId(topCallFrame, callFrameId);
+ if (!callFrame)
+ return "Could not find call frame with given id";
+ callFrame.rereadScopes();
+ return InjectedScript.CallFrameProxy._wrapScopeChain(callFrame);
+ },
+
/**
* @param {Object} topCallFrame
* @param {string} callFrameId
@@ -733,7 +742,7 @@ InjectedScript.prototype = {
/**
* @param {string} name
* @return {Object}
- */
+ */
module: function(name)
{
return this._modules[name];
@@ -743,7 +752,7 @@ InjectedScript.prototype = {
* @param {string} name
* @param {string} source
* @return {Object}
- */
+ */
injectModule: function(name, source)
{
delete this._modules[name];
@@ -976,7 +985,7 @@ InjectedScript.RemoteObject.prototype = {
this._appendPropertyPreview(preview, { name: name, type: "object", value: "null" }, propertiesThreshold);
continue;
}
-
+
const maxLength = 100;
var type = typeof value;
@@ -1061,28 +1070,29 @@ InjectedScript.CallFrameProxy = function(ordinal, callFrame)
this.callFrameId = "{\"ordinal\":" + ordinal + ",\"injectedScriptId\":" + injectedScriptId + "}";
this.functionName = (callFrame.type === "function" ? callFrame.functionName : "");
this.location = { scriptId: String(callFrame.sourceID), lineNumber: callFrame.line, columnNumber: callFrame.column };
- this.scopeChain = this._wrapScopeChain(callFrame);
+ this.scopeChain = InjectedScript.CallFrameProxy._wrapScopeChain(callFrame);
this.this = injectedScript._wrapObject(callFrame.thisObject, "backtrace");
}
InjectedScript.CallFrameProxy.prototype = {
- /**
- * @param {Object} callFrame
- * @return {!Array.<DebuggerAgent.Scope>}
- */
- _wrapScopeChain: function(callFrame)
- {
- var scopeChain = callFrame.scopeChain;
- var scopeChainProxy = [];
- for (var i = 0; i < scopeChain.length; i++) {
- var scope = InjectedScript.CallFrameProxy._createScopeJson(callFrame.scopeType(i), scopeChain[i], "backtrace");
- scopeChainProxy.push(scope);
- }
- return scopeChainProxy;
- }
}
/**
+ * @param {Object} callFrame
+ * @return {!Array.<DebuggerAgent.Scope>}
+ */
+InjectedScript.CallFrameProxy._wrapScopeChain = function(callFrame)
+{
+ var scopeChain = callFrame.scopeChain;
+ var scopeChainProxy = [];
+ for (var i = 0; i < scopeChain.length; i++) {
+ var scope = InjectedScript.CallFrameProxy._createScopeJson(callFrame.scopeType(i), scopeChain[i], "backtrace");
+ scopeChainProxy.push(scope);
+ }
+ return scopeChainProxy;
+};
+
+/**
* @param {number} scopeTypeCode
* @param {*} scopeObject
* @param {string} groupId
« no previous file with comments | « Source/core/inspector/InjectedScriptExterns.js ('k') | Source/core/inspector/InspectorDebuggerAgent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698