Revision 7d92dbd58ac296da6fb2e24d9c9758775e873088 authored by Mike West on 06 December 2018, 10:19:53 UTC, committed by Chromium WPT Sync on 06 December 2018, 10:19:53 UTC
This patch adjusts `ScriptURLString` to be a union including `USVString`, not `DOMString`. The advice in [WebIDL][1] isn't exactly clear, but it boils down to @domenic's notes in [heycam/webidl#84][2] and [w3ctag/design-principles#93][3]. Long story short, URLs are `USVString`. This patch adjusts our implementation to match. [1]: https://heycam.github.io/webidl/#idl-USVString [2]: https://github.com/heycam/webidl/issues/84#issuecomment-300857185 [3]: https://github.com/w3ctag/design-principles/issues/93#issuecomment-379816152 Change-Id: I9bf1240b421287d7d9c291b13d887ca981a66231
1 parent 93af5d9
event_no_duplicates.html
<!DOCTYPE HTML>
<html>
<title>WebStorage Test: StorageEvent - only if something changes</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<script>
const iframe = document.createElement('iframe');
function tests(storageName) {
test(t => assert_true(storageName in window), storageName + ' exists');
const storage = window[storageName];
const iframeStorage = iframe.contentWindow[storageName];
add_completion_callback(() => {
storage.clear();
});
promise_test(t => {
const w = new EventWatcher(t, iframe.contentWindow, 'storage');
// Random key to make sure we don't conflict with any cruft leftover from
// earlier runs. Any synchronization would be really hard with localStorage
// limited guarantees.
const testKey = Math.random().toString(36).slice(2);
storage.setItem(testKey, 'foo');
storage.setItem(testKey, 'foo');
storage.setItem(testKey, 'bar');
return w.wait_for('storage')
.then(e => {
assert_equals(e.storageArea, iframeStorage);
assert_equals(e.key, testKey);
assert_equals(e.newValue, 'foo');
return w.wait_for('storage');
})
.then(e => {
assert_equals(e.storageArea, iframeStorage);
assert_equals(e.key, testKey);
assert_equals(e.oldValue, 'foo');
assert_equals(e.newValue, 'bar');
});
}, 'Setting to same value does not trigger event for ' + storageName);
promise_test(t => {
const w = new EventWatcher(t, iframe.contentWindow, 'storage');
// Random key to make sure we don't conflict with any cruft leftover from
// earlier runs. Any synchronization would be really hard with localStorage
// limited guarantees.
const testKey1 = Math.random().toString(36).slice(2);
const testKey2 = Math.random().toString(36).slice(2);
storage.removeItem(testKey1);
storage.setItem(testKey2, 'foo');
return w.wait_for('storage')
.then(e => {
assert_equals(e.storageArea, iframeStorage);
assert_equals(e.key, testKey2);
assert_equals(e.newValue, 'foo');
});
}, 'Deleting non-existent key does not trigger event for ' + storageName);
promise_test(t => {
const w = new EventWatcher(t, iframe.contentWindow, 'storage');
// Random key to make sure we don't conflict with any cruft leftover from
// earlier runs. Any synchronization would be really hard with localStorage
// limited guarantees.
const testKey = Math.random().toString(36).slice(2);
storage.setItem(testKey, 'foo');
storage.clear();
storage.clear();
storage.setItem(testKey, 'bar');
return w.wait_for('storage')
.then(e => {
assert_equals(e.storageArea, iframeStorage);
assert_equals(e.key, testKey);
assert_equals(e.newValue, 'foo');
return w.wait_for('storage');
})
.then(e => {
assert_equals(e.storageArea, iframeStorage);
assert_equals(e.key, null);
assert_equals(e.oldValue, null);
assert_equals(e.newValue, null);
return w.wait_for('storage');
})
.then(e => {
assert_equals(e.storageArea, iframeStorage);
assert_equals(e.key, testKey);
assert_equals(e.oldValue, null);
assert_equals(e.newValue, 'bar');
});
}, 'Clearing empty storage does not trigger event for ' + storageName);
}
iframe.onload = () => {
tests('sessionStorage');
tests('localStorage');
};
iframe.src = 'about:blank';
document.body.appendChild(iframe);
</script>
</body>
</html>
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...