| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 * @template T | 133 * @template T |
| 134 */ | 134 */ |
| 135 function nullifyObjectProto(obj) | 135 function nullifyObjectProto(obj) |
| 136 { | 136 { |
| 137 if (obj && typeof obj === "object") | 137 if (obj && typeof obj === "object") |
| 138 obj.__proto__ = null; | 138 obj.__proto__ = null; |
| 139 return obj; | 139 return obj; |
| 140 } | 140 } |
| 141 | 141 |
| 142 /** | 142 /** |
| 143 * @param {*} obj |
| 144 * @return {boolean} |
| 145 */ |
| 146 function isUInt32(obj) |
| 147 { |
| 148 return typeof obj === "number" && obj >>> 0 === obj && (obj > 0 || 1 / obj >
0); |
| 149 } |
| 150 |
| 151 /** |
| 143 * FireBug's array detection. | 152 * FireBug's array detection. |
| 144 * @param {*} obj | 153 * @param {*} obj |
| 145 * @return {boolean} | 154 * @return {boolean} |
| 146 */ | 155 */ |
| 147 function isArrayLike(obj) | 156 function isArrayLike(obj) |
| 148 { | 157 { |
| 149 try { | 158 try { |
| 150 if (typeof obj !== "object") | 159 if (typeof obj !== "object") |
| 151 return false; | 160 return false; |
| 152 if (typeof obj.splice === "function") | 161 if (typeof obj.splice === "function") |
| 153 return isFinite(obj.length); | 162 return isUInt32(obj.length); |
| 154 var str = InjectedScriptHost.callFunction(Object.prototype.toString, obj
); | 163 var str = InjectedScriptHost.callFunction(Object.prototype.toString, obj
); |
| 155 if (str === "[object Arguments]") | 164 if (str === "[object Arguments]") |
| 156 return isFinite(obj.length); | 165 return isUInt32(obj.length); |
| 157 } catch (e) { | 166 } catch (e) { |
| 158 } | 167 } |
| 159 return false; | 168 return false; |
| 160 } | 169 } |
| 161 | 170 |
| 162 /** | 171 /** |
| 163 * @param {number} a | 172 * @param {number} a |
| 164 * @param {number} b | 173 * @param {number} b |
| 165 * @return {number} | 174 * @return {number} |
| 166 */ | 175 */ |
| (...skipping 1527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1694 */ | 1703 */ |
| 1695 _logEvent: function(event) | 1704 _logEvent: function(event) |
| 1696 { | 1705 { |
| 1697 inspectedWindow.console.log(event.type, event); | 1706 inspectedWindow.console.log(event.type, event); |
| 1698 } | 1707 } |
| 1699 } | 1708 } |
| 1700 | 1709 |
| 1701 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); | 1710 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); |
| 1702 return injectedScript; | 1711 return injectedScript; |
| 1703 }) | 1712 }) |
| OLD | NEW |