Intent to Experiment: KV storage built-in module + import maps

443 views
Skip to first unread message

Domenic Denicola

unread,
Mar 5, 2019, 6:26:25 PM3/5/19
to blink-dev, hiro...@chromium.org, Kouhei Ueno, Victor Costan

Contact emails

dom...@chromium.org, hiro...@chromium.org, kou...@chromium.org, pwn...@chromium.org


Spec

https://wicg.github.io/kv-storage/

https://github.com/WICG/import-maps


Summary

KV storage (formerly "async local storage") is a new high-level API for an asynchronous key/value store, layered on top of IndexedDB.


Importantly, KV storage is our first experiment with shipping APIs as built-in modules, instead of putting them on the global namespace. This brings along the need for new technology for controlling built-in modules. That is where import maps comes in.


Import maps provide the ability to control how JavaScript imports modules, including built-in modules. This allows polyfilling and virtualization of built-in modules, like developers do already with built-in globals.


We want to run an experiment with both of these features together, as they are coupled in interesting ways which we want to gain experimental feedback on. Import maps are more interesting when a built-in module, such as KV storage, exists to use them with. And KV storage is more useful to web developers when it can be polyfilled, which import maps allows.


Link to “Intent to Implement” blink-dev discussion



Note that we will only be experimenting with the subset of import maps discussed in that Intent to Implement.


Goals for experimentation

  • Does the KV storage API meet developers' expectations and needs for key/value storage, enough to allow them to replace existing uses of sync localStorage or of large-ish async key/value store libraries?

  • Do any of the open issues on KV storage, e.g. around rate limiting or allowed key types, show up in practice when using KV storage in production?

  • Do import maps make it feasible to polyfill KV storage in production? (We plan to publish a basic polyfill at the start of the experiment, and invest in it more if there is developer interest.)

  • Do import maps integrate well with modern JavaScript build tooling, e.g. bundlers, package managers, or module/nomodule builds?

  • Is the syntax and developer experience of import maps usable and intuitive, or are there areas we could improve? (Including e.g. error messages, devtools integration, etc.)


Experimental timeline

M74 - M76


Any risks when the experiment finishes?

None. Although this is indeed an experimental storage API (which is literally the example given in the Intent to Experiment template), this API is layered on top of IndexedDB, so the data stays perfectly accessible!


In particular, a polyfill for KV storage can access the same IndexedDB databases that the built-in implementation creates, via the same API. Or, a developer could write hand-rolled IndexedDB code to access the data.


Ongoing technical constraints

None.


Debuggability

One interesting implementation artifact of our experimental implementation is that you can debug the JavaScript source code of the KV storage API using the devtools debugger. We are curious to find out if origin trial participants use this; if so, we may want to preserve this ability.


Otherwise, most of the DevTools-related concerns are about import maps, and are captured in that Intent to Implement.


Will this feature be supported on all five Blink platforms supported by Origin Trials (Windows, Mac, Linux, Chrome OS, and Android)?

Yes.


Link to entry on the feature dashboard


Chris Harrelson

unread,
Mar 7, 2019, 2:23:00 PM3/7/19
to Domenic Denicola, blink-dev, Hiroshige Hayashizaki, Kouhei Ueno, Victor Costan
LGTM

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAM0wra8G1Gf5XU%3DKDSsu1%2BSotQMGvVJ0OM7aQPEdfbG%2B4Ck4hg%40mail.gmail.com.

Jochen Eisinger

unread,
Mar 12, 2019, 5:41:17 AM3/12/19
to Chris Harrelson, Domenic Denicola, blink-dev, Hiroshige Hayashizaki, Kouhei Ueno, Victor Costan
Is this hooked up to content settings?

Domenic Denicola

unread,
Mar 12, 2019, 4:15:56 PM3/12/19
to Jochen Eisinger, Chris Harrelson, Domenic Denicola, blink-dev, Hiroshige Hayashizaki, Kouhei Ueno, Victor Costan
On Tue, Mar 12, 2019 at 5:41 AM Jochen Eisinger <joc...@chromium.org> wrote:
Is this hooked up to content settings?

Talking with Jochen offline, I clarified that he meant the settings in chrome://settings/content/cookies for blocking site data. The answer is "yes"; since KV storage is layered on top of IndexedDB, instead of being a separate storage technology, it is automatically controlled in the same way.
Reply all
Reply to author
Forward
0 new messages