Index: Source/core/inspector/InjectedScriptSource.js |
diff --git a/Source/core/inspector/InjectedScriptSource.js b/Source/core/inspector/InjectedScriptSource.js |
index 6897dcfb408b1149ab35f57eb4d9776580e3a428..e8dcf1457cb4b90d83cfcfee94878922cc23e5cc 100644 |
--- a/Source/core/inspector/InjectedScriptSource.js |
+++ b/Source/core/inspector/InjectedScriptSource.js |
@@ -111,6 +111,30 @@ function nullifyObjectProto(obj) |
} |
/** |
+ * FireBug's array detection. |
+ * @param {*} obj |
+ * @return {boolean} |
+ */ |
+function isArrayLike(obj) |
+{ |
+ try { |
+ if (typeof obj !== "object") |
+ return false; |
+ if (typeof obj.splice === "function") |
+ return isFinite(obj.length); |
+ var str = Object.prototype.toString.call(obj); |
+ if (str === "[object Array]" || |
+ str === "[object Arguments]" || |
+ str === "[object HTMLCollection]" || |
+ str === "[object NodeList]" || |
+ str === "[object DOMTokenList]") |
+ return isFinite(obj.length); |
+ } catch (e) { |
+ } |
+ return false; |
+} |
+ |
+/** |
* @constructor |
*/ |
var InjectedScript = function() |
@@ -893,14 +917,8 @@ InjectedScript.prototype = { |
if (preciseType) |
return preciseType; |
- // FireBug's array detection. |
- try { |
- if (typeof obj.splice === "function" && isFinite(obj.length)) |
- return "array"; |
- if (Object.prototype.toString.call(obj) === "[object Arguments]" && isFinite(obj.length)) // arguments. |
- return "array"; |
- } catch (e) { |
- } |
+ if (isArrayLike(obj)) |
+ return "array"; |
// If owning frame has navigated to somewhere else window properties will be undefined. |
return null; |