mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 985536. Go back to allowing optional any with no default value in WebIDL, but treat it as having a default value of undefined. r=khuey
This commit is contained in:
parent
d592724cf0
commit
e10e715648
@ -2944,16 +2944,8 @@ class IDLArgument(IDLObjectWithIdentifier):
|
||||
elif self.type.isAny():
|
||||
assert (self.defaultValue is None or
|
||||
isinstance(self.defaultValue, IDLNullValue))
|
||||
if (self.optional and not self.variadic and
|
||||
not self.dictionaryMember and not self.defaultValue):
|
||||
raise WebIDLError("Arguments of type 'any' are always optional "
|
||||
"and shouldn't have the 'optional' keyword "
|
||||
"unless they're being given a default value "
|
||||
"of 'null'",
|
||||
[self.location])
|
||||
# 'any' values are always optional.
|
||||
self.optional = True
|
||||
if not self.defaultValue and not self.variadic:
|
||||
# optional 'any' values always have a default value
|
||||
if self.optional and not self.defaultValue and not self.variadic:
|
||||
# Set the default value to undefined, for simplicity, so the
|
||||
# codegen doesn't have to special-case this.
|
||||
self.defaultValue = IDLUndefinedValue(self.location)
|
||||
@ -4355,9 +4347,9 @@ class Parser(Tokenizer):
|
||||
raise WebIDLError("Mandatory arguments can't have a default value.",
|
||||
[self.getLocation(p, 6)])
|
||||
|
||||
# We can't test t.isAny() here and force optional to true, since at this
|
||||
# point t is not a fully resolved type yet (e.g. it might be a typedef).
|
||||
# We'll handle the 'any' case in IDLArgument.complete.
|
||||
# We can't test t.isAny() here and give it a default value as needed,
|
||||
# since at this point t is not a fully resolved type yet (e.g. it might
|
||||
# be a typedef). We'll handle the 'any' case in IDLArgument.complete.
|
||||
|
||||
if variadic:
|
||||
if optional:
|
||||
|
@ -112,7 +112,7 @@ def WebIDLTest(parser, harness):
|
||||
checkMethod(methods[11], "::TestMethods::setAny",
|
||||
"setAny",
|
||||
[("Void",
|
||||
[("::TestMethods::setAny::arg1", "arg1", "Any", True, False)])])
|
||||
[("::TestMethods::setAny::arg1", "arg1", "Any", False, False)])])
|
||||
checkMethod(methods[12], "::TestMethods::doFloats",
|
||||
"doFloats",
|
||||
[("Float",
|
||||
|
@ -472,6 +472,7 @@ public:
|
||||
// Any types
|
||||
void PassAny(JSContext*, JS::Handle<JS::Value>);
|
||||
void PassVariadicAny(JSContext*, const Sequence<JS::Value>&);
|
||||
void PassOptionalAny(JSContext*, JS::Handle<JS::Value>);
|
||||
void PassAnyDefaultNull(JSContext*, JS::Handle<JS::Value>);
|
||||
void PassSequenceOfAny(JSContext*, const Sequence<JS::Value>&);
|
||||
void PassNullableSequenceOfAny(JSContext*, const Nullable<Sequence<JS::Value> >&);
|
||||
|
@ -110,8 +110,7 @@ interface OnlyForUseInConstructor {
|
||||
NamedConstructor=Test,
|
||||
NamedConstructor=Test(DOMString str),
|
||||
NamedConstructor=Test2(DictForConstructor dict, any any1, object obj1,
|
||||
object? obj2, sequence<Dict> seq,
|
||||
optional any any2 = null,
|
||||
object? obj2, sequence<Dict> seq, optional any any2,
|
||||
optional object obj3, optional object? obj4)
|
||||
]
|
||||
interface TestInterface {
|
||||
@ -429,6 +428,7 @@ interface TestInterface {
|
||||
// Any types
|
||||
void passAny(any arg);
|
||||
void passVariadicAny(any... arg);
|
||||
void passOptionalAny(optional any arg);
|
||||
void passAnyDefaultNull(optional any arg = null);
|
||||
void passSequenceOfAny(sequence<any> arg);
|
||||
void passNullableSequenceOfAny(sequence<any>? arg);
|
||||
|
@ -12,8 +12,7 @@
|
||||
NamedConstructor=Example,
|
||||
NamedConstructor=Example(DOMString str),
|
||||
NamedConstructor=Example2(DictForConstructor dict, any any1, object obj1,
|
||||
object? obj2, sequence<Dict> seq,
|
||||
optional any any2 = null,
|
||||
object? obj2, sequence<Dict> seq, optional any any2,
|
||||
optional object obj3, optional object? obj4)
|
||||
]
|
||||
interface TestExampleInterface {
|
||||
@ -322,6 +321,7 @@ interface TestExampleInterface {
|
||||
// Any types
|
||||
void passAny(any arg);
|
||||
void passVariadicAny(any... arg);
|
||||
void passOptionalAny(optional any arg);
|
||||
void passAnyDefaultNull(optional any arg = null);
|
||||
void passSequenceOfAny(sequence<any> arg);
|
||||
void passNullableSequenceOfAny(sequence<any>? arg);
|
||||
|
@ -23,7 +23,7 @@ enum MyTestEnum {
|
||||
TestInterface? iface, long arg1,
|
||||
DictForConstructor dict, any any1,
|
||||
object obj1,
|
||||
object? obj2, sequence<Dict> seq, optional any any2 = null,
|
||||
object? obj2, sequence<Dict> seq, optional any any2,
|
||||
optional object obj3,
|
||||
optional object? obj4),
|
||||
JSImplementation="@mozilla.org/test-js-impl-interface;1"]
|
||||
@ -344,6 +344,7 @@ interface TestJSImplInterface {
|
||||
// Any types
|
||||
void passAny(any arg);
|
||||
void passVariadicAny(any... arg);
|
||||
void passOptionalAny(optional any arg);
|
||||
void passAnyDefaultNull(optional any arg = null);
|
||||
void passSequenceOfAny(sequence<any> arg);
|
||||
void passNullableSequenceOfAny(sequence<any>? arg);
|
||||
|
@ -79,7 +79,7 @@ dictionary EventInit {
|
||||
interface CustomEvent : Event {
|
||||
readonly attribute any detail;
|
||||
|
||||
void initCustomEvent(DOMString type, boolean bubbles, boolean cancelable, optional any details);
|
||||
void initCustomEvent(DOMString type, boolean bubbles, boolean cancelable, any details);
|
||||
};
|
||||
|
||||
dictionary CustomEventInit : EventInit {
|
||||
|
@ -17,8 +17,8 @@ interface Console {
|
||||
void group(any... data);
|
||||
void groupCollapsed(any... data);
|
||||
void groupEnd(any... data);
|
||||
void time(any time);
|
||||
void timeEnd(any time);
|
||||
void time(optional any time);
|
||||
void timeEnd(optional any time);
|
||||
|
||||
[Throws]
|
||||
void profile(any... data);
|
||||
|
@ -26,11 +26,11 @@ interface HTMLCanvasElement : HTMLElement {
|
||||
|
||||
[Throws]
|
||||
DOMString toDataURL(optional DOMString type = "",
|
||||
any encoderOptions);
|
||||
optional any encoderOptions);
|
||||
[Throws]
|
||||
void toBlob(FileCallback _callback,
|
||||
optional DOMString type = "",
|
||||
any encoderOptions);
|
||||
optional any encoderOptions);
|
||||
};
|
||||
|
||||
// Mozilla specific bits
|
||||
|
@ -32,7 +32,7 @@ interface IDBCursor {
|
||||
void advance ([EnforceRange] unsigned long count);
|
||||
|
||||
[Throws]
|
||||
void continue (any key);
|
||||
void continue (optional any key);
|
||||
|
||||
[Throws]
|
||||
IDBRequest delete ();
|
||||
|
@ -23,10 +23,10 @@ interface IDBIndex {
|
||||
readonly attribute boolean unique;
|
||||
|
||||
[Throws]
|
||||
IDBRequest openCursor (any range, optional IDBCursorDirection direction = "next");
|
||||
IDBRequest openCursor (optional any range, optional IDBCursorDirection direction = "next");
|
||||
|
||||
[Throws]
|
||||
IDBRequest openKeyCursor (any range, optional IDBCursorDirection direction = "next");
|
||||
IDBRequest openKeyCursor (optional any range, optional IDBCursorDirection direction = "next");
|
||||
|
||||
[Throws]
|
||||
IDBRequest get (any key);
|
||||
@ -35,15 +35,15 @@ interface IDBIndex {
|
||||
IDBRequest getKey (any key);
|
||||
|
||||
[Throws]
|
||||
IDBRequest count (any key);
|
||||
IDBRequest count (optional any key);
|
||||
};
|
||||
|
||||
partial interface IDBIndex {
|
||||
readonly attribute DOMString storeName;
|
||||
|
||||
[Throws]
|
||||
IDBRequest mozGetAll (any key, optional unsigned long limit);
|
||||
IDBRequest mozGetAll (optional any key, optional unsigned long limit);
|
||||
|
||||
[Throws]
|
||||
IDBRequest mozGetAllKeys (any key, optional unsigned long limit);
|
||||
IDBRequest mozGetAllKeys (optional any key, optional unsigned long limit);
|
||||
};
|
||||
|
@ -25,10 +25,10 @@ interface IDBObjectStore {
|
||||
readonly attribute boolean autoIncrement;
|
||||
|
||||
[Throws]
|
||||
IDBRequest put (any value, any key);
|
||||
IDBRequest put (any value, optional any key);
|
||||
|
||||
[Throws]
|
||||
IDBRequest add (any value, any key);
|
||||
IDBRequest add (any value, optional any key);
|
||||
|
||||
[Throws]
|
||||
IDBRequest delete (any key);
|
||||
@ -40,7 +40,7 @@ interface IDBObjectStore {
|
||||
IDBRequest clear ();
|
||||
|
||||
[Throws]
|
||||
IDBRequest openCursor (any range, optional IDBCursorDirection direction = "next");
|
||||
IDBRequest openCursor (optional any range, optional IDBCursorDirection direction = "next");
|
||||
|
||||
// Bug 899972
|
||||
// IDBIndex createIndex (DOMString name, (DOMString or sequence<DOMString>) keyPath, optional IDBIndexParameters optionalParameters);
|
||||
@ -58,20 +58,20 @@ interface IDBObjectStore {
|
||||
void deleteIndex (DOMString indexName);
|
||||
|
||||
[Throws]
|
||||
IDBRequest count (any key);
|
||||
IDBRequest count (optional any key);
|
||||
};
|
||||
|
||||
partial interface IDBObjectStore {
|
||||
// Success fires IDBTransactionEvent, result == array of values for given keys
|
||||
[Throws]
|
||||
IDBRequest mozGetAll (any key, optional unsigned long limit);
|
||||
IDBRequest mozGetAll (optional any key, optional unsigned long limit);
|
||||
|
||||
[Pref="dom.indexedDB.experimental", Throws]
|
||||
IDBRequest getAll (any key, optional unsigned long limit);
|
||||
IDBRequest getAll (optional any key, optional unsigned long limit);
|
||||
|
||||
[Pref="dom.indexedDB.experimental", Throws]
|
||||
IDBRequest getAllKeys (any key, optional unsigned long limit);
|
||||
IDBRequest getAllKeys (optional any key, optional unsigned long limit);
|
||||
|
||||
[Pref="dom.indexedDB.experimental", Throws]
|
||||
IDBRequest openKeyCursor (any range, optional IDBCursorDirection direction = "next");
|
||||
IDBRequest openKeyCursor (optional any range, optional IDBCursorDirection direction = "next");
|
||||
};
|
||||
|
@ -26,9 +26,9 @@ interface Promise {
|
||||
// Promise object in this scope without having resolved the interface object
|
||||
// first.
|
||||
[NewObject, Throws]
|
||||
static Promise resolve(any value);
|
||||
static Promise resolve(optional any value);
|
||||
[NewObject, Throws]
|
||||
static Promise reject(any value);
|
||||
static Promise reject(optional any value);
|
||||
|
||||
// The [TreatNonCallableAsNull] annotation is required since then() should do
|
||||
// nothing instead of throwing errors when non-callable arguments are passed.
|
||||
|
@ -150,7 +150,7 @@ dictionary RTCStatsReportInternal {
|
||||
interface RTCStatsReport {
|
||||
[ChromeOnly]
|
||||
readonly attribute DOMString mozPcid;
|
||||
void forEach(RTCStatsReportCallback callbackFn, any thisArg);
|
||||
void forEach(RTCStatsReportCallback callbackFn, optional any thisArg);
|
||||
object get(DOMString key);
|
||||
boolean has(DOMString key);
|
||||
};
|
||||
|
@ -76,7 +76,7 @@ typedef any Transferable;
|
||||
[Throws] DOMString? prompt(optional DOMString message = "", optional DOMString default = "");
|
||||
[Throws] void print();
|
||||
//[Throws] any showModalDialog(DOMString url, optional any argument);
|
||||
[Throws] any showModalDialog(DOMString url, any argument, optional DOMString options = "");
|
||||
[Throws] any showModalDialog(DOMString url, optional any argument, optional DOMString options = "");
|
||||
|
||||
[Throws, CrossOriginCallable] void postMessage(any message, DOMString targetOrigin, optional sequence<Transferable> transfer);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user