mirror of
https://github.com/servo/servo.git
synced 2025-06-13 19:04:30 +00:00
Enter a compartment when calling callbacks.
This commit is contained in:
parent
3a5fc11bb8
commit
8ea3cbf18a
1 changed files with 11 additions and 4 deletions
|
@ -4859,14 +4859,21 @@ class CallbackMember(CGNativeMember):
|
|||
# Avoid weird 0-sized arrays
|
||||
replacements["argvDecl"] = ""
|
||||
|
||||
return string.Template(
|
||||
# Newlines and semicolons are in the values
|
||||
# Newlines and semicolons are in the values
|
||||
pre = string.Template(
|
||||
"${setupCall}"
|
||||
"${declRval}"
|
||||
"${argvDecl}"
|
||||
"${argvDecl}").substitute(replacements)
|
||||
body = string.Template(
|
||||
"${convertArgs}"
|
||||
"${doCall}"
|
||||
"${returnResult}").substitute(replacements)
|
||||
return CGList([
|
||||
CGGeneric(pre),
|
||||
CGWrapper(CGIndenter(CGGeneric(body)),
|
||||
pre="with_compartment(cx, self.parent.callback, || {\n",
|
||||
post="})")
|
||||
], "\n").define()
|
||||
|
||||
def getResultConversion(self):
|
||||
replacements = {
|
||||
|
@ -4889,7 +4896,7 @@ class CallbackMember(CGNativeMember):
|
|||
assignRetval = string.Template(
|
||||
self.getRetvalInfo(self.retvalType,
|
||||
False)[2]).substitute(replacements)
|
||||
return convertType.define() + "\n" + assignRetval
|
||||
return convertType.define() + "\n" + assignRetval + "\n"
|
||||
|
||||
def getArgConversions(self):
|
||||
# Just reget the arglist from self.originalSig, because our superclasses
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue