Skip to content

Commit

Permalink
fix: make OrdinarySetPrototypeOf use correct function (#67)
Browse files Browse the repository at this point in the history
It was incorrectly using SameValueNonNumber before instead of SameValue.
  • Loading branch information
sno2 authored Nov 24, 2023
1 parent 641ba69 commit 1a079bc
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions nova_vm/src/ecmascript/builtins/ordinary.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::ecmascript::{
abstract_operations::{
operations_on_objects::{get, get_function_realm},
testing_and_comparison::{same_value, same_value_non_number},
testing_and_comparison::same_value,
},
execution::{Agent, JsResult, ProtoIntrinsics},
types::{
Expand Down Expand Up @@ -125,7 +125,7 @@ pub(crate) fn ordinary_set_prototype_of_check_loop(
// i. Set done to true.

// b. Else if SameValue(p, O) is true, then
if same_value_non_number(agent, p_inner, o) {
if same_value(agent, p_inner, o) {
// i. Return false.
return false;
}
Expand Down Expand Up @@ -158,9 +158,7 @@ pub(crate) fn ordinary_set_prototype_of(

// 2. If SameValue(V, current) is true, return true.
match (prototype, current) {
(Some(prototype), Some(current)) if same_value_non_number(agent, prototype, current) => {
return true
}
(Some(prototype), Some(current)) if same_value(agent, prototype, current) => return true,
(None, None) => return true,
_ => {}
}
Expand Down

0 comments on commit 1a079bc

Please sign in to comment.