| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1299 InjectedScript.RemoteObject.prototype = { | 1299 InjectedScript.RemoteObject.prototype = { |
| 1300 | 1300 |
| 1301 /** | 1301 /** |
| 1302 * @param {*} object | 1302 * @param {*} object |
| 1303 * @param {string=} objectGroupName | 1303 * @param {string=} objectGroupName |
| 1304 * @return {?RuntimeAgent.CustomPreview} | 1304 * @return {?RuntimeAgent.CustomPreview} |
| 1305 */ | 1305 */ |
| 1306 _customPreview: function(object, objectGroupName) | 1306 _customPreview: function(object, objectGroupName) |
| 1307 { | 1307 { |
| 1308 try { | 1308 try { |
| 1309 var formatter = inspectedWindow["devtoolsFormatter"]; | 1309 var formatters = inspectedWindow["devtoolsFormatters"]; |
| 1310 if (!formatter) | 1310 if (!formatters || !isArrayLike(formatters)) |
| 1311 return null; | 1311 return null; |
| 1312 | 1312 |
| 1313 var formatted = formatter.header(object); | 1313 for (var i = 0; i < formatters.length; ++i) { |
| 1314 if (!formatted) | 1314 try { |
| 1315 return null; | 1315 var formatted = formatters[i].header(object); |
| 1316 if (!formatted) |
| 1317 continue; |
| 1316 | 1318 |
| 1317 var hasBody = formatter.hasBody(object); | 1319 var hasBody = formatters[i].hasBody(object); |
| 1318 injectedScript._substituteObjectTagsInCustomPreview(objectGroupName,
formatted); | 1320 injectedScript._substituteObjectTagsInCustomPreview(objectGr
oupName, formatted); |
| 1319 return {header: JSON.stringify(formatted), hasBody: !!hasBody}; | 1321 var formatterObjectId = injectedScript._bind(formatters[i],
objectGroupName); |
| 1322 return {header: JSON.stringify(formatted), hasBody: !!hasBod
y, formatterObjectId: formatterObjectId}; |
| 1323 } catch (e) { |
| 1324 inspectedWindow.console.error("Custom Formatter Failed: " +
e); |
| 1325 } |
| 1326 } |
| 1320 } catch (e) { | 1327 } catch (e) { |
| 1321 inspectedWindow.console.error("Custom Formatter Failed: " + e); | 1328 inspectedWindow.console.error("Custom Formatter Failed: " + e); |
| 1322 return null; | |
| 1323 } | 1329 } |
| 1330 return null; |
| 1324 }, | 1331 }, |
| 1325 | 1332 |
| 1326 /** | 1333 /** |
| 1327 * @return {!RuntimeAgent.ObjectPreview} preview | 1334 * @return {!RuntimeAgent.ObjectPreview} preview |
| 1328 */ | 1335 */ |
| 1329 _createEmptyPreview: function() | 1336 _createEmptyPreview: function() |
| 1330 { | 1337 { |
| 1331 var preview = { | 1338 var preview = { |
| 1332 type: /** @type {!RuntimeAgent.ObjectPreviewType.<string>} */ (this.
type), | 1339 type: /** @type {!RuntimeAgent.ObjectPreviewType.<string>} */ (this.
type), |
| 1333 description: this.description || toStringDescription(this.value), | 1340 description: this.description || toStringDescription(this.value), |
| (...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1990 */ | 1997 */ |
| 1991 _logEvent: function(event) | 1998 _logEvent: function(event) |
| 1992 { | 1999 { |
| 1993 inspectedWindow.console.log(event.type, event); | 2000 inspectedWindow.console.log(event.type, event); |
| 1994 } | 2001 } |
| 1995 } | 2002 } |
| 1996 | 2003 |
| 1997 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); | 2004 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); |
| 1998 return injectedScript; | 2005 return injectedScript; |
| 1999 }) | 2006 }) |
| OLD | NEW |