Chromium Code Reviews| 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 1f5ac6d6099e43c633ed290b3d12c2827d5ca5d3..27c6654ac05900f7b7272db5b86f7dce987913c5 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.js |
| @@ -239,6 +239,11 @@ WebInspector.RuntimeModel.prototype = { |
| { |
| var object = this.createRemoteObject(payload); |
| + if (hints.copyToClipboard) { |
| + this._copyRequested(object); |
| + return; |
| + } |
| + |
| if (object.isNode()) { |
| WebInspector.Revealer.revealPromise(object).then(object.release.bind(object)); |
| return; |
| @@ -259,10 +264,37 @@ WebInspector.RuntimeModel.prototype = { |
| return; |
| WebInspector.Revealer.reveal(response.location); |
| } |
| + object.release(); |
| + }, |
| - if (hints.copyToClipboard) |
| + /** |
| + * @param {!WebInspector.RemoteObject} object |
| + */ |
| + _copyRequested: function(object) |
| + { |
| + if (!object.objectId) { |
| InspectorFrontendHost.copyText(object.value); |
| - object.release(); |
| + return; |
| + } |
| + object.callFunctionJSON(toStringForClipboard, [ { value : object.subtype } ], InspectorFrontendHost.copyText.bind(InspectorFrontendHost)); |
| + |
| + /** |
| + * @param {string} subtype |
| + * @this {Object} |
| + * @suppressReceiverCheck |
| + */ |
| + function toStringForClipboard(subtype) |
| + { |
| + if (subtype === "node") |
|
dgozman
2016/04/27 00:25:50
Can we use object.isNode()?
kozy
2016/04/27 01:22:00
This method is called on object in page not Remote
|
| + return this.outerHTML; |
| + if (subtype && typeof this === "undefined") |
| + return subtype + ""; |
| + try { |
| + return JSON.stringify(this, null, " "); |
| + } catch (e) { |
| + return "" + this; |
| + } |
| + } |
| }, |
| __proto__: WebInspector.SDKModel.prototype |