mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Root JS object members in dictionaries
This commit is contained in:
parent
b49acf40ba
commit
760e0a5b57
2 changed files with 4 additions and 6 deletions
|
@ -1121,13 +1121,10 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
|
||||||
templateBody = "${val}.get().to_object()"
|
templateBody = "${val}.get().to_object()"
|
||||||
default = "ptr::null_mut()"
|
default = "ptr::null_mut()"
|
||||||
|
|
||||||
# TODO: Do we need to do the same for dictionaries?
|
if isMember in ("Dictionary", "Union"):
|
||||||
if isMember == "Union":
|
|
||||||
templateBody = "RootedTraceableBox::from_box(Heap::boxed(%s))" % templateBody
|
templateBody = "RootedTraceableBox::from_box(Heap::boxed(%s))" % templateBody
|
||||||
default = "RootedTraceableBox::new(Heap::default())"
|
default = "RootedTraceableBox::new(Heap::default())"
|
||||||
declType = CGGeneric("RootedTraceableBox<Heap<*mut JSObject>>")
|
declType = CGGeneric("RootedTraceableBox<Heap<*mut JSObject>>")
|
||||||
elif isMember == "Dictionary":
|
|
||||||
declType = CGGeneric("Heap<*mut JSObject>")
|
|
||||||
else:
|
else:
|
||||||
# TODO: Need to root somehow
|
# TODO: Need to root somehow
|
||||||
# https://github.com/servo/servo/issues/6382
|
# https://github.com/servo/servo/issues/6382
|
||||||
|
@ -6168,7 +6165,8 @@ class CGDictionary(CGThing):
|
||||||
conversion = self.getMemberConversion(memberInfo, member.type)
|
conversion = self.getMemberConversion(memberInfo, member.type)
|
||||||
if isInitial:
|
if isInitial:
|
||||||
return CGGeneric("%s: %s,\n" % (name, conversion.define()))
|
return CGGeneric("%s: %s,\n" % (name, conversion.define()))
|
||||||
if member.type.isAny() or member.type.isObject():
|
# TODO: Root Heap<JSVal> using RootedTraceableBox
|
||||||
|
if member.type.isAny():
|
||||||
return CGGeneric("dictionary.%s.set(%s);\n" % (name, conversion.define()))
|
return CGGeneric("dictionary.%s.set(%s);\n" % (name, conversion.define()))
|
||||||
return CGGeneric("dictionary.%s = %s;\n" % (name, conversion.define()))
|
return CGGeneric("dictionary.%s = %s;\n" % (name, conversion.define()))
|
||||||
|
|
||||||
|
|
|
@ -369,7 +369,7 @@ impl TestBindingMethods for TestBinding {
|
||||||
nullableFloatValue: None,
|
nullableFloatValue: None,
|
||||||
nullableLongLongValue: None,
|
nullableLongLongValue: None,
|
||||||
nullableLongValue: None,
|
nullableLongValue: None,
|
||||||
nullableObjectValue: Heap::default(),
|
nullableObjectValue: RootedTraceableBox::new(Heap::default()),
|
||||||
nullableOctetValue: None,
|
nullableOctetValue: None,
|
||||||
nullableShortValue: None,
|
nullableShortValue: None,
|
||||||
nullableStringValue: None,
|
nullableStringValue: None,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue