mirror of https://github.com/gorhill/uBlock.git
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:
parent
1c63aa719d
commit
7735b35e21
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue