@@ -14636,6 +14636,110 @@ THREADED_TEST(ProxyGetPropertyNames) {
14636
14636
CheckIsSymbolAt(isolate, properties, 4, "symbol");
14637
14637
}
14638
14638
14639
+ THREADED_TEST(ProxyGetPropertyNamesWithOwnKeysTrap) {
14640
+ LocalContext context;
14641
+ v8::Isolate* isolate = context->GetIsolate();
14642
+ v8::HandleScope scope(isolate);
14643
+ v8::Local<v8::Value> result = CompileRun(
14644
+ "var target = {0: 0, 1: 1, a: 2, b: 3};"
14645
+ "target[2**32] = '4294967296';"
14646
+ "target[2**32-1] = '4294967295';"
14647
+ "target[2**32-2] = '4294967294';"
14648
+ "target[Symbol('symbol')] = true;"
14649
+ "target.__proto__ = {__proto__:null, 2: 4, 3: 5, c: 6, d: 7};"
14650
+ "var result = new Proxy(target, { ownKeys: (t) => Reflect.ownKeys(t) });"
14651
+ "result;");
14652
+ v8::Local<v8::Object> object = result.As<v8::Object>();
14653
+ v8::PropertyFilter default_filter =
14654
+ static_cast<v8::PropertyFilter>(v8::ONLY_ENUMERABLE | v8::SKIP_SYMBOLS);
14655
+ v8::PropertyFilter include_symbols_filter = v8::ONLY_ENUMERABLE;
14656
+
14657
+ v8::Local<v8::Array> properties =
14658
+ object->GetPropertyNames(context.local()).ToLocalChecked();
14659
+ const char* expected_properties1[] = {"0", "1", "4294967294", "a",
14660
+ "b", "4294967296", "4294967295", "2",
14661
+ "3", "c", "d"};
14662
+ CheckStringArray(isolate, properties, 11, expected_properties1);
14663
+
14664
+ properties =
14665
+ object
14666
+ ->GetPropertyNames(context.local(),
14667
+ v8::KeyCollectionMode::kIncludePrototypes,
14668
+ default_filter, v8::IndexFilter::kIncludeIndices)
14669
+ .ToLocalChecked();
14670
+ CheckStringArray(isolate, properties, 11, expected_properties1);
14671
+
14672
+ properties = object
14673
+ ->GetPropertyNames(context.local(),
14674
+ v8::KeyCollectionMode::kIncludePrototypes,
14675
+ include_symbols_filter,
14676
+ v8::IndexFilter::kIncludeIndices)
14677
+ .ToLocalChecked();
14678
+ const char* expected_properties1_1[] = {
14679
+ "0", "1", "4294967294", "a", "b", "4294967296",
14680
+ "4294967295", nullptr, "2", "3", "c", "d"};
14681
+ CheckStringArray(isolate, properties, 12, expected_properties1_1);
14682
+ CheckIsSymbolAt(isolate, properties, 7, "symbol");
14683
+
14684
+ properties =
14685
+ object
14686
+ ->GetPropertyNames(context.local(),
14687
+ v8::KeyCollectionMode::kIncludePrototypes,
14688
+ default_filter, v8::IndexFilter::kSkipIndices)
14689
+ .ToLocalChecked();
14690
+ const char* expected_properties2[] = {"a", "b", "4294967296",
14691
+ "4294967295", "c", "d"};
14692
+ CheckStringArray(isolate, properties, 6, expected_properties2);
14693
+
14694
+ properties = object
14695
+ ->GetPropertyNames(context.local(),
14696
+ v8::KeyCollectionMode::kIncludePrototypes,
14697
+ include_symbols_filter,
14698
+ v8::IndexFilter::kSkipIndices)
14699
+ .ToLocalChecked();
14700
+ const char* expected_properties2_1[] = {
14701
+ "a", "b", "4294967296", "4294967295", nullptr, "c", "d"};
14702
+ CheckStringArray(isolate, properties, 7, expected_properties2_1);
14703
+ CheckIsSymbolAt(isolate, properties, 4, "symbol");
14704
+
14705
+ properties =
14706
+ object
14707
+ ->GetPropertyNames(context.local(), v8::KeyCollectionMode::kOwnOnly,
14708
+ default_filter, v8::IndexFilter::kIncludeIndices)
14709
+ .ToLocalChecked();
14710
+ const char* expected_properties3[] = {"0", "1", "4294967294", "a",
14711
+ "b", "4294967296", "4294967295"};
14712
+ CheckStringArray(isolate, properties, 7, expected_properties3);
14713
+
14714
+ properties = object
14715
+ ->GetPropertyNames(
14716
+ context.local(), v8::KeyCollectionMode::kOwnOnly,
14717
+ include_symbols_filter, v8::IndexFilter::kIncludeIndices)
14718
+ .ToLocalChecked();
14719
+ const char* expected_properties3_1[] = {
14720
+ "0", "1", "4294967294", "a", "b", "4294967296", "4294967295", nullptr};
14721
+ CheckStringArray(isolate, properties, 8, expected_properties3_1);
14722
+ CheckIsSymbolAt(isolate, properties, 7, "symbol");
14723
+
14724
+ properties =
14725
+ object
14726
+ ->GetPropertyNames(context.local(), v8::KeyCollectionMode::kOwnOnly,
14727
+ default_filter, v8::IndexFilter::kSkipIndices)
14728
+ .ToLocalChecked();
14729
+ const char* expected_properties4[] = {"a", "b", "4294967296", "4294967295"};
14730
+ CheckStringArray(isolate, properties, 4, expected_properties4);
14731
+
14732
+ properties = object
14733
+ ->GetPropertyNames(
14734
+ context.local(), v8::KeyCollectionMode::kOwnOnly,
14735
+ include_symbols_filter, v8::IndexFilter::kSkipIndices)
14736
+ .ToLocalChecked();
14737
+ const char* expected_properties4_1[] = {"a", "b", "4294967296", "4294967295",
14738
+ nullptr};
14739
+ CheckStringArray(isolate, properties, 5, expected_properties4_1);
14740
+ CheckIsSymbolAt(isolate, properties, 4, "symbol");
14741
+ }
14742
+
14639
14743
THREADED_TEST(AccessChecksReenabledCorrectly) {
14640
14744
LocalContext context;
14641
14745
v8::Isolate* isolate = context->GetIsolate();
0 commit comments