| 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 8dfa7dfbccdbae8ceeade944a61616a3270bf699..e733e8a3153d6a0422b7df183c9b0f3e5d0a8101 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.js
|
| @@ -581,233 +581,6 @@ WebInspector.ExecutionContext = class extends WebInspector.SDKObject {
|
| }
|
|
|
| /**
|
| - * @param {string} expressionString
|
| - * @param {string} prefix
|
| - * @param {boolean=} force
|
| - * @return {!Promise<!Array<string>>}
|
| - */
|
| - completionsForExpression(expressionString, prefix, force) {
|
| - var lastIndex = expressionString.length - 1;
|
| -
|
| - var dotNotation = (expressionString[lastIndex] === '.');
|
| - var bracketNotation = (expressionString[lastIndex] === '[');
|
| -
|
| - if (dotNotation || bracketNotation)
|
| - expressionString = expressionString.substr(0, lastIndex);
|
| -
|
| - // User is entering float value, do not suggest anything.
|
| - if (expressionString && !isNaN(expressionString))
|
| - return Promise.resolve([]);
|
| -
|
| - if (!prefix && !expressionString && !force)
|
| - return Promise.resolve([]);
|
| -
|
| - var fufill;
|
| - var promise = new Promise(x => fufill = x);
|
| - if (!expressionString && this.debuggerModel.selectedCallFrame())
|
| - this.debuggerModel.selectedCallFrame().variableNames(receivedPropertyNames.bind(this));
|
| - else
|
| - this.evaluate(expressionString, 'completion', true, true, false, false, false, evaluated.bind(this));
|
| -
|
| - return promise;
|
| - /**
|
| - * @param {?WebInspector.RemoteObject} result
|
| - * @param {!Protocol.Runtime.ExceptionDetails=} exceptionDetails
|
| - * @this {WebInspector.ExecutionContext}
|
| - */
|
| - function evaluated(result, exceptionDetails) {
|
| - if (!result || !!exceptionDetails) {
|
| - fufill([]);
|
| - return;
|
| - }
|
| -
|
| - /**
|
| - * @param {?WebInspector.RemoteObject} object
|
| - * @return {!Promise<?WebInspector.RemoteObject>}
|
| - */
|
| - function extractTarget(object) {
|
| - if (!object)
|
| - return Promise.resolve(/** @type {?WebInspector.RemoteObject} */ (null));
|
| - if (object.type !== 'object' || object.subtype !== 'proxy')
|
| - return Promise.resolve(/** @type {?WebInspector.RemoteObject} */ (object));
|
| - return object.getOwnPropertiesPromise().then(extractTargetFromProperties).then(extractTarget);
|
| - }
|
| -
|
| - /**
|
| - * @param {!{properties: ?Array<!WebInspector.RemoteObjectProperty>, internalProperties: ?Array<!WebInspector.RemoteObjectProperty>}} properties
|
| - * @return {?WebInspector.RemoteObject}
|
| - */
|
| - function extractTargetFromProperties(properties) {
|
| - var internalProperties = properties.internalProperties || [];
|
| - var target = internalProperties.find(property => property.name === '[[Target]]');
|
| - return target ? target.value : null;
|
| - }
|
| -
|
| - /**
|
| - * @param {string=} type
|
| - * @return {!Object}
|
| - * @suppressReceiverCheck
|
| - * @this {Object}
|
| - */
|
| - function getCompletions(type) {
|
| - var object;
|
| - if (type === 'string')
|
| - object = new String('');
|
| - else if (type === 'number')
|
| - object = new Number(0);
|
| - else if (type === 'boolean')
|
| - object = new Boolean(false);
|
| - else
|
| - object = this;
|
| -
|
| - var resultSet = {__proto__: null};
|
| - try {
|
| - for (var o = object; o; o = Object.getPrototypeOf(o)) {
|
| - if ((type === 'array' || type === 'typedarray') && o === object && ArrayBuffer.isView(o) && o.length > 9999)
|
| - continue;
|
| - var names = Object.getOwnPropertyNames(o);
|
| - var isArray = Array.isArray(o);
|
| - for (var i = 0; i < names.length; ++i) {
|
| - // Skip array elements indexes.
|
| - if (isArray && /^[0-9]/.test(names[i]))
|
| - continue;
|
| - resultSet[names[i]] = true;
|
| - }
|
| - }
|
| - } catch (e) {
|
| - }
|
| - return resultSet;
|
| - }
|
| -
|
| - /**
|
| - * @param {?WebInspector.RemoteObject} object
|
| - * @this {WebInspector.ExecutionContext}
|
| - */
|
| - function completionsForObject(object) {
|
| - if (!object)
|
| - receivedPropertyNames.call(this, null);
|
| - else if (object.type === 'object' || object.type === 'function')
|
| - object.callFunctionJSON(
|
| - getCompletions, [WebInspector.RemoteObject.toCallArgument(object.subtype)],
|
| - receivedPropertyNames.bind(this));
|
| - else if (object.type === 'string' || object.type === 'number' || object.type === 'boolean')
|
| - this.evaluate(
|
| - '(' + getCompletions + ')("' + result.type + '")', 'completion', false, true, true, false, false,
|
| - receivedPropertyNamesFromEval.bind(this));
|
| - }
|
| -
|
| - extractTarget(result).then(completionsForObject.bind(this));
|
| - }
|
| -
|
| - /**
|
| - * @param {?WebInspector.RemoteObject} result
|
| - * @param {!Protocol.Runtime.ExceptionDetails=} exceptionDetails
|
| - * @this {WebInspector.ExecutionContext}
|
| - */
|
| - function receivedPropertyNamesFromEval(result, exceptionDetails) {
|
| - this.target().runtimeAgent().releaseObjectGroup('completion');
|
| - if (result && !exceptionDetails)
|
| - receivedPropertyNames.call(this, /** @type {!Object} */ (result.value));
|
| - else
|
| - fufill([]);
|
| - }
|
| -
|
| - /**
|
| - * @param {?Object} propertyNames
|
| - * @this {WebInspector.ExecutionContext}
|
| - */
|
| - function receivedPropertyNames(propertyNames) {
|
| - this.target().runtimeAgent().releaseObjectGroup('completion');
|
| - if (!propertyNames) {
|
| - fufill([]);
|
| - return;
|
| - }
|
| - var includeCommandLineAPI = (!dotNotation && !bracketNotation);
|
| - if (includeCommandLineAPI) {
|
| - const commandLineAPI = [
|
| - 'dir',
|
| - 'dirxml',
|
| - 'keys',
|
| - 'values',
|
| - 'profile',
|
| - 'profileEnd',
|
| - 'monitorEvents',
|
| - 'unmonitorEvents',
|
| - 'inspect',
|
| - 'copy',
|
| - 'clear',
|
| - 'getEventListeners',
|
| - 'debug',
|
| - 'undebug',
|
| - 'monitor',
|
| - 'unmonitor',
|
| - 'table',
|
| - '$',
|
| - '$$',
|
| - '$x'
|
| - ];
|
| - for (var i = 0; i < commandLineAPI.length; ++i)
|
| - propertyNames[commandLineAPI[i]] = true;
|
| - }
|
| - fufill(this._completionsForPrefix(
|
| - dotNotation, bracketNotation, expressionString, prefix, Object.keys(propertyNames)));
|
| - }
|
| - }
|
| -
|
| - /**
|
| - * @param {boolean} dotNotation
|
| - * @param {boolean} bracketNotation
|
| - * @param {string} expressionString
|
| - * @param {string} prefix
|
| - * @param {!Array.<string>} properties
|
| - * @return {!Array<string>}
|
| - */
|
| - _completionsForPrefix(dotNotation, bracketNotation, expressionString, prefix, properties) {
|
| - if (bracketNotation) {
|
| - if (prefix.length && prefix[0] === '\'')
|
| - var quoteUsed = '\'';
|
| - else
|
| - var quoteUsed = '"';
|
| - }
|
| -
|
| - var results = [];
|
| -
|
| - if (!expressionString) {
|
| - const keywords = [
|
| - 'break', 'case', 'catch', 'continue', 'default', 'delete', 'do', 'else', 'finally',
|
| - 'for', 'function', 'if', 'in', 'instanceof', 'new', 'return', 'switch', 'this',
|
| - 'throw', 'try', 'typeof', 'var', 'void', 'while', 'with'
|
| - ];
|
| - properties = properties.concat(keywords);
|
| - }
|
| -
|
| - properties.sort();
|
| -
|
| - for (var i = 0; i < properties.length; ++i) {
|
| - var property = properties[i];
|
| -
|
| - // Assume that all non-ASCII characters are letters and thus can be used as part of identifier.
|
| - if (dotNotation && !/^[a-zA-Z_$\u008F-\uFFFF][a-zA-Z0-9_$\u008F-\uFFFF]*$/.test(property))
|
| - continue;
|
| -
|
| - if (bracketNotation) {
|
| - if (!/^[0-9]+$/.test(property))
|
| - property = quoteUsed + property.escapeCharacters(quoteUsed + '\\') + quoteUsed;
|
| - property += ']';
|
| - }
|
| -
|
| - if (property.length < prefix.length)
|
| - continue;
|
| - if (prefix.length && !property.startsWith(prefix))
|
| - continue;
|
| -
|
| - // Substitute actual newlines with newline characters. @see crbug.com/498421
|
| - results.push(property.split('\n').join('\\n'));
|
| - }
|
| - return results;
|
| - }
|
| -
|
| - /**
|
| * @return {string}
|
| */
|
| label() {
|
|
|