mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 21:35:39 +00:00
Bug 1333480. Disallow indexed getters on interfaces without an integer-typed 'length' attribute. r=qdot
This commit is contained in:
parent
b1b6ca681a
commit
20418bd1bf
@ -1330,7 +1330,7 @@ class IDLInterfaceOrNamespace(IDLObjectWithScope, IDLExposureMixins):
|
||||
if not indexedGetter:
|
||||
raise WebIDLError("Interface with value iterator does not "
|
||||
"support indexed properties",
|
||||
[self.location])
|
||||
[self.location, iterableDecl.location])
|
||||
|
||||
if iterableDecl.valueType != indexedGetter.signatures()[0][0]:
|
||||
raise WebIDLError("Iterable type does not match indexed "
|
||||
@ -1341,7 +1341,7 @@ class IDLInterfaceOrNamespace(IDLObjectWithScope, IDLExposureMixins):
|
||||
if not hasLengthAttribute:
|
||||
raise WebIDLError('Interface with value iterator does not '
|
||||
'have an integer-typed "length" attribute',
|
||||
[self.location])
|
||||
[self.location, iterableDecl.location])
|
||||
else:
|
||||
assert iterableDecl.isPairIterator()
|
||||
if indexedGetter:
|
||||
@ -1350,6 +1350,11 @@ class IDLInterfaceOrNamespace(IDLObjectWithScope, IDLExposureMixins):
|
||||
[self.location, iterableDecl.location,
|
||||
indexedGetter.location])
|
||||
|
||||
if indexedGetter and not hasLengthAttribute:
|
||||
raise WebIDLError('Interface with an indexed getter does not have '
|
||||
'an integer-typed "length" attribute',
|
||||
[self.location, indexedGetter.location])
|
||||
|
||||
def isExternal(self):
|
||||
return False
|
||||
|
||||
|
@ -1180,6 +1180,7 @@ interface TestIndexedGetterAndSetterAndNamedGetterInterface {
|
||||
getter DOMString (DOMString myName);
|
||||
getter long (unsigned long index);
|
||||
setter creator void (unsigned long index, long arg);
|
||||
readonly attribute unsigned long length;
|
||||
};
|
||||
|
||||
interface TestIndexedAndNamedGetterInterface {
|
||||
@ -1191,6 +1192,7 @@ interface TestIndexedAndNamedGetterInterface {
|
||||
interface TestIndexedSetterInterface {
|
||||
setter creator void setItem(unsigned long idx, DOMString item);
|
||||
getter DOMString (unsigned long idx);
|
||||
readonly attribute unsigned long length;
|
||||
};
|
||||
|
||||
interface TestNamedSetterInterface {
|
||||
@ -1201,6 +1203,7 @@ interface TestNamedSetterInterface {
|
||||
interface TestIndexedAndNamedSetterInterface {
|
||||
setter creator void (unsigned long index, TestIndexedSetterInterface item);
|
||||
getter TestIndexedSetterInterface (unsigned long index);
|
||||
readonly attribute unsigned long length;
|
||||
setter creator void setNamedItem(DOMString name, TestIndexedSetterInterface item);
|
||||
getter TestIndexedSetterInterface (DOMString name);
|
||||
};
|
||||
|
@ -434,6 +434,7 @@ interface TestExampleInterface {
|
||||
void passUnion((object or long) arg);
|
||||
// Some union tests are debug-only to avoid creating all those
|
||||
// unused union types in opt builds.
|
||||
|
||||
#ifdef DEBUG
|
||||
void passUnion2((long or boolean) arg);
|
||||
void passUnion3((object or long or boolean) arg);
|
||||
@ -803,6 +804,7 @@ interface TestExampleInterface {
|
||||
interface TestExampleProxyInterface {
|
||||
getter long longIndexedGetter(unsigned long ix);
|
||||
setter creator void longIndexedSetter(unsigned long y, long z);
|
||||
readonly attribute unsigned long length;
|
||||
stringifier DOMString myStringifier();
|
||||
getter short shortNameGetter(DOMString nom);
|
||||
deleter void (DOMString nomnom);
|
||||
|
@ -93,6 +93,12 @@ partial interface OfflineResourceList {
|
||||
[Throws]
|
||||
getter DOMString mozItem(unsigned long index);
|
||||
|
||||
/**
|
||||
* We need a "length" to actually be valid Web IDL, given that we have an
|
||||
* indexed getter.
|
||||
*/
|
||||
readonly attribute unsigned long length;
|
||||
|
||||
/**
|
||||
* Add an item to the list of dynamically-managed entries. The resource
|
||||
* will be fetched into the application cache.
|
||||
|
Loading…
Reference in New Issue
Block a user