зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1286548 - SecureContext makes sense for interface with NoInterfaceObject, since it is also propagated to interface members; r=bz
MozReview-Commit-ID: K7Z3r2YRt7M --HG-- extra : rebase_source : 5ebb9cd09de4a42690bac6cd04208f108da50731
This commit is contained in:
Родитель
3b48ca5b21
Коммит
3c4e6a930e
|
@ -1295,7 +1295,9 @@ class IDLInterfaceOrNamespace(IDLObjectWithScope, IDLExposureMixins):
|
|||
|
||||
# Conditional exposure makes no sense for interfaces with no
|
||||
# interface object, unless they're navigator properties.
|
||||
if (self.isExposedConditionally() and
|
||||
# And SecureContext makes sense for interfaces with no interface object,
|
||||
# since it is also propagated to interface members.
|
||||
if (self.isExposedConditionally(exclusions=["SecureContext"]) and
|
||||
not self.hasInterfaceObject() and
|
||||
not self.isNavigatorProperty()):
|
||||
raise WebIDLError("Interface with no interface object is "
|
||||
|
@ -1533,8 +1535,8 @@ class IDLInterfaceOrNamespace(IDLObjectWithScope, IDLExposureMixins):
|
|||
"SecureContext",
|
||||
"CheckAnyPermissions",
|
||||
"CheckAllPermissions" ]
|
||||
def isExposedConditionally(self):
|
||||
return any(self.getExtendedAttribute(a) for a in self.conditionExtendedAttributes)
|
||||
def isExposedConditionally(self, exclusions=[]):
|
||||
return any(((not a in exclusions) and self.getExtendedAttribute(a)) for a in self.conditionExtendedAttributes)
|
||||
|
||||
class IDLInterface(IDLInterfaceOrNamespace):
|
||||
def __init__(self, location, parentScope, name, parent, members,
|
||||
|
|
|
@ -316,3 +316,17 @@ def WebIDLTest(parser, harness):
|
|||
harness.ok(results[0].members[3].getExtendedAttribute("SecureContext") is None,
|
||||
"Methods copied from non-[SecureContext] interface should not be [SecureContext]")
|
||||
|
||||
# Test SecureContext and NoInterfaceObject
|
||||
parser = parser.reset()
|
||||
parser.parse("""
|
||||
[NoInterfaceObject, SecureContext]
|
||||
interface TestSecureContextNoInterfaceObject {
|
||||
void testSecureMethod(byte foo);
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
harness.check(len(results[0].members), 1, "TestSecureContextNoInterfaceObject should have only one member")
|
||||
harness.ok(results[0].getExtendedAttribute("SecureContext"),
|
||||
"Interface should have [SecureContext] extended attribute")
|
||||
harness.ok(results[0].members[0].getExtendedAttribute("SecureContext"),
|
||||
"Interface member should have [SecureContext] extended attribute")
|
||||
|
|
Загрузка…
Ссылка в новой задаче