Closed
Bug 1328616
Opened 7 years ago
Closed 7 years ago
storage.local.get returns array instead of object in Firefox <=51
Categories
(Developer Documentation Graveyard :: Add-ons, defect, P2)
Developer Documentation Graveyard
Add-ons
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: geoffreydebelie, Unassigned)
Details
Attachments
(1 file)
965 bytes,
application/octet-stream
|
Details |
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0 Build ID: 20161213204721 Steps to reproduce: https://github.com/Smile4ever/firefoxaddons/blob/f1ce137a8d7a3ceaf1a242e0c58abb1dd76b88de/Scrollkey-webext/scrollkey.js Important parts from the code: var getScrollValue = function(id) -> storage.local.get is called var value = function(result) -> the result is processed. Note the if(isLowFirefoxVersion()) as a workaround for this (suspected) bug. Actual results: storage.local.get returns an array in Firefox <=51 [{ "key": "value" }] In Firefox >=52 this works correctly and an object is returned (see below). Expected results: storage.local.get should return an object: { "key": "value" }
Comment 1•7 years ago
|
||
I just did a quick test on Firefox 50.1 and I do get an object back from storage.local.get. Can you create a reduced test case that reproduces this behaviour on Firefox < 52?
Flags: needinfo?(computergeoffrey)
Reporter | ||
Comment 2•7 years ago
|
||
Test case. Output with Firefox 50.1.0: Getting result.. testlocalstorage.js:16:2 An array testlocalstorage.js:18:3 [{"scrollvalue":600}] testlocalstorage.js:22:2 Source (zip also contains manifest): var onSuccess = function(result){ console.log("Getting result.."); if(Array.isArray(result)){ console.log("An array"); }else{ console.log("Not an array"); } console.log(JSON.stringify(result)); } var onError = function(result){ } browser.storage.local.set({ scrollvalue: 600 }); var getting1 = browser.storage.local.get("scrollvalue"); getting1.then(onSuccess, onError);
Flags: needinfo?(computergeoffrey)
Comment 3•7 years ago
|
||
It is reproducible when run from a content script, but not when run from a background script, and I can see that on Firefox 50.1 an array is returned while on 53 an object is returned, so this does look like a bug. I'll leave it to be triaged in case anyone else has any quick ideas about what the cause may be, and whether a fix needs to be uplifted. Thanks Geoffrey.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 4•7 years ago
|
||
believe regression introduced and then fixed in 52. Timing wise we won't be able to uplift into Beta before 51 goes to release. Add to release notes. Matt Wein will document
Status: NEW → RESOLVED
Closed: 7 years ago
Flags: needinfo?(mwein)
Keywords: dev-doc-needed
Priority: -- → P2
Resolution: --- → WONTFIX
Comment 5•7 years ago
|
||
matt will write up docs to let folks know issue in 51.
Component: WebExtensions: Untriaged → Add-ons
Product: Toolkit → Developer Documentation
Comment 6•7 years ago
|
||
This is already documented in the warning box at https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/storage/StorageArea/get.
Flags: needinfo?(mwein)
Comment 7•7 years ago
|
||
Thanks to Makyen for adding in the documentation
Updated•7 years ago
|
Keywords: dev-doc-needed
You need to log in
before you can comment on or make changes to this bug.
Description
•