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

**URL:** <https://discourse.mozilla.org/t/pb-chrome-storage-local-get-never-called/11904>\
**Category:** Development\
**Created:** [November 7, 2016, 8:34am UTC](https://discourse.mozilla.org/t/pb-chrome-storage-local-get-never-called/11904 "2016-11-07T08:34:53Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![dave-hill](https://avatars.discourse-cdn.com/v4/letter/d/7ea924/32.png) [@dave-hill](https://discourse.mozilla.org/u/dave-hill)\
**Post date:** [November 7, 2016, 8:34am UTC](https://discourse.mozilla.org/t/pb-chrome-storage-local-get-never-called/11904/1 "2016-11-07T08:34:55Z")

</div>

Hello everyone,

I’m the developper of the WebExtension :  
[https://addons.mozilla.org/fr/firefox/addon/lockself/](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

 ![](https://us1.discourse-cdn.com/flex001/uploads/mozilla/original/2X/8/8c84302b82bc137e9eb61e5598d4548883d50f82.png)

![](https://us1.discourse-cdn.com/flex001/uploads/mozilla/original/2X/9/9fcfff2975e647536c8ef40ab7db981413509b77.png)

> var APP\_LANG = ‘default’;  
> var URLAPI = “[https://www.xxxxxx.com/outils/apixxxxx.php](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 !

---

<div class="post-metadata">

**Author:** ![NilkasG](https://avatars.discourse-cdn.com/v4/letter/n/0ea827/32.png) [@NilkasG](https://discourse.mozilla.org/u/NilkasG)\
**Post date:** [November 8, 2016, 11:44am UTC](https://discourse.mozilla.org/t/pb-chrome-storage-local-get-never-called/11904/2 "2016-11-08T11:44:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dave-hill](https://avatars.discourse-cdn.com/v4/letter/d/7ea924/32.png) [@dave-hill](https://discourse.mozilla.org/u/dave-hill)\
**Post date:** [November 8, 2016, 12:50pm UTC](https://discourse.mozilla.org/t/pb-chrome-storage-local-get-never-called/11904/3 "2016-11-08T12:50:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![noitidart](https://avatars.discourse-cdn.com/v4/letter/n/9f8e36/32.png) [@noitidart](https://discourse.mozilla.org/u/noitidart)\
**Post date:** [November 8, 2016, 6:08pm UTC](https://discourse.mozilla.org/t/pb-chrome-storage-local-get-never-called/11904/4 "2016-11-08T18:08:37Z")

</div>

> [@dave-hill](#):
>
> TrackError(“Inside - IsConnected”);
> 
> ```
> }); TrackError("End - IsConnected"); }
> 
> ```

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.

---

<div class="post-metadata">

**Author:** ![dave-hill](https://avatars.discourse-cdn.com/v4/letter/d/7ea924/32.png) [@dave-hill](https://discourse.mozilla.org/u/dave-hill)\
**Post date:** [November 9, 2016, 5:49am UTC](https://discourse.mozilla.org/t/pb-chrome-storage-local-get-never-called/11904/5 "2016-11-09T05:49:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![noitidart](https://avatars.discourse-cdn.com/v4/letter/n/9f8e36/32.png) [@noitidart](https://discourse.mozilla.org/u/noitidart)\
**Post date:** [November 11, 2016, 6:53am UTC](https://discourse.mozilla.org/t/pb-chrome-storage-local-get-never-called/11904/6 "2016-11-11T06:53:19Z")

</div>

> [@dave-hill](#):
>
> “”

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

---

<div class="post-metadata">

**Author:** ![dave-hill](https://avatars.discourse-cdn.com/v4/letter/d/7ea924/32.png) [@dave-hill](https://discourse.mozilla.org/u/dave-hill)\
**Post date:** [November 11, 2016, 4:05pm UTC](https://discourse.mozilla.org/t/pb-chrome-storage-local-get-never-called/11904/7 "2016-11-11T16:05:18Z")

</div>

“” was the all\_url tag stripped by the Mozilla forum

---

<div class="post-metadata">

**Author:** ![wbamberg](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/wbamberg/32/30597_2.png) [@wbamberg](https://discourse.mozilla.org/u/wbamberg)\
**Post date:** [November 12, 2016, 1:08am UTC](https://discourse.mozilla.org/t/pb-chrome-storage-local-get-never-called/11904/8 "2016-11-12T01:08:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lipocodes](https://avatars.discourse-cdn.com/v4/letter/l/54ee81/32.png) [@lipocodes](https://discourse.mozilla.org/u/lipocodes)\
**Post date:** [November 13, 2016, 1:00pm UTC](https://discourse.mozilla.org/t/pb-chrome-storage-local-get-never-called/11904/9 "2016-11-13T13:00:27Z")

</div>

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”],

---

<div class="post-metadata">

**Author:** ![NilkasG](https://avatars.discourse-cdn.com/v4/letter/n/0ea827/32.png) [@NilkasG](https://discourse.mozilla.org/u/NilkasG)\
**Post date:** [November 13, 2016, 1:17pm UTC](https://discourse.mozilla.org/t/pb-chrome-storage-local-get-never-called/11904/10 "2016-11-13T13:17:55Z")

</div>

> [@lipocodes](#):
>
> why not using “synch” instead of “local”?

Because Firefox doesn’t support it (yet):

> **[storage - Mozilla | MDN](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/storage)**
>
> Enables extensions to store and retrieve data, and listen for changes to stored items.
