Bug 1234020: Part 3 - [webext] Remove promise<->callback compatibility workarounds. r?billm
--- a/toolkit/components/extensions/Extension.jsm
+++ b/toolkit/components/extensions/Extension.jsm
@@ -372,29 +372,22 @@ GlobalManager = {
// the `chrome` API, so promise objects are not returned,
// and lastError values are reported immediately.
if (callback === null) {
callback = defaultCallback;
}
let promise;
try {
- // TODO: Stop passing the callback once all APIs return
- // promises.
- promise = schemaApi[ns][name](...args, callback);
+ promise = schemaApi[ns][name](...args);
} catch (e) {
promise = Promise.reject(e);
}
- // TODO: This check should no longer be necessary
- // once all async methods return promises.
- if (promise) {
- return context.wrapPromise(promise, callback);
- }
- return undefined;
+ return context.wrapPromise(promise || Promise.resolve(), callback);
},
getProperty(ns, name) {
return schemaApi[ns][name];
},
setProperty(ns, name, value) {
schemaApi[ns][name] = value;