Bug 821580. Disallow [Unforgeable] on static attributes, per spec update. r=khuey

This commit is contained in:
Boris Zbarsky 2013-01-02 22:03:25 -05:00
parent a93cc6b13a
commit d0142e3dab
2 changed files with 18 additions and 0 deletions

View File

@ -2142,6 +2142,9 @@ class IDLAttribute(IDLInterfaceMember):
if not self.readonly:
raise WebIDLError("[Unforgeable] is only allowed on readonly "
"attributes", [attr.location, self.location])
if self.isStatic():
raise WebIDLError("[Unforgeable] is only allowed on non-static "
"attributes", [attr.location, self.location])
self._unforgeable = True
elif identifier == "Constant" and not self.readonly:
raise WebIDLError("[Constant] only allowed on readonly attributes",

View File

@ -176,3 +176,18 @@ def WebIDLTest(parser, harness):
threw = True
harness.ok(threw, "Should have thrown for writable [Unforgeable] attribute.")
parser = parser.reset();
threw = False
try:
parser.parse("""
interface iface {
[Unforgeable] static readonly attribute long foo;
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Should have thrown for static [Unforgeable] attribute.")