@@ -1775,7 +1775,7 @@ def generateArray(self, array, name):
1775
1775
if len (array ) == 0 :
1776
1776
return ""
1777
1777
1778
- flags = "JSPROP_ENUMERATE | JSPROP_SHARED "
1778
+ flags = "JSPROP_ENUMERATE"
1779
1779
if self .unforgeable :
1780
1780
flags += " | JSPROP_PERMANENT"
1781
1781
@@ -1822,15 +1822,18 @@ def specData(attr):
1822
1822
' JSPropertySpec {\n '
1823
1823
' name: %s as *const u8 as *const libc::c_char,\n '
1824
1824
' flags: (%s) as u8,\n '
1825
- ' getter: %s,\n '
1826
- ' setter: %s\n '
1827
- ' }' ,
1828
- ' JSPropertySpec {\n '
1829
- ' name: 0 as *const libc::c_char,\n '
1830
- ' flags: 0,\n '
1831
- ' getter: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },\n '
1832
- ' setter: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo }\n '
1825
+ ' __bindgen_anon_1: JSPropertySpec__bindgen_ty_1 {\n '
1826
+ ' accessors: JSPropertySpec__bindgen_ty_1__bindgen_ty_1 {\n '
1827
+ ' getter: JSPropertySpec__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 {\n '
1828
+ ' native: %s,\n '
1829
+ ' },\n '
1830
+ ' setter: JSPropertySpec__bindgen_ty_1__bindgen_ty_1__bindgen_ty_2 {\n '
1831
+ ' native: %s,\n '
1832
+ ' }\n '
1833
+ ' }\n '
1834
+ ' }\n '
1833
1835
' }' ,
1836
+ ' JSPropertySpec::ZERO' ,
1834
1837
'JSPropertySpec' ,
1835
1838
PropertyDefiner .getControllingCondition , specData )
1836
1839
@@ -2124,7 +2127,7 @@ def define(self):
2124
2127
"domClass" : DOMClass (self .descriptor ),
2125
2128
"enumerateHook" : "None" ,
2126
2129
"finalizeHook" : FINALIZE_HOOK_NAME ,
2127
- "flags" : "0 " ,
2130
+ "flags" : "JSCLASS_FOREGROUND_FINALIZE " ,
2128
2131
"name" : str_to_const_array (self .descriptor .interface .identifier .name ),
2129
2132
"resolveHook" : "None" ,
2130
2133
"slots" : "1" ,
@@ -2133,7 +2136,7 @@ def define(self):
2133
2136
if self .descriptor .isGlobal ():
2134
2137
assert not self .descriptor .weakReferenceable
2135
2138
args ["enumerateHook" ] = "Some(enumerate_global)"
2136
- args ["flags" ] = "JSCLASS_IS_GLOBAL | JSCLASS_DOM_GLOBAL"
2139
+ args ["flags" ] = "JSCLASS_IS_GLOBAL | JSCLASS_DOM_GLOBAL | JSCLASS_FOREGROUND_FINALIZE "
2137
2140
args ["slots" ] = "JSCLASS_GLOBAL_SLOT_COUNT + 1"
2138
2141
args ["resolveHook" ] = "Some(resolve_global)"
2139
2142
args ["traceHook" ] = "js::jsapi::JS_GlobalObjectTraceHook"
@@ -2143,9 +2146,8 @@ def define(self):
2143
2146
static CLASS_OPS: js::jsapi::JSClassOps = js::jsapi::JSClassOps {
2144
2147
addProperty: None,
2145
2148
delProperty: None,
2146
- getProperty: None,
2147
- setProperty: None,
2148
2149
enumerate: %(enumerateHook)s,
2150
+ newEnumerate: None,
2149
2151
resolve: %(resolveHook)s,
2150
2152
mayResolve: None,
2151
2153
finalize: Some(%(finalizeHook)s),
@@ -2583,22 +2585,25 @@ def CreateBindingJSObject(descriptor, parent=None):
2583
2585
let handler = RegisterBindings::PROXY_HANDLERS[PrototypeList::Proxies::%s as usize];
2584
2586
rooted!(in(cx) let private = PrivateValue(raw as *const libc::c_void));
2585
2587
let obj = NewProxyObject(cx, handler,
2586
- private.handle( ),
2588
+ Handle::from_raw(UndefinedHandleValue ),
2587
2589
proto.get(), %s.get(),
2588
2590
ptr::null_mut(), ptr::null_mut());
2589
2591
assert!(!obj.is_null());
2592
+ SetProxyReservedSlot(obj, 0, &private.get());
2590
2593
rooted!(in(cx) let obj = obj);\
2591
2594
""" % (descriptor .name , parent )
2592
2595
else :
2593
2596
create += ("rooted!(in(cx) let obj = JS_NewObjectWithGivenProto(\n "
2594
2597
" cx, &Class.base as *const JSClass, proto.handle()));\n "
2595
2598
"assert!(!obj.is_null());\n "
2596
2599
"\n "
2597
- "JS_SetReservedSlot(obj.get(), DOM_OBJECT_SLOT,\n "
2598
- " PrivateValue(raw as *const libc::c_void));" )
2600
+ "let val = PrivateValue(raw as *const libc::c_void);\n "
2601
+ "\n "
2602
+ "JS_SetReservedSlot(obj.get(), DOM_OBJECT_SLOT, &val);" )
2599
2603
if descriptor .weakReferenceable :
2600
2604
create += """
2601
- JS_SetReservedSlot(obj.get(), DOM_WEAK_SLOT, PrivateValue(ptr::null()));"""
2605
+ let val = PrivateValue(ptr::null());
2606
+ JS_SetReservedSlot(obj.get(), DOM_WEAK_SLOT, &val);"""
2602
2607
return create
2603
2608
2604
2609
@@ -2652,9 +2657,10 @@ def CopyUnforgeablePropertiesToInstance(descriptor):
2652
2657
else :
2653
2658
copyFunc = "JS_InitializePropertiesFromCompatibleNativeObject"
2654
2659
copyCode += """\
2660
+ let ref mut slot = UndefinedValue();
2661
+ JS_GetReservedSlot(proto.get(), DOM_PROTO_UNFORGEABLE_HOLDER_SLOT, slot);
2655
2662
rooted!(in(cx) let mut unforgeable_holder = ptr::null_mut::<JSObject>());
2656
- unforgeable_holder.handle_mut().set(
2657
- JS_GetReservedSlot(proto.get(), DOM_PROTO_UNFORGEABLE_HOLDER_SLOT).to_object());
2663
+ unforgeable_holder.handle_mut().set(slot.to_object());
2658
2664
assert!(%(copyFunc)s(cx, %(obj)s.handle(), unforgeable_holder.handle()));
2659
2665
""" % {'copyFunc' : copyFunc , 'obj' : obj }
2660
2666
@@ -3013,7 +3019,7 @@ def defineAlias(alias):
3013
3019
CGGeneric (fill (
3014
3020
"""
3015
3021
assert!(${defineFn}(cx, prototype.handle(), ${prop}, aliasedVal.handle(),
3016
- JSPROP_ENUMERATE, None, None ));
3022
+ JSPROP_ENUMERATE as u32 ));
3017
3023
""" ,
3018
3024
defineFn = defineFn ,
3019
3025
prop = prop ))
@@ -3078,8 +3084,8 @@ def defineAliasesFor(m):
3078
3084
""" % {'holderClass' : holderClass , 'holderProto' : holderProto }))
3079
3085
code .append (InitUnforgeablePropertiesOnHolder (self .descriptor , self .properties ))
3080
3086
code .append (CGGeneric ("""\
3081
- JS_SetReservedSlot(prototype .get(), DOM_PROTO_UNFORGEABLE_HOLDER_SLOT,
3082
- ObjectValue(unforgeable_holder .get()) )""" ))
3087
+ let val = ObjectValue(unforgeable_holder .get());
3088
+ JS_SetReservedSlot(prototype .get(), DOM_PROTO_UNFORGEABLE_HOLDER_SLOT, &val )""" ))
3083
3089
3084
3090
return CGList (code , "\n " )
3085
3091
@@ -3533,11 +3539,13 @@ def __init__(self, descriptor, name):
3533
3539
self .exposureSet = descriptor .interface .exposureSet
3534
3540
3535
3541
def definition_body (self ):
3536
- preamble = "let global = GlobalScope::from_object(JS_CALLEE(cx, vp).to_object());\n "
3542
+ preamble = """\
3543
+ let args = CallArgs::from_vp(vp, argc);
3544
+ let global = GlobalScope::from_object(args.callee());
3545
+ """
3537
3546
if len (self .exposureSet ) == 1 :
3538
- preamble += """
3539
- let global = DomRoot::downcast::<dom::types::%s>(global).unwrap();
3540
- """ % list (self .exposureSet )[0 ]
3547
+ preamble += ("let global = DomRoot::downcast::<dom::types::%s>(global).unwrap();\n " %
3548
+ list (self .exposureSet )[0 ])
3541
3549
return CGList ([CGGeneric (preamble ), self .generate_code ()])
3542
3550
3543
3551
def generate_code (self ):
@@ -3741,7 +3749,7 @@ def definition_body(self):
3741
3749
assert all (ord (c ) < 128 for c in name )
3742
3750
return CGGeneric ("""\
3743
3751
JS_DefineProperty(cx, obj, %s as *const u8 as *const libc::c_char,
3744
- HandleValue::from_raw(args.get(0)), JSPROP_ENUMERATE, None, None )""" % name )
3752
+ HandleValue::from_raw(args.get(0)), JSPROP_ENUMERATE as u32 )""" % name )
3745
3753
3746
3754
3747
3755
class CGMemberJITInfo (CGThing ):
@@ -4959,7 +4967,9 @@ def definition_body(self):
4959
4967
obj = js::UnwrapObject(obj);
4960
4968
}*/
4961
4969
//MOZ_ASSERT(IsProxy(obj));
4962
- let box_ = GetProxyPrivate(obj.get()).to_private() as *const %s;
4970
+ let ref mut slot = UndefinedValue();
4971
+ GetProxyReservedSlot(obj.get(), 0, slot);
4972
+ let box_ = slot.to_private() as *const %s;
4963
4973
return box_;""" % self .descriptor .concreteType )
4964
4974
4965
4975
@@ -4985,7 +4995,7 @@ def getBody(self):
4985
4995
attrs += " | JSPROP_READONLY"
4986
4996
# FIXME(#11868) Should assign to desc.value, desc.get() is a copy.
4987
4997
fillDescriptor = ("desc.get().value = result_root.get();\n "
4988
- "fill_property_descriptor(MutableHandle::from_raw(desc), proxy.get(), %s );\n "
4998
+ "fill_property_descriptor(MutableHandle::from_raw(desc), proxy.get(), (%s) as u32 );\n "
4989
4999
"return true;" % attrs )
4990
5000
templateValues = {
4991
5001
'jsvalRef' : 'result_root.handle_mut()' ,
@@ -5011,7 +5021,7 @@ def getBody(self):
5011
5021
attrs = "0"
5012
5022
# FIXME(#11868) Should assign to desc.value, desc.get() is a copy.
5013
5023
fillDescriptor = ("desc.get().value = result_root.get();\n "
5014
- "fill_property_descriptor(MutableHandle::from_raw(desc), proxy.get(), %s );\n "
5024
+ "fill_property_descriptor(MutableHandle::from_raw(desc), proxy.get(), (%s) as u32 );\n "
5015
5025
"return true;" % attrs )
5016
5026
templateValues = {
5017
5027
'jsvalRef' : 'result_root.handle_mut()' ,
@@ -5425,7 +5435,9 @@ def finalizeHook(descriptor, hookName, context):
5425
5435
"""
5426
5436
elif descriptor .weakReferenceable :
5427
5437
release += """\
5428
- let weak_box_ptr = JS_GetReservedSlot(obj, DOM_WEAK_SLOT).to_private() as *mut WeakBox<%s>;
5438
+ let ref mut slot = UndefinedValue();
5439
+ JS_GetReservedSlot(obj, DOM_WEAK_SLOT, slot);
5440
+ let weak_box_ptr = slot.to_private() as *mut WeakBox<%s>;
5429
5441
if !weak_box_ptr.is_null() {
5430
5442
let count = {
5431
5443
let weak_box = &*weak_box_ptr;
@@ -5736,6 +5748,7 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
5736
5748
'js::jsapi::INTERNED_STRING_TO_JSID' ,
5737
5749
'js::jsapi::IsCallable' ,
5738
5750
'js::jsapi::JSAutoCompartment' ,
5751
+ 'js::jsapi::JSCLASS_FOREGROUND_FINALIZE' ,
5739
5752
'js::jsapi::JSCLASS_RESERVED_SLOTS_SHIFT' ,
5740
5753
'js::jsapi::JSClass' ,
5741
5754
'js::jsapi::JSContext' ,
@@ -5757,8 +5770,11 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
5757
5770
'js::jsapi::JSPROP_ENUMERATE' ,
5758
5771
'js::jsapi::JSPROP_PERMANENT' ,
5759
5772
'js::jsapi::JSPROP_READONLY' ,
5760
- 'js::jsapi::JSPROP_SHARED' ,
5761
5773
'js::jsapi::JSPropertySpec' ,
5774
+ 'js::jsapi::JSPropertySpec__bindgen_ty_1' ,
5775
+ 'js::jsapi::JSPropertySpec__bindgen_ty_1__bindgen_ty_1' ,
5776
+ 'js::jsapi::JSPropertySpec__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1' ,
5777
+ 'js::jsapi::JSPropertySpec__bindgen_ty_1__bindgen_ty_1__bindgen_ty_2' ,
5762
5778
'js::jsapi::JSString' ,
5763
5779
'js::jsapi::JSTracer' ,
5764
5780
'js::jsapi::JSType' ,
@@ -5778,7 +5794,7 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
5778
5794
'js::rust::wrappers::JS_GetProperty' ,
5779
5795
'js::jsapi::JS_GetPropertyById' ,
5780
5796
'js::jsapi::JS_GetPropertyDescriptorById' ,
5781
- 'js::jsapi ::JS_GetReservedSlot' ,
5797
+ 'js::glue ::JS_GetReservedSlot' ,
5782
5798
'js::jsapi::JS_HasProperty' ,
5783
5799
'js::jsapi::JS_HasPropertyById' ,
5784
5800
'js::rust::wrappers::JS_InitializePropertiesFromCompatibleNativeObject' ,
@@ -5813,12 +5829,14 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
5813
5829
'js::jsval::ObjectOrNullValue' ,
5814
5830
'js::jsval::PrivateValue' ,
5815
5831
'js::jsval::UndefinedValue' ,
5832
+ 'js::jsapi::UndefinedHandleValue' ,
5816
5833
'js::glue::AppendToAutoIdVector' ,
5817
5834
'js::glue::CallJitGetterOp' ,
5818
5835
'js::glue::CallJitMethodOp' ,
5819
5836
'js::glue::CallJitSetterOp' ,
5820
5837
'js::glue::CreateProxyHandler' ,
5821
- 'js::glue::GetProxyPrivate' ,
5838
+ 'js::glue::GetProxyReservedSlot' ,
5839
+ 'js::glue::SetProxyReservedSlot' ,
5822
5840
'js::rust::wrappers::NewProxyObject' ,
5823
5841
'js::glue::ProxyTraps' ,
5824
5842
'js::glue::RUST_JSID_IS_INT' ,
0 commit comments