зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1533617 part 3. Add a [can_run_script] xpidl annotation. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D22837 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
5879288b7b
Коммит
30c26603e0
|
@ -69,6 +69,12 @@ def attributeReturnType(a, getter, macro):
|
|||
|
||||
if a.must_use:
|
||||
ret = "MOZ_MUST_USE " + ret
|
||||
# Ideally, we'd set MOZ_CAN_RUN_SCRIPT in the "scriptable and not
|
||||
# builtinclass" case too, so we'd just have memberCanRunScript() check
|
||||
# can_explicitly_run_script and call it here. But that would likely require
|
||||
# a fair amount of Gecko-side annotation work. See bug 1534292.
|
||||
if a.explicit_can_run_script:
|
||||
ret = "MOZ_CAN_RUN_SCRIPT " + ret
|
||||
return ret
|
||||
|
||||
|
||||
|
@ -115,6 +121,12 @@ def methodReturnType(m, macro):
|
|||
|
||||
if m.must_use:
|
||||
ret = "MOZ_MUST_USE " + ret
|
||||
# Ideally, we'd set MOZ_CAN_RUN_SCRIPT in the "scriptable and not
|
||||
# builtinclass" case too, so we'd just have memberCanRunScript() check
|
||||
# can_explicitly_run_script and call it here. But that would likely require
|
||||
# a fair amount of Gecko-side annotation work. See bug 1534292.
|
||||
if m.explicit_can_run_script:
|
||||
ret = "MOZ_CAN_RUN_SCRIPT " + ret
|
||||
return ret
|
||||
|
||||
|
||||
|
|
|
@ -1010,6 +1010,9 @@ class Attribute(object):
|
|||
must_use = False
|
||||
binaryname = None
|
||||
infallible = False
|
||||
# explicit_can_run_script is true if the attribute is explicitly annotated
|
||||
# as being able to cause script to run.
|
||||
explicit_can_run_script = False
|
||||
|
||||
def __init__(self, type, name, attlist, readonly, location, doccomments):
|
||||
self.type = type
|
||||
|
@ -1045,6 +1048,8 @@ class Attribute(object):
|
|||
self.must_use = True
|
||||
elif name == 'infallible':
|
||||
self.infallible = True
|
||||
elif name == 'can_run_script':
|
||||
self.explicit_can_run_script = True
|
||||
else:
|
||||
raise IDLError("Unexpected attribute '%s'" % name, aloc)
|
||||
|
||||
|
@ -1092,6 +1097,9 @@ class Method(object):
|
|||
nostdcall = False
|
||||
must_use = False
|
||||
optional_argc = False
|
||||
# explicit_can_run_script is true if the method is explicitly annotated
|
||||
# as being able to cause script to run.
|
||||
explicit_can_run_script = False
|
||||
|
||||
def __init__(self, type, name, attlist, paramlist, location, doccomments, raises):
|
||||
self.type = type
|
||||
|
@ -1128,6 +1136,8 @@ class Method(object):
|
|||
self.nostdcall = True
|
||||
elif name == 'must_use':
|
||||
self.must_use = True
|
||||
elif name == 'can_run_script':
|
||||
self.explicit_can_run_script = True
|
||||
else:
|
||||
raise IDLError("Unexpected attribute '%s'" % name, aloc)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче