localForage setItem/getItem unreliable in Firefox / FireStorage Plus

荒凉一梦 提交于 2019-12-11 23:15:28

问题


I am loading a local instance of localForage and using it with Promise chains to save basic data. A simple example:

localforage.getItem("sellerExtension").then(function(sellerExtension) {
if ((!sellerExtension)  || (sellerExtension.length < 3)) {
    var sellerExtension = $('input#sellerExtension').val();
    if ((sellerExtension)  && (sellerExtension.length > 3)) {
        localforage.setItem('sellerExtension', sellerExtension).then( function() {

        });
    }
} 
});

The problem comes when I go into the FF Dev-Tools to check FireStorage Plus! and see nothing related to the saved/set data. BUT I do in Chrome just fine. There should be several saved items.

I'd been replacing localStorage (just for Firefox ugh) and am somewhat perplexed why thier own wrapper isn't showing in this FF specific extension for accessing the local DB instances. It shows key, getItem, clear and all, however.

Any ideas why this is happening? I fully expected to see something, and am looking in the right spot, I believe. (Screenshot below) It doesn't seem to be loading the data from a .getItem request, either.

I am using some AJAX to access other files in a sub-directory which handles localForage, but am on the same domain/port. Could I somehow be working in another scope? How would I know?

Thanx MUCH for any assistance!

And in Chrome I see it all...

BUT not in FF in any of the Scopes listed...


回答1:


Could the problem be that it's localStorage and not localForage as you have in your code?

Did you notice that in your screen shot, the Firebug tab says localStorage on it?




回答2:


Extensions like Firestorage Plus! and simplesession are NOT reliable when looking for data being set with localForage!!! The key (pun intended) is to use the Firefox built-in Inspector.

I could NOT find this in my FF after adding extensions, but I had the FF Dev Edition, ran that, enabled the Storage tool in config options, and bam, there they ALL were!! Hope this helps someone else out.

I "believe" that if you set data on a different page/file, those extensions wont see these values, only the orginial file/page's getItem data.



来源:https://stackoverflow.com/questions/36482778/localforage-setitem-getitem-unreliable-in-firefox-firestorage-plus

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!