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)

defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1287007

People

(Reporter: wbamberg, Assigned: kmag)

Details

(Keywords: regression)

Attachments

(1 file)

Attached file test-storage.zip
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.
I had a feeling that was going to happen, but no tests were failing... :/
Assignee: nobody → kmaglione+bmo
Severity: normal → critical
Keywords: regression
Priority: -- → P1
Hm. Actually, it looks like this is already fixed and tested.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: