Skip to content

Commit afcd24a

Browse files
committed
make ownPropertyKeys trap return @@toStringTag key
This fixes the failures in the “[[OwnPropertyKeys]]” subtest.
1 parent 4bafb27 commit afcd24a

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

components/script/window_named_properties.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,13 @@ use crate::dom::window::Window;
1111
use crate::js::conversions::ToJSValConvertible;
1212
use crate::script_runtime::JSContext as SafeJSContext;
1313
use js::conversions::jsstr_to_string;
14-
use js::glue::{CreateProxyHandler, NewProxyObject, ProxyTraps};
15-
use js::jsapi::{GetWellKnownSymbol, JS_SetImmutablePrototype, SymbolCode};
14+
use js::glue::{
15+
AppendToIdVector, CreateProxyHandler, NewProxyObject, ProxyTraps, RUST_SYMBOL_TO_JSID,
16+
};
17+
use js::jsapi::{
18+
jsid, GetPropertyKeys, GetWellKnownSymbol, JS_SetImmutablePrototype, SymbolCode, JSITER_HIDDEN,
19+
JSITER_OWNONLY, JSITER_SYMBOLS,
20+
};
1621
use js::jsapi::{
1722
Handle, HandleObject, JSClass, JSContext, JSErrNum, MutableHandleObject, UndefinedHandleValue,
1823
};
@@ -147,11 +152,12 @@ unsafe extern "C" fn get_own_property_descriptor(
147152

148153
#[allow(unsafe_code)]
149154
unsafe extern "C" fn own_property_keys(
150-
_cx: *mut JSContext,
155+
cx: *mut JSContext,
151156
_proxy: HandleObject,
152-
_props: MutableHandleIdVector,
157+
props: MutableHandleIdVector,
153158
) -> bool {
154-
// FIXME(pylbrecht): dummy implementation
159+
rooted!(in(cx) let mut rooted = SymbolId(GetWellKnownSymbol(cx, SymbolCode::toStringTag)));
160+
AppendToIdVector(props, rooted.handle().into());
155161
true
156162
}
157163

0 commit comments

Comments
 (0)