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