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
Родитель 7edf1854ef
Коммит 4407e6c85b
2 изменённых файлов: 18 добавлений и 0 удалений

Просмотреть файл

@ -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",

Просмотреть файл

@ -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.")