Skip to content

Commit

Permalink
util: isEqualBoxedPrimitive: ensure both values are actual boxed Symbols
Browse files Browse the repository at this point in the history
... before trying to valueOf them

PR-URL: #29029
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
ljharb authored and targos committed Aug 19, 2019
1 parent 8426077 commit 112ec73
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/internal/util/comparisons.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,11 @@ function isEqualBoxedPrimitive(val1, val2) {
return isBigIntObject(val2) &&
BigIntPrototype.valueOf(val1) === BigIntPrototype.valueOf(val2);
}
return isSymbolObject(val2) &&
SymbolPrototype.valueOf(val1) === SymbolPrototype.valueOf(val2);
if (isSymbolObject(val1)) {
return isSymbolObject(val2) &&
SymbolPrototype.valueOf(val1) === SymbolPrototype.valueOf(val2);
}
return false;
}

// Notes: Type tags are historical [[Class]] properties that can be set by
Expand Down

0 comments on commit 112ec73

Please sign in to comment.