Remove the migration code for old localStorage data in ViewHistory
This was added in PR 7793, which has now been present in a number of PDF.js releases (from version `v1.7.225`). Hence we should be able to remove it now, considering that the migration code was only intended as a best effort solution to avoid wiping out all existing user data at once. Also, keep in mind that `ViewHistory` is already limited with regards to the number of documents it will simultaneous store data for.
This commit is contained in:
parent
9b26bec1d7
commit
81b4761e6e
@ -73,25 +73,7 @@ class ViewHistory {
|
||||
PDFJSDev.test('FIREFOX || MOZCENTRAL')) {
|
||||
resolve(sessionStorage.getItem('pdfjs.history'));
|
||||
} else {
|
||||
let value = localStorage.getItem('pdfjs.history');
|
||||
|
||||
// TODO: Remove this key-name conversion after a suitable time-frame.
|
||||
// Note that we only remove the old 'database' entry if it looks like
|
||||
// it was created by PDF.js, to avoid removing someone else's data.
|
||||
if (!value) {
|
||||
let databaseStr = localStorage.getItem('database');
|
||||
if (databaseStr) {
|
||||
try {
|
||||
let database = JSON.parse(databaseStr);
|
||||
if (typeof database.files[0].fingerprint === 'string') {
|
||||
localStorage.setItem('pdfjs.history', databaseStr);
|
||||
localStorage.removeItem('database');
|
||||
value = databaseStr;
|
||||
}
|
||||
} catch (ex) { }
|
||||
}
|
||||
}
|
||||
resolve(value);
|
||||
resolve(localStorage.getItem('pdfjs.history'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user