Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Object expected in chrome.storage.sync.get callback #7314

Closed
jonathansampson opened this issue Feb 19, 2017 · 7 comments
Closed

Object expected in chrome.storage.sync.get callback #7314

jonathansampson opened this issue Feb 19, 2017 · 7 comments

Comments

@jonathansampson
Copy link
Collaborator

jonathansampson commented Feb 19, 2017

When calling chrome.storage.sync.get, the user passes along a callback function. When this function is executed, the first argument is expected to be an object. Presently, it is undefined. This causes errors to be thrown when attempting to access any property.

As an example, the following is from the Mercury extension:

chrome.storage.sync.get(null, function (items) {
    myObj = items;
    _this2.setState({
        theme: myObj.mercuryTheme || 'light',
        textSize: myObj.mercuryTextSize || 'medium',
        typography: myObj.mercuryTypography || 'serif',
        settingsLoaded: true,
        showApproveTos: myObj.mercuryApproveTos !== undefined ? myObj.mercuryApproveTos : true
    });
    chrome.runtime.sendMessage({ type: 'settingsLoaded' });
});

During the attempt to setState, the call to myObj.mercuryTheme will throw.

@jonathansampson jonathansampson added this to the 0.13.5 milestone Feb 19, 2017
@bbondy bbondy modified the milestones: 0.13.6, 0.13.5 Feb 25, 2017
@bsclifton
Copy link
Member

Moving to 0.13.7

@bsclifton bsclifton modified the milestones: 0.13.7, 0.13.6 Mar 14, 2017
@bridiver
Copy link
Collaborator

didn't we talk about making sync storage just point to regular storage?

@jonathansampson
Copy link
Collaborator Author

jonathansampson commented Mar 23, 2017

@bridiver We had indeed floated that idea in the past :) Of course, now that we have Brave Sync, I wonder how feasible it would be to integrate there.

@bridiver
Copy link
Collaborator

doing it right now

@bridiver
Copy link
Collaborator

it will actually point to a separate local storage instance

@bridiver
Copy link
Collaborator

fixed brave/muon@6c89ced

@bsclifton
Copy link
Member

marked as no QA needed; extension compatibility tracked with https://github.com/brave/browser-laptop/projects/1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants