Skip to content

Commit

Permalink
An associated-interface-free DOM Storage
Browse files Browse the repository at this point in the history
Removes the last usage of Mojo associated interfaces from DOM Storage
code. Prior to this change, associated interfaces are used to
synchronize Clone() operations on a StorageNamespace interface with
arbitrary mutations on any StorageArea bound through that
StorageNamespace.

With the introduction of the Mojo async flushing API in r730829 we can
enforce such synchronization without associated interfaces. This CL does
that with a simple two-phase flush at clone time:

- Flush all related StorageArea pipes immediately prior to Clone
- Tell the StorageNamespace pipe to pause until said flushes complete
- Call StorageNamespace.Clone()
- Flush the StorageNamespace pipe immediately after Clone
- Tell all related StorageArea pipes to pause until that flush completes

This achieves the necessary ordering constraints for Session Storage
cloning without requiring strict ordering among all StorageNamespace and
StorageArea messages, consequently allowing StorageNamespace and
StorageArea to use independent pipes connected to potentially different
processes from each other. This satisfies a key requirement for
migrating Session Storage to the Storage Service.

Bug: 1000959
Change-Id: Ic1ccc2d6cbfa462733c53d2052d616655b49ed53
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2036885
Commit-Queue: Ken Rockot <rockot@google.com>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Daniel Murphy <dmurph@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738439}
  • Loading branch information
krockot authored and chromium-wpt-export-bot committed Feb 5, 2020
1 parent e3f4537 commit a5943e9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions webstorage/resources/storage_session_window_open_second.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
expected: "BAR",
message: "value for FOO in my opening window"
});
assertions.push({
actual: storage.getItem("BAZ"),
expected: null,
message: "value for BAZ set after window.open(), is not set in new window"
});

window.opener.postMessage(assertions, '*');

Expand Down
1 change: 1 addition & 0 deletions webstorage/storage_session_window_open.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

storage.setItem("FOO", "BAR");
var win = window.open("resources/storage_session_window_open_second.html");
storage.setItem("BAZ", "QUX");
window.addEventListener('message', t.step_func(function(e) {
e.data.forEach(t.step_func(function(assertion) {
assert_equals(assertion.actual, assertion.expected, assertion.message);
Expand Down

0 comments on commit a5943e9

Please sign in to comment.