Skip to content

Commit cecfa5f

Browse files
committed
fixup: apply the review
Signed-off-by: Daeyeon Jeong [email protected]
1 parent 036ad32 commit cecfa5f

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

src/js_native_api_v8.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -2457,9 +2457,9 @@ napi_status NAPI_CDECL napi_check_object_type_tag(napi_env env,
24572457
*result =
24582458
(tag.lower == type_tag->lower && tag.upper == type_tag->upper);
24592459
} else if (size == 1) {
2460-
*result = (tag.lower == type_tag->lower);
2460+
*result = (tag.lower == type_tag->lower && 0 == type_tag->upper);
24612461
} else if (size == 0) {
2462-
*result = (type_tag->lower == 0 && type_tag->upper == 0);
2462+
*result = (0 == type_tag->lower && 0 == type_tag->upper);
24632463
}
24642464
}
24652465
}

test/js-native-api/test_object/test.js

+5
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,11 @@ assert.strictEqual(newObject.test_string, 'test string');
175175
// Verify that wrongly tagged objects are rejected.
176176
assert.strictEqual(test_object.CheckTypeTag(0, obj2), false);
177177
assert.strictEqual(test_object.CheckTypeTag(1, obj1), false);
178+
assert.strictEqual(test_object.CheckTypeTag(0, obj3), false);
179+
assert.strictEqual(test_object.CheckTypeTag(1, obj4), false);
180+
assert.strictEqual(test_object.CheckTypeTag(2, obj4), false);
181+
assert.strictEqual(test_object.CheckTypeTag(3, obj3), false);
182+
assert.strictEqual(test_object.CheckTypeTag(4, obj3), false);
178183

179184
// Verify that untagged objects are rejected.
180185
assert.strictEqual(test_object.CheckTypeTag(0, {}), false);

test/js-native-api/test_object/test_object.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -605,11 +605,12 @@ static napi_value TestSeal(napi_env env,
605605
}
606606

607607
// We create two type tags. They are basically 128-bit UUIDs.
608-
static const napi_type_tag type_tags[4] = {
608+
static const napi_type_tag type_tags[5] = {
609609
{ 0xdaf987b3cc62481a, 0xb745b0497f299531 },
610610
{ 0xbb7936c374084d9b, 0xa9548d0762eeedb9 },
611611
{ 0xa5ed9ce2e4c00c38, 0 },
612612
{ 0, 0 },
613+
{ 0xa5ed9ce2e4c00c38, 0xdaf987b3cc62481a },
613614
};
614615

615616
static napi_value

0 commit comments

Comments
 (0)