@@ -1886,7 +1886,7 @@ def __init__(self, descriptor, name, static, unforgeable, crossorigin=False):
18861886 "name" : m .identifier .name ,
18871887 "attr" : m ,
18881888 "flags" : "JSPROP_ENUMERATE" ,
1889- "is_accessor " : "true " ,
1889+ "kind " : "JSPropertySpec_Kind::NativeAccessor " ,
18901890 }
18911891 for m in descriptor .interface .members if
18921892 m .isAttr () and m .isStatic () == static
@@ -1906,7 +1906,7 @@ def __init__(self, descriptor, name, static, unforgeable, crossorigin=False):
19061906 "name" : "@@toStringTag" ,
19071907 "attr" : None ,
19081908 "flags" : "JSPROP_READONLY" ,
1909- "is_accessor " : "false " ,
1909+ "kind " : "JSPropertySpec_Kind::Value " ,
19101910 })
19111911
19121912 def generateArray (self , array , name ):
@@ -1963,21 +1963,21 @@ def condition(m, d):
19631963
19641964 def specData (attr ):
19651965 if attr ["name" ] == "@@toStringTag" :
1966- return (attr ["name" ][2 :], attr ["flags" ], attr ["is_accessor " ],
1966+ return (attr ["name" ][2 :], attr ["flags" ], attr ["kind " ],
19671967 str_to_const_array (self .descriptor .interface .getClassName ()))
19681968
19691969 flags = attr ["flags" ]
19701970 if self .unforgeable :
19711971 flags += " | JSPROP_PERMANENT"
1972- return (str_to_const_array (attr ["attr" ].identifier .name ), flags , attr ["is_accessor " ], getter (attr ),
1972+ return (str_to_const_array (attr ["attr" ].identifier .name ), flags , attr ["kind " ], getter (attr ),
19731973 setter (attr ))
19741974
19751975 def template (m ):
19761976 if m ["name" ] == "@@toStringTag" :
19771977 return """ JSPropertySpec {
19781978 name: JSPropertySpec_Name { symbol_: SymbolCode::%s as usize + 1 },
19791979 attributes_: (%s) as u8,
1980- isAccessor_ : (%s),
1980+ kind_ : (%s),
19811981 u: JSPropertySpec_AccessorsOrValue {
19821982 value: JSPropertySpec_ValueWrapper {
19831983 type_: JSPropertySpec_ValueWrapper_Type::String,
@@ -1991,7 +1991,7 @@ def template(m):
19911991 return """ JSPropertySpec {
19921992 name: JSPropertySpec_Name { string_: %s as *const u8 as *const libc::c_char },
19931993 attributes_: (%s) as u8,
1994- isAccessor_ : (%s),
1994+ kind_ : (%s),
19951995 u: JSPropertySpec_AccessorsOrValue {
19961996 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
19971997 getter: JSPropertySpec_Accessor {
@@ -2361,7 +2361,6 @@ def define(self):
23612361 mayResolve: None,
23622362 finalize: Some(%(finalizeHook)s),
23632363 call: None,
2364- hasInstance: None,
23652364 construct: None,
23662365 trace: Some(%(traceHook)s),
23672366};
@@ -3620,7 +3619,6 @@ def definition_body(self):
36203619 hasOwn: Some(hasOwn),
36213620 getOwnEnumerablePropertyKeys: Some(%(getOwnEnumerablePropertyKeys)s),
36223621 nativeCall: None,
3623- hasInstance: None,
36243622 objectClassIs: None,
36253623 className: Some(className),
36263624 fun_toString: None,
@@ -5368,7 +5366,7 @@ def __init__(self, descriptor, operation):
53685366 }
53695367 self .cgRoot .prepend (instantiateJSToNativeConversionTemplate (
53705368 template , templateValues , declType , argument .identifier .name ))
5371- self .cgRoot .prepend (CGGeneric ("rooted!(in(*cx) let value = desc.value );" ))
5369+ self .cgRoot .prepend (CGGeneric ("rooted!(in(*cx) let value = desc.value_ );" ))
53725370
53735371 def getArguments (self ):
53745372 args = [(a , process_arg (a .identifier .name , a )) for a in self .arguments ]
@@ -5471,7 +5469,8 @@ class CGDOMJSProxyHandler_getOwnPropertyDescriptor(CGAbstractExternMethod):
54715469 def __init__ (self , descriptor ):
54725470 args = [Argument ('*mut JSContext' , 'cx' ), Argument ('RawHandleObject' , 'proxy' ),
54735471 Argument ('RawHandleId' , 'id' ),
5474- Argument ('RawMutableHandle<PropertyDescriptor>' , 'mut desc' )]
5472+ Argument ('RawMutableHandle<PropertyDescriptor>' , 'mut desc' ),
5473+ Argument ('*mut bool' , 'is_none' )]
54755474 CGAbstractExternMethod .__init__ (self , descriptor , "getOwnPropertyDescriptor" ,
54765475 "bool" , args )
54775476 self .descriptor = descriptor
@@ -5487,11 +5486,11 @@ def getBody(self):
54875486 """
54885487 if !proxyhandler::is_platform_object_same_origin(cx, proxy) {
54895488 if !proxyhandler::cross_origin_get_own_property_helper(
5490- cx, proxy, &CROSS_ORIGIN_PROPERTIES, id, desc
5489+ cx, proxy, &CROSS_ORIGIN_PROPERTIES, id, desc, &mut *is_none
54915490 ) {
54925491 return false;
54935492 }
5494- if desc.obj.is_null() {
5493+ if *is_none {
54955494 return proxyhandler::cross_origin_property_fallback(cx, proxy, id, desc);
54965495 }
54975496 return true;
@@ -5507,8 +5506,9 @@ def getBody(self):
55075506 attrs = "JSPROP_ENUMERATE"
55085507 if self .descriptor .operations ['IndexedSetter' ] is None :
55095508 attrs += " | JSPROP_READONLY"
5510- fillDescriptor = ("desc.value = result_root.get();\n "
5511- "fill_property_descriptor(MutableHandle::from_raw(desc), proxy.get(), (%s) as u32);\n "
5509+ fillDescriptor = (#"desc.value_ = result_root.get();\n"
5510+ "SetDataPropertyDescriptor(MutableHandle::from_raw(desc), result_root.handle(), (%s) as u32);\n "
5511+ #"fill_property_descriptor(MutableHandle::from_raw(desc), proxy.get(), (%s) as u32);\n"
55125512 "return true;" % attrs )
55135513 templateValues = {
55145514 'jsvalRef' : 'result_root.handle_mut()' ,
@@ -5532,8 +5532,9 @@ def getBody(self):
55325532 attrs = " | " .join (attrs )
55335533 else :
55345534 attrs = "0"
5535- fillDescriptor = ("desc.value = result_root.get();\n "
5536- "fill_property_descriptor(MutableHandle::from_raw(desc), proxy.get(), (%s) as u32);\n "
5535+ fillDescriptor = (#"desc.value_ = result_root.get();\n"
5536+ "SetDataPropertyDescriptor(MutableHandle::from_raw(desc), result_root.handle(), (%s) as u32);\n "
5537+ #"fill_property_descriptor(MutableHandle::from_raw(desc), proxy.get(), (%s) as u32);\n"
55375538 "return true;" % attrs )
55385539 templateValues = {
55395540 'jsvalRef' : 'result_root.handle_mut()' ,
@@ -5569,17 +5570,16 @@ def getBody(self):
55695570let proxy_lt = Handle::from_raw(proxy);
55705571let id_lt = Handle::from_raw(id);
55715572if !expando.is_null() {
5572- if !JS_GetPropertyDescriptorById(*cx, expando.handle().into(), id, desc) {
5573+ rooted!(in(*cx) let mut ignored = ptr::null_mut::<JSObject>());
5574+ if !JS_GetPropertyDescriptorById(*cx, expando.handle().into(), id, desc, ignored.handle_mut().into(), is_none) {
55735575 return false;
55745576 }
5575- if !desc.obj.is_null() {
5577+ if !*is_none {
55765578 // Pretend the property lives on the wrapper.
5577- desc.obj = proxy.get();
55785579 return true;
55795580 }
55805581}
55815582""" + namedGet + """\
5582- desc.obj = ptr::null_mut();
55835583 return true;"""
55845584
55855585 def definition_body (self ):
@@ -6139,7 +6139,7 @@ class CGClassFinalizeHook(CGAbstractClassHook):
61396139 A hook for finalize, used to release our native object.
61406140 """
61416141 def __init__ (self , descriptor ):
6142- args = [Argument ('*mut JSFreeOp ' , '_fop ' ), Argument ('*mut JSObject' , 'obj' )]
6142+ args = [Argument ('*mut GCContext ' , '_cx ' ), Argument ('*mut JSObject' , 'obj' )]
61436143 CGAbstractClassHook .__init__ (self , descriptor , FINALIZE_HOOK_NAME ,
61446144 'void' , args )
61456145
@@ -6302,6 +6302,7 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
63026302 'js::jsapi::CallArgs' ,
63036303 'js::jsapi::CurrentGlobalOrNull' ,
63046304 'js::rust::wrappers::GetPropertyKeys' ,
6305+ 'js::jsapi::GCContext' ,
63056306 'js::jsapi::GetWellKnownSymbol' ,
63066307 'js::rust::Handle' ,
63076308 'js::jsapi::Handle as RawHandle' ,
@@ -6320,7 +6321,6 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
63206321 'js::jsapi::JSCLASS_RESERVED_SLOTS_SHIFT' ,
63216322 'js::jsapi::JSClass' ,
63226323 'js::jsapi::JSContext' ,
6323- 'js::jsapi::JSFreeOp' ,
63246324 'js::jsapi::JSFunctionSpec' ,
63256325 'js::jsapi::JSITER_HIDDEN' ,
63266326 'js::jsapi::JSITER_OWNONLY' ,
@@ -6345,6 +6345,7 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
63456345 'js::jsapi::JSPropertySpec_Accessor' ,
63466346 'js::jsapi::JSPropertySpec_AccessorsOrValue' ,
63476347 'js::jsapi::JSPropertySpec_AccessorsOrValue_Accessors' ,
6348+ 'js::jsapi::JSPropertySpec_Kind' ,
63486349 'js::jsapi::JSPropertySpec_Name' ,
63496350 'js::jsapi::JSPropertySpec_ValueWrapper' ,
63506351 'js::jsapi::JSPropertySpec_ValueWrapper_Type' ,
@@ -6412,6 +6413,7 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
64126413 'js::glue::CreateProxyHandler' ,
64136414 'js::glue::GetProxyReservedSlot' ,
64146415 'js::glue::SetProxyReservedSlot' ,
6416+ 'js::rust::wrappers::SetDataPropertyDescriptor' ,
64156417 'js::rust::wrappers::NewProxyObject' ,
64166418 'js::glue::ProxyTraps' ,
64176419 'js::glue::RUST_JSID_IS_INT' ,
@@ -6521,7 +6523,7 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
65216523 'crate::dom::bindings::inheritance::Castable' ,
65226524 'crate::dom::bindings::proxyhandler' ,
65236525 'crate::dom::bindings::proxyhandler::ensure_expando_object' ,
6524- 'crate::dom::bindings::proxyhandler::fill_property_descriptor' ,
6526+ # 'crate::dom::bindings::proxyhandler::fill_property_descriptor',
65256527 'crate::dom::bindings::proxyhandler::get_expando_object' ,
65266528 'crate::dom::bindings::record::Record' ,
65276529 'std::ptr::NonNull' ,
0 commit comments