Closed
Bug 1316386
Opened 8 years ago
Closed 8 years ago
storage.local.get() returns an array when called from a content script
Categories
(WebExtensions :: General, defect, P1)
WebExtensions
General
Tracking
(Not tracked)
RESOLVED
DUPLICATE
of bug 1287007
People
(Reporter: wbamberg, Assigned: kmag)
Details
(Keywords: regression)
Attachments
(1 file)
990 bytes,
application/zip
|
Details |
I've attached a WebExtension that has a background script and a content script. The background script sets a storage item, then retrieves it using storage.local.get() and logs it. The content script just gets it and logs it:
function onError(error) {
console.log(`Error: ${error}`);
}
function onGot(item) {
console.log(item);
}
var getting = browser.storage.local.get("color");
getting.then(onGot, onError);
In the background script, the `item` passed into `onGot()` is an object with a property `color`, as per the docs.
In the content script, it is an array containing one object, which is the object with the `color` property.
Tested in Firefox 49 and 51. This seems like a regression, because the tutorial https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Implement_a_settings_page uses this feature, and I would have tested it when I wrote it.
Assignee | ||
Comment 1•8 years ago
|
||
I had a feeling that was going to happen, but no tests were failing... :/
Assignee | ||
Comment 2•8 years ago
|
||
Hm. Actually, it looks like this is already fixed and tested.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
Updated•7 years ago
|
Product: Toolkit → WebExtensions
You need to log in
before you can comment on or make changes to this bug.
Description
•