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

Unified Diff: third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.js

Issue 1952553002: [DevTools] Auto completion for proxy uses proxy target object (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move-property-descriptors-to-native
Patch Set: Created 4 years, 8 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 | « third_party/WebKit/LayoutTests/http/tests/inspector/console-cd-completions-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.js b/third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.js
index 27c6654ac05900f7b7272db5b86f7dce987913c5..4ec202ba43ab4a68f355ddddbe584a91f3bec8e2 100644
--- a/third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.js
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.js
@@ -526,9 +526,31 @@ WebInspector.ExecutionContext.prototype = {
}
/**
+ * @param {?Array<!WebInspector.RemoteObjectProperty>} properties
+ * @param {?Array.<!WebInspector.RemoteObjectProperty>} internalProperties
+ * @this {WebInspector.ExecutionContext}
+ */
+ function completionsForProxyTarget(properties, internalProperties)
+ {
+ if (internalProperties) {
lushnikov 2016/05/04 19:27:21 lets use as much fast returns as possible! the les
pfeldman 2016/05/04 22:45:07 +1
kozy 2016/05/05 00:51:08 Done.
+ for (var property of internalProperties) {
+ if (property.name === "[[Target]]") {
+ var target = property.value;
+ if (target.subtype !== "proxy")
+ target.callFunctionJSON(getCompletions, [WebInspector.RemoteObject.toCallArgument(target.subtype)], receivedPropertyNames.bind(this));
+ else
+ target.getOwnProperties(completionsForProxyTarget.bind(this));
+ return;
+ }
+ }
+ }
+ completionsReadyCallback([]);
+ }
+
+ /**
* @param {string=} type
* @suppressReceiverCheck
- * @this {WebInspector.ExecutionContext}
+ * @this {*}
*/
function getCompletions(type)
{
@@ -547,7 +569,7 @@ WebInspector.ExecutionContext.prototype = {
for (var o = object; o; o = o.__proto__) {
if (type === "array" && o === object && ArrayBuffer.isView(o) && o.length > 9999)
continue;
- var names = Object.getOwnPropertyNames(o);
+ var names = Object.getOwnPropertyNames(/** @type{!Object} */(o));
var isArray = Array.isArray(o);
for (var i = 0; i < names.length; ++i) {
// Skip array elements indexes.
@@ -561,7 +583,9 @@ WebInspector.ExecutionContext.prototype = {
return resultSet;
}
- if (result.type === "object" || result.type === "function")
+ if (result.type === "object" && result.subtype === "proxy")
lushnikov 2016/05/04 19:27:21 result = extractTarget(result).then(onTarget); f
kozy 2016/05/05 00:51:08 Done.
+ result.getOwnProperties(completionsForProxyTarget.bind(this));
+ else if (result.type === "object" || result.type === "function")
result.callFunctionJSON(getCompletions, [WebInspector.RemoteObject.toCallArgument(result.subtype)], receivedPropertyNames.bind(this));
else if (result.type === "string" || result.type === "number" || result.type === "boolean")
this.evaluate("(" + getCompletions + ")(\"" + result.type + "\")", "completion", false, true, true, false, false, receivedPropertyNamesFromEval.bind(this));
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/inspector/console-cd-completions-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698