Commit bf5f2b59 authored by jkummerow's avatar jkummerow Committed by Commit bot

[tools] Fix detect-builtins.js

- include non-default prototypes (useful for TypedArrays)
- print value of string/number properties (avoids endless recursion)

Review-Url: https://codereview.chromium.org/2048593004
Cr-Commit-Position: refs/heads/master@{#36849}
parent 6a5d769b
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
} }
// Avoid endless recursion. // Avoid endless recursion.
if (this_name === "prototype" && name === "constructor") continue; if (this_name === "prototype" && name === "constructor") continue;
// Avoid needless duplication.
if (this_name === "__PROTO__" && name === "constructor") continue;
// Could get this from the parent, but having it locally is easier. // Could get this from the parent, but having it locally is easier.
var property = { "name": name }; var property = { "name": name };
try { try {
...@@ -39,9 +41,18 @@ ...@@ -39,9 +41,18 @@
property.length = value.length; property.length = value.length;
property.prototype = GetProperties("prototype", value.prototype); property.prototype = GetProperties("prototype", value.prototype);
} }
if (type === "string" || type === "number") {
property.value = value;
} else {
property.properties = GetProperties(name, value); property.properties = GetProperties(name, value);
}
result[name] = property; result[name] = property;
} }
// Print the __proto__ if it's not the default Object prototype.
if (typeof object === "object" && object.__proto__ !== null &&
!object.__proto__.hasOwnProperty("__proto__")) {
result.__PROTO__ = GetProperties("__PROTO__", object.__proto__);
}
return result; return result;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment