@@ -14425,6 +14425,110 @@ THREADED_TEST(ProxyGetPropertyNames) {
1442514425 CheckIsSymbolAt(isolate, properties, 4, "symbol");
1442614426}
1442714427
14428+ THREADED_TEST(ProxyGetPropertyNamesWithOwnKeysTrap) {
14429+ LocalContext context;
14430+ v8::Isolate* isolate = context->GetIsolate();
14431+ v8::HandleScope scope(isolate);
14432+ v8::Local<v8::Value> result = CompileRun(
14433+ "var target = {0: 0, 1: 1, a: 2, b: 3};"
14434+ "target[2**32] = '4294967296';"
14435+ "target[2**32-1] = '4294967295';"
14436+ "target[2**32-2] = '4294967294';"
14437+ "target[Symbol('symbol')] = true;"
14438+ "target.__proto__ = {__proto__:null, 2: 4, 3: 5, c: 6, d: 7};"
14439+ "var result = new Proxy(target, { ownKeys: (t) => Reflect.ownKeys(t) });"
14440+ "result;");
14441+ v8::Local<v8::Object> object = result.As<v8::Object>();
14442+ v8::PropertyFilter default_filter =
14443+ static_cast<v8::PropertyFilter>(v8::ONLY_ENUMERABLE | v8::SKIP_SYMBOLS);
14444+ v8::PropertyFilter include_symbols_filter = v8::ONLY_ENUMERABLE;
14445+
14446+ v8::Local<v8::Array> properties =
14447+ object->GetPropertyNames(context.local()).ToLocalChecked();
14448+ const char* expected_properties1[] = {"0", "1", "4294967294", "a",
14449+ "b", "4294967296", "4294967295", "2",
14450+ "3", "c", "d"};
14451+ CheckStringArray(isolate, properties, 11, expected_properties1);
14452+
14453+ properties =
14454+ object
14455+ ->GetPropertyNames(context.local(),
14456+ v8::KeyCollectionMode::kIncludePrototypes,
14457+ default_filter, v8::IndexFilter::kIncludeIndices)
14458+ .ToLocalChecked();
14459+ CheckStringArray(isolate, properties, 11, expected_properties1);
14460+
14461+ properties = object
14462+ ->GetPropertyNames(context.local(),
14463+ v8::KeyCollectionMode::kIncludePrototypes,
14464+ include_symbols_filter,
14465+ v8::IndexFilter::kIncludeIndices)
14466+ .ToLocalChecked();
14467+ const char* expected_properties1_1[] = {
14468+ "0", "1", "4294967294", "a", "b", "4294967296",
14469+ "4294967295", nullptr, "2", "3", "c", "d"};
14470+ CheckStringArray(isolate, properties, 12, expected_properties1_1);
14471+ CheckIsSymbolAt(isolate, properties, 7, "symbol");
14472+
14473+ properties =
14474+ object
14475+ ->GetPropertyNames(context.local(),
14476+ v8::KeyCollectionMode::kIncludePrototypes,
14477+ default_filter, v8::IndexFilter::kSkipIndices)
14478+ .ToLocalChecked();
14479+ const char* expected_properties2[] = {"a", "b", "4294967296",
14480+ "4294967295", "c", "d"};
14481+ CheckStringArray(isolate, properties, 6, expected_properties2);
14482+
14483+ properties = object
14484+ ->GetPropertyNames(context.local(),
14485+ v8::KeyCollectionMode::kIncludePrototypes,
14486+ include_symbols_filter,
14487+ v8::IndexFilter::kSkipIndices)
14488+ .ToLocalChecked();
14489+ const char* expected_properties2_1[] = {
14490+ "a", "b", "4294967296", "4294967295", nullptr, "c", "d"};
14491+ CheckStringArray(isolate, properties, 7, expected_properties2_1);
14492+ CheckIsSymbolAt(isolate, properties, 4, "symbol");
14493+
14494+ properties =
14495+ object
14496+ ->GetPropertyNames(context.local(), v8::KeyCollectionMode::kOwnOnly,
14497+ default_filter, v8::IndexFilter::kIncludeIndices)
14498+ .ToLocalChecked();
14499+ const char* expected_properties3[] = {"0", "1", "4294967294", "a",
14500+ "b", "4294967296", "4294967295"};
14501+ CheckStringArray(isolate, properties, 7, expected_properties3);
14502+
14503+ properties = object
14504+ ->GetPropertyNames(
14505+ context.local(), v8::KeyCollectionMode::kOwnOnly,
14506+ include_symbols_filter, v8::IndexFilter::kIncludeIndices)
14507+ .ToLocalChecked();
14508+ const char* expected_properties3_1[] = {
14509+ "0", "1", "4294967294", "a", "b", "4294967296", "4294967295", nullptr};
14510+ CheckStringArray(isolate, properties, 8, expected_properties3_1);
14511+ CheckIsSymbolAt(isolate, properties, 7, "symbol");
14512+
14513+ properties =
14514+ object
14515+ ->GetPropertyNames(context.local(), v8::KeyCollectionMode::kOwnOnly,
14516+ default_filter, v8::IndexFilter::kSkipIndices)
14517+ .ToLocalChecked();
14518+ const char* expected_properties4[] = {"a", "b", "4294967296", "4294967295"};
14519+ CheckStringArray(isolate, properties, 4, expected_properties4);
14520+
14521+ properties = object
14522+ ->GetPropertyNames(
14523+ context.local(), v8::KeyCollectionMode::kOwnOnly,
14524+ include_symbols_filter, v8::IndexFilter::kSkipIndices)
14525+ .ToLocalChecked();
14526+ const char* expected_properties4_1[] = {"a", "b", "4294967296", "4294967295",
14527+ nullptr};
14528+ CheckStringArray(isolate, properties, 5, expected_properties4_1);
14529+ CheckIsSymbolAt(isolate, properties, 4, "symbol");
14530+ }
14531+
1442814532THREADED_TEST(AccessChecksReenabledCorrectly) {
1442914533 LocalContext context;
1443014534 v8::Isolate* isolate = context->GetIsolate();
0 commit comments