| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 }, | 232 }, |
| 233 | 233 |
| 234 /** | 234 /** |
| 235 * @param {!RuntimeAgent.RemoteObject} payload | 235 * @param {!RuntimeAgent.RemoteObject} payload |
| 236 * @param {!Object=} hints | 236 * @param {!Object=} hints |
| 237 */ | 237 */ |
| 238 _inspectRequested: function(payload, hints) | 238 _inspectRequested: function(payload, hints) |
| 239 { | 239 { |
| 240 var object = this.createRemoteObject(payload); | 240 var object = this.createRemoteObject(payload); |
| 241 | 241 |
| 242 if (hints.copyToClipboard) { |
| 243 this._copyRequested(object); |
| 244 return; |
| 245 } |
| 246 |
| 242 if (object.isNode()) { | 247 if (object.isNode()) { |
| 243 WebInspector.Revealer.revealPromise(object).then(object.release.bind
(object)); | 248 WebInspector.Revealer.revealPromise(object).then(object.release.bind
(object)); |
| 244 return; | 249 return; |
| 245 } | 250 } |
| 246 | 251 |
| 247 if (object.type === "function") { | 252 if (object.type === "function") { |
| 248 WebInspector.RemoteFunction.objectAsFunction(object).targetFunctionD
etails().then(didGetDetails); | 253 WebInspector.RemoteFunction.objectAsFunction(object).targetFunctionD
etails().then(didGetDetails); |
| 249 return; | 254 return; |
| 250 } | 255 } |
| 251 | 256 |
| 252 /** | 257 /** |
| 253 * @param {?WebInspector.DebuggerModel.FunctionDetails} response | 258 * @param {?WebInspector.DebuggerModel.FunctionDetails} response |
| 254 */ | 259 */ |
| 255 function didGetDetails(response) | 260 function didGetDetails(response) |
| 256 { | 261 { |
| 257 object.release(); | 262 object.release(); |
| 258 if (!response || !response.location) | 263 if (!response || !response.location) |
| 259 return; | 264 return; |
| 260 WebInspector.Revealer.reveal(response.location); | 265 WebInspector.Revealer.reveal(response.location); |
| 261 } | 266 } |
| 262 | |
| 263 if (hints.copyToClipboard) | |
| 264 InspectorFrontendHost.copyText(object.value); | |
| 265 object.release(); | 267 object.release(); |
| 266 }, | 268 }, |
| 267 | 269 |
| 270 /** |
| 271 * @param {!WebInspector.RemoteObject} object |
| 272 */ |
| 273 _copyRequested: function(object) |
| 274 { |
| 275 if (!object.objectId) { |
| 276 InspectorFrontendHost.copyText(object.value); |
| 277 return; |
| 278 } |
| 279 object.callFunctionJSON(toStringForClipboard, [ { value : object.subtype
} ], InspectorFrontendHost.copyText.bind(InspectorFrontendHost)); |
| 280 |
| 281 /** |
| 282 * @param {string} subtype |
| 283 * @this {Object} |
| 284 * @suppressReceiverCheck |
| 285 */ |
| 286 function toStringForClipboard(subtype) |
| 287 { |
| 288 if (subtype === "node") |
| 289 return this.outerHTML; |
| 290 if (subtype && typeof this === "undefined") |
| 291 return subtype + ""; |
| 292 try { |
| 293 return JSON.stringify(this, null, " "); |
| 294 } catch (e) { |
| 295 return "" + this; |
| 296 } |
| 297 } |
| 298 }, |
| 299 |
| 268 __proto__: WebInspector.SDKModel.prototype | 300 __proto__: WebInspector.SDKModel.prototype |
| 269 } | 301 } |
| 270 | 302 |
| 271 /** | 303 /** |
| 272 * @constructor | 304 * @constructor |
| 273 * @implements {RuntimeAgent.Dispatcher} | 305 * @implements {RuntimeAgent.Dispatcher} |
| 274 * @param {!WebInspector.RuntimeModel} runtimeModel | 306 * @param {!WebInspector.RuntimeModel} runtimeModel |
| 275 */ | 307 */ |
| 276 WebInspector.RuntimeDispatcher = function(runtimeModel) | 308 WebInspector.RuntimeDispatcher = function(runtimeModel) |
| 277 { | 309 { |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 /** | 813 /** |
| 782 * @param {string} listenerType | 814 * @param {string} listenerType |
| 783 */ | 815 */ |
| 784 setListenerType: function(listenerType) | 816 setListenerType: function(listenerType) |
| 785 { | 817 { |
| 786 this._listenerType = listenerType; | 818 this._listenerType = listenerType; |
| 787 }, | 819 }, |
| 788 | 820 |
| 789 __proto__: WebInspector.SDKObject.prototype | 821 __proto__: WebInspector.SDKObject.prototype |
| 790 } | 822 } |
| OLD | NEW |