diff --git a/src/browser/js/Object.zig b/src/browser/js/Object.zig index fbf036e4..13899782 100644 --- a/src/browser/js/Object.zig +++ b/src/browser/js/Object.zig @@ -152,7 +152,7 @@ pub fn getPropertyNames(self: Object) js.Array { } pub fn nameIterator(self: Object) !NameIterator { - const handle = v8.v8__Object__GetPropertyNames(self.handle, self.local.handle) orelse { + const handle = v8.v8__Object__GetOwnPropertyNames(self.handle, self.local.handle) orelse { // see getOwnPropertyNames above return error.TypeError; }; diff --git a/src/browser/js/Snapshot.zig b/src/browser/js/Snapshot.zig index 5562a73a..7da66e79 100644 --- a/src/browser/js/Snapshot.zig +++ b/src/browser/js/Snapshot.zig @@ -670,11 +670,12 @@ fn attachClass(comptime JsApi: type, isolate: *v8.Isolate, template: *const v8.F if (value.static) { v8.v8__Template__SetAccessorProperty(@ptrCast(template), js_name, getter_callback, setter_callback, attribute); } else { + const accessor_attr = if (own_properties) attribute else attribute | v8.DontEnum; v8.v8__ObjectTemplate__SetAccessorProperty__Config(prototype, &.{ .key = js_name, .getter = getter_callback, .setter = setter_callback, - .attribute = attribute, + .attribute = accessor_attr, }); } }, @@ -695,10 +696,8 @@ fn attachClass(comptime JsApi: type, isolate: *v8.Isolate, template: *const v8.F if (value.static and !own_properties) { v8.v8__Template__Set(@ptrCast(template), js_name, @ptrCast(function_template), v8.None); } else { - // For own_properties namespaces, static methods still belong - // on the instance — `CSS` is exposed as an instance via - // `window.CSS`, not as a constructor. - v8.v8__Template__Set(@ptrCast(member_template), js_name, @ptrCast(function_template), v8.None); + const fn_attr: v8.PropertyAttribute = if (own_properties) v8.None else v8.DontEnum; + v8.v8__Template__Set(@ptrCast(member_template), js_name, @ptrCast(function_template), fn_attr); } }, bridge.Indexed => { diff --git a/src/browser/tests/net/url_search_params.html b/src/browser/tests/net/url_search_params.html index a4213655..08d28ec0 100644 --- a/src/browser/tests/net/url_search_params.html +++ b/src/browser/tests/net/url_search_params.html @@ -416,6 +416,99 @@ } + + + + + + + + + + + +