Skip to content

Commit 8a33441

Browse files
alexnjmoz-wptsync-bot
authored andcommitted
Bug 1936249 [wpt PR 49617] - Add WPT test for Document-Policy: expect-no-linked-resources, a=testonly
Automatic update from web-platform-tests Add WPT test for Document-Policy: expect-no-linked-resources Add a tentative and optional test case for whatwg/html#10718. -- wpt-commits: e2df4d406f762be154339148fe953629493c28c5 wpt-pr: 49617
1 parent 7eb367c commit 8a33441

File tree

4 files changed

+48
-0
lines changed

4 files changed

+48
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<!DOCTYPE html>
2+
<meta charset=utf-8>
3+
<title>Speculative parsing, expect-no-linked-resources Document-Policy</title>
4+
<meta name="timeout" content="long">
5+
<script src=/resources/testharness.js></script>
6+
<script src=/resources/testharnessreport.js></script>
7+
<script src="/resources/testdriver.js"></script>
8+
<script src="/resources/testdriver-vendor.js"></script>
9+
<script src="/common/utils.js"></script>
10+
<script>
11+
async function get_results(uuid) {
12+
const response = await fetch(`/html/syntax/speculative-parsing/expect-no-linked-resources/resources/stash.py?action=get&uuid=${uuid}`);
13+
return await response.text();
14+
}
15+
16+
promise_test(async () => {
17+
const uuid = token();
18+
19+
await test_driver.bless('Open a URL with expect-no-linked-resources Document-Policy');
20+
const popup = window.open(`/html/syntax/speculative-parsing/expect-no-linked-resources/resources/no-speculative-fetch.sub.html?pipe=sub&uuid=${uuid}`, '_blank');
21+
await new Promise(resolve => popup.addEventListener('load', resolve));
22+
23+
const result = await get_results(uuid);
24+
assert_equals(result, '', 'speculative case fetched');
25+
}, `expect-no-linked-resources hint was ignored`);
26+
</script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!doctype html>
2+
<title>Navigating to a page with expect-no-linked-resources</title>
3+
4+
<body>
5+
<script>
6+
document.write('<plaintext>');
7+
</script>
8+
<img
9+
src="/html/syntax/speculative-parsing/expect-no-linked-resources/resources/stash.py?action=put&uuid={{GET[uuid]}}">
10+
</body>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Document-Policy: expect-no-linked-resources
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import time
2+
3+
def main(request, response):
4+
if request.GET[b"action"] == b"put":
5+
# Received result data from target page
6+
request.server.stash.put(request.GET[b"uuid"], request.GET[b"uuid"], u'/expect-no-linked-resources/')
7+
return u"ok"
8+
else:
9+
# Request for result data from test page
10+
value = request.server.stash.take(request.GET[b"uuid"], u'/expect-no-linked-resources/')
11+
return value

0 commit comments

Comments
 (0)