PB "chrome.storage.local.get" never called

Hello everyone,

I’m the developper of the WebExtension :
https://addons.mozilla.org/fr/firefox/addon/lockself/

This is a password manager, and i need to store & use datas to identify or configure account.

Since few time, the native method “chrome.storage.local.get(null, callback)” doesn’t work …
To be really exact, the “callback function” is never called … no error, no trace …
I can put a console.log before & after … they are displayed, but if i put a console.log at the start of the callback function, it doesn’t appear and nothing happen in it

var APP_LANG = ‘default’;
var URLAPI = “https://www.xxxxxx.com/outils/apixxxxx.php”;

var TrackError = function (error){
console.log(error); }



var connexion = function(){
TrackError("connexion");
user = {};
user.autofill     	= true;
user.autoDestroyPub = true;
user.username     	= document.getElementById('c_username').value;
user.password     	= document.getElementById('c_password').value;
user.urlAPI       	= (document.getElementById('URLAPI').value.length > 0)?document.getElementById('URLAPI').value:URLAPI;
user.ExtensionVersion =  chrome.runtime.getManifest().version;
user.lastusername 	= user.username;
user.language 		= APP_LANG;
var nextStepCo = function(msg){
	if (msg) alert(msg);
	clickConnexionAction=true;
	TrackError(user);
	chrome.storage.local.set(user);
	IsConnected();
}
$.get(user.urlAPI+'/../apipub.php', function(e){ user.pubs = e;nextStepCo(); });}




   var IsConnected =  function (){
	  TrackError("IsConnected");
	chrome.storage.local.get(null, function(e){
		TrackError("Inside - IsConnected");
		
	}); TrackError("End - IsConnected"); }

And it’s verry strange, that’s working fine on :

  • Chrome
  • Firefox Nightly
  • Firefox Developper Edition
  • Standard Firefox ( before version 49.0 )

Manifest.json Permission :

permissions": [ “tabs”, “<all_urls>”, “storage”, “unlimitedStorage”, “webNavigation” , “webRequest”, “webRequestBlocking”,“downloads” ],

Have you Some Idea ?

Thanks for everything !

I encountered a but that Firefox wouldn’t resolve a browser.storage.local.get Promise about a Month ago too, probably in FF49.

In my case it only occurred while my extensions settings page was loading. Putting the request in a setTimeout(..., 10) fixed that for me.

It doesn’t work in my case :confused:
I’m searching a durable solution, this is in enterprise context :confused:

Side note: you aren’t error checking. You should.If chrome.runtime.lastError is set in the callback, you need to do the get again.

Already done (i was putting it in TrackError), but nothing more happen …
No error … Iike that’s working … But no working :frowning:

In your manifest.json you have this blank string, can it be that all permissions after this don’t take?

“” was the all_url tag stripped by the Mozilla forum

Can you share a complete minimal example that reproduces the problem?

Hi,

Here is a basic example of storage (why not using “synch” instead of “local”?):

chrome.storage.sync.get(“last_popup_time”, function (obj)
{
var milliseconds = (new Date).getTime();

  }

});

“permissions”: [“webRequest”,“webRequestBlocking”, “<all_urls>”, “storage”],

Because Firefox doesn’t support it (yet):
https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/storage#Browser_compatibility