I'm trying to use chrome.storage.local in my extension. This is a test that I coded up:
chrome.storage.local.set({'test': 'foo'}, function() {
  chrome.storage.local.get('test', function(data) {
    console.log("Test Result: ")
    console.log(data);
  })
});
var keyword = 'test2';
chrome.storage.local.set({keyword: 'foo'}, function() {
  chrome.storage.local.get(keyword, function(data) {
    console.log("Test 2 Result: ")
    console.log(data);
  })
});
The only difference between the first and the second test is that I replaced the string test by a variable holding the string test2. Now, you'd expect these both to work, right? The output is:
Test Result: 
Object {test: "foo"}
Test 2 Result: 
Object {}
What am I doing wrong?
 
    