windows.getAll and storage.local.get callbacks not always invoked
Reported by
eric.pro...@gmail.com,
Oct 10 2017
|
|||
Issue description
UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36
Steps to reproduce the problem:
1. Load the extension
2. Click on the "rifle scope" icon
3. Wait for an alert telling you the callback succeeded
What is the expected behavior?
The following alerts:
alert("QQQ: - get pattern");
alert("QQQ: >> gotPatternOK");
alert("QQQ: - get showAudio");
alert(">> gotSettingOK");
alert("- populateTabList();");
alert("... called back with " + N + " windows (code is working)"
What went wrong?
Either one of the `storage.get` functions or the call to `chrome.windows.getAll` silently fails. No exception raised,
no callback invoked, just silence.
Did this work before? N/A
Does this work in other browsers? Yes
Chrome version: 61.0.3163.100 Channel: stable
OS Version: OS X 10.12.6
Flash Version:
I'm porting a firefox webextensions add-on to chrome. I have it working in firefox with the webextensions API no problem. I realize the namespace and api signatures in chrome are different, but I don't know why things are failing here.
,
Oct 10 2017
,
Oct 10 2017
* Your code has a bug: getAllProperties is not defined. * "alert()" is an ancient and very awkward way of debugging code in extensions development. Depending on OS, it may close the popup itself and thus stop further execution, for example, In Windows I only see the first alert. Switch to console.log, right-click the popup window, click Inspect to open popup's devtools. * No need for any of those try/catch
,
Oct 10 2017
BTW, instead of rewriting API calls, it may be sufficient to simply add 'browser' namespace polyfill to your WebExtension: https://github.com/mozilla/webextension-polyfill
,
Oct 11 2017
nyeraramilli, thanks for fixing the summary; woxxom, thanks for the replies. I wasn't getting console.log to work, so I resorted to alert. Then I googled and found the 'Inspect popup' console. Now I see the error messages, etc. And I'll look into polyfill. The rewrite was temporary -- I really don't want to maintain two near-identical code bases.
,
Oct 11 2017
And actually I was getting both the repro, and the code it came from to work, once I could see the console. I don't see a way I can close this, so please close it as "not a bug" or something like that.
,
Oct 11 2017
polyfill works perfectly -- thanks
,
Oct 11 2017
|
|||
►
Sign in to add a comment |
|||
Comment 1 by eric.pro...@gmail.com
, Oct 10 2017