Closed Bug 1481607 Opened 2 years ago Closed 2 years ago

Fix ExtensionStorageIDB storage.local.get when called with a string parameter

Categories

(WebExtensions :: Storage, defect, P1)

defect

Tracking

(firefox63 verified)

VERIFIED FIXED
mozilla63
Iteration:
63.4 - Aug 20
Tracking Status
firefox63 --- verified

People

(Reporter: mte90net, Assigned: rpl)

References

Details

Attachments

(2 files)

The extension is https://addons.mozilla.org/en-US/firefox/addon/share-backported/
Code on https://github.com/Mte90/Share-Backported

I received support request and also tested on my installation that with last Firefox Nightly the data are not migrated and as explained on https://blog.mozilla.org/addons/2018/08/03/new-backend-for-storage-local-api/ the file exist.

In any case I was trying to understand if I can reconfigure the plugin with saving new settings.
When I save with storage.local seems that the data are not saved.
When the storage.local.get API method is called with a string parameter, it should return
a result object that only include that property (if it is one of the key stored into the
storage.local data backend).

This patch fixes the behavior of the ExtensionStorageIDB in the above scenario, and also
applies some related small changes to the tests (to add some additional assertion to verify
this behavior as part of the automated tests and to fix a mistake on a storage.local.get
call in one of the test case, which has been caught once fixed the storage.local.get behavior
for the string parameter).
Assignee: nobody → lgreco
Status: NEW → ASSIGNED
Iteration: --- → 63.4 - Aug 20
Priority: -- → P1
So I don't need to fix that from my extension but when this fix will be available for Nightly users?
(In reply to Daniele "Mte90" Scasciafratte from comment #2)
> So I don't need to fix that from my extension but when this fix will be
> available for Nightly users?

Yes, the extension linked in Comment 0 should work correctly without any changes on a Nightly build with the attached fix applied.

From what I saw while I've been investigating this issue, the data is actually saved (and migrated) correctly, on the contrary the issue is when the extension's options page is loading the saved settings using the storage.local.get API method with a string parameter (which should return as a result an object with just that property, but it is currently returning an object with all the properties, and this seems to be what is making the extension's options page to do not set the expected values on the input elements).

You may also test if the patch fixes the issue for your extension before the patch is merged by using a linux64 build created in one of my push to try, e.g.:

- https://queue.taskcluster.net/v1/task/Bt9ZDeEoR2aC5y5DpotLTQ/runs/0/artifacts/public/build/target.tar.bz2
  (Generated from the following push to try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=61da4c757b52eb61df833042ba06450461ce6344)
Tested and is working, when will be available on Nightly?
Pushed by luca.greco@alcacoop.it:
https://hg.mozilla.org/integration/autoland/rev/84aff55a4fbf
Fix ExtensionStorageIDB storage.local.get when called with a string param. r=aswan
Comment on attachment 8998506 [details]
Bug 1481607 - Fix ExtensionStorageIDB storage.local.get when called with a string param.

Andrew Swan [:aswan] has approved the revision.
Attachment #8998506 - Flags: review+
https://hg.mozilla.org/mozilla-central/rev/84aff55a4fbf
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
Attached image Bug1481607.gif
This issue is verified as fixed on Firefox 63.0a1(20180809220138) under Win 7 64-bit and Mac OS X 10.13.3.

STR:
- Start Firefox 62 latest Beta.
- Install the extension from the Description.
- Open the options page, set some options and press the “Save” button.
- Reload the options page and check that your settings have been saved.
- Start Firefox 63 latest Nightly on the same profile.
- Open the options page and check that the settings you made are migrated as expected.
- Open about:config and check that the extension has been migrated (ExtensionStorageIDB.migrated.ADDON_ID)
- Change the settings from the options page again and press the “Save” button.
- Reload the options page and check that the new settings are loaded as expected.

Please see the attached video.
Status: RESOLVED → VERIFIED
Summary: Data not saved in Nightly → Fix ExtensionStorageIDB storage.local.get when called with a string parameter
You need to log in before you can comment on or make changes to this bug.