You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
console.warn('Cannot restore segments. This database will be removed',e,core);
try{
core.properties.file.remove();
deletedownloads.cache[id];
}
catch(e){}
});
},undefined,false);
}
};
chrome.runtime.onStartup.addListener(restore);
chrome.runtime.onInstalled.addListener(restore);
}
This could be fixed by adding this to manager.js:
manager.updateDb=(obj)=>{if(manager.db){consttransaction=manager.db.transaction('downloads','readwrite');// transaction.oncomplete = resolve;transaction.onerror=e=>reject(Error('Manager.updateDb, '+e.target.error));transaction.objectStore('downloads').put(JSON.parse(JSON.stringify(downloads.cache[obj.id])));transaction.commit();};};{request=indexedDB.open('downloads',1);request.onupgradeneeded=()=>{// TODO - Remove this line when Firefox supports indexedDB.databases()if(('databases'inindexedDB)===false){localStorage.setItem('downloads',true);}request.result.createObjectStore('downloads',{keyPath: 'id'});};request.onerror=e=>reject(Error('File.open, '+e.target.error));request.onsuccess=()=>{manager.db=request.result;manager.opened=true;};}downloads.onChanged.addListener(manager.updateDb);
Then one could do something like this at that restore:
I am not sure how to replicate this. As far as I see, the function does not rely on the existing entries of downloads.cache after a restart. The downloads.download({}, id => {..}) is supposed to prepare a new download entry so the cache must be available.
If
downloads.cache
isn't populated (e.g. the extension crashed & was reloaded), then this will fail.turbo-download-manager-v2/v3/downloads/manager.js
Lines 457 to 482 in 6b565b0
This could be fixed by adding this to manager.js:
Then one could do something like this at that restore:
However, the IDB storage necessarily removes functions, callbacks, etc. So
downloads.download
would need to be refactored to accept this.The text was updated successfully, but these errors were encountered: