mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1084381 - Do not wrap the DOMRequest in a promise in test_mmi_call_forwarding.js; r=hsinyi
DOMRequest now has a .then() method compatible with Promise.
This commit is contained in:
parent
92b4c47ea6
commit
4ad13a373c
@ -31,33 +31,6 @@ function waitForManagerEvent(aEventName) {
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap DOMRequest onsuccess/onerror events to Promise resolve/reject.
|
||||
*
|
||||
* Fulfill params: A DOMEvent.
|
||||
* Reject params: A DOMEvent.
|
||||
*
|
||||
* @param aRequest
|
||||
* A DOMRequest instance.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function wrapDomRequestAsPromise(aRequest) {
|
||||
let deferred = Promise.defer();
|
||||
|
||||
ok(aRequest instanceof DOMRequest,
|
||||
"aRequest is instanceof " + aRequest.constructor);
|
||||
|
||||
aRequest.addEventListener("success", function(aEvent) {
|
||||
deferred.resolve(aEvent);
|
||||
});
|
||||
aRequest.addEventListener("error", function(aEvent) {
|
||||
deferred.reject(aEvent);
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures call forward options.
|
||||
*
|
||||
@ -73,8 +46,7 @@ function wrapDomRequestAsPromise(aRequest) {
|
||||
*/
|
||||
function setCallForwardingOption(aOptions) {
|
||||
let request = connection.setCallForwardingOption(aOptions);
|
||||
return wrapDomRequestAsPromise(request)
|
||||
.then(null, () => { throw request.error; });
|
||||
return request.then(null, () => { throw request.error; });
|
||||
}
|
||||
|
||||
const TEST_DATA = [
|
||||
|
Loading…
Reference in New Issue
Block a user