@@ -2920,6 +2920,14 @@ def definition_body(self):
29202920%s;
29212921assert!(!prototype_proto.is_null());""" % getPrototypeProto )]
29222922
2923+ if self .descriptor .hasNamedPropertiesObject ():
2924+ assert self .descriptor .isGlobal ()
2925+ assert not self .haveUnscopables
2926+ code .append (CGGeneric ("""\
2927+ rooted!(in(cx) let mut prototype_proto_proto = prototype_proto.get());
2928+ dom::types::%s::create_named_properties_object(cx, prototype_proto_proto.handle(), prototype_proto.handle_mut());
2929+ assert!(!prototype_proto.is_null());""" % name ))
2930+
29232931 properties = {
29242932 "id" : name ,
29252933 "unscopables" : "unscopable_names" if self .haveUnscopables else "&[]"
@@ -2943,8 +2951,12 @@ def definition_body(self):
29432951 else :
29442952 proto_properties = properties
29452953
2954+
29462955 code .append (CGGeneric ("""
29472956rooted!(in(cx) let mut prototype = ptr::null_mut::<JSObject>());
2957+ """ ))
2958+
2959+ code .append (CGGeneric ("""
29482960create_interface_prototype_object(cx,
29492961 prototype_proto.handle().into(),
29502962 &PrototypeClass,
@@ -2953,6 +2965,9 @@ def definition_body(self):
29532965 %(consts)s,
29542966 %(unscopables)s,
29552967 prototype.handle_mut().into());
2968+ """ % proto_properties ))
2969+
2970+ code .append (CGGeneric ("""
29562971assert!(!prototype.is_null());
29572972assert!((*cache)[PrototypeList::ID::%(id)s as usize].is_null());
29582973(*cache)[PrototypeList::ID::%(id)s as usize] = prototype.get();
@@ -4998,9 +5013,7 @@ def getBody(self):
49985013 attrs = "JSPROP_ENUMERATE"
49995014 if self .descriptor .operations ['IndexedSetter' ] is None :
50005015 attrs += " | JSPROP_READONLY"
5001- # FIXME(#11868) Should assign to desc.value, desc.get() is a copy.
5002- fillDescriptor = ("desc.get().value = result_root.get();\n "
5003- "fill_property_descriptor(MutableHandle::from_raw(desc), proxy.get(), (%s) as u32);\n "
5016+ fillDescriptor = ("fill_property_descriptor(MutableHandle::from_raw(desc), proxy.get(), result_root.get(), (%s) as u32);\n "
50045017 "return true;" % attrs )
50055018 templateValues = {
50065019 'jsvalRef' : 'result_root.handle_mut()' ,
@@ -5013,8 +5026,7 @@ def getBody(self):
50135026 CGIndenter (CGProxyIndexedGetter (self .descriptor , templateValues )).define () + "\n " +
50145027 "}\n " )
50155028
5016- namedGetter = self .descriptor .operations ['NamedGetter' ]
5017- if namedGetter :
5029+ if self .descriptor .operations ['NamedGetter' ]:
50185030 attrs = []
50195031 if not self .descriptor .interface .getExtendedAttribute ("LegacyUnenumerableNamedProperties" ):
50205032 attrs .append ("JSPROP_ENUMERATE" )
@@ -5024,9 +5036,7 @@ def getBody(self):
50245036 attrs = " | " .join (attrs )
50255037 else :
50265038 attrs = "0"
5027- # FIXME(#11868) Should assign to desc.value, desc.get() is a copy.
5028- fillDescriptor = ("desc.get().value = result_root.get();\n "
5029- "fill_property_descriptor(MutableHandle::from_raw(desc), proxy.get(), (%s) as u32);\n "
5039+ fillDescriptor = ("fill_property_descriptor(MutableHandle::from_raw(desc), proxy.get(), result_root.get(), (%s) as u32);\n "
50305040 "return true;" % attrs )
50315041 templateValues = {
50325042 'jsvalRef' : 'result_root.handle_mut()' ,
@@ -5267,11 +5277,10 @@ def getBody(self):
52675277 else :
52685278 indexed = ""
52695279
5270- namedGetter = self .descriptor .operations ['NamedGetter' ]
52715280 condition = "RUST_JSID_IS_STRING(id) || RUST_JSID_IS_INT(id)"
52725281 if indexedGetter :
52735282 condition = "index.is_none() && (%s)" % condition
5274- if namedGetter :
5283+ if self . descriptor . operations [ 'NamedGetter' ] :
52755284 named = """\
52765285 if %s {
52775286 let mut has_on_proto = false;
@@ -5354,8 +5363,7 @@ def getBody(self):
53545363 else :
53555364 getIndexedOrExpando = getFromExpando + "\n "
53565365
5357- namedGetter = self .descriptor .operations ['NamedGetter' ]
5358- if namedGetter :
5366+ if self .descriptor .operations ['NamedGetter' ]:
53595367 condition = "RUST_JSID_IS_STRING(id) || RUST_JSID_IS_INT(id)"
53605368 # From step 1:
53615369 # If O supports indexed properties and P is an array index, then:
@@ -5684,6 +5692,7 @@ def contains_unsafe_arg(arguments):
56845692 return reduce ((lambda x , y : x or y [1 ] == '*mut JSContext' ), arguments , False )
56855693
56865694 methods = []
5695+
56875696 for name , arguments , rettype in members ():
56885697 arguments = list (arguments )
56895698 methods .append (CGGeneric ("%sfn %s(&self%s) -> %s;\n " % (
@@ -5997,6 +6006,7 @@ def reexportedName(name):
59976006 cgThings = []
59986007
59996008 unscopableNames = []
6009+
60006010 for m in descriptor .interface .members :
60016011 if (m .isMethod () and
60026012 (not m .isIdentifierLess () or m == descriptor .operations ["Stringifier" ])):
@@ -6034,7 +6044,7 @@ def reexportedName(name):
60346044 elif m .getExtendedAttribute ("Replaceable" ):
60356045 cgThings .append (CGSpecializedReplaceableSetter (descriptor , m ))
60366046
6037- if ( not m .isStatic () and not descriptor .interface .isCallback () ):
6047+ if not m .isStatic () and not descriptor .interface .isCallback ():
60386048 cgThings .append (CGMemberJITInfo (descriptor , m ))
60396049
60406050 if descriptor .concrete :
0 commit comments