Skip to content

Commit

Permalink
HTML: Add tentative tests for speculative HTML parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
zcorpan authored Sep 14, 2021
1 parent f0aff7d commit 9afacb7
Show file tree
Hide file tree
Showing 216 changed files with 4,341 additions and 1 deletion.
3 changes: 2 additions & 1 deletion common/slow.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import time

def main(request, response):
time.sleep(2)
delay = float(request.GET.first(b"delay", 2000)) / 1000
time.sleep(delay)
return 200, [], b''
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<!-- DO NOT EDIT. This file has been generated. Source:
/html/syntax/speculative-parsing/tools/generate.py
-->
<meta charset=utf-8>
<title>Speculative parsing, document.write(): base-href-script-src</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/common/utils.js></script>
<script src=/html/syntax/speculative-parsing/resources/speculative-parsing-util.js></script>
<script>
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, true)
.then(compare_with_nonspeculative(uuid, 'base-href-script-src', true))
.then(done);
document.write(`
<script src="/common/slow.py?delay=1500"><\/script>
<script>
document.write('<plaintext>');
<\/script>
<\!-- speculative case in document.write -->
<base href=//{{domains[www1]}}:{{ports[http][0]}}><script src="/html/syntax/speculative-parsing/resources/stash.py?action=put&amp;uuid=${uuid}&amp;encodingcheck=&Gbreve;"><\/script>
`);
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<!-- DO NOT EDIT. This file has been generated. Source:
/html/syntax/speculative-parsing/tools/generate.py
-->
<meta charset=utf-8>
<title>Speculative parsing, document.write(): image-src</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/common/utils.js></script>
<script src=/html/syntax/speculative-parsing/resources/speculative-parsing-util.js></script>
<script>
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, true)
.then(compare_with_nonspeculative(uuid, 'image-src', true))
.then(done);
document.write(`
<script src="/common/slow.py?delay=1500"><\/script>
<script>
document.write('<plaintext>');
<\/script>
<\!-- speculative case in document.write -->
<image src="/html/syntax/speculative-parsing/resources/stash.py?action=put&amp;uuid=${uuid}&amp;encodingcheck=&Gbreve;">
`);
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<!-- DO NOT EDIT. This file has been generated. Source:
/html/syntax/speculative-parsing/tools/generate.py
-->
<meta charset=utf-8>
<title>Speculative parsing, document.write(): img-data-src</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/common/utils.js></script>
<script src=/html/syntax/speculative-parsing/resources/speculative-parsing-util.js></script>
<script>
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, false)
.then(compare_with_nonspeculative(uuid, 'img-data-src', true))
.then(done);
document.write(`
<script src="/common/slow.py?delay=1500"><\/script>
<script>
document.write('<plaintext>');
<\/script>
<\!-- speculative case in document.write -->
<img data-src="/html/syntax/speculative-parsing/resources/stash.py?action=put&amp;uuid=${uuid}&amp;encodingcheck=&Gbreve;">
`);
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<!-- DO NOT EDIT. This file has been generated. Source:
/html/syntax/speculative-parsing/tools/generate.py
-->
<meta charset=utf-8>
<title>Speculative parsing, document.write(): img-src-crossorigin</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/common/utils.js></script>
<script src=/html/syntax/speculative-parsing/resources/speculative-parsing-util.js></script>
<script>
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, true)
.then(compare_with_nonspeculative(uuid, 'img-src-crossorigin', true))
.then(done);
document.write(`
<script src="/common/slow.py?delay=1500"><\/script>
<script>
document.write('<plaintext>');
<\/script>
<\!-- speculative case in document.write -->
<img src="/html/syntax/speculative-parsing/resources/stash.py?action=put&amp;uuid=${uuid}&amp;encodingcheck=&Gbreve;" crossorigin>
`);
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<!-- DO NOT EDIT. This file has been generated. Source:
/html/syntax/speculative-parsing/tools/generate.py
-->
<meta charset=utf-8>
<title>Speculative parsing, document.write(): img-src-loading-lazy</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/common/utils.js></script>
<script src=/html/syntax/speculative-parsing/resources/speculative-parsing-util.js></script>
<script>
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, false)
.then(compare_with_nonspeculative(uuid, 'img-src-loading-lazy', false))
.then(done);
document.write(`
<script src="/common/slow.py?delay=1500"><\/script>
<script>
document.write('<plaintext>');
<\/script>
<\!-- speculative case in document.write -->
<img src="/html/syntax/speculative-parsing/resources/stash.py?action=put&amp;uuid=${uuid}&amp;encodingcheck=&Gbreve;" loading=lazy>
`);
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<!-- DO NOT EDIT. This file has been generated. Source:
/html/syntax/speculative-parsing/tools/generate.py
-->
<meta charset=utf-8>
<title>Speculative parsing, document.write(): img-src-referrerpolicy-no-referrer</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/common/utils.js></script>
<script src=/html/syntax/speculative-parsing/resources/speculative-parsing-util.js></script>
<script>
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, true)
.then(compare_with_nonspeculative(uuid, 'img-src-referrerpolicy-no-referrer', true))
.then(done);
document.write(`
<script src="/common/slow.py?delay=1500"><\/script>
<script>
document.write('<plaintext>');
<\/script>
<\!-- speculative case in document.write -->
<img src="/html/syntax/speculative-parsing/resources/stash.py?action=put&amp;uuid=${uuid}&amp;encodingcheck=&Gbreve;" referrerpolicy=no-referrer>
`);
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<!-- DO NOT EDIT. This file has been generated. Source:
/html/syntax/speculative-parsing/tools/generate.py
-->
<meta charset=utf-8>
<title>Speculative parsing, document.write(): img-src</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/common/utils.js></script>
<script src=/html/syntax/speculative-parsing/resources/speculative-parsing-util.js></script>
<script>
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, true)
.then(compare_with_nonspeculative(uuid, 'img-src', true))
.then(done);
document.write(`
<script src="/common/slow.py?delay=1500"><\/script>
<script>
document.write('<plaintext>');
<\/script>
<\!-- speculative case in document.write -->
<img src="/html/syntax/speculative-parsing/resources/stash.py?action=put&amp;uuid=${uuid}&amp;encodingcheck=&Gbreve;">
`);
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<!-- DO NOT EDIT. This file has been generated. Source:
/html/syntax/speculative-parsing/tools/generate.py
-->
<meta charset=utf-8>
<title>Speculative parsing, document.write(): img-srcset</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/common/utils.js></script>
<script src=/html/syntax/speculative-parsing/resources/speculative-parsing-util.js></script>
<script>
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, true)
.then(compare_with_nonspeculative(uuid, 'img-srcset', true))
.then(done);
document.write(`
<script src="/common/slow.py?delay=1500"><\/script>
<script>
document.write('<plaintext>');
<\/script>
<\!-- speculative case in document.write -->
<img srcset="/html/syntax/speculative-parsing/resources/stash.py?action=put&amp;uuid=${uuid}&amp;encodingcheck=&Gbreve;">
`);
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<!-- DO NOT EDIT. This file has been generated. Source:
/html/syntax/speculative-parsing/tools/generate.py
-->
<meta charset=utf-8>
<title>Speculative parsing, document.write(): link-no-rel</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/common/utils.js></script>
<script src=/html/syntax/speculative-parsing/resources/speculative-parsing-util.js></script>
<script>
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, false)
.then(compare_with_nonspeculative(uuid, 'link-no-rel', true))
.then(done);
document.write(`
<script src="/common/slow.py?delay=1500"><\/script>
<script>
document.write('<plaintext>');
<\/script>
<\!-- speculative case in document.write -->
<link href="/html/syntax/speculative-parsing/resources/stash.py?action=put&amp;uuid=${uuid}&amp;encodingcheck=&Gbreve;">
`);
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<!-- DO NOT EDIT. This file has been generated. Source:
/html/syntax/speculative-parsing/tools/generate.py
-->
<meta charset=utf-8>
<title>Speculative parsing, document.write(): link-rel-alternate-stylesheet</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/common/utils.js></script>
<script src=/html/syntax/speculative-parsing/resources/speculative-parsing-util.js></script>
<script>
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, false)
.then(compare_with_nonspeculative(uuid, 'link-rel-alternate-stylesheet', true))
.then(done);
document.write(`
<script src="/common/slow.py?delay=1500"><\/script>
<script>
document.write('<plaintext>');
<\/script>
<\!-- speculative case in document.write -->
<link rel="alternate stylesheet" href="/html/syntax/speculative-parsing/resources/stash.py?action=put&amp;uuid=${uuid}&amp;encodingcheck=&Gbreve;">
`);
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<!-- DO NOT EDIT. This file has been generated. Source:
/html/syntax/speculative-parsing/tools/generate.py
-->
<meta charset=utf-8>
<title>Speculative parsing, document.write(): link-rel-preload-as-font-crossorigin</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/common/utils.js></script>
<script src=/html/syntax/speculative-parsing/resources/speculative-parsing-util.js></script>
<script>
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, true)
.then(compare_with_nonspeculative(uuid, 'link-rel-preload-as-font-crossorigin', true))
.then(done);
document.write(`
<script src="/common/slow.py?delay=1500"><\/script>
<script>
document.write('<plaintext>');
<\/script>
<\!-- speculative case in document.write -->
<link rel=preload as=font href="/html/syntax/speculative-parsing/resources/stash.py?action=put&amp;uuid=${uuid}&amp;encodingcheck=&Gbreve;" crossorigin>
`);
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<!-- DO NOT EDIT. This file has been generated. Source:
/html/syntax/speculative-parsing/tools/generate.py
-->
<meta charset=utf-8>
<title>Speculative parsing, document.write(): link-rel-preload-as-image</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/common/utils.js></script>
<script src=/html/syntax/speculative-parsing/resources/speculative-parsing-util.js></script>
<script>
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, true)
.then(compare_with_nonspeculative(uuid, 'link-rel-preload-as-image', true))
.then(done);
document.write(`
<script src="/common/slow.py?delay=1500"><\/script>
<script>
document.write('<plaintext>');
<\/script>
<\!-- speculative case in document.write -->
<link rel=preload as=image href="/html/syntax/speculative-parsing/resources/stash.py?action=put&amp;uuid=${uuid}&amp;encodingcheck=&Gbreve;">
`);
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<!-- DO NOT EDIT. This file has been generated. Source:
/html/syntax/speculative-parsing/tools/generate.py
-->
<meta charset=utf-8>
<title>Speculative parsing, document.write(): link-rel-preload-as-script</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/common/utils.js></script>
<script src=/html/syntax/speculative-parsing/resources/speculative-parsing-util.js></script>
<script>
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, true)
.then(compare_with_nonspeculative(uuid, 'link-rel-preload-as-script', true))
.then(done);
document.write(`
<script src="/common/slow.py?delay=1500"><\/script>
<script>
document.write('<plaintext>');
<\/script>
<\!-- speculative case in document.write -->
<link rel=preload as=script href="/html/syntax/speculative-parsing/resources/stash.py?action=put&amp;uuid=${uuid}&amp;encodingcheck=&Gbreve;">
`);
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<!-- DO NOT EDIT. This file has been generated. Source:
/html/syntax/speculative-parsing/tools/generate.py
-->
<meta charset=utf-8>
<title>Speculative parsing, document.write(): link-rel-preload-as-style</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/common/utils.js></script>
<script src=/html/syntax/speculative-parsing/resources/speculative-parsing-util.js></script>
<script>
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, true)
.then(compare_with_nonspeculative(uuid, 'link-rel-preload-as-style', true))
.then(done);
document.write(`
<script src="/common/slow.py?delay=1500"><\/script>
<script>
document.write('<plaintext>');
<\/script>
<\!-- speculative case in document.write -->
<link rel=preload as=style href="/html/syntax/speculative-parsing/resources/stash.py?action=put&amp;uuid=${uuid}&amp;encodingcheck=&Gbreve;">
`);
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<!-- DO NOT EDIT. This file has been generated. Source:
/html/syntax/speculative-parsing/tools/generate.py
-->
<meta charset=utf-8>
<title>Speculative parsing, document.write(): link-rel-stylesheet-crossorigin</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/common/utils.js></script>
<script src=/html/syntax/speculative-parsing/resources/speculative-parsing-util.js></script>
<script>
setup({single_test: true});
const uuid = token();
expect_fetched_onload(uuid, true)
.then(compare_with_nonspeculative(uuid, 'link-rel-stylesheet-crossorigin', true))
.then(done);
document.write(`
<script src="/common/slow.py?delay=1500"><\/script>
<script>
document.write('<plaintext>');
<\/script>
<\!-- speculative case in document.write -->
<link rel=stylesheet href="/html/syntax/speculative-parsing/resources/stash.py?action=put&amp;uuid=${uuid}&amp;encodingcheck=&Gbreve;" crossorigin>
`);
</script>
Loading

0 comments on commit 9afacb7

Please sign in to comment.