Fix race condition when loading redirect/scriptlet resources

Related feedback:
https://github.com/uBlockOrigin/uAssets/issues/23806#issuecomment-2190491767
This commit is contained in:
Raymond Hill 2024-06-26 11:00:50 -04:00
parent 6b349ca0ef
commit 896737d098
No known key found for this signature in database
GPG key ID: 25E1490B761470C2

View file

@ -1008,12 +1008,12 @@ onBroadcast(msg => {
ubolog('loadFilterLists() Start');
t0 = Date.now();
loadedListKeys.length = 0;
loadingPromise = Promise.all([
this.getAvailableLists().then(lists => onFilterListsReady(lists)),
this.loadRedirectResources().then(( ) => {
ubolog(`loadFilterLists() Redirects/scriptlets ready at ${elapsed()}`);
}),
]).then(( ) => {
loadingPromise = this.loadRedirectResources().then(( ) => {
ubolog(`loadFilterLists() Redirects/scriptlets ready at ${elapsed()}`);
return this.getAvailableLists();
}).then(lists => {
return onFilterListsReady(lists)
}).then(( ) => {
onDone();
});
return loadingPromise;