1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
content / test / data / browsing_data / embeds_storage_accessor.html [blame]
<html>
<script>
async function accessStorage() {
// Set a cookie at the embedder level.
document.cookie = `embedder=embedder; max-age=3600;path=/`;
// Access local storage.
localStorage.setItem('bar', 'bar');
// Access web database.
window.openDatabase('bar', '1.0', 'bar DB', 1024);
// Access file system.
const file_system_promise = new Promise(function(resolve, reject) {
window.webkitRequestFileSystem(TEMPORARY, 1024, fs => {
fs.root.getFile("foo.txt");
resolve();
});
});
await file_system_promise;
// Access service worker.
await navigator.serviceWorker.register("empty.js");
// Access cache storage.
await caches.open('test');
// Access Indexed DB.
await indexedDB.open("bar");
return true;
}
</script>
<body>
<iframe src="
https://REPLACE_WITH_HOST_AND_PORT/browsing_data/storage_accessor.html">
</iframe>
</body>
</html>