aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
diff options
context:
space:
mode:
authormarmeladema <xademax@gmail.com>2019-07-27 17:05:35 +0100
committermarmeladema <xademax@gmail.com>2019-08-09 00:02:09 +0100
commit8968286aa17ab413c072231aaebbd21428245e3e (patch)
treecac15f13692af1f58c6134ea758944170973b8d2 /components/script/dom
parent914bda9cd41dd2e0724bbd758af35fcbed8ba0a5 (diff)
downloadservo-8968286aa17ab413c072231aaebbd21428245e3e.tar.gz
servo-8968286aa17ab413c072231aaebbd21428245e3e.zip
Don't mark new methods as unsafe in code generation
Diffstat (limited to 'components/script/dom')
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py30
1 files changed, 16 insertions, 14 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index ef3beafb3f1..49402ade3c7 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -6355,21 +6355,23 @@ class CGDictionary(CGThing):
return string.Template(
"impl ${selfName} {\n"
"${empty}\n"
- " pub unsafe fn new(cx: SafeJSContext, val: HandleValue) \n"
+ " pub fn new(cx: SafeJSContext, val: HandleValue) \n"
" -> Result<ConversionResult<${actualType}>, ()> {\n"
- " let object = if val.get().is_null_or_undefined() {\n"
- " ptr::null_mut()\n"
- " } else if val.get().is_object() {\n"
- " val.get().to_object()\n"
- " } else {\n"
- " return Ok(ConversionResult::Failure(\"Value is not an object.\".into()));\n"
- " };\n"
- " rooted!(in(*cx) let object = object);\n"
+ " unsafe {\n"
+ " let object = if val.get().is_null_or_undefined() {\n"
+ " ptr::null_mut()\n"
+ " } else if val.get().is_object() {\n"
+ " val.get().to_object()\n"
+ " } else {\n"
+ " return Ok(ConversionResult::Failure(\"Value is not an object.\".into()));\n"
+ " };\n"
+ " rooted!(in(*cx) let object = object);\n"
"${preInitial}"
"${initParent}"
"${initMembers}"
"${postInitial}"
- " Ok(ConversionResult::Success(dictionary))\n"
+ " Ok(ConversionResult::Success(dictionary))\n"
+ " }\n"
" }\n"
"}\n"
"\n"
@@ -6391,11 +6393,11 @@ class CGDictionary(CGThing):
"selfName": selfName,
"actualType": actualType,
"empty": CGIndenter(CGGeneric(self.makeEmpty()), indentLevel=4).define(),
- "initParent": CGIndenter(CGGeneric(initParent), indentLevel=12).define(),
- "initMembers": CGIndenter(memberInits, indentLevel=12).define(),
+ "initParent": CGIndenter(CGGeneric(initParent), indentLevel=16).define(),
+ "initMembers": CGIndenter(memberInits, indentLevel=16).define(),
"insertMembers": CGIndenter(memberInserts, indentLevel=8).define(),
- "preInitial": CGIndenter(CGGeneric(preInitial), indentLevel=12).define(),
- "postInitial": CGIndenter(CGGeneric(postInitial), indentLevel=12).define(),
+ "preInitial": CGIndenter(CGGeneric(preInitial), indentLevel=16).define(),
+ "postInitial": CGIndenter(CGGeneric(postInitial), indentLevel=16).define(),
})
def membersNeedTracing(self):