Add onChanged event callback to StorageArea
Reported by
jakewhar...@gmail.com,
Jul 13
|
||||||||||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36 Steps to reproduce the problem: When writing an abstraction over StorageArea, you are unable to listen to changes only to a supplied StorageArea. The onChanged listener exists on the chrome.storage object and requires knowing a string key of the StorageArea instance you care about. What is the expected behavior? If each StorageArea had an onChanged event callback whose callback function only received the single changes object, abstractions could read, write, and listen to changes to a StorageArea without knowing which one it was. Internally this event callback could simply delegate to the chrome.storage.onChanged event callback and perform the filtering on the consumer's behalf. This becomes essential in strongly typed languages like TypeScript and Kotlin where classes want to receive only a StorageArea instance. What went wrong? chrome.storage exposes an onChanged event callback for changes to all of the StorageArea instances which are then disambiguated with a string key. This prevents simple abstractions from being written which are independent of the StorageArea to which they will be reading, writing, and listening to changes. The abstraction is required to, at minimum, pass in the chrome.storage instance and a string of the StorageArea name which is then looked up by that name. Did this work before? N/A Chrome version: 67.0.3396.99 Channel: stable OS Version: OS X 10.13.5 Flash Version:
,
Jul 16
Thanks for filing the issue... @Reporter : It would be really helpful if a sample URL is provided, so that we can investigate the issue further. Thanks.!
,
Jul 18
This is an API design feature request for chrome.storage and not a bug report so there is no URL to provide.
,
Jul 18
Thank you for providing more feedback. Adding the requester to the cc list. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Jul 25
As per the confirmation given in comment#3 by reporter this seems to be a Feature request not a Bug, hence marking it as Untriaged and adding appropriate labels. Thanks!
,
Jul 26
,
Jul 26
Per the mention of chrome.storage this seems to be about the extensions API, and not the blink/web platform DOMStorage API.
,
Jul 27
This is an interesting idea, and I can definitely see the benefit in adding a callback to the specific storage area. I don't think this is something we'll get to in the near future, so marking as available in case someone wants to drive this. We're happy to offer guidance where we can. :)
,
Nov 9
I'm interesting in this issue. I will try it out.
,
Nov 17
,
Dec 11
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/02de02be61c0564bbbfef0d868e2b543572b3c86 commit 02de02be61c0564bbbfef0d868e2b543572b3c86 Author: Sungguk Lim <limasdf@gmail.com> Date: Tue Dec 11 03:01:53 2018 Add onChanged event callback to StorageArea When new value is updated by StorageArea.set(), chrome.storage.onChanged callback and newly added StorageArea.onChanged callback would be called at the same time. Bug: 863277 Change-Id: I9076fdf1c55f5c2d5e913e3c671aab6630cee304 Reviewed-on: https://chromium-review.googlesource.com/c/1329802 Reviewed-by: Devlin <rdevlin.cronin@chromium.org> Commit-Queue: Sungguk Lim <limasdf@gmail.com> Cr-Commit-Position: refs/heads/master@{#615409} [modify] https://crrev.com/02de02be61c0564bbbfef0d868e2b543572b3c86/chrome/browser/extensions/api/storage/settings_apitest.cc [modify] https://crrev.com/02de02be61c0564bbbfef0d868e2b543572b3c86/chrome/test/data/extensions/api_test/native_bindings/extension/background.js [add] https://crrev.com/02de02be61c0564bbbfef0d868e2b543572b3c86/chrome/test/data/extensions/api_test/settings/storage_area/background.js [add] https://crrev.com/02de02be61c0564bbbfef0d868e2b543572b3c86/chrome/test/data/extensions/api_test/settings/storage_area/manifest.json [modify] https://crrev.com/02de02be61c0564bbbfef0d868e2b543572b3c86/extensions/browser/api/storage/storage_api_unittest.cc [modify] https://crrev.com/02de02be61c0564bbbfef0d868e2b543572b3c86/extensions/browser/api/storage/storage_frontend.cc [modify] https://crrev.com/02de02be61c0564bbbfef0d868e2b543572b3c86/extensions/browser/extension_event_histogram_value.h [modify] https://crrev.com/02de02be61c0564bbbfef0d868e2b543572b3c86/extensions/common/api/storage.json [modify] https://crrev.com/02de02be61c0564bbbfef0d868e2b543572b3c86/extensions/renderer/resources/storage_area.js [modify] https://crrev.com/02de02be61c0564bbbfef0d868e2b543572b3c86/extensions/renderer/storage_area.cc [modify] https://crrev.com/02de02be61c0564bbbfef0d868e2b543572b3c86/extensions/renderer/storage_area.h [modify] https://crrev.com/02de02be61c0564bbbfef0d868e2b543572b3c86/extensions/renderer/storage_area_unittest.cc [modify] https://crrev.com/02de02be61c0564bbbfef0d868e2b543572b3c86/tools/metrics/histograms/enums.xml
,
Dec 11
Merged to master. |
||||||||||
►
Sign in to add a comment |
||||||||||
Comment 1 by krajshree@chromium.org
, Jul 13