mirror of https://github.com/gorhill/uBlock.git
Fix idbStorage.keys()
Related commit: https://github.com/gorhill/uBlock/commit/d4efaf020b
This commit is contained in:
parent
d8544dc047
commit
801d6500b0
|
@ -790,7 +790,7 @@ async function assetCacheRemove(pattern, options = {}) {
|
|||
}
|
||||
if ( options.janitor && pattern instanceof RegExp ) {
|
||||
const re = new RegExp(
|
||||
pattern.source.replace(/^\^/, 'cache\/'),
|
||||
pattern.source.replace(/^\^/, '^cache\\/'),
|
||||
pattern.flags
|
||||
);
|
||||
const keys = await cacheStorage.keys(re);
|
||||
|
|
|
@ -546,7 +546,7 @@ const idbStorage = (( ) => {
|
|||
});
|
||||
};
|
||||
|
||||
const getAllKeys = async function() {
|
||||
const getAllKeys = async function(regex) {
|
||||
const db = await getDb();
|
||||
if ( db === null ) { return []; }
|
||||
return new Promise(resolve => {
|
||||
|
@ -562,6 +562,7 @@ const idbStorage = (( ) => {
|
|||
req.onsuccess = ev => {
|
||||
const cursor = ev.target && ev.target.result;
|
||||
if ( !cursor ) { return; }
|
||||
if ( regex && regex.test(cursor.key) === false ) { return; }
|
||||
keys.push(cursor.key);
|
||||
cursor.continue();
|
||||
};
|
||||
|
@ -685,8 +686,8 @@ const idbStorage = (( ) => {
|
|||
return setEntries(bin);
|
||||
},
|
||||
|
||||
keys() {
|
||||
return getAllKeys();
|
||||
keys(...args) {
|
||||
return getAllKeys(...args);
|
||||
},
|
||||
|
||||
remove(...args) {
|
||||
|
|
|
@ -232,8 +232,7 @@ const onUserSettingsReady = fetched => {
|
|||
fetched.importedLists.length === 0 &&
|
||||
fetched.externalLists !== ''
|
||||
) {
|
||||
fetched.importedLists =
|
||||
fetched.externalLists.trim().split(/[\n\r]+/);
|
||||
fetched.importedLists = fetched.externalLists.trim().split(/[\n\r]+/);
|
||||
}
|
||||
|
||||
fromFetch(µb.userSettings, fetched);
|
||||
|
|
Loading…
Reference in New Issue