New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 863277 link

Starred by 4 users

Issue metadata

Status: Fixed
Owner:
Last visit 27 days ago
Closed: Dec 11
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Feature



Sign in to add a comment

Add onChanged event callback to StorageArea

Reported by jakewhar...@gmail.com, Jul 13

Issue description

UserAgent: 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:
 
Labels: Needs-Triage-M67
Cc: phanindra.mandapaka@chromium.org
Labels: Triaged-ET Needs-Feedback
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.!
This is an API design feature request for chrome.storage and not a bug report so there is no URL to provide.
Project Member

Comment 4 by sheriffbot@chromium.org, Jul 18

Labels: -Needs-Feedback
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
Cc: vamshi.kommuri@chromium.org
Labels: -Type-Bug Target-70 M-70 FoundIn-70 OS-Linux OS-Windows Type-Feature
Status: Untriaged (was: Unconfirmed)
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!
Components: -Platform>DevTools Blink>Storage>DOMStorage
Components: -Blink>Storage>DOMStorage Platform>Extensions>API
Per the mention of chrome.storage this seems to be about the extensions API, and not the blink/web platform DOMStorage API.
Cc: dbertoni@chromium.org rdevlin....@chromium.org
Status: Available (was: Untriaged)
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. :)
Owner: lima...@gmail.com
I'm interesting in this issue. I will try it out.

Status: Started (was: Available)
Project Member

Comment 11 by bugdroid1@chromium.org, 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

Status: Fixed (was: Started)
Merged to master.

Sign in to add a comment