Skip to content

Commit

Permalink
index: try/catch the Object.getOwnPropertyNames() call
Browse files Browse the repository at this point in the history
There is a possibility that this function may throw when given a native
host object
  • Loading branch information
TooTallNate committed Feb 18, 2014
1 parent 29aaab6 commit a7602ec
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,12 @@ function formatValue(ctx, value, recurseTimes) {
var keys = objectKeys(value);
var visibleKeys = arrayToHash(keys);

if (ctx.showHidden && Object.getOwnPropertyNames) {
keys = Object.getOwnPropertyNames(value);
try {
if (ctx.showHidden && Object.getOwnPropertyNames) {
keys = Object.getOwnPropertyNames(value);
}
} catch (e) {
// ignore
}

// IE doesn't make error fields non-enumerable
Expand Down

0 comments on commit a7602ec

Please sign in to comment.