зеркало из https://github.com/mozilla/gecko-dev.git
Bug 821580. Disallow [Unforgeable] on static attributes, per spec update. r=khuey
This commit is contained in:
Родитель
7edf1854ef
Коммит
4407e6c85b
|
@ -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.")
|
||||
|
|
Загрузка…
Ссылка в новой задаче