mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1045743. Add support for the Promise<type> syntax to Web IDL bindings. r=khuey
This commit is contained in:
parent
aa258b24d3
commit
6f36b0cbb8
@ -1540,8 +1540,9 @@ class IDLUnresolvedType(IDLType):
|
||||
Unresolved types are interface types
|
||||
"""
|
||||
|
||||
def __init__(self, location, name):
|
||||
def __init__(self, location, name, promiseInnerType=None):
|
||||
IDLType.__init__(self, location, name)
|
||||
self._promiseInnerType = promiseInnerType
|
||||
|
||||
def isComplete(self):
|
||||
return False
|
||||
@ -1562,8 +1563,11 @@ class IDLUnresolvedType(IDLType):
|
||||
obj = obj.complete(scope)
|
||||
return obj
|
||||
|
||||
if self._promiseInnerType and not self._promiseInnerType.isComplete():
|
||||
self._promiseInnerType = self._promiseInnerType.complete(scope)
|
||||
|
||||
name = self.name.resolve(scope, None)
|
||||
return IDLWrapperType(self.location, obj)
|
||||
return IDLWrapperType(self.location, obj, self._promiseInnerType)
|
||||
|
||||
def isDistinguishableFrom(self, other):
|
||||
raise TypeError("Can't tell whether an unresolved type is or is not "
|
||||
@ -2157,11 +2161,13 @@ class IDLTypedefType(IDLType, IDLObjectWithIdentifier):
|
||||
return self.inner._getDependentObjects()
|
||||
|
||||
class IDLWrapperType(IDLType):
|
||||
def __init__(self, location, inner):
|
||||
def __init__(self, location, inner, promiseInnerType=None):
|
||||
IDLType.__init__(self, location, inner.identifier.name)
|
||||
self.inner = inner
|
||||
self._identifier = inner.identifier
|
||||
self.builtin = False
|
||||
assert not promiseInnerType or inner.identifier.name == "Promise"
|
||||
self._promiseInnerType = promiseInnerType
|
||||
|
||||
def __eq__(self, other):
|
||||
return isinstance(other, IDLWrapperType) and \
|
||||
@ -3873,6 +3879,7 @@ class Tokenizer(object):
|
||||
"object": "OBJECT",
|
||||
"octet": "OCTET",
|
||||
"optional": "OPTIONAL",
|
||||
"Promise": "PROMISE",
|
||||
"sequence": "SEQUENCE",
|
||||
"MozMap": "MOZMAP",
|
||||
"short": "SHORT",
|
||||
@ -4893,6 +4900,20 @@ class Parser(Tokenizer):
|
||||
type = IDLNullableType(self.getLocation(p, 5), type)
|
||||
p[0] = type
|
||||
|
||||
# Note: Promise<void> is allowed, so we want to parametrize on
|
||||
# ReturnType, not Type. Also, we want this to end up picking up
|
||||
# the Promise interface for now, hence the games with IDLUnresolvedType.
|
||||
def p_NonAnyTypePromiseType(self, p):
|
||||
"""
|
||||
NonAnyType : PROMISE LT ReturnType GT Null
|
||||
"""
|
||||
innerType = p[3]
|
||||
promiseIdent = IDLUnresolvedIdentifier(self.getLocation(p, 1), "Promise")
|
||||
type = IDLUnresolvedType(self.getLocation(p, 1), promiseIdent, p[3])
|
||||
if p[5]:
|
||||
type = IDLNullableType(self.getLocation(p, 5), type)
|
||||
p[0] = type
|
||||
|
||||
def p_NonAnyTypeMozMapType(self, p):
|
||||
"""
|
||||
NonAnyType : MOZMAP LT Type GT Null
|
||||
@ -4909,6 +4930,11 @@ class Parser(Tokenizer):
|
||||
"""
|
||||
assert isinstance(p[1], IDLUnresolvedIdentifier)
|
||||
|
||||
if p[1].name == "Promise":
|
||||
raise WebIDLError("Promise used without saying what it's "
|
||||
"parametrized over",
|
||||
[self.getLocation(p, 1)])
|
||||
|
||||
type = None
|
||||
|
||||
try:
|
||||
|
@ -2,9 +2,9 @@ def WebIDLTest(parser, harness):
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
interface Promise {};
|
||||
interface _Promise {};
|
||||
interface A {
|
||||
legacycaller Promise foo();
|
||||
legacycaller Promise<any> foo();
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
@ -18,9 +18,9 @@ def WebIDLTest(parser, harness):
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
interface Promise {};
|
||||
interface _Promise {};
|
||||
interface A {
|
||||
Promise foo();
|
||||
Promise<any> foo();
|
||||
long foo(long arg);
|
||||
};
|
||||
""")
|
||||
@ -35,10 +35,10 @@ def WebIDLTest(parser, harness):
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
interface Promise {};
|
||||
interface _Promise {};
|
||||
interface A {
|
||||
long foo(long arg);
|
||||
Promise foo();
|
||||
Promise<any> foo();
|
||||
};
|
||||
""")
|
||||
results = parser.finish();
|
||||
@ -50,10 +50,10 @@ def WebIDLTest(parser, harness):
|
||||
|
||||
parser = parser.reset()
|
||||
parser.parse("""
|
||||
interface Promise {};
|
||||
interface _Promise {};
|
||||
interface A {
|
||||
Promise foo();
|
||||
Promise foo(long arg);
|
||||
Promise<any> foo();
|
||||
Promise<any> foo(long arg);
|
||||
};
|
||||
""")
|
||||
results = parser.finish();
|
||||
|
@ -84,26 +84,20 @@ interface BluetoothAdapter : EventTarget {
|
||||
* request, and the last one would indicate adapter.state becomes
|
||||
* enabled/disabled.
|
||||
*/
|
||||
// Promise<void>
|
||||
[NewObject, Throws]
|
||||
Promise enable();
|
||||
// Promise<void>
|
||||
Promise<void> enable();
|
||||
[NewObject, Throws]
|
||||
Promise disable();
|
||||
Promise<void> disable();
|
||||
|
||||
// Promise<void>
|
||||
[NewObject, Throws]
|
||||
Promise setName(DOMString aName);
|
||||
// Promise<void>
|
||||
Promise<void> setName(DOMString aName);
|
||||
[NewObject, Throws]
|
||||
Promise setDiscoverable(boolean aDiscoverable);
|
||||
Promise<void> setDiscoverable(boolean aDiscoverable);
|
||||
|
||||
// Promise<BluetoothDiscoveryHandle>
|
||||
[NewObject, Throws]
|
||||
Promise startDiscovery();
|
||||
// Promise<void>
|
||||
Promise<BluetoothDiscoveryHandle> startDiscovery();
|
||||
[NewObject, Throws]
|
||||
Promise stopDiscovery();
|
||||
Promise<void> stopDiscovery();
|
||||
|
||||
[NewObject, Throws]
|
||||
DOMRequest pair(DOMString deviceAddress);
|
||||
|
@ -39,7 +39,6 @@ interface BluetoothDevice : EventTarget
|
||||
* If the operation succeeds, the promise will be resolved with up-to-date
|
||||
* UUID list which is identical to attribute uuids.
|
||||
*/
|
||||
// Promise<sequence<DOMString>>
|
||||
[NewObject, Throws]
|
||||
Promise fetchUuids();
|
||||
Promise<sequence<DOMString>> fetchUuids();
|
||||
};
|
||||
|
@ -13,10 +13,8 @@ interface BluetoothPairingHandle
|
||||
*/
|
||||
readonly attribute DOMString passkey;
|
||||
|
||||
// Promise<void>
|
||||
[NewObject, Throws]
|
||||
Promise setPinCode(DOMString aPinCode);
|
||||
// Promise<void>
|
||||
Promise<void> setPinCode(DOMString aPinCode);
|
||||
[NewObject, Throws]
|
||||
Promise setPairingConfirmation(boolean aConfirm);
|
||||
Promise<void> setPairingConfirmation(boolean aConfirm);
|
||||
};
|
||||
|
@ -27,35 +27,29 @@ interface DataStore : EventTarget {
|
||||
[GetterThrows]
|
||||
readonly attribute boolean readOnly;
|
||||
|
||||
// Promise<any>
|
||||
[Throws]
|
||||
Promise get(DataStoreKey... id);
|
||||
Promise<any> get(DataStoreKey... id);
|
||||
|
||||
// Promise<void>
|
||||
[Throws]
|
||||
Promise put(any obj, DataStoreKey id, optional DOMString revisionId = "");
|
||||
Promise<void> put(any obj, DataStoreKey id, optional DOMString revisionId = "");
|
||||
|
||||
// Promise<DataStoreKey>
|
||||
[Throws]
|
||||
Promise add(any obj, optional DataStoreKey id,
|
||||
optional DOMString revisionId = "");
|
||||
Promise<DataStoreKey> add(any obj, optional DataStoreKey id,
|
||||
optional DOMString revisionId = "");
|
||||
|
||||
// Promise<boolean>
|
||||
[Throws]
|
||||
Promise remove(DataStoreKey id, optional DOMString revisionId = "");
|
||||
Promise<boolean> remove(DataStoreKey id, optional DOMString revisionId = "");
|
||||
|
||||
// Promise<void>
|
||||
[Throws]
|
||||
Promise clear(optional DOMString revisionId = "");
|
||||
Promise<void> clear(optional DOMString revisionId = "");
|
||||
|
||||
[GetterThrows]
|
||||
readonly attribute DOMString revisionId;
|
||||
|
||||
attribute EventHandler onchange;
|
||||
|
||||
// Promise<unsigned long>
|
||||
[Throws]
|
||||
Promise getLength();
|
||||
Promise<unsigned long> getLength();
|
||||
|
||||
[NewObject, Throws]
|
||||
DataStoreCursor sync(optional DOMString revisionId = "");
|
||||
@ -78,9 +72,8 @@ interface DataStoreCursor {
|
||||
[GetterThrows]
|
||||
readonly attribute DataStore store;
|
||||
|
||||
// Promise<DataStoreTask>
|
||||
[Throws]
|
||||
Promise next();
|
||||
Promise<DataStoreTask> next();
|
||||
|
||||
[Throws]
|
||||
void close();
|
||||
|
@ -24,26 +24,20 @@ interface DataStoreImpl {
|
||||
// is readOnly a F(current_app, datastore) function? yes
|
||||
readonly attribute boolean readOnly;
|
||||
|
||||
// Promise<any>
|
||||
Promise get(DataStoreKey... id);
|
||||
Promise<any> get(DataStoreKey... id);
|
||||
|
||||
// Promise<void>
|
||||
Promise put(any obj, DataStoreKey id, optional DOMString revisionId = "");
|
||||
Promise<void> put(any obj, DataStoreKey id, optional DOMString revisionId = "");
|
||||
|
||||
// Promise<DataStoreKey>
|
||||
Promise add(any obj, optional DataStoreKey id,
|
||||
optional DOMString revisionId = "");
|
||||
Promise<DataStoreKey> add(any obj, optional DataStoreKey id,
|
||||
optional DOMString revisionId = "");
|
||||
|
||||
// Promise<boolean>
|
||||
Promise remove(DataStoreKey id, optional DOMString revisionId = "");
|
||||
Promise<boolean> remove(DataStoreKey id, optional DOMString revisionId = "");
|
||||
|
||||
// Promise<void>
|
||||
Promise clear(optional DOMString revisionId = "");
|
||||
Promise<void> clear(optional DOMString revisionId = "");
|
||||
|
||||
readonly attribute DOMString revisionId;
|
||||
|
||||
// Promise<unsigned long>
|
||||
Promise getLength();
|
||||
Promise<unsigned long> getLength();
|
||||
|
||||
[NewObject]
|
||||
DataStoreCursor sync(optional DOMString revisionId = "");
|
||||
@ -61,8 +55,7 @@ interface DataStoreCursorImpl {
|
||||
// the DataStore
|
||||
readonly attribute DataStore store;
|
||||
|
||||
// Promise<DataStoreTask>
|
||||
Promise next();
|
||||
Promise<DataStoreTask> next();
|
||||
|
||||
void close();
|
||||
};
|
||||
|
@ -83,5 +83,6 @@ interface DeviceStorage : EventTarget {
|
||||
readonly attribute boolean default;
|
||||
|
||||
[NewObject, Throws]
|
||||
Promise getRoot();
|
||||
// XXXbz what type does this really return?
|
||||
Promise<any> getRoot();
|
||||
};
|
||||
|
@ -38,8 +38,7 @@ interface Directory {
|
||||
* File object. Otherwise, rejected with a DOM error.
|
||||
*/
|
||||
[NewObject, Throws]
|
||||
// Promise<File>
|
||||
Promise createFile(DOMString path, optional CreateFileOptions options);
|
||||
Promise<File> createFile(DOMString path, optional CreateFileOptions options);
|
||||
|
||||
/*
|
||||
* Creates a descendent directory. This method will create any intermediate
|
||||
@ -51,8 +50,7 @@ interface Directory {
|
||||
* Directory object. Otherwise, rejected with a DOM error.
|
||||
*/
|
||||
[NewObject, Throws]
|
||||
// Promise<Directory>
|
||||
Promise createDirectory(DOMString path);
|
||||
Promise<Directory> createDirectory(DOMString path);
|
||||
|
||||
/*
|
||||
* Gets a descendent file or directory with the given path.
|
||||
@ -63,8 +61,7 @@ interface Directory {
|
||||
* rejected with a DOM error.
|
||||
*/
|
||||
[NewObject, Throws]
|
||||
// Promise<(File or Directory)>
|
||||
Promise get(DOMString path);
|
||||
Promise<(File or Directory)> get(DOMString path);
|
||||
|
||||
/*
|
||||
* Deletes a file or an empty directory. The target must be a descendent of
|
||||
@ -78,8 +75,7 @@ interface Directory {
|
||||
* and was successfully deleted, the promise is resolved with boolean true.
|
||||
*/
|
||||
[NewObject, Throws]
|
||||
// Promise<boolean>
|
||||
Promise remove((DOMString or File or Directory) path);
|
||||
Promise<boolean> remove((DOMString or File or Directory) path);
|
||||
|
||||
/*
|
||||
* Deletes a file or a directory recursively. The target should be a
|
||||
@ -93,8 +89,7 @@ interface Directory {
|
||||
* deleted, the promise is resolved with boolean true.
|
||||
*/
|
||||
[NewObject, Throws]
|
||||
// Promise<boolean>
|
||||
Promise removeDeep((DOMString or File or Directory) path);
|
||||
Promise<boolean> removeDeep((DOMString or File or Directory) path);
|
||||
};
|
||||
|
||||
enum CreateIfExistsMode { "replace", "fail" };
|
||||
|
@ -29,14 +29,15 @@ enum DownloadState {
|
||||
interface DOMDownloadManager : EventTarget {
|
||||
// This promise returns an array of downloads with all the current
|
||||
// download objects.
|
||||
Promise getDownloads();
|
||||
Promise<sequence<DOMDownload>> getDownloads();
|
||||
|
||||
// Removes one download from the downloads set. Returns a promise resolved
|
||||
// with the finalized download.
|
||||
Promise remove(DOMDownload download);
|
||||
Promise<DOMDownload> remove(DOMDownload download);
|
||||
|
||||
// Removes all the completed downloads from the set.
|
||||
Promise clearAllDone();
|
||||
// Removes all the completed downloads from the set. Returns an
|
||||
// array of the completed downloads that were removed.
|
||||
Promise<sequence<DOMDownload>> clearAllDone();
|
||||
|
||||
// Fires when a new download starts.
|
||||
attribute EventHandler ondownloadstart;
|
||||
@ -84,11 +85,11 @@ interface DOMDownload : EventTarget {
|
||||
readonly attribute DOMError? error;
|
||||
|
||||
// Pauses the download.
|
||||
Promise pause();
|
||||
Promise<DOMDownload> pause();
|
||||
|
||||
// Resumes the download. This resolves only once the download has
|
||||
// succeeded.
|
||||
Promise resume();
|
||||
Promise<DOMDownload> resume();
|
||||
|
||||
// This event is triggered anytime a property of the object changes:
|
||||
// - when the transfer progresses, updating currentBytes.
|
||||
|
@ -150,9 +150,9 @@ partial interface HTMLMediaElement {
|
||||
[Pref="media.eme.enabled"]
|
||||
readonly attribute MediaKeys? mediaKeys;
|
||||
|
||||
// Promise<any>
|
||||
// void, not any: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26457
|
||||
[Pref="media.eme.enabled", Throws, NewObject]
|
||||
Promise setMediaKeys(MediaKeys? mediaKeys);
|
||||
Promise<void> setMediaKeys(MediaKeys? mediaKeys);
|
||||
|
||||
[Pref="media.eme.enabled"]
|
||||
attribute EventHandler onneedkey;
|
||||
|
@ -113,7 +113,7 @@ interface MozInputContext: EventTarget {
|
||||
* Get the whole text content of the input field.
|
||||
* @return DOMString
|
||||
*/
|
||||
Promise getText(optional long offset, optional long length);
|
||||
Promise<DOMString> getText(optional long offset, optional long length);
|
||||
// The start and stop position of the selection.
|
||||
readonly attribute long selectionStart;
|
||||
readonly attribute long selectionEnd;
|
||||
@ -134,7 +134,7 @@ interface MozInputContext: EventTarget {
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
Promise setSelectionRange(long start, long length);
|
||||
Promise<boolean> setSelectionRange(long start, long length);
|
||||
|
||||
/* User moves the cursor, or changes the selection with other means. If the text around
|
||||
* cursor has changed, but the cursor has not been moved, the IME won't get notification.
|
||||
@ -150,7 +150,7 @@ interface MozInputContext: EventTarget {
|
||||
* @param length The length of text to replace. Defaults to 0.
|
||||
* @return boolean
|
||||
*/
|
||||
Promise replaceSurroundingText(DOMString text, optional long offset, optional long length);
|
||||
Promise<boolean> replaceSurroundingText(DOMString text, optional long offset, optional long length);
|
||||
|
||||
/*
|
||||
*
|
||||
@ -160,7 +160,7 @@ interface MozInputContext: EventTarget {
|
||||
* TODO: maybe updateSurroundingText(DOMString beforeText, DOMString afterText); ?
|
||||
* @return boolean
|
||||
*/
|
||||
Promise deleteSurroundingText(long offset, long length);
|
||||
Promise<boolean> deleteSurroundingText(long offset, long length);
|
||||
|
||||
/*
|
||||
* Notifies when the text around the cursor is changed, due to either text
|
||||
@ -187,7 +187,7 @@ interface MozInputContext: EventTarget {
|
||||
* parameter repeat to true and invoke sendKey n-1 times, and then set
|
||||
* repeat to false in the last invoke.
|
||||
*/
|
||||
Promise sendKey(long keyCode, long charCode, long modifiers, optional boolean repeat);
|
||||
Promise<boolean> sendKey(long keyCode, long charCode, long modifiers, optional boolean repeat);
|
||||
|
||||
/*
|
||||
* Set current composing text. This method will start composition or update
|
||||
@ -216,8 +216,9 @@ interface MozInputContext: EventTarget {
|
||||
* To finish composition and commit text to current input field, an IME
|
||||
* should call |endComposition|.
|
||||
*/
|
||||
Promise setComposition(DOMString text, optional long cursor,
|
||||
optional sequence<CompositionClauseParameters> clauses);
|
||||
// XXXbz what is this promise resolved with?
|
||||
Promise<any> setComposition(DOMString text, optional long cursor,
|
||||
optional sequence<CompositionClauseParameters> clauses);
|
||||
|
||||
/*
|
||||
* End composition, clear the composing text and commit given text to
|
||||
@ -232,7 +233,8 @@ interface MozInputContext: EventTarget {
|
||||
* |replaceSurroundingText|, |deleteSurroundingText|, user moving the
|
||||
* cursor, changing the focus, etc.
|
||||
*/
|
||||
Promise endComposition(optional DOMString text);
|
||||
// XXXbz what is this promise resolved with?
|
||||
Promise<any> endComposition(optional DOMString text);
|
||||
};
|
||||
|
||||
enum CompositionClauseSelectionType {
|
||||
|
@ -13,5 +13,5 @@
|
||||
Func="mozilla::dom::workers::ServiceWorkerEventsVisible"]
|
||||
interface InstallPhaseEvent : Event {
|
||||
// https://github.com/slightlyoff/ServiceWorker/issues/261
|
||||
void waitUntil(Promise p);
|
||||
void waitUntil(Promise<any> p);
|
||||
};
|
||||
|
@ -25,19 +25,19 @@ interface MediaKeySession : EventTarget {
|
||||
|
||||
readonly attribute unrestricted double expiration;
|
||||
|
||||
// Promise<any>
|
||||
readonly attribute Promise closed;
|
||||
// void, not any: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26457
|
||||
readonly attribute Promise<void> closed;
|
||||
|
||||
// session operations
|
||||
//Promise<any>
|
||||
// void, not any: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26457
|
||||
[NewObject, Throws]
|
||||
Promise update(Uint8Array response);
|
||||
Promise<void> update(Uint8Array response);
|
||||
|
||||
// Promise<any>
|
||||
// void, not any: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26457
|
||||
[NewObject, Throws]
|
||||
Promise close();
|
||||
Promise<void> close();
|
||||
|
||||
// Promise<any>
|
||||
// void, not any: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26457
|
||||
[NewObject, Throws]
|
||||
Promise remove();
|
||||
Promise<void> remove();
|
||||
};
|
||||
|
@ -17,21 +17,18 @@ enum SessionType { "temporary", "persistent" };
|
||||
interface MediaKeys {
|
||||
readonly attribute DOMString keySystem;
|
||||
|
||||
// Promise<MediaKeySession>
|
||||
[NewObject, Throws]
|
||||
Promise createSession(DOMString initDataType, Uint8Array initData, optional SessionType sessionType = "temporary");
|
||||
Promise<MediaKeySession> createSession(DOMString initDataType, Uint8Array initData, optional SessionType sessionType = "temporary");
|
||||
|
||||
// Promise<MediaKeySession>
|
||||
[NewObject, Throws]
|
||||
Promise loadSession(DOMString sessionId);
|
||||
Promise<MediaKeySession> loadSession(DOMString sessionId);
|
||||
|
||||
// Promise<any>
|
||||
// void, not any: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26457
|
||||
[NewObject, Throws]
|
||||
Promise setServerCertificate(Uint8Array serverCertificate);
|
||||
Promise<void> setServerCertificate(Uint8Array serverCertificate);
|
||||
|
||||
// Promise<MediaKeys>
|
||||
[Throws,NewObject]
|
||||
static Promise create(DOMString keySystem);
|
||||
static Promise<MediaKeys> create(DOMString keySystem);
|
||||
static IsTypeSupportedResult isTypeSupported(DOMString keySystem, optional DOMString initDataType, optional DOMString contentType, optional DOMString capability);
|
||||
|
||||
};
|
||||
|
@ -37,5 +37,5 @@ interface MozSelfSupportImpl
|
||||
* @return Promise<Object>
|
||||
* Resolved when the FHR payload data has been collected.
|
||||
*/
|
||||
Promise getHealthReportPayload();
|
||||
Promise<object> getHealthReportPayload();
|
||||
};
|
||||
|
@ -84,7 +84,7 @@ interface NavigatorStorageUtils {
|
||||
[NoInterfaceObject]
|
||||
interface NavigatorFeatures {
|
||||
[CheckPermissions="feature-detection", Throws]
|
||||
Promise getFeature(DOMString name);
|
||||
Promise<any> getFeature(DOMString name);
|
||||
};
|
||||
|
||||
// Things that definitely need to be in the spec and and are not for some
|
||||
@ -123,7 +123,8 @@ Navigator implements NavigatorBattery;
|
||||
[NoInterfaceObject]
|
||||
interface NavigatorDataStore {
|
||||
[Throws, NewObject, Func="Navigator::HasDataStoreSupport"]
|
||||
Promise getDataStores(DOMString name, optional DOMString? owner = null);
|
||||
Promise<sequence<DataStore>> getDataStores(DOMString name,
|
||||
optional DOMString? owner = null);
|
||||
};
|
||||
Navigator implements NavigatorDataStore;
|
||||
|
||||
@ -161,8 +162,9 @@ interface NavigatorMobileId {
|
||||
// Ideally we would use [CheckPermissions] here, but the "mobileid"
|
||||
// permission is set to PROMPT_ACTION and [CheckPermissions] only checks
|
||||
// for ALLOW_ACTION.
|
||||
// XXXbz what is this promise resolved with?
|
||||
[Throws, NewObject, Func="Navigator::HasMobileIdSupport"]
|
||||
Promise getMobileIdAssertion(optional MobileIdOptions options);
|
||||
Promise<any> getMobileIdAssertion(optional MobileIdOptions options);
|
||||
};
|
||||
Navigator implements NavigatorMobileId;
|
||||
#endif // MOZ_B2G
|
||||
|
@ -21,7 +21,7 @@ interface Notification : EventTarget {
|
||||
static void requestPermission(optional NotificationPermissionCallback permissionCallback);
|
||||
|
||||
[Throws]
|
||||
static Promise get(optional GetNotificationOptions filter);
|
||||
static Promise<sequence<Notification>> get(optional GetNotificationOptions filter);
|
||||
|
||||
attribute EventHandler onclick;
|
||||
|
||||
|
@ -17,7 +17,8 @@ callback AnyCallback = any (any value);
|
||||
|
||||
// REMOVE THE RELEVANT ENTRY FROM test_interfaces.html WHEN THIS IS IMPLEMENTED IN JS.
|
||||
[Constructor(PromiseInit init)]
|
||||
interface Promise {
|
||||
// Need to escape "Promise" so it's treated as an identifier.
|
||||
interface _Promise {
|
||||
// TODO bug 875289 - static Promise fulfill(any value);
|
||||
|
||||
// Disable the static methods when the interface object is supposed to be
|
||||
@ -26,22 +27,22 @@ interface Promise {
|
||||
// Promise object in this scope without having resolved the interface object
|
||||
// first.
|
||||
[NewObject, Throws]
|
||||
static Promise resolve(optional any value);
|
||||
static Promise<any> resolve(optional any value);
|
||||
[NewObject, Throws]
|
||||
static Promise reject(optional any value);
|
||||
static Promise<void> reject(optional any value);
|
||||
|
||||
// The [TreatNonCallableAsNull] annotation is required since then() should do
|
||||
// nothing instead of throwing errors when non-callable arguments are passed.
|
||||
[NewObject, Throws]
|
||||
Promise then([TreatNonCallableAsNull] optional AnyCallback? fulfillCallback = null,
|
||||
[TreatNonCallableAsNull] optional AnyCallback? rejectCallback = null);
|
||||
Promise<any> then([TreatNonCallableAsNull] optional AnyCallback? fulfillCallback = null,
|
||||
[TreatNonCallableAsNull] optional AnyCallback? rejectCallback = null);
|
||||
|
||||
[NewObject, Throws]
|
||||
Promise catch([TreatNonCallableAsNull] optional AnyCallback? rejectCallback = null);
|
||||
Promise<any> catch([TreatNonCallableAsNull] optional AnyCallback? rejectCallback = null);
|
||||
|
||||
[NewObject, Throws]
|
||||
static Promise all(sequence<any> iterable);
|
||||
static Promise<any> all(sequence<any> iterable);
|
||||
|
||||
[NewObject, Throws]
|
||||
static Promise race(sequence<any> iterable);
|
||||
static Promise<any> race(sequence<any> iterable);
|
||||
};
|
||||
|
@ -16,5 +16,5 @@ enum PromiseDebuggingState { "pending", "fulfilled", "rejected" };
|
||||
|
||||
[ChromeOnly]
|
||||
interface PromiseDebugging {
|
||||
static PromiseDebuggingStateHolder getState(Promise p);
|
||||
static PromiseDebuggingStateHolder getState(Promise<any> p);
|
||||
};
|
||||
|
@ -132,9 +132,9 @@ interface ResourceStatsManager
|
||||
*
|
||||
* If success, the fulfillment value is a ResourceStats object.
|
||||
*/
|
||||
Promise getStats(optional ResourceStatsOptions statsOptions,
|
||||
[EnforceRange] optional DOMTimeStamp? start = null,
|
||||
[EnforceRange] optional DOMTimeStamp? end = null);
|
||||
Promise<ResourceStats> getStats(optional ResourceStatsOptions statsOptions,
|
||||
[EnforceRange] optional DOMTimeStamp? start = null,
|
||||
[EnforceRange] optional DOMTimeStamp? end = null);
|
||||
|
||||
/**
|
||||
* Clear resource statistics stored in database.
|
||||
@ -145,14 +145,16 @@ interface ResourceStatsManager
|
||||
* If |start| is null or undefined, delete the stats since measurements.
|
||||
* If |end| is null or undefined. delete the stats until the current time.
|
||||
*/
|
||||
Promise clearStats(optional ResourceStatsOptions statsOptions,
|
||||
[EnforceRange] optional DOMTimeStamp? start = null,
|
||||
[EnforceRange] optional DOMTimeStamp? end = null);
|
||||
// XXXbz What is this promise resolved with?
|
||||
Promise<any> clearStats(optional ResourceStatsOptions statsOptions,
|
||||
[EnforceRange] optional DOMTimeStamp? start = null,
|
||||
[EnforceRange] optional DOMTimeStamp? end = null);
|
||||
|
||||
/**
|
||||
* Clear all resource statistics stored in database.
|
||||
*/
|
||||
Promise clearAllStats();
|
||||
// XXXbz What is this promise resolved with?
|
||||
Promise<any> clearAllStats();
|
||||
|
||||
/**
|
||||
* Install an alarm to monitor resource usage.
|
||||
@ -167,9 +169,9 @@ interface ResourceStatsManager
|
||||
*
|
||||
* If success, the fulfillment value is an alarm ID.
|
||||
*/
|
||||
Promise addAlarm([EnforceRange] unsigned long long threshold,
|
||||
optional ResourceStatsOptions statsOptions,
|
||||
optional ResourceStatsAlarmOptions alarmOptions);
|
||||
Promise<unsigned long> addAlarm([EnforceRange] unsigned long long threshold,
|
||||
optional ResourceStatsOptions statsOptions,
|
||||
optional ResourceStatsAlarmOptions alarmOptions);
|
||||
|
||||
/**
|
||||
* Obtain alarms.
|
||||
@ -180,26 +182,28 @@ interface ResourceStatsManager
|
||||
*
|
||||
* If success, the fulfillment value is an array of ResourceStatsAlarm.
|
||||
*/
|
||||
Promise getAlarms(optional ResourceStatsOptions statsOptions);
|
||||
Promise<sequence<ResourceStatsAlarm>> getAlarms(optional ResourceStatsOptions statsOptions);
|
||||
|
||||
/**
|
||||
* Remove the specified alarm.
|
||||
*
|
||||
* |alarmId| specifies the alarm to be removed.
|
||||
*/
|
||||
Promise removeAlarm([EnforceRange] unsigned long alarmId);
|
||||
// XXXbz What is this promise resolved with?
|
||||
Promise<any> removeAlarm([EnforceRange] unsigned long alarmId);
|
||||
|
||||
/**
|
||||
* Remove all alarms.
|
||||
*/
|
||||
Promise removeAllAlarms();
|
||||
// XXXbz What is this promise resolved with?
|
||||
Promise<any> removeAllAlarms();
|
||||
|
||||
/**
|
||||
* Enumerate components that have stored statistics in database.
|
||||
*
|
||||
* If success, the fulfillment value is an array of DOMString.
|
||||
*/
|
||||
Promise getAvailableComponents();
|
||||
Promise<sequence<DOMString>> getAvailableComponents();
|
||||
|
||||
/**
|
||||
* Return supporting resource statistics, i.e. ["Network", "Power"]
|
||||
|
@ -18,21 +18,17 @@ interface ServiceWorkerContainer {
|
||||
[Unforgeable] readonly attribute ServiceWorker? active;
|
||||
[Unforgeable] readonly attribute ServiceWorker? controller;
|
||||
|
||||
// Promise<ServiceWorker>
|
||||
[Throws]
|
||||
readonly attribute Promise ready;
|
||||
readonly attribute Promise<any> ready;
|
||||
|
||||
// Promise<sequence<ServiceWorker>?>
|
||||
[Throws]
|
||||
Promise getAll();
|
||||
Promise<any> getAll();
|
||||
|
||||
// Promise<ServiceWorker>
|
||||
[Throws]
|
||||
Promise register(DOMString url, optional RegistrationOptionList options);
|
||||
Promise<ServiceWorker> register(DOMString url, optional RegistrationOptionList options);
|
||||
|
||||
// Promise<any>
|
||||
[Throws]
|
||||
Promise unregister(DOMString? scope);
|
||||
Promise<any> unregister(DOMString? scope);
|
||||
|
||||
attribute EventHandler onupdatefound;
|
||||
attribute EventHandler oncontrollerchange;
|
||||
@ -44,7 +40,7 @@ interface ServiceWorkerContainer {
|
||||
[ChromeOnly, Pref="dom.serviceWorkers.testing.enabled"]
|
||||
partial interface ServiceWorkerContainer {
|
||||
[Throws]
|
||||
Promise clearAllServiceWorkerData();
|
||||
Promise<any> clearAllServiceWorkerData();
|
||||
|
||||
[Throws]
|
||||
DOMString getScopeForUrl(DOMString url);
|
||||
|
@ -169,63 +169,63 @@ typedef (object or DOMString) AlgorithmIdentifier;
|
||||
[Pref="dom.webcrypto.enabled"]
|
||||
interface SubtleCrypto {
|
||||
[Throws]
|
||||
Promise encrypt(AlgorithmIdentifier algorithm,
|
||||
CryptoKey key,
|
||||
CryptoOperationData data);
|
||||
Promise<any> encrypt(AlgorithmIdentifier algorithm,
|
||||
CryptoKey key,
|
||||
CryptoOperationData data);
|
||||
[Throws]
|
||||
Promise decrypt(AlgorithmIdentifier algorithm,
|
||||
CryptoKey key,
|
||||
CryptoOperationData data);
|
||||
Promise<any> decrypt(AlgorithmIdentifier algorithm,
|
||||
CryptoKey key,
|
||||
CryptoOperationData data);
|
||||
[Throws]
|
||||
Promise sign(AlgorithmIdentifier algorithm,
|
||||
CryptoKey key,
|
||||
CryptoOperationData data);
|
||||
Promise<any> sign(AlgorithmIdentifier algorithm,
|
||||
CryptoKey key,
|
||||
CryptoOperationData data);
|
||||
[Throws]
|
||||
Promise verify(AlgorithmIdentifier algorithm,
|
||||
CryptoKey key,
|
||||
CryptoOperationData signature,
|
||||
CryptoOperationData data);
|
||||
Promise<any> verify(AlgorithmIdentifier algorithm,
|
||||
CryptoKey key,
|
||||
CryptoOperationData signature,
|
||||
CryptoOperationData data);
|
||||
[Throws]
|
||||
Promise digest(AlgorithmIdentifier algorithm,
|
||||
CryptoOperationData data);
|
||||
Promise<any> digest(AlgorithmIdentifier algorithm,
|
||||
CryptoOperationData data);
|
||||
|
||||
[Throws]
|
||||
Promise generateKey(AlgorithmIdentifier algorithm,
|
||||
boolean extractable,
|
||||
sequence<KeyUsage> keyUsages );
|
||||
Promise<any> generateKey(AlgorithmIdentifier algorithm,
|
||||
boolean extractable,
|
||||
sequence<KeyUsage> keyUsages );
|
||||
[Throws]
|
||||
Promise deriveKey(AlgorithmIdentifier algorithm,
|
||||
CryptoKey baseKey,
|
||||
AlgorithmIdentifier derivedKeyType,
|
||||
boolean extractable,
|
||||
sequence<KeyUsage> keyUsages );
|
||||
Promise<any> deriveKey(AlgorithmIdentifier algorithm,
|
||||
CryptoKey baseKey,
|
||||
AlgorithmIdentifier derivedKeyType,
|
||||
boolean extractable,
|
||||
sequence<KeyUsage> keyUsages );
|
||||
[Throws]
|
||||
Promise deriveBits(AlgorithmIdentifier algorithm,
|
||||
CryptoKey baseKey,
|
||||
unsigned long length);
|
||||
Promise<any> deriveBits(AlgorithmIdentifier algorithm,
|
||||
CryptoKey baseKey,
|
||||
unsigned long length);
|
||||
|
||||
[Throws]
|
||||
Promise importKey(KeyFormat format,
|
||||
object keyData,
|
||||
AlgorithmIdentifier algorithm,
|
||||
boolean extractable,
|
||||
sequence<KeyUsage> keyUsages );
|
||||
Promise<any> importKey(KeyFormat format,
|
||||
object keyData,
|
||||
AlgorithmIdentifier algorithm,
|
||||
boolean extractable,
|
||||
sequence<KeyUsage> keyUsages );
|
||||
[Throws]
|
||||
Promise exportKey(KeyFormat format, CryptoKey key);
|
||||
Promise<any> exportKey(KeyFormat format, CryptoKey key);
|
||||
|
||||
[Throws]
|
||||
Promise wrapKey(KeyFormat format,
|
||||
CryptoKey key,
|
||||
CryptoKey wrappingKey,
|
||||
AlgorithmIdentifier wrapAlgorithm);
|
||||
Promise<any> wrapKey(KeyFormat format,
|
||||
CryptoKey key,
|
||||
CryptoKey wrappingKey,
|
||||
AlgorithmIdentifier wrapAlgorithm);
|
||||
|
||||
[Throws]
|
||||
Promise unwrapKey(KeyFormat format,
|
||||
CryptoOperationData wrappedKey,
|
||||
CryptoKey unwrappingKey,
|
||||
AlgorithmIdentifier unwrapAlgorithm,
|
||||
AlgorithmIdentifier unwrappedKeyAlgorithm,
|
||||
boolean extractable,
|
||||
sequence<KeyUsage> keyUsages );
|
||||
Promise<any> unwrapKey(KeyFormat format,
|
||||
CryptoOperationData wrappedKey,
|
||||
CryptoKey unwrappingKey,
|
||||
AlgorithmIdentifier unwrapAlgorithm,
|
||||
AlgorithmIdentifier unwrappedKeyAlgorithm,
|
||||
boolean extractable,
|
||||
sequence<KeyUsage> keyUsages );
|
||||
};
|
||||
|
||||
|
@ -16,13 +16,11 @@ interface Telephony : EventTarget {
|
||||
* |navigator.mozMobileConnections.length|.
|
||||
*/
|
||||
|
||||
// Promise<TelephonyCall>
|
||||
[Throws]
|
||||
Promise dial(DOMString number, optional unsigned long serviceId);
|
||||
Promise<TelephonyCall> dial(DOMString number, optional unsigned long serviceId);
|
||||
|
||||
// Promise<TelephonyCall>
|
||||
[Throws]
|
||||
Promise dialEmergency(DOMString number, optional unsigned long serviceId);
|
||||
Promise<TelephonyCall> dialEmergency(DOMString number, optional unsigned long serviceId);
|
||||
|
||||
[Throws]
|
||||
void startTone(DOMString tone, optional unsigned long serviceId);
|
||||
|
Loading…
Reference in New Issue
Block a user