aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/codegen/CodegenRust.py
diff options
context:
space:
mode:
authormarmeladema <xademax@gmail.com>2019-07-27 20:03:16 +0100
committermarmeladema <xademax@gmail.com>2019-08-09 00:43:29 +0100
commit357b6c54ff053fdd9e17832c06d7acdcbcb07991 (patch)
treee49917dad34627110492f3bed11e0aec70346686 /components/script/dom/bindings/codegen/CodegenRust.py
parent0703a1ad6d736796d467f5a028e5ab3c6d876268 (diff)
downloadservo-357b6c54ff053fdd9e17832c06d7acdcbcb07991.tar.gz
servo-357b6c54ff053fdd9e17832c06d7acdcbcb07991.zip
Use safe JSContext in callbacks
Diffstat (limited to 'components/script/dom/bindings/codegen/CodegenRust.py')
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index ea27af3b5b6..4bea65388b6 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -6828,8 +6828,8 @@ class CGCallback(CGClass):
# Record the names of all the arguments, so we can use them when we call
# the private method.
argnames = [arg.name for arg in args]
- argnamesWithThis = ["SafeJSContext::from_ptr(s.get_context())", "thisObjJS.handle()"] + argnames
- argnamesWithoutThis = ["SafeJSContext::from_ptr(s.get_context())", "thisObjJS.handle()"] + argnames
+ argnamesWithThis = ["s.get_context()", "thisObjJS.handle()"] + argnames
+ argnamesWithoutThis = ["s.get_context()", "thisObjJS.handle()"] + argnames
# Now that we've recorded the argnames for our call to our private
# method, insert our optional argument for deciding whether the
# CallSetup should re-throw exceptions on aRv.
@@ -6849,7 +6849,7 @@ class CGCallback(CGClass):
bodyWithThis = string.Template(
setupCall +
- "rooted!(in(s.get_context()) let mut thisObjJS = ptr::null_mut::<JSObject>());\n"
+ "rooted!(in(*s.get_context()) let mut thisObjJS = ptr::null_mut::<JSObject>());\n"
"wrap_call_this_object(s.get_context(), thisObj, thisObjJS.handle_mut());\n"
"if thisObjJS.is_null() {\n"
" return Err(JSFailed);\n"
@@ -6860,7 +6860,7 @@ class CGCallback(CGClass):
})
bodyWithoutThis = string.Template(
setupCall +
- "rooted!(in(s.get_context()) let thisObjJS = ptr::null_mut::<JSObject>());\n"
+ "rooted!(in(*s.get_context()) let thisObjJS = ptr::null_mut::<JSObject>());\n"
"unsafe { ${methodName}(${callArgs}) }").substitute({
"callArgs": ", ".join(argnamesWithoutThis),
"methodName": 'self.' + method.name,
@@ -7118,7 +7118,7 @@ class CallbackMember(CGNativeMember):
return ""
return (
"CallSetup s(CallbackPreserveColor(), aRv, aExceptionHandling);\n"
- "JSContext* cx = s.get_context();\n"
+ "JSContext* cx = *s.get_context();\n"
"if (!cx) {\n"
" return Err(JSFailed);\n"
"}\n")
@@ -7219,7 +7219,7 @@ class CallbackOperationBase(CallbackMethod):
"methodName": self.methodName
}
getCallableFromProp = string.Template(
- 'r#try!(self.parent.get_callable_property(*cx, "${methodName}"))'
+ 'r#try!(self.parent.get_callable_property(cx, "${methodName}"))'
).substitute(replacements)
if not self.singleOperation:
return 'rooted!(in(*cx) let callable =\n' + getCallableFromProp + ');\n'