chrome.storage.local api not working

2,182 views
Skip to first unread message

Methos

unread,
Nov 27, 2013, 4:52:01 PM11/27/13
to Chromium-extensions
Hi,

I want to use chrome.storage.local api to store some intermediate state which could be very large in size.

I was trying to test it on developer command line for my extension. Some things do not work.

1. chrome.storage.local.set() works. 

2. .get() works for a specific key.
    Does not work for "null" key as per the documentation.

3. chrome.storage.local.clear() does not work. Storage size remains unchanged and I can still read the data with a specific key. But .remove() works.

Since clear() does not work and get() does not work with a null key, I can see that my local storage is non empty but don't know what is occupying it.

How can this be made to work?

-Methos


Adrian Aichner

unread,
Nov 27, 2013, 7:42:49 PM11/27/13
to Methos, Chromium-extensions
Code sample or it didn't happen.


--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To post to this group, send email to chromium-...@chromium.org.
Visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/CA%2BTpfpgBRLEqTGXfBZA_cyr%2B7wBMm_42TXR%3DUrpkzZMGsUY7ag%40mail.gmail.com.
For more options, visit https://groups.google.com/a/chromium.org/groups/opt_out.

Methos

unread,
Nov 29, 2013, 11:24:25 AM11/29/13
to Adrian Aichner, Chromium-extensions
I tried to reproduce it in a sample extension but then it works as expected. However, in my extension the problem remains. 
Here is the output from main extension:

Function print_result() is defined as:

function print_result(msg) {
    return function (rc) {
        console.log(msg + JSON.stringify(rc));
    }
}


chrome.storage.local.get(null, print_result("Getting all objects: "));
undefined
Getting all objects: undefined
chrome.storage.local.getBytesInUse(null, print_result("Local storage size: "));
undefined
Local storage size: 7698
chrome.storage.local.clear();
undefined
chrome.storage.local.getBytesInUse(null, print_result("Local storage size: "));
undefined
Local storage size: 7698 
Reply all
Reply to author
Forward
0 new messages