diff --git a/dom/system/gonk/tests/marionette/head.js b/dom/system/gonk/tests/marionette/head.js index a786ca96d767..64e238f68057 100644 --- a/dom/system/gonk/tests/marionette/head.js +++ b/dom/system/gonk/tests/marionette/head.js @@ -17,33 +17,6 @@ ok(ril, "ril.constructor is " + ril.constructor); let radioInterface = ril.getRadioInterface(0); ok(radioInterface, "radioInterface.constructor is " + radioInterface.constrctor); -/** - * 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; -} - /** * Get mozSettings value specified by @aKey. * @@ -63,11 +36,10 @@ function wrapDomRequestAsPromise(aRequest) { */ function getSettings(aKey, aAllowError) { let request = window.navigator.mozSettings.createLock().get(aKey); - return wrapDomRequestAsPromise(request) - .then(function resolve(aEvent) { + return request.then(function resolve(aValue) { log("getSettings(" + aKey + ") - success"); - return aEvent.target.result[aKey]; - }, function reject(aEvent) { + return aValue[aKey]; + }, function reject(aError) { ok(aAllowError, "getSettings(" + aKey + ") - error"); }); }