-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Add WPT test for Document-Policy: expect-no-linked-resources #49617
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
domenic
merged 2 commits into
web-platform-tests:master
from
alexnj:expect-no-linked-resources
Dec 11, 2024
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
...eculative-parsing/expect-no-linked-resources/no-speculative-fetch.tentative.optional.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!DOCTYPE html> | ||
<meta charset=utf-8> | ||
<title>Speculative parsing, expect-no-linked-resources Document-Policy</title> | ||
<meta name="timeout" content="long"> | ||
<script src=/resources/testharness.js></script> | ||
<script src=/resources/testharnessreport.js></script> | ||
<script src="/resources/testdriver.js"></script> | ||
<script src="/resources/testdriver-vendor.js"></script> | ||
<script src="/common/utils.js"></script> | ||
<script src="stash.js"></script> | ||
<script> | ||
promise_test(t => new Promise((resolve, reject) => { | ||
const uuid = token(); | ||
async function on_load_test_document() { | ||
resolve(await get_results(uuid)); | ||
} | ||
|
||
test_driver.bless('Open a URL with expect-no-linked-resources Document-Policy', () => { | ||
const popup = window.open(`/html/syntax/speculative-parsing/expect-no-linked-resources/no-speculative-fetch.tentative.optional.sub.html?pipe=sub&uuid=${uuid}`, '_blank'); | ||
popup.addEventListener('load', on_load_test_document, false); | ||
}); | ||
}).then(result => { | ||
assert_equals(result, '', 'speculative case fetched'); | ||
}), `no-linked-resources speculative hint was ignored`); | ||
alexnj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
</script> |
10 changes: 10 additions & 0 deletions
10
...ative-parsing/expect-no-linked-resources/no-speculative-fetch.tentative.optional.sub.html
alexnj marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!doctype html> | ||
<title>Navigating to a page with expect-no-linked-resources</title> | ||
|
||
<body> | ||
<script> | ||
document.write('<plaintext>'); | ||
</script> | ||
<img | ||
src="/html/syntax/speculative-parsing/expect-no-linked-resources/stash.py?action=put&uuid={{GET[uuid]}}&encodingcheck=Ğ"> | ||
alexnj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</body> |
1 change: 1 addition & 0 deletions
1
...rsing/expect-no-linked-resources/no-speculative-fetch.tentative.optional.sub.html.headers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Document-Policy: expect-no-linked-resources |
6 changes: 6 additions & 0 deletions
6
html/syntax/speculative-parsing/expect-no-linked-resources/stash.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Fetch test results from the Stash | ||
alexnj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
async function get_results(uuid) { | ||
const response = await fetch(`/html/syntax/speculative-parsing/expect-no-linked-resources/stash.py?action=get&uuid=${uuid}`); | ||
const text = await response.text(); | ||
return text; | ||
} |
11 changes: 11 additions & 0 deletions
11
html/syntax/speculative-parsing/expect-no-linked-resources/stash.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import time | ||
|
||
def main(request, response): | ||
if request.GET[b"action"] == b"put": | ||
# Received result data from target page | ||
request.server.stash.put(request.GET[b"uuid"], request.GET[b"uuid"], u'/expect-no-linked-resources/') | ||
return u"ok" | ||
else: | ||
# Request for result data from test page | ||
value = request.server.stash.take(request.GET[b"uuid"], u'/expect-no-linked-resources/') | ||
return value |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.