Chromium Code Reviews| 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 164 | 164 |
| 165 /** | 165 /** |
| 166 * @param {!Object} object | 166 * @param {!Object} object |
| 167 * @param {string} attribute | 167 * @param {string} attribute |
| 168 * @return {boolean} | 168 * @return {boolean} |
| 169 */ | 169 */ |
| 170 function doesAttributeHaveObservableSideEffectOnGet(object, attribute) | 170 function doesAttributeHaveObservableSideEffectOnGet(object, attribute) |
| 171 { | 171 { |
| 172 for (var interfaceName in domAttributesWithObservableSideEffectOnGet) { | 172 for (var interfaceName in domAttributesWithObservableSideEffectOnGet) { |
| 173 var interfaceFunction = inspectedGlobalObject[interfaceName]; | 173 var interfaceFunction = inspectedGlobalObject[interfaceName]; |
| 174 var isInstance = typeof interfaceFunction === "function" && object insta nceof interfaceFunction; | 174 var isInstance = typeof interfaceFunction === "function" && /* suppressB lacklist */ object instanceof interfaceFunction; |
| 175 if (isInstance) | 175 if (isInstance) |
| 176 return attribute in domAttributesWithObservableSideEffectOnGet[inter faceName]; | 176 return attribute in domAttributesWithObservableSideEffectOnGet[inter faceName]; |
| 177 } | 177 } |
| 178 return false; | 178 return false; |
| 179 } | 179 } |
| 180 | 180 |
| 181 /** | 181 /** |
| 182 * @constructor | 182 * @constructor |
| 183 */ | 183 */ |
| 184 var InjectedScript = function() | 184 var InjectedScript = function() |
| 185 { | 185 { |
| 186 } | 186 } |
| 187 | 187 |
| 188 /** | 188 /** |
| 189 * @type {!Object.<string, boolean>} | 189 * @type {!Object.<string, boolean>} |
| 190 * @const | 190 * @const |
| 191 */ | 191 */ |
| 192 InjectedScript.primitiveTypes = { | 192 InjectedScript.primitiveTypes = { |
| 193 "undefined": true, | 193 "undefined": true, |
| 194 "boolean": true, | 194 "boolean": true, |
| 195 "number": true, | 195 "number": true, |
| 196 "string": true, | 196 "string": true, |
| 197 __proto__: null | 197 __proto__: null |
| 198 } | 198 } |
| 199 | 199 |
| 200 /** | 200 /** |
| 201 * @type {!Map<string, string>} | 201 * @type {!Object<string, string>} |
| 202 * @const | 202 * @const |
| 203 */ | 203 */ |
| 204 InjectedScript.closureTypes = new Map([ | 204 InjectedScript.closureTypes = {}; |
|
dgozman
2016/08/10 16:48:36
__proto__: null
kozy
2016/08/10 17:02:43
Done.
| |
| 205 ["local", "Local"], | 205 InjectedScript.closureTypes["local"] = "Local"; |
| 206 ["closure", "Closure"], | 206 InjectedScript.closureTypes["closure"] = "Closure"; |
| 207 ["catch", "Catch"], | 207 InjectedScript.closureTypes["catch"] = "Catch"; |
| 208 ["block", "Block"], | 208 InjectedScript.closureTypes["block"] = "Block"; |
| 209 ["script", "Script"], | 209 InjectedScript.closureTypes["script"] = "Script"; |
| 210 ["with", "With Block"], | 210 InjectedScript.closureTypes["with"] = "With Block"; |
| 211 ["global", "Global"] | 211 InjectedScript.closureTypes["global"] = "Global"; |
| 212 ]); | |
| 213 | 212 |
| 214 InjectedScript.prototype = { | 213 InjectedScript.prototype = { |
| 215 /** | 214 /** |
| 216 * @param {*} object | 215 * @param {*} object |
| 217 * @return {boolean} | 216 * @return {boolean} |
| 218 */ | 217 */ |
| 219 isPrimitiveValue: function(object) | 218 isPrimitiveValue: function(object) |
| 220 { | 219 { |
| 221 // FIXME(33716): typeof document.all is always 'undefined'. | 220 // FIXME(33716): typeof document.all is always 'undefined'. |
| 222 return InjectedScript.primitiveTypes[typeof object] && !this._isHTMLAllC ollection(object); | 221 return InjectedScript.primitiveTypes[typeof object] && !this._isHTMLAllC ollection(object); |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 630 if (typeof obj.length === "number") | 629 if (typeof obj.length === "number") |
| 631 className += "[" + obj.length + "]"; | 630 className += "[" + obj.length + "]"; |
| 632 return className; | 631 return className; |
| 633 } | 632 } |
| 634 | 633 |
| 635 if (typeof obj === "function") | 634 if (typeof obj === "function") |
| 636 return toString(obj); | 635 return toString(obj); |
| 637 | 636 |
| 638 if (isSymbol(obj)) { | 637 if (isSymbol(obj)) { |
| 639 try { | 638 try { |
| 640 return obj.toString() || "Symbol"; | 639 return /* suppressBlacklist */ obj.toString() || "Symbol"; |
| 641 } catch (e) { | 640 } catch (e) { |
| 642 return "Symbol"; | 641 return "Symbol"; |
| 643 } | 642 } |
| 644 } | 643 } |
| 645 | 644 |
| 646 if (InjectedScriptHost.subtype(obj) === "error") { | 645 if (InjectedScriptHost.subtype(obj) === "error") { |
| 647 try { | 646 try { |
| 648 var stack = obj.stack; | 647 var stack = obj.stack; |
| 649 var message = obj.message && obj.message.length ? ": " + obj.mes sage : ""; | 648 var message = obj.message && obj.message.length ? ": " + obj.mes sage : ""; |
| 650 var firstCallFrame = /^\s+at\s/m.exec(stack); | 649 var firstCallFrame = /^\s+at\s/m.exec(stack); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 661 if (subtype === "internal#entry") { | 660 if (subtype === "internal#entry") { |
| 662 if ("key" in obj) | 661 if ("key" in obj) |
| 663 return "{" + this._describeIncludingPrimitives(obj.key) + " => " + this._describeIncludingPrimitives(obj.value) + "}"; | 662 return "{" + this._describeIncludingPrimitives(obj.key) + " => " + this._describeIncludingPrimitives(obj.value) + "}"; |
| 664 return this._describeIncludingPrimitives(obj.value); | 663 return this._describeIncludingPrimitives(obj.value); |
| 665 } | 664 } |
| 666 | 665 |
| 667 if (subtype === "internal#scopeList") | 666 if (subtype === "internal#scopeList") |
| 668 return "Scopes[" + obj.length + "]"; | 667 return "Scopes[" + obj.length + "]"; |
| 669 | 668 |
| 670 if (subtype === "internal#scope") | 669 if (subtype === "internal#scope") |
| 671 return (InjectedScript.closureTypes.get(obj.type) || "Unknown") + (o bj.name ? " (" + obj.name + ")" : ""); | 670 return (InjectedScript.closureTypes[obj.type] || "Unknown") + (obj.n ame ? " (" + obj.name + ")" : ""); |
| 672 | 671 |
| 673 return className; | 672 return className; |
| 674 }, | 673 }, |
| 675 | 674 |
| 676 /** | 675 /** |
| 677 * @param {*} value | 676 * @param {*} value |
| 678 * @return {string} | 677 * @return {string} |
| 679 */ | 678 */ |
| 680 _describeIncludingPrimitives: function(value) | 679 _describeIncludingPrimitives: function(value) |
| 681 { | 680 { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 786 * @param {*=} customObjectConfig | 785 * @param {*=} customObjectConfig |
| 787 * @return {?RuntimeAgent.CustomPreview} | 786 * @return {?RuntimeAgent.CustomPreview} |
| 788 */ | 787 */ |
| 789 _customPreview: function(object, objectGroupName, customObjectConfig) | 788 _customPreview: function(object, objectGroupName, customObjectConfig) |
| 790 { | 789 { |
| 791 /** | 790 /** |
| 792 * @param {!Error} error | 791 * @param {!Error} error |
| 793 */ | 792 */ |
| 794 function logError(error) | 793 function logError(error) |
| 795 { | 794 { |
| 796 Promise.resolve().then(inspectedGlobalObject.console.error.bind(insp ectedGlobalObject.console, "Custom Formatter Failed: " + error.message)); | 795 Promise.resolve().then(/* suppressBlacklist */ inspectedGlobalObject .console.error.bind(inspectedGlobalObject.console, "Custom Formatter Failed: " + error.message)); |
| 797 } | 796 } |
| 798 | 797 |
| 799 /** | 798 /** |
| 800 * @suppressReceiverCheck | 799 * @suppressReceiverCheck |
| 801 * @param {*} object | 800 * @param {*} object |
| 802 * @param {*=} customObjectConfig | 801 * @param {*=} customObjectConfig |
| 803 * @return {*} | 802 * @return {*} |
| 804 */ | 803 */ |
| 805 function wrap(object, customObjectConfig) | 804 function wrap(object, customObjectConfig) |
| 806 { | 805 { |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1065 return string.substr(0, leftHalf) + "\u2026" + string.substr(string. length - rightHalf, rightHalf); | 1064 return string.substr(0, leftHalf) + "\u2026" + string.substr(string. length - rightHalf, rightHalf); |
| 1066 } | 1065 } |
| 1067 return string.substr(0, maxLength) + "\u2026"; | 1066 return string.substr(0, maxLength) + "\u2026"; |
| 1068 }, | 1067 }, |
| 1069 | 1068 |
| 1070 __proto__: null | 1069 __proto__: null |
| 1071 } | 1070 } |
| 1072 | 1071 |
| 1073 return injectedScript; | 1072 return injectedScript; |
| 1074 }) | 1073 }) |
| OLD | NEW |