Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use chrome.storage.sync instead of chrome.storage.local #7325

Closed
csbenjamin opened this issue May 12, 2016 · 7 comments
Closed

Use chrome.storage.sync instead of chrome.storage.local #7325

csbenjamin opened this issue May 12, 2016 · 7 comments

Comments

@csbenjamin
Copy link

csbenjamin commented May 12, 2016

Is there any chance to use chrome.storage.sync to store the history? Thus the database will be stored on the cloud and it will be synced over all computer that the user is logged in into chrome with a google account. Doing that, if I have some online pdf document, something like www.example.com/myOnlinePdf.pdf, I can open in my office computer, start reading it and later, when I get home, I can open that pdf url and I can continue reading where I had stopped when I was in the office.

@timvandermeij
Copy link
Contributor

Fixed in #7346.

@csbenjamin
Copy link
Author

@Rob--W When will the PDF Viewer be updated? I mean, when will the chrome extension in chrome web store be updated?

@timvandermeij
Copy link
Contributor

@csbenjamin Probably this week, according to #7353 (comment).

@Rob--W
Copy link
Member

Rob--W commented Jun 5, 2016

@csbenjamin I published an update two days ago (1.4.55).

But after reading your ticket again, I see that the initial triage is incorrect. chrome.storage is only used for preferences, not for the database (so supporting chrome.storage.sync along with chrome.storage.local does not change the status of this bug):

ViewHistory.prototype = {
_writeToStorage: function ViewHistory_writeToStorage() {
return new Promise(function (resolve) {
var databaseStr = JSON.stringify(this.database);
//#if FIREFOX || MOZCENTRAL
// sessionStorage.setItem('pdfjsHistory', databaseStr);
// resolve();
//#endif
//#if !(FIREFOX || MOZCENTRAL)
localStorage.setItem('database', databaseStr);
resolve();
//#endif
}.bind(this));
},
_readFromStorage: function ViewHistory_readFromStorage() {
return new Promise(function (resolve) {
//#if FIREFOX || MOZCENTRAL
// resolve(sessionStorage.getItem('pdfjsHistory'));
//#endif
//#if !(FIREFOX || MOZCENTRAL)
resolve(localStorage.getItem('database'));
//#endif
});
},

@yurydelendik @Snuffleupagus In Firefox, the database is stored in transient sessionStorage instead of some persistent storage. This was introduced in #4559 (previously the settings were in prefs.js). Why did you switch to sessionStorage instead of localStorage?

it is not that difficult to offer a preference to save the database in synchronized storage instead of localStorage (we just need to be careful and not store data when Private/incognito mode is enabled). If there are no objections I don't mind sending a PR.

@Rob--W Rob--W reopened this Jun 5, 2016
@Snuffleupagus
Copy link
Collaborator

In Firefox, the database is stored in transient sessionStorage instead of some persistent storage. This was introduced in #4559 (previously the settings were in prefs.js). Why did you switch to sessionStorage instead of localStorage?

Please see the bugs referenced in the PR, i.e. https://bugzilla.mozilla.org/show_bug.cgi?id=986966 and https://bugzilla.mozilla.org/show_bug.cgi?id=865893, for the rationale.

@Rob--W
Copy link
Member

Rob--W commented Jun 5, 2016

In Firefox, the database is stored in transient sessionStorage instead of some persistent storage. This was introduced in #4559 (previously the settings were in prefs.js). Why did you switch to sessionStorage instead of localStorage?

Please see the bugs referenced in the PR, i.e. https://bugzilla.mozilla.org/show_bug.cgi?id=986966 and https://bugzilla.mozilla.org/show_bug.cgi?id=865893, for the rationale.

Those bugs are about switching away from prefs.js, and do not provide any reason to specifically prefer sessionStorage over localStorage.

@Rob--W
Copy link
Member

Rob--W commented Jul 2, 2023

The storage.sync area quota is very limited, and I don't see a benefit in syncing per-document preferences. Therefore I'll close this.

@Rob--W Rob--W closed this as completed Jul 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants