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 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 | 966 |
967 /** | 967 /** |
968 * @param {*} obj | 968 * @param {*} obj |
969 * @return {string?} | 969 * @return {string?} |
970 */ | 970 */ |
971 _describe: function(obj) | 971 _describe: function(obj) |
972 { | 972 { |
973 if (this.isPrimitiveValue(obj)) | 973 if (this.isPrimitiveValue(obj)) |
974 return null; | 974 return null; |
975 | 975 |
976 // Type is object, get subtype. | 976 var type = typeof obj; |
977 var subtype = this._subtype(obj); | 977 var subtype = this._subtype(obj); |
978 | 978 |
979 if (subtype === "regexp") | 979 if (subtype === "regexp") |
980 return toString(obj); | 980 return toString(obj); |
981 | 981 |
982 if (subtype === "date") | 982 if (subtype === "date") |
983 return toString(obj); | 983 return toString(obj); |
984 | 984 |
985 if (subtype === "node") { | 985 if (subtype === "node") { |
986 var description = obj.nodeName.toLowerCase(); | 986 var description = obj.nodeName.toLowerCase(); |
(...skipping 11 matching lines...) Expand all Loading... |
998 } | 998 } |
999 | 999 |
1000 var className = InjectedScriptHost.internalConstructorName(obj); | 1000 var className = InjectedScriptHost.internalConstructorName(obj); |
1001 if (subtype === "array") { | 1001 if (subtype === "array") { |
1002 if (typeof obj.length === "number") | 1002 if (typeof obj.length === "number") |
1003 className += "[" + obj.length + "]"; | 1003 className += "[" + obj.length + "]"; |
1004 return className; | 1004 return className; |
1005 } | 1005 } |
1006 | 1006 |
1007 // NodeList in JSC is a function, check for array prior to this. | 1007 // NodeList in JSC is a function, check for array prior to this. |
1008 if (typeof obj === "function") | 1008 if (type === "function") |
1009 return toString(obj); | 1009 return toString(obj); |
1010 | 1010 |
1011 if (typeof obj === "symbol") { | 1011 if (type === "symbol") { |
1012 try { | 1012 try { |
1013 return Symbol.prototype.toString.call(obj) || "Symbol"; | 1013 return Symbol.prototype.toString.call(obj) || "Symbol"; |
1014 } catch (e) { | 1014 } catch (e) { |
1015 return "Symbol"; | 1015 return "Symbol"; |
1016 } | 1016 } |
1017 } | 1017 } |
1018 | 1018 |
1019 if (className === "Object") { | 1019 if (className === "Object") { |
1020 // In Chromium DOM wrapper prototypes will have Object as their cons
tructor name, | 1020 // In Chromium DOM wrapper prototypes will have Object as their cons
tructor name, |
1021 // get the real DOM wrapper name from the constructor property. | 1021 // get the real DOM wrapper name from the constructor property. |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1629 */ | 1629 */ |
1630 _logEvent: function(event) | 1630 _logEvent: function(event) |
1631 { | 1631 { |
1632 inspectedWindow.console.log(event.type, event); | 1632 inspectedWindow.console.log(event.type, event); |
1633 } | 1633 } |
1634 } | 1634 } |
1635 | 1635 |
1636 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); | 1636 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); |
1637 return injectedScript; | 1637 return injectedScript; |
1638 }) | 1638 }) |
OLD | NEW |