Fix uncaught rejected promise in assets.fetchText()

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/534

Regression from
a52b07ff6e
This commit is contained in:
Raymond Hill 2019-04-21 06:12:20 -04:00
parent 1c63aa719d
commit 7735b35e21
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 4 additions and 4 deletions

View File

@ -83,7 +83,7 @@ api.fetchText = function(url, onLoad, onError) {
onError = onLoad; onError = onLoad;
} }
return new Promise((resolve, reject) => { return new Promise(resolve => {
// Start of executor // Start of executor
const timeoutAfter = µBlock.hiddenSettings.assetFetchTimeout * 1000 || 30000; const timeoutAfter = µBlock.hiddenSettings.assetFetchTimeout * 1000 || 30000;
@ -104,16 +104,16 @@ api.fetchText = function(url, onLoad, onError) {
const onResolve = function(details) { const onResolve = function(details) {
if ( onLoad instanceof Function ) { if ( onLoad instanceof Function ) {
onLoad(details); return onLoad(details);
} }
resolve(details); resolve(details);
}; };
const onReject = function(details) { const onReject = function(details) {
if ( onError instanceof Function ) { if ( onError instanceof Function ) {
onError(details); return onError(details);
} }
reject(details); resolve(details);
}; };
// https://github.com/gorhill/uMatrix/issues/15 // https://github.com/gorhill/uMatrix/issues/15