Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/sdk/RemoteObject.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/RemoteObject.js b/third_party/WebKit/Source/devtools/front_end/sdk/RemoteObject.js |
| index f3ffecd8973d23b97a3dceefec10586579183be5..0a8fd1581c868ac0d6d94b8a469ca7c8a241508e 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/sdk/RemoteObject.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/sdk/RemoteObject.js |
| @@ -95,29 +95,7 @@ WebInspector.RemoteObject.prototype = { |
| */ |
| getOwnPropertiesPromise: function() |
| { |
| - return new Promise(promiseConstructor.bind(this)); |
| - |
| - /** |
| - * @param {function(!{properties: ?Array.<!WebInspector.RemoteObjectProperty>, internalProperties: ?Array.<!WebInspector.RemoteObjectProperty>})} success |
| - * @this {WebInspector.RemoteObject} |
| - */ |
| - function promiseConstructor(success) |
| - { |
| - this.getOwnProperties(getOwnPropertiesCallback.bind(null, success)); |
| - } |
| - |
| - /** |
| - * @param {function(!{properties: ?Array.<!WebInspector.RemoteObjectProperty>, internalProperties: ?Array.<!WebInspector.RemoteObjectProperty>})} callback |
| - * @param {?Array.<!WebInspector.RemoteObjectProperty>} properties |
| - * @param {?Array.<!WebInspector.RemoteObjectProperty>} internalProperties |
| - */ |
| - function getOwnPropertiesCallback(callback, properties, internalProperties) |
| - { |
| - callback({ |
| - properties: properties, |
| - internalProperties: internalProperties |
| - }); |
| - } |
| + return new Promise((fulfill) => this.getOwnProperties((properties, internalProperties) => fulfill({ properties: properties, internalProperties: internalProperties }))); |
|
lushnikov
2016/08/11 00:55:44
drop ()
lets' not nest arrow functions - looks fu
kozy
2016/08/13 00:11:36
Done.
|
| }, |
| /** |
| @@ -135,29 +113,7 @@ WebInspector.RemoteObject.prototype = { |
| */ |
| getAllPropertiesPromise: function(accessorPropertiesOnly) |
| { |
| - return new Promise(promiseConstructor.bind(this)); |
| - |
| - /** |
| - * @param {function(!{properties: ?Array<!WebInspector.RemoteObjectProperty>, internalProperties: ?Array.<!WebInspector.RemoteObjectProperty>})} success |
| - * @this {WebInspector.RemoteObject} |
| - */ |
| - function promiseConstructor(success) |
| - { |
| - this.getAllProperties(accessorPropertiesOnly, getAllPropertiesCallback.bind(null, success)); |
| - } |
| - |
| - /** |
| - * @param {function(!{properties: ?Array<!WebInspector.RemoteObjectProperty>, internalProperties: ?Array<!WebInspector.RemoteObjectProperty>})} callback |
| - * @param {?Array<!WebInspector.RemoteObjectProperty>} properties |
| - * @param {?Array<!WebInspector.RemoteObjectProperty>} internalProperties |
| - */ |
| - function getAllPropertiesCallback(callback, properties, internalProperties) |
| - { |
| - callback({ |
| - properties: properties, |
| - internalProperties: internalProperties |
| - }); |
| - } |
| + return new Promise((fulfill) => this.getAllProperties(accessorPropertiesOnly, (properties, internalProperties) => fulfill({ properties: properties, internalProperties: internalProperties }))); |
| }, |
| /** |
| @@ -204,29 +160,7 @@ WebInspector.RemoteObject.prototype = { |
| */ |
| callFunctionPromise: function(functionDeclaration, args) |
| { |
| - return new Promise(promiseConstructor.bind(this)); |
| - |
| - /** |
| - * @param {function(!WebInspector.CallFunctionResult)} success |
| - * @this {WebInspector.RemoteObject} |
| - */ |
| - function promiseConstructor(success) |
| - { |
| - this.callFunction(functionDeclaration, args, callFunctionCallback.bind(null, success)); |
| - } |
| - |
| - /** |
| - * @param {function(!WebInspector.CallFunctionResult)} callback |
| - * @param {?WebInspector.RemoteObject} object |
| - * @param {boolean=} wasThrown |
| - */ |
| - function callFunctionCallback(callback, object, wasThrown) |
| - { |
| - callback({ |
| - object: object, |
| - wasThrown: wasThrown |
| - }); |
| - } |
| + return new Promise((fulfill) => this.callFunction(functionDeclaration, args, (object, wasThrown) => fulfill({ object: object, wasThrown: wasThrown }))); |
|
lushnikov
2016/08/11 00:55:44
ditto
kozy
2016/08/13 00:11:36
Done.
|
| }, |
| /** |
| @@ -248,15 +182,7 @@ WebInspector.RemoteObject.prototype = { |
| */ |
| callFunctionJSONPromise: function(functionDeclaration, args) |
| { |
| - return new Promise(promiseConstructor.bind(this)); |
| - |
| - /** |
| - * @this {WebInspector.RemoteObject} |
| - */ |
| - function promiseConstructor(success) |
| - { |
| - this.callFunctionJSON(functionDeclaration, args, success); |
| - } |
| + return new Promise((fulfill) => this.callFunctionJSON(functionDeclaration, args, fulfill)); |
| }, |
| /** |
| @@ -394,7 +320,9 @@ WebInspector.RemoteObjectImpl = function(target, objectId, type, subtype, value, |
| this._preview = preview; |
| } else { |
| // Primitive or null object. |
| - this._description = description || (value + ""); |
| + this._description = description; |
| + if (!this._description && (typeof value !== "object" || value === null)) |
| + this._description = value + ""; |
| this._hasChildren = false; |
| if (typeof unserializableValue !== "undefined") { |
| this._unserializableValue = unserializableValue; |