mirror of
https://github.com/servo/servo
synced 2026-05-13 18:37:30 +02:00
Update web-platform-tests to revision b'b728032f59a396243864b0f8584e7211e3632005'
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
<meta name="timeout" content="long">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/dispatcher/dispatcher.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<script src="resources/utils.js"></script>
|
||||
<body>
|
||||
<script>
|
||||
@@ -10,32 +12,23 @@
|
||||
setup(() => assertSpeculationRulesIsSupported());
|
||||
|
||||
promise_test(async t => {
|
||||
const bc = new BroadcastChannel('prerender-channel');
|
||||
|
||||
const gotMessage = new Promise(resolve => {
|
||||
bc.addEventListener('message', e => {
|
||||
resolve(e.data);
|
||||
}, {
|
||||
once: true
|
||||
});
|
||||
});
|
||||
|
||||
const cacheName = 'checkallowed';
|
||||
const cacheName = token();
|
||||
const cache = await caches.open(cacheName);
|
||||
await cache.add('resources/cache.txt');
|
||||
t.add_cleanup(() => caches.delete(cacheName));
|
||||
const response = await cache.match('resources/cache.txt');
|
||||
const cacheText = await (response ? response.text() : 'primary cache match failed');
|
||||
|
||||
// Start prerendering a page that attempts to access cache storage.
|
||||
startPrerendering(`resources/cache-storage-access.https.html`);
|
||||
const result = await gotMessage;
|
||||
const {exec} = await create_prerendered_page(t);
|
||||
const result = await exec(async cacheName => {
|
||||
const cache = await caches.open(cacheName);
|
||||
const match = await cache.match('cache.txt');
|
||||
return await match.text();
|
||||
}, [cacheName]);
|
||||
|
||||
assert_equals(
|
||||
result, cacheText,
|
||||
'prerendering page should be able to read from cache storage.');
|
||||
await caches.delete(cacheName);
|
||||
|
||||
bc.close();
|
||||
}, 'prerendering page should be able to access cache storage')
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user