| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 Components.JavaScriptAutocomplete = {}; | 5 Components.JavaScriptAutocomplete = {}; |
| 6 | 6 |
| 7 /** @typedef {{title:(string|undefined), items:Array<string>}} */ | 7 /** @typedef {{title:(string|undefined), items:Array<string>}} */ |
| 8 Components.JavaScriptAutocomplete.CompletionGroup; | 8 Components.JavaScriptAutocomplete.CompletionGroup; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 97 |
| 98 /** | 98 /** |
| 99 * @param {?SDK.RemoteObject} object | 99 * @param {?SDK.RemoteObject} object |
| 100 * @return {!Promise<?SDK.RemoteObject>} | 100 * @return {!Promise<?SDK.RemoteObject>} |
| 101 */ | 101 */ |
| 102 function extractTarget(object) { | 102 function extractTarget(object) { |
| 103 if (!object) | 103 if (!object) |
| 104 return Promise.resolve(/** @type {?SDK.RemoteObject} */ (null)); | 104 return Promise.resolve(/** @type {?SDK.RemoteObject} */ (null)); |
| 105 if (object.type !== 'object' || object.subtype !== 'proxy') | 105 if (object.type !== 'object' || object.subtype !== 'proxy') |
| 106 return Promise.resolve(/** @type {?SDK.RemoteObject} */ (object)); | 106 return Promise.resolve(/** @type {?SDK.RemoteObject} */ (object)); |
| 107 return object.getOwnPropertiesPromise().then(extractTargetFromProperties).
then(extractTarget); | 107 return object.getOwnPropertiesPromise(false /* generatePreview */) |
| 108 .then(extractTargetFromProperties) |
| 109 .then(extractTarget); |
| 108 } | 110 } |
| 109 | 111 |
| 110 /** | 112 /** |
| 111 * @param {!{properties: ?Array<!SDK.RemoteObjectProperty>, internalProperti
es: ?Array<!SDK.RemoteObjectProperty>}} properties | 113 * @param {!{properties: ?Array<!SDK.RemoteObjectProperty>, internalProperti
es: ?Array<!SDK.RemoteObjectProperty>}} properties |
| 112 * @return {?SDK.RemoteObject} | 114 * @return {?SDK.RemoteObject} |
| 113 */ | 115 */ |
| 114 function extractTargetFromProperties(properties) { | 116 function extractTargetFromProperties(properties) { |
| 115 var internalProperties = properties.internalProperties || []; | 117 var internalProperties = properties.internalProperties || []; |
| 116 var target = internalProperties.find(property => property.name === '[[Targ
et]]'); | 118 var target = internalProperties.find(property => property.name === '[[Targ
et]]'); |
| 117 return target ? target.value : null; | 119 return target ? target.value : null; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 group.items.push(properties[i].name); | 201 group.items.push(properties[i].name); |
| 200 if (--pendingRequests === 0) | 202 if (--pendingRequests === 0) |
| 201 callback(result); | 203 callback(result); |
| 202 } | 204 } |
| 203 | 205 |
| 204 var scopeChain = callFrame.scopeChain(); | 206 var scopeChain = callFrame.scopeChain(); |
| 205 var pendingRequests = scopeChain.length; | 207 var pendingRequests = scopeChain.length; |
| 206 for (var i = 0; i < scopeChain.length; ++i) { | 208 for (var i = 0; i < scopeChain.length; ++i) { |
| 207 var scope = scopeChain[i]; | 209 var scope = scopeChain[i]; |
| 208 var object = scope.object(); | 210 var object = scope.object(); |
| 209 object.getAllProperties(false, propertiesCollected.bind(null, scope.typeNa
me())); | 211 object.getAllProperties( |
| 212 false /* accessorPropertiesOnly */, false /* generatePreview */, |
| 213 propertiesCollected.bind(null, scope.typeName())); |
| 210 } | 214 } |
| 211 } | 215 } |
| 212 | 216 |
| 213 /** | 217 /** |
| 214 * @param {?SDK.RemoteObject} result | 218 * @param {?SDK.RemoteObject} result |
| 215 * @param {!Protocol.Runtime.ExceptionDetails=} exceptionDetails | 219 * @param {!Protocol.Runtime.ExceptionDetails=} exceptionDetails |
| 216 */ | 220 */ |
| 217 function receivedPropertyNamesFromEval(result, exceptionDetails) { | 221 function receivedPropertyNamesFromEval(result, exceptionDetails) { |
| 218 executionContext.target().runtimeAgent().releaseObjectGroup('completion'); | 222 executionContext.target().runtimeAgent().releaseObjectGroup('completion'); |
| 219 if (result && !exceptionDetails) | 223 if (result && !exceptionDetails) |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 function itemComparator(a, b) { | 347 function itemComparator(a, b) { |
| 344 var aStartsWithUnderscore = a.startsWith('_'); | 348 var aStartsWithUnderscore = a.startsWith('_'); |
| 345 var bStartsWithUnderscore = b.startsWith('_'); | 349 var bStartsWithUnderscore = b.startsWith('_'); |
| 346 if (aStartsWithUnderscore && !bStartsWithUnderscore) | 350 if (aStartsWithUnderscore && !bStartsWithUnderscore) |
| 347 return 1; | 351 return 1; |
| 348 if (bStartsWithUnderscore && !aStartsWithUnderscore) | 352 if (bStartsWithUnderscore && !aStartsWithUnderscore) |
| 349 return -1; | 353 return -1; |
| 350 return String.naturalOrderComparator(a, b); | 354 return String.naturalOrderComparator(a, b); |
| 351 } | 355 } |
| 352 }; | 356 }; |
| OLD | NEW |