Use promises in content scripts

This commit is contained in:
Nils Maier 2019-09-04 14:07:18 +02:00
parent 2c18ddaaa8
commit fdcdae0412

View File

@ -295,7 +295,7 @@ class Gatherer {
function gather(msg: any, sender: any, callback: Function) {
try {
if (!msg || msg.type !== "DTA:gather" || !callback) {
return;
return Promise.resolve(null);
}
const gatherer = new Gatherer(msg);
const result = {
@ -313,10 +313,11 @@ function gather(msg: any, sender: any, callback: Function) {
),
};
urlToUsable(result, result.baseURL);
callback(result);
return Promise.resolve(result);
}
catch (ex) {
console.error(ex.toString(), ex.stack, ex);
return Promise.resolve(null);
}
}