Closed
Bug 1265317
Opened 9 years ago
Closed 8 years ago
”Unable to parse JSON data for extension storage” error for a webextension installation
Categories
(WebExtensions :: Untriaged, defect)
WebExtensions
Untriaged
Tracking
(firefox45 affected, firefox46 affected, firefox47 unaffected, firefox48 affected, firefox49 affected, firefox50 verified)
VERIFIED
FIXED
mozilla50
People
(Reporter: vtamas, Assigned: freaktechnik, Mentored)
Details
(Whiteboard: [good first bug]triaged)
Attachments
(1 file, 1 obsolete file)
(deleted),
patch
|
kmag
:
review+
|
Details | Diff | Splinter Review |
[Note]
This is a follow-up bug for Bug 1197475
[Affected versions]:
Firefox 48.0a1 (2016-04-17)
Firefox 46.0b11
Firefox 45.0.2
[Affected platforms]:
Windows 10 64-bit
Ubuntu 14.04 32-bit
Mac OS X 10.11
[Steps to reproduce]:
1.Launch Firefox with clean profile.
2.Create the xpinstall.signatures.dev-root pref in about:config and set it to true.
3.Install the following webextension: https://addons.allizom.org/en-US/firefox/addon/testwebextension/?src=ss
4.Check the Browser Console.
[Expected Results]:
There are no errors thrown in Browser Console.
[Actual Results]:
The following JS error appears after installing the webextension: Unable to parse JSON data for extension storage. ExtensionStorage.jsm:49:0
[Additional notes]:
- I am marking Firefox 47.0a2 (2016-04-17) as unaffected because the webextension cannot be installed on this Firefox version.
- I was able to reproduce this issue down to Firefox 42.
Comment 1•9 years ago
|
||
I think this is a harmless error that just happens because we don't have a special case to handle when the file doesn't yet exist:
https://dxr.mozilla.org/mozilla-central/source/toolkit/components/extensions/ExtensionStorage.jsm#103
So we just need to check if OS.File.read throws an error because the file doesn't exist, and if so, treat it as success:
https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/OSFile.jsm/OS.File_for_the_main_thread#OS.File.read()
Mentor: kmaglione+bmo
Whiteboard: [good first bug]
Updated•9 years ago
|
Whiteboard: [good first bug] → [good first bug]triaged
Hi,
I am new here, If this bug is still open I would like to work on this.
I tried to reproduce the scenario. What I did:
I am using Mozilla VM, I executed following steps:
1. Build the source code.
2. Run the Nightly version of firefox
3. Followed steps to reproduce and got the error as mentioned.
I want to debug more. I used console.log() to check the path variable that is being passed in OS.File.read() and flow but did not get any sccusses.
Looking for help to debug and fix this issue.
Flags: needinfo?(kmaglione+bmo)
Also, As I am new I do not have much idea what code is done. It would be great if you could give some pointers.
Comment 4•9 years ago
|
||
`console.log` isn't available in this context. You can use Services.console.logStringMessage to log a message to the console, dump() to log a message to the standard output, or the browser debugger[1] if you need to debug browser code.
[1]: https://developer.mozilla.org/en-US/docs/Tools/Browser_Toolbox
Flags: needinfo?(kmaglione+bmo)
Assignee | ||
Comment 5•8 years ago
|
||
Fixes the error as suggested, by handling a missing file as success. After I applied this patch the error was gone.
Attachment #8762899 -
Flags: review?(kmaglione+bmo)
Updated•8 years ago
|
Assignee: nobody → martin
Comment 6•8 years ago
|
||
Comment on attachment 8762899 [details] [diff] [review]
bug1265317-v1.patch
Review of attachment 8762899 [details] [diff] [review]:
-----------------------------------------------------------------
::: toolkit/components/extensions/ExtensionStorage.jsm
@@ +103,5 @@
> let promise = OS.File.read(path);
> promise = promise.then(array => {
> return JSON.parse(decoder.decode(array));
> + }, (error) => {
> + if (error instanceof OS.File.Error && error.becauseNoSuchFile) {
We can add this check to the existing `.catch()` handler. And there's no need for the `instanceof OS.File.Error` check. Just checking the `becauseNoSuchFile` property is enough.
Attachment #8762899 -
Flags: review?(kmaglione+bmo)
Assignee | ||
Comment 7•8 years ago
|
||
Simplified the error handling as suggested.
Attachment #8762899 -
Attachment is obsolete: true
Attachment #8762907 -
Flags: review?(kmaglione+bmo)
Comment 8•8 years ago
|
||
Comment on attachment 8762907 [details] [diff] [review]
bug1265317-v2.patch
Review of attachment 8762907 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good. Thanks!
Attachment #8762907 -
Flags: review?(kmaglione+bmo) → review+
Assignee | ||
Comment 9•8 years ago
|
||
Assignee | ||
Updated•8 years ago
|
Keywords: checkin-needed
Comment 10•8 years ago
|
||
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/369ea77ee0d9
Handle missing storage error as success. r=kmag
Keywords: checkin-needed
Comment 11•8 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox50:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
Reporter | ||
Comment 12•8 years ago
|
||
I was able to reproduce the initial issue on Firefox 48.0a1 (2016-04-18) under Windows 10 64-bit.
Verified as fixed on Firefox 50.01 (2016-06-26) under Windows 10 64-bit and Ubuntu 16.04 32-bit. The error is no longer thrown in Browser Console.
Updated•6 years ago
|
Product: Toolkit → WebExtensions
You need to log in
before you can comment on or make changes to this bug.
Description
•