I'm trying to save pair pageUrl:imageUrl into chrom local storage. Here is the code:
function saveImage (href, urlImage)
{
var dataObj = {href:urlImage};
dataObj[href] = urlImage;
chrome.storage.local.set(dataObj);
console.log("Image url has been saved into storage "+href);
}
function tryLoadCachedImageUrl(hrefObj)
{
console.log("Trying to load image from storage: "+hrefObj.href);
chrome.storage.local.get(hrefObj.href,
function(result){
loadImages(result,hrefObj);
});
}
chrome.storage.local.get causes exception:
Error in response to storage.get: ReferenceError: obj is not defined
hrefObj.href contains string, equal to pageUrl
which was saved in saveImage
What am I doing wrong?