util: isEqualBoxedPrimitive: ensure both values are actual boxed Symbols

... before trying to valueOf them

PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
Jordan Harband 2019-08-06 19:42:35 -07:00 committed by Gus Caplan
parent 6c3af76fef
commit 8fdd634517
No known key found for this signature in database
GPG Key ID: F00BD11880E82F0E

View File

@ -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