Update web-platform-tests to revision 097043b336e46876e281ddec3bb014fe9c480128

This commit is contained in:
WPT Sync Bot 2019-08-03 10:25:42 +00:00
parent ecd32570c0
commit b68253eac0
405 changed files with 9164 additions and 3050 deletions

View file

@ -19,3 +19,14 @@ action "website-build-and-publish" {
runs = ["/bin/bash", "tools/ci/website_build.sh"]
secrets = ["DEPLOY_TOKEN"]
}
workflow "Synchronize the Pull Request Preview" {
on = "pull_request"
resolves = "update-pr-preview"
}
action "update-pr-preview" {
uses = "./tools/docker/github"
runs = ["python", "tools/ci/update_pr_preview.py", "https://api.github.com"]
secrets = ["GITHUB_TOKEN"]
}

View file

@ -57,6 +57,57 @@ def dump_test_parameters(selection):
selection, indent=2, separators=(',', ': '), sort_keys=True)
def get_test_filename(config, selection):
'''Returns the filname for the main test HTML file'''
selection_for_filename = copy.deepcopy(selection)
# Use 'unset' rather than 'None' in test filenames.
if selection_for_filename['delivery_value'] is None:
selection_for_filename['delivery_value'] = 'unset'
return os.path.join(config.spec_directory,
config.test_file_path_pattern % selection_for_filename)
def handle_deliveries(policy_deliveries):
'''
Generate <meta> elements and HTTP headers for the given list of
PolicyDelivery.
TODO(hiroshige): Merge duplicated code here, scope/document.py, etc.
'''
meta = ''
headers = {}
for delivery in policy_deliveries:
if delivery.value is None:
continue
if delivery.key == 'referrerPolicy':
if delivery.delivery_type == 'meta':
meta += \
'<meta name="referrer" content="%s">' % delivery.value
elif delivery.delivery_type == 'http-rp':
headers['Referrer-Policy'] = delivery.value
# TODO(kristijanburnik): Limit to WPT origins.
headers['Access-Control-Allow-Origin'] = '*'
else:
raise Exception(
'Invalid delivery_type: %s' % delivery.delivery_type)
elif delivery.key == 'mixedContent':
assert (delivery.value == 'opt-in')
if delivery.delivery_type == 'meta':
meta += '<meta http-equiv="Content-Security-Policy" ' + \
'content="block-all-mixed-content">'
elif delivery.delivery_type == 'http-rp':
headers['Content-Security-Policy'] = 'block-all-mixed-content'
else:
raise Exception(
'Invalid delivery_type: %s' % delivery.delivery_type)
else:
raise Exception('Invalid delivery_key: %s' % delivery.key)
return {"meta": meta, "headers": headers}
def generate_selection(config, selection, spec, test_html_template_basename):
test_parameters = dump_test_parameters(selection)
# Adjust the template for the test invoking JS. Indent it to look nice.
@ -80,8 +131,7 @@ def generate_selection(config, selection, spec, test_html_template_basename):
selection['sanity_checker_js'] = config.sanity_checker_js
selection['spec_json_js'] = config.spec_json_js
test_filename = os.path.join(config.spec_directory,
config.test_file_path_pattern % selection)
test_filename = get_test_filename(config, selection)
test_headers_filename = test_filename + ".headers"
test_directory = os.path.dirname(test_filename)
@ -109,13 +159,16 @@ def generate_selection(config, selection, spec, test_html_template_basename):
except:
pass
delivery = config.handleDelivery(selection, spec)
delivery = handle_deliveries([
util.PolicyDelivery(selection['delivery_type'],
selection['delivery_key'],
selection['delivery_value'])
])
if len(delivery['headers']) > 0:
with open(test_headers_filename, "w") as f:
for header in delivery['headers']:
f.write(header)
f.write('\n')
f.write('%s: %s\n' % (header, delivery['headers'][header]))
selection['meta_delivery_method'] = delivery['meta']
# Obey the lint and pretty format.

View file

@ -39,3 +39,14 @@ def load_spec_json(path_to_spec):
print(read_nth_line(f, line_number).rstrip())
print(" " * (column - 1) + "^")
sys.exit(1)
class PolicyDelivery(object):
'''
See `@typedef PolicyDelivery` comments in `resources/common.js`.
'''
def __init__(self, delivery_type, key, value):
self.delivery_type = delivery_type
self.key = key
self.value = value

View file

@ -0,0 +1,10 @@
<!DOCTYPE html>
<head>
<title>CSP script-hash block causes error event</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'sha256-deadbeef'"></meta>
</head>
<body>
<script src="support/inline-script-should-be-blocked.js"></script>
</body>

View file

@ -0,0 +1,35 @@
<!DOCTYPE html>
<head>
<title>CSP inline script check is done at #prepare-a-script (hash)</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!--
'log1 += 'scr1 at #prepare-a-script';' => 'sha256-sI+xsvqqUw0LQQGgsgkYoXKWhlGgaCqsqVbPx0Z2A4s=' (allowed)
'log1 += 'scr1 at #execute-the-script-block';' => 'sha256-Vtap5AhPN9kbQAbWqObJexCvNDexqoIwo4XsABQBqcg=' (blocked)
-->
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'nonce-abc' 'sha256-sI+xsvqqUw0LQQGgsgkYoXKWhlGgaCqsqVbPx0Z2A4s='"></meta>
</head>
<!--
"Should element's inline behavior be blocked by Content Security Policy?"
is executed at the time of https://html.spec.whatwg.org/C/#prepare-a-script,
not at https://html.spec.whatwg.org/C/#execute-the-script-block.
So when innerText is modified after #prepare-a-script, the text BEFORE
the modification is used for hash check.
-->
<script nonce="abc">
let log1 = '';
</script>
<!-- Execution order:
async script is executed
-> stylesheet is loaded
-> inline script is executed. -->
<link rel="stylesheet" href="support/empty.css?dummy=1&pipe=trickle(d2)" type="text/css">
<script src="support/change-scripthash-before-execute.js?dummy=1&pipe=trickle(d1)" async></script>
<script id="scr1">log1 += 'scr1 at #prepare-a-script';</script>
<script nonce="abc">
test(() => {
assert_equals(log1, 'scr1 at #prepare-a-script');
}, 'scr1.innerText before modification should not be blocked');
</script>

View file

@ -0,0 +1,35 @@
<!DOCTYPE html>
<head>
<title>CSP inline script check is done at #prepare-a-script (hash)</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!--
'log2 += 'scr2 at #prepare-a-script';' => 'sha256-9vE5NuHfEDoLvk3nPZPDX2/mnG+ZwKhpPuwQZwCDGc4=' (blocked)
'log2 += 'scr2 at #execute-the-script-block';' => 'sha256-3AdhWTFuyxSUPxmqpTJaFRx3R5WNcyGw57lFoj1rTXw=' (allowed)
-->
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'nonce-abc' 'sha256-3AdhWTFuyxSUPxmqpTJaFRx3R5WNcyGw57lFoj1rTXw='"></meta>
</head>
<!--
"Should element's inline behavior be blocked by Content Security Policy?"
is executed at the time of https://html.spec.whatwg.org/C/#prepare-a-script,
not at https://html.spec.whatwg.org/C/#execute-the-script-block.
So when innerText is modified after #prepare-a-script, the text BEFORE
the modification is used for hash check.
-->
<script nonce="abc">
let log2 = '';
</script>
<!-- Execution order:
async script is executed
-> stylesheet is loaded
-> inline script is executed. -->
<link rel="stylesheet" href="support/empty.css?dummy=2&pipe=trickle(d2)" type="text/css">
<script src="support/change-scripthash-before-execute.js?dummy=2&pipe=trickle(d1)" async></script>
<script id="scr2">log2 += 'scr2 at #prepare-a-script';</script>
<script nonce="abc">
test(() => {
assert_equals(log2, '');
}, 'scr2.innerText before modification should be blocked');
</script>

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<head>
<title>CSP inline script check is done at #prepare-a-script (nonce)</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'nonce-abc' 'sha256-deadbeef'"></meta>
</head>
<!--
"Should element's inline behavior be blocked by Content Security Policy?"
is executed at the time of https://html.spec.whatwg.org/C/#prepare-a-script,
not at https://html.spec.whatwg.org/C/#execute-the-script-block.
So when nonce is modified after #prepare-a-script, the nonce BEFORE
the modification is used for hash check.
-->
<script nonce="abc">
let log1 = '';
</script>
<!-- Execution order:
async script is executed
-> stylesheet is loaded
-> inline script is executed. -->
<link rel="stylesheet" href="support/empty.css?dummy=3&pipe=trickle(d2)" type="text/css">
<script src="support/change-scriptnonce-before-execute.js?dummy=3&pipe=trickle(d1)" async></script>
<script id="scr1" nonce="abc">log1 += 'scr1 executed';</script>
<script nonce="abc">
test(() => {
assert_equals(log1, 'scr1 executed');
}, 'scr1 nonce before modification should not be blocked');
</script>

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<head>
<title>CSP inline script check is done at #prepare-a-script (nonce)</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'nonce-abc' 'sha256-deadbeef'"></meta>
</head>
<!--
"Should element's inline behavior be blocked by Content Security Policy?"
is executed at the time of https://html.spec.whatwg.org/C/#prepare-a-script,
not at https://html.spec.whatwg.org/C/#execute-the-script-block.
So when nonce is modified after #prepare-a-script, the nonce BEFORE
the modification is used for hash check.
-->
<script nonce="abc">
let log2 = '';
</script>
<!-- Execution order:
async script is executed
-> stylesheet is loaded
-> inline script is executed. -->
<link rel="stylesheet" href="support/empty.css?dummy=4&pipe=trickle(d2)" type="text/css">
<script src="support/change-scriptnonce-before-execute.js?dummy=4&pipe=trickle(d1)" async></script>
<script id="scr2" nonce="wrong">log2 += 'scr2 executed';</script>
<script nonce="abc">
test(() => {
assert_equals(log2, '');
}, 'scr2 nonce before modification should be blocked');
</script>

View file

@ -0,0 +1,10 @@
// This script is executed after |scr1| and |scr2| are inserted into DOM
// before their execution (if not blocked by CSP).
if (document.getElementById("scr1")) {
document.getElementById("scr1").innerText =
"log1 += 'scr1 at #execute-the-script-block';";
}
if (document.getElementById("scr2")) {
document.getElementById("scr2").innerText =
"log2 += 'scr2 at #execute-the-script-block';";
}

View file

@ -0,0 +1,8 @@
// This script is executed after |scr1| and |scr2| are inserted into DOM
// before their execution (if not blocked by CSP).
if (document.getElementById('scr1')) {
document.getElementById('scr1').setAttribute('nonce', 'wrong');
}
if (document.getElementById('scr2')) {
document.getElementById('scr2').setAttribute('nonce', 'abc');
}

View file

@ -0,0 +1,14 @@
var t;
async_test(t => {
self.t = t;
const s = document.createElement('script');
s.onerror = t.step_func(function() {
assert_unreached('Script error event should not be fired.');
});
s.onload = t.step_func(function() {
assert_unreached('Script load event should not be fired.');
});
s.innerText = 'self.t.assert_unreached("Script should not run.");'
document.body.appendChild(s);
setTimeout(() => t.done(), 2000);
});

View file

@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>Inheritance of CSS Fonts Level 3 properties</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#property-index">
<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#font-stretch-prop">
<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#property-index">
<meta name="assert" content="Properties inherit according to the spec.">
<meta name="assert" content="Properties have initial values according to the spec.">
<script src="/resources/testharness.js"></script>
@ -40,6 +40,7 @@ assert_inherited('font-variant-east-asian', 'normal', 'ruby');
assert_inherited('font-variant-ligatures', 'normal', 'none');
assert_inherited('font-variant-numeric', 'normal', 'ordinal');
assert_inherited('font-variant-position', 'normal', 'super');
assert_inherited('font-variation-settings', 'normal', '"wght" 700');
assert_inherited('font-weight', '400' /* normal */, '900');
</script>
</body>

View file

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: getComputedStyle().fontVariationSettings</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#propdef-font-variation-settings">
<meta name="assert" content="font-variation-settings computed value is as specified.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
</head>
<body>
<div id="target"></div>
<script>
test_computed_value('font-variation-settings', 'normal');
test_computed_value('font-variation-settings', '"wght" 700');
test_computed_value('font-variation-settings', '"wght" 700, "XHGT" 0.7');
test_computed_value('font-variation-settings', '"XHGT" calc(0.4 + 0.3)', '"XHGT" 0.7');
</script>
</body>
</html>

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 4: parsing font-variation-settings with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#propdef-font-variation-settings">
<meta name="assert" content="font-variation-settings supports only the grammar 'normal | [ <string> <number>] #'.">
<meta name="assert" content="font-variation-settings strings must have 4 characters.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value('font-variation-settings', '700');
test_invalid_value('font-variation-settings', '"XHGT"');
test_invalid_value('font-variation-settings', 'wght 700');
test_invalid_value('font-variation-settings', 'normal, "wght" 700');
test_invalid_value('font-variation-settings', '"wgt" 700');
test_invalid_value('font-variation-settings', '"XHGTX" 0.7');
test_invalid_value('font-variation-settings', '"abc\1F" 0.5');
test_invalid_value('font-variation-settings', '"abc\7F" 0.5');
test_invalid_value('font-variation-settings', '"abc\A9" 0.5');
</script>
</body>
</html>

View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 4: parsing font-variation-settings with valid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#propdef-font-variation-settings">
<meta name="assert" content="font-variation-settings supports the full grammar 'normal | [ <string> <number>] #'.">
<meta name="assert" content="font-variation-settings strings are case sensitive.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value('font-variation-settings', 'normal');
test_valid_value('font-variation-settings', '"wght" 700');
test_valid_value('font-variation-settings', '"wght" 700, "XHGT" 0.7');
test_valid_value('font-variation-settings', '"a cd" 0.5');
test_valid_value('font-variation-settings', '"ab@d" 0.5');
</script>
</body>
</html>

View file

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Inline Layout: getComputedStyle().dominantBaseline</title>
<link rel="help" href="https://drafts.csswg.org/css-inline-3/#dominant-baseline-property">
<meta name="assert" content="dominant-baseline computed value is as specified.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
</head>
<body>
<div id="target"></div>
<script>
test_computed_value("dominant-baseline", "auto");
test_computed_value("dominant-baseline", "text-bottom");
test_computed_value("dominant-baseline", "alphabetic");
test_computed_value("dominant-baseline", "ideographic");
test_computed_value("dominant-baseline", "middle");
test_computed_value("dominant-baseline", "central");
test_computed_value("dominant-baseline", "mathematical");
test_computed_value("dominant-baseline", "hanging");
test_computed_value("dominant-baseline", "text-top");
</script>
</body>
</html>

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Inline Layout: parsing dominant-baseline with invalid values</title>
<link rel="help" href="https://drafts.csswg.org/css-inline-3/#dominant-baseline-property">
<meta name="assert" content="dominant-baseline supports only the grammar 'auto | text-bottom | alphabetic | ideographic | middle | central | mathematical | hanging | text-top'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("dominant-baseline", "normal");
test_invalid_value("dominant-baseline", "none");
test_invalid_value("dominant-baseline", "alphabetic, ideographic");
test_invalid_value("dominant-baseline", "middle central");
</script>
</body>
</html>

View file

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Inline Layout: parsing dominant-baseline with valid values</title>
<link rel="help" href="https://drafts.csswg.org/css-inline-3/#dominant-baseline-property">
<meta name="assert" content="dominant-baseline supports the full grammar 'auto | text-bottom | alphabetic | ideographic | middle | central | mathematical | hanging | text-top'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("dominant-baseline", "auto");
test_valid_value("dominant-baseline", "text-bottom");
test_valid_value("dominant-baseline", "alphabetic");
test_valid_value("dominant-baseline", "ideographic");
test_valid_value("dominant-baseline", "middle");
test_valid_value("dominant-baseline", "central");
test_valid_value("dominant-baseline", "mathematical");
test_valid_value("dominant-baseline", "hanging");
test_valid_value("dominant-baseline", "text-top");
</script>
</body>
</html>

View file

@ -52,7 +52,7 @@
<div class="outer">
<div class="blueborders"></div>
<div class="innerbg" style="left: 0"></div>
<div class="inner lefthalf" style="left: 0; height: 60px">
<div class="inner lefthalf" style="left: 0">
AAAAA<br>
BBBBB<br>
CCCCC

View file

@ -5,6 +5,7 @@
<link rel="author" title="Mozilla" href="https://mozilla.org/">
<link rel="help" href="https://drafts.csswg.org/css-multicol/#column-gaps-and-rules">
<link rel="help" href="https://drafts.csswg.org/css-multicol/#cf">
<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/2309">
<link rel="match" href="multicol-breaking-000-ref.html">
<style>

View file

@ -67,7 +67,7 @@
JJJJJ
</div>
<div class="innerbg" style="left: 204px"></div>
<div class="inner lefthalf" style="left: 204px; height: 80px">
<div class="inner lefthalf" style="left: 204px">
KKKKK<br>
LLLLL<br>
MMMMM<br>

View file

@ -5,6 +5,7 @@
<link rel="author" title="Mozilla" href="https://mozilla.org/">
<link rel="help" href="https://drafts.csswg.org/css-multicol/#column-gaps-and-rules">
<link rel="help" href="https://drafts.csswg.org/css-multicol/#cf">
<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/2309">
<link rel="match" href="multicol-breaking-001-ref.html">
<style>

View file

@ -77,7 +77,7 @@
</div>
<div class="border-bottom" style="left: 0"></div>
<div class="innerbg" style="left: 204px"></div>
<div class="inner lefthalf" style="left: 204px; height: 80px">
<div class="inner lefthalf" style="left: 204px">
KKKKK<br>
LLLLL<br>
MMMMM<br>

View file

@ -6,6 +6,7 @@
<link rel="author" title="Mozilla" href="https://mozilla.org/">
<link rel="help" href="https://drafts.csswg.org/css-multicol/#column-gaps-and-rules">
<link rel="help" href="https://drafts.csswg.org/css-multicol/#cf">
<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/2309">
<link rel="help" href="https://drafts.csswg.org/css-break/#break-decoration">
<link rel="match" href="multicol-breaking-004-ref.html">
<style>

View file

@ -32,7 +32,7 @@
</style>
<div class="outer">
<div class="inner lefthalf" style="left: 0; height: 60px">
<div class="inner lefthalf" style="left: 0">
AAAAA<br>
BBBBB<br>
CCCCC

View file

@ -5,6 +5,7 @@
<link rel="author" title="Mozilla" href="https://mozilla.org/">
<link rel="help" href="https://drafts.csswg.org/css-multicol/#column-gaps-and-rules">
<link rel="help" href="https://drafts.csswg.org/css-multicol/#cf">
<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/2309">
<link rel="match" href="multicol-breaking-nobackground-000-ref.html">
<style>

View file

@ -46,7 +46,7 @@
IIIII<br>
JJJJJ
</div>
<div class="inner lefthalf" style="left: 204px; height: 80px">
<div class="inner lefthalf" style="left: 204px">
KKKKK<br>
LLLLL<br>
MMMMM<br>

View file

@ -5,6 +5,7 @@
<link rel="author" title="Mozilla" href="https://mozilla.org/">
<link rel="help" href="https://drafts.csswg.org/css-multicol/#column-gaps-and-rules">
<link rel="help" href="https://drafts.csswg.org/css-multicol/#cf">
<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/2309">
<link rel="match" href="multicol-breaking-nobackground-001-ref.html">
<style>

View file

@ -0,0 +1,43 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<title>CSS Multi-column Layout Test Reference: Test the column rules' block-size with nested balancing multicol container</title>
<link rel="author" title="Ting-Yu Lin" href="tlin@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org/">
<style>
.outer {
column-count: 2;
column-rule: 6px solid black;
column-fill: auto;
width: 400px;
height: 250px;
}
.inner {
column-count: 2;
column-rule: 3px solid gray;
column-fill: auto;
height: 200px;
}
.outer-block {
background-color: lightgreen;
height: 200px;
}
.inner-block {
background-color: lightblue;
height: 150px;
}
.space {
height: 50px;
}
</style>
<article class="outer">
<div class="outer-block"></div>
<div class="space"></div>
<article class="inner">
<div class="inner-block"></div><div class="space"></div>
<div class="inner-block"></div><div class="space"></div>
</article>
</article>
</html>

View file

@ -0,0 +1,41 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<title>CSS Multi-column Layout Test: Test the column rules' block-size with nested balancing multicol container</title>
<link rel="author" title="Ting-Yu Lin" href="tlin@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org/">
<link rel="help" href="https://drafts.csswg.org/css-multicol-1/#cf">
<link rel="help" href="https://drafts.csswg.org/css-multicol-1/#column-gaps-and-rules">
<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/2309">
<link rel="match" href="multicol-rule-nested-balancing-001-ref.html">
<meta name="assert" content="This test verifies that the column-rules are extended to the content block-end edges of their corresponding inner and outer multicol container.">
<style>
.outer {
column-count: 2;
column-rule: 6px solid black;
width: 400px;
height: 250px;
}
.inner {
column-count: 2;
column-rule: 3px solid gray;
height: 200px;
}
.outer-block {
background-color: lightgreen;
height: 200px;
}
.inner-block {
background-color: lightblue;
height: 300px;
}
</style>
<article class="outer">
<div class="outer-block"></div>
<article class="inner">
<div class="inner-block"></div>
</article>
</article>
</html>

View file

@ -0,0 +1,43 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<title>CSS Multi-column Layout Test Reference: Test the column rules' block-size with nested balancing multicol container</title>
<link rel="author" title="Ting-Yu Lin" href="tlin@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org/">
<style>
.outer {
column-count: 2;
column-rule: 6px solid black;
column-fill: auto;
width: 400px;
height: 250px;
}
.inner {
column-count: 2;
column-rule: 3px solid gray;
column-fill: auto;
height: 200px;
}
.outer-block {
background-color: lightgreen;
height: 200px;
}
.inner-block {
background-color: lightblue;
height: 200px;
}
.space {
height: 50px;
}
</style>
<article class="outer">
<div class="outer-block"></div>
<div class="space"></div>
<article class="inner">
<div class="inner-block"></div>
<div class="inner-block"></div>
</article>
</article>
</html>

View file

@ -0,0 +1,41 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<title>CSS Multi-column Layout Test: Test the column rules' block-size with nested balancing multicol container</title>
<link rel="author" title="Ting-Yu Lin" href="tlin@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org/">
<link rel="help" href="https://drafts.csswg.org/css-multicol-1/#cf">
<link rel="help" href="https://drafts.csswg.org/css-multicol-1/#column-gaps-and-rules">
<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/2309">
<link rel="match" href="multicol-rule-nested-balancing-002-ref.html">
<meta name="assert" content="This test verifies that the column-rules are extended to the content block-end edges of their corresponding inner and outer multicol container, where the inner container has height: auto.">
<style>
.outer {
column-count: 2;
column-rule: 6px solid black;
width: 400px;
height: 250px;
}
.inner {
column-count: 2;
column-rule: 3px solid gray;
height: auto;
}
.outer-block {
background-color: lightgreen;
height: 200px;
}
.inner-block {
background-color: lightblue;
height: 400px;
}
</style>
<article class="outer">
<div class="outer-block"></div>
<article class="inner">
<div class="inner-block"></div>
</article>
</article>
</html>

View file

@ -0,0 +1,47 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<title>CSS Multi-column Layout Test Reference: Test the block-size distribution across column-span split in a balancing multicol container</title>
<link rel="author" title="Ting-Yu Lin" href="tlin@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org/">
<style>
article {
column-count: 2;
width: 400px;
background-color: lightgreen;
}
div.container {
height: 200px;
background-color: pink;
}
div.block {
width: 100px;
height: 200px;
background-color: yellow;
}
div.column-span {
width: 400px;
height: 50px;
background-color: lightblue;
}
</style>
<article>
<div class="container">
<div class="block">block1</div>
</div>
</article>
<div class="column-span">column-span1</div>
<article>
<div class="container">
<div class="block">block2</div>
</div>
</article>
<div class="column-span">column-span2</div>
<article>
<div class="container" style="height: 50px;">
<div class="block">block3</div>
</div>
</article>
</html>

View file

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<title>CSS Multi-column Layout Test: Test the block-size distribution across column-span split in a balancing multicol container</title>
<link rel="author" title="Ting-Yu Lin" href="tlin@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org/">
<link rel="help" href="https://drafts.csswg.org/css-multicol-1/#column-span">
<link rel="match" href="multicol-span-all-children-height-004a-ref.html">
<meta name="assert" content="This test verifies that a block container with a fixed block-size, split by column-span, distributes just enough block-size to hold its children.">
<style>
article {
column-count: 2;
width: 400px;
background-color: lightgreen;
}
div.container {
height: 450px;
background-color: pink;
}
div.block {
width: 100px;
height: 200px;
background-color: yellow;
}
div.column-span {
column-span: all;
height: 50px;
background-color: lightblue;
}
</style>
<article>
<!-- The container is split by the column-spans.
a) Before column-span1, it distributes 200px height into two columns,
and each column takes 100px height.
b) In between column-span1 and column-span2, same distribution as a).
c) After column-span2, it has 50px height left, which goes to the first
column.
-->
<div class="container">
<!-- Each block spreads its height evenly into two columns, and
each column contains 100px height. -->
<div class="block">block1</div>
<div class="column-span">column-span1</div>
<div class="block">block2</div>
<div class="column-span">column-span2</div>
<div class="block">block3</div>
</div>
</article>
</html>

View file

@ -0,0 +1,47 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<title>CSS Multi-column Layout Test Reference: Test the block-size distribution across column-span split in a balancing multicol container</title>
<link rel="author" title="Ting-Yu Lin" href="tlin@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org/">
<style>
article {
column-count: 2;
width: 400px;
background-color: lightgreen;
}
div.container {
height: 200px;
background-color: pink;
}
div.block {
width: 100px;
height: 200px;
background-color: yellow;
}
div.column-span {
width: 400px;
height: 50px;
background-color: lightblue;
}
</style>
<article>
<div class="container">
<div class="block">block1</div>
</div>
</article>
<div class="column-span">column-span1</div>
<article>
<div class="container" style="height: 150px;">
<div class="block">block2</div>
</div>
</article>
<div class="column-span">column-span2</div>
<article>
<div class="container" style="height: 0;">
<div class="block">block3</div>
</div>
</article>
</html>

View file

@ -0,0 +1,50 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<title>CSS Multi-column Layout Test: Test the block-size distribution across column-span split in a balancing multicol container</title>
<link rel="author" title="Ting-Yu Lin" href="tlin@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org/">
<link rel="help" href="https://drafts.csswg.org/css-multicol-1/#column-span">
<link rel="match" href="multicol-span-all-children-height-004b-ref.html">
<meta name="assert" content="This test verifies that a block container with a fixed block-size, split by column-span, distributes just enough block-size to hold its children.">
<style>
article {
column-count: 2;
width: 400px;
background-color: lightgreen;
}
div.container {
height: 350px;
background-color: pink;
}
div.block {
width: 100px;
height: 200px;
background-color: yellow;
}
div.column-span {
column-span: all;
height: 50px;
background-color: lightblue;
}
</style>
<article>
<!-- The container is split by the column-spans.
a) Before column-span1, it distributes 200px height into two columns,
and each column takes 100px height.
b) In between column-span1 and column-span2, it has 150px left. The first
column takes 100px, and the second column takes 50px.
-->
<div class="container">
<!-- Each block spreads its height evenly into two columns, and
each column contains 100px height. -->
<div class="block">block1</div>
<div class="column-span">column-span1</div>
<div class="block">block2</div>
<div class="column-span">column-span2</div>
<div class="block">block3</div>
</div>
</article>
</html>

View file

@ -0,0 +1,46 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<title>CSS Multi-column Layout Test Reference: Test the block-size distribution across column-span split in a column-fill:auto multicol container</title>
<link rel="author" title="Ting-Yu Lin" href="tlin@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org/">
<style>
article {
column-count: 1;
width: 200px;
background-color: lightgreen;
}
div.container {
background-color: pink;
}
div.block {
width: 100px;
height: 100px;
background-color: yellow;
}
div.column-span {
width: 200px;
height: 50px;
background-color: lightblue;
}
</style>
<article>
<div class="container">
<div class="block">block1</div>
</div>
</article>
<div class="column-span">column-span1</div>
<article>
<div class="container">
<div class="block">block2</div>
</div>
</article>
<div class="column-span">column-span2</div>
<article>
<div class="container" style="height: 50px;">
<div class="block">block3</div>
</div>
</article>
</html>

View file

@ -0,0 +1,48 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<title>CSS Multi-column Layout Test: Test the block-size distribution across column-span split in a column-fill:auto multicol container</title>
<link rel="author" title="Ting-Yu Lin" href="tlin@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org/">
<link rel="help" href="https://drafts.csswg.org/css-multicol-1/#column-span">
<link rel="match" href="multicol-span-all-children-height-005-ref.html">
<meta name="assert" content="This test verifies that a block container with a fixed block-size, split by column-span, distributes just enough block-size to hold its children.">
<style>
article {
column-count: 1;
column-fill: auto;
width: 200px;
background-color: lightgreen;
}
div.container {
height: 250px;
background-color: pink;
}
div.block {
width: 100px;
height: 100px;
background-color: yellow;
}
div.column-span {
column-span: all;
height: 50px;
background-color: lightblue;
}
</style>
<article>
<!-- The container is split by the column-spans.
a) Before column-span1, it distributes 100px height into the sole column.
b) In between column-span1 and column-span2, same distribution as a).
c) After column-span2, it has 50px height left.
-->
<div class="container">
<div class="block">block1</div>
<div class="column-span">column-span1</div>
<div class="block">block2</div>
<div class="column-span">column-span2</div>
<div class="block">block3</div>
</div>
</article>
</html>

View file

@ -0,0 +1,42 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<title>CSS Multi-column Layout Test Reference: Test the borders drawing for a block split by column-span</title>
<link rel="author" title="Ting-Yu Lin" href="tlin@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org/">
<style>
article {
column-count: 2;
width: 400px;
background-color: lightgreen;
}
div.container {
background-color: pink;
border: 20px solid purple;
}
div.block {
/* This block spreads evenly into two columns, each has 100px height. */
width: 100px;
height: 200px;
background-color: yellow;
}
div.column-span {
width: 400px;
height: 50px;
background-color: lightblue;
}
</style>
<article>
<div class="container" style="border-bottom: none; height: 200px;">
<div class="block">block1</div>
</div>
</article>
<div class="column-span">column-span1</div>
<article>
<div class="container" style="border-top: none; height: 50px;">
<div class="block">block2</div>
</div>
</article>
</html>

View file

@ -0,0 +1,41 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<title>CSS Multi-column Layout Test: Test the borders drawing for a block split by column-span</title>
<link rel="author" title="Ting-Yu Lin" href="tlin@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org/">
<link rel="help" href="https://drafts.csswg.org/css-multicol-1/#column-span">
<link rel="match" href="multicol-span-all-children-height-006-ref.html">
<meta name="assert" content="This test verifies that the borders of block container with a fixed block-size, split by column-span, are skipped on the sides adjacent to column-span.">
<style>
article {
column-count: 2;
width: 400px;
background-color: lightgreen;
}
div.container {
height: 250px;
background-color: pink;
border: 20px solid purple;
}
div.block {
width: 100px;
height: 200px;
background-color: yellow;
}
div.column-span {
column-span: all;
height: 50px;
background-color: lightblue;
}
</style>
<article>
<div class="container">
<div class="block">block1</div>
<div class="column-span">column-span1</div>
<div class="block">block2</div>
</div>
</article>
</html>

View file

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<title>CSS Multi-column Layout Test: Test the column-rule's block-size</title>
<link rel="author" title="Ting-Yu Lin" href="tlin@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org/">
<style>
article {
column-count: 2;
column-rule: 6px solid;
width: 400px;
height: 500px;
background-color: lightgreen;
border: 2em solid purple;
padding: 2em;
}
div.block {
width: 100px;
height: 200px;
}
div.column-span {
column-span: all;
height: 50px;
background-color: lightblue;
}
</style>
<article>
<div class="block">block1</div>
<div class="column-span">column-span1</div>
<div class="block">block2</div>
<div class="column-span">column-span2</div>
<div class="block" style="height: 400px;">block3</div>
</article>
</html>

View file

@ -0,0 +1,45 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<title>CSS Multi-column Layout Test: Test the column rule's block-size</title>
<link rel="author" title="Ting-Yu Lin" href="tlin@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org/">
<link rel="help" href="https://drafts.csswg.org/css-multicol-1/#column-span">
<link rel="help" href="https://drafts.csswg.org/css-multicol-1/#column-gaps-and-rules">
<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/2309">
<link rel="match" href="multicol-span-all-rule-001-ref.html">
<meta name="assert" content="This test verifies that the column-rule after the last column-span is extended to the content block-end edge of the multicol container.">
<style>
article {
column-count: 2;
column-rule: 6px solid;
width: 400px;
height: 500px;
background-color: lightgreen;
border: 2em solid purple;
padding: 2em;
}
div.block {
width: 100px;
height: 200px;
}
div.column-span {
column-span: all;
height: 50px;
background-color: lightblue;
}
</style>
<article>
<!-- Each block spreads its height evenly into two columns, and
each column contains 100px height. -->
<div class="block">block1</div>
<div class="column-span">column-span1</div>
<div class="block">block2</div>
<div class="column-span">column-span2</div>
<!-- The column rule after column-span2 should extend to the content edge
of the multicol container as if block3 has "height: 400px;" -->
<div class="block">block3</div>
</article>
</html>

View file

@ -0,0 +1,12 @@
<!DOCTYPE html>
<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=919415">
<div id="target" style="position:absolute; overflow:auto; height:100px; top:100px;"></div>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(()=> {
document.body.offsetTop;
target.style.top = "50px";
}, "no crash");
</script>

View file

@ -15,6 +15,8 @@
<div id="target"></div>
</div>
<script>
assert_not_inherited('overscroll-behavior-block', 'auto', 'contain');
assert_not_inherited('overscroll-behavior-inline', 'auto', 'contain');
assert_not_inherited('overscroll-behavior-x', 'auto', 'contain');
assert_not_inherited('overscroll-behavior-y', 'auto', 'contain');
</script>

View file

@ -0,0 +1,22 @@
<!doctype html>
<title>CSS Test: ::before box removed when display set to 'none'.</title>
<link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#generated-content">
<link rel="match" href="../reference/pass_if_pass_below.html">
<style>
#id::before {
content: "FAIL";
position: absolute;
width: 100px;
height: 100px;
background-color: red;
}
#id.none::before {
display: none;
}
</style>
<p>Test passes if there is the word "PASS" below.</p>
<div id="id" class="open">PASS</div>
<script>
id.offsetTop;
id.className = "none";
</script>

View file

@ -16,7 +16,7 @@
background: green;
font-family: monospace;
width: 1ch;
height: 20em;
height: 19em;
}
#test {
width: 1ch;
@ -25,9 +25,12 @@
font-family: monospace;
line-break: anywhere;
}
span {
background: red;
}
</style>
<p>Test passes if there is a green rectangle below and no red.</p>
<div id=green></div>
<!-- with line breaks everywhere, none of the following characters should stick out from under the green div -->
<div id=test>aa-a.a)a,aa&nbsp;a&#xfeff;a&#x2060;a&#x200d;a・a</div>
<div id=test>aa-a.a)a,aa<span>&nbsp;</span>a&#xfeff;a&#x2060;a&#x200d;a・a</div>

View file

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!DOCTYPE html>
<html lang=en>
<meta charset="utf-8">
<title>CSS Text Test Reference</title>
@ -9,7 +9,7 @@
background: green;
font-family: monospace;
width: 1ch;
height: 20em;
height: 19em;
}
</style>

View file

@ -0,0 +1,18 @@
<!DOCTYPE html>
<title>CSS Text Test: Chrome pre-line crash test</title>
<link rel="help" href="https://crbug.com/989827">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
br { white-space: pre-line }
</style>
<script>
test(() => {
document.documentElement.remove();
const br = document.createElement("br");
br.appendChild(document.createTextNode(""));
document.appendChild(br);
br.offsetTop;
br.firstChild.data = " ";
}, "Modifying data of a text child of a root br element with pre-line should not crash.");
</script>

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSSOM View: getComputedStyle().scrollBehavior</title>
<link rel="help" href="https://drafts.csswg.org/cssom-view/#propdef-scroll-behavior">
<meta name="assert" content="scroll-behavior computed value is as specified.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
</head>
<body>
<div id="target"></div>
<script>
test_computed_value("scroll-behavior", 'auto');
test_computed_value("scroll-behavior", 'smooth');
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSSOM View: parsing scroll-behavior with invalid values</title>
<link rel="help" href="https://drafts.csswg.org/cssom-view/#propdef-scroll-behavior">
<meta name="assert" content="scroll-behavior supports only the grammar 'auto | smooth'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("scroll-behavior", 'normal');
test_invalid_value("scroll-behavior", 'auto smooth');
test_invalid_value("scroll-behavior", 'auto, smooth');
</script>
</body>
</html>

View file

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSSOM View: parsing scroll-behavior with valid values</title>
<link rel="help" href="https://drafts.csswg.org/cssom-view/#propdef-scroll-behavior">
<meta name="assert" content="scroll-behavior supports the full grammar 'auto | smooth'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("scroll-behavior", 'auto');
test_valid_value("scroll-behavior", 'smooth');
</script>
</body>
</html>

View file

@ -42,7 +42,7 @@
to: 'right -140% bottom -60%',
}, [
{at: -1, expect: 'calc(960px - 240%) calc(800px - 160%)'},
{at: 0, expect: 'left 480px top 400px'},
{at: 0, expect: 'left calc(0% + 480px) top calc(0% + 400px)'},
{at: 0.125, expect: 'calc(420px + 30%) calc(350px + 20%)'},
{at: 0.875, expect: 'calc(210% + 60px) calc(140% + 50px)'},
{at: 1, expect: 'right -140% bottom -60%'},
@ -54,12 +54,12 @@
from: 'left top',
to: 'left 8px bottom 20%',
}, [
{at: -1, expect: '-8px -80%'},
{at: -1, expect: 'calc(0% - 8px) -80%'},
{at: 0, expect: 'left top'},
{at: 0.125, expect: '1px 10%'},
{at: 0.875, expect: '7px 70%'},
{at: 1, expect: 'left 8px bottom 20%'},
{at: 2, expect: '16px 160%'}
{at: 0.125, expect: 'calc(0% + 1px) 10%'},
{at: 0.875, expect: 'calc(0% + 7px) 70%'},
{at: 1, expect: 'left calc(0% + 8px) bottom 20%'},
{at: 2, expect: 'calc(0% + 16px) 160%'}
]);
test_no_interpolation({

View file

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html class="reftest-wait">
<head>
<title>CSS Motion Path: Combined transformation matrix interpolation</title>
<link rel="help" href="https://drafts.csswg.org/css-transforms-2/#ctm">
<link rel="match" href="offset-path-with-transforms-ref.html">
<meta name="assert" content="This tests animating combined transformation matrix.">
<style>
@keyframes anim {
to {
translate: 0px 100px;
offset-distance: 100%;
transform: translateX(-100px);
}
}
#target {
position: absolute;
width: 100px;
height: 50px;
background-color: lime;
offset-path: path("M25 0v100");
animation: anim 10s -5s paused linear;
}
</style>
</head>
<body onload="load()">
<div id="target"></div>
<div style='width: 50px; height: 100px; background-color: red;'></div>
</body>
<script>
requestAnimationFrame(() => {
document.documentElement.classList.remove('reftest-wait');
});
</script>
</html>

View file

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<title>CSS Motion Path: Combined transformation matrix interpolation reference</title>
<style>
#target {
width: 50px;
height: 100px;
background-color: lime;
}
</style>
</head>
<body>
<div id="target"></div>
</body>
</html>

View file

@ -22,7 +22,7 @@
test(function(){
target.style = 'offset-position: calc(30px + 20%) calc(-200px + 8em + 100%);';
assert_equals(getComputedStyle(target).offsetPosition, 'calc(20% + 30px) calc(100% + -40px)');
assert_equals(getComputedStyle(target).offsetPosition, 'calc(20% + 30px) calc(100% - 40px)');
}, 'offset-position supports calc');
test(function(){
@ -32,7 +32,7 @@ test(function(){
test(function(){
target.style = 'offset-distance: calc(-100px + 50%);';
assert_equals(getComputedStyle(target).offsetDistance, 'calc(50% + -100px)');
assert_equals(getComputedStyle(target).offsetDistance, 'calc(50% - 100px)');
}, 'offset-distance supports calc');
test(function(){
@ -42,7 +42,7 @@ test(function(){
test(function(){
target.style = 'offset-anchor: calc(30px + 20%) calc(-200px + 8em + 100%);';
assert_equals(getComputedStyle(target).offsetAnchor, 'calc(20% + 30px) calc(100% + -40px)');
assert_equals(getComputedStyle(target).offsetAnchor, 'calc(20% + 30px) calc(100% - 40px)');
}, 'offset-anchor supports calc');
</script>

View file

@ -19,7 +19,7 @@ test_valid_value("offset-anchor", "center center");
test_valid_value("offset-anchor", "right center");
test_valid_value("offset-anchor", "center top");
test_valid_value("offset-anchor", "center bottom");
test_valid_value("offset-anchor", "calc(10px + 20%) center");
test_valid_value("offset-anchor", "calc(20% + 10px) center");
test_valid_value("offset-anchor", "right 30em");
test_valid_value("offset-anchor", "10px 20%");
test_valid_value("offset-anchor", "left -10px top -20%");

View file

@ -20,7 +20,7 @@ if ('capture' in HTMLInputElement.prototype) {
instance['capture'] = 'user';
const logEntries = element.takeLog();
assert_array_equals(logEntries.types(), ['attributeChanged']);
assert_attribute_log_entry(logEntries.last(), {name: 'capture', oldValue: '', newValue: 'user', namespace: null});
assert_attribute_log_entry(logEntries.last(), {name: 'capture', oldValue: null, newValue: 'user', namespace: null});
}, 'capture on HTMLInputElement must enqueue an attributeChanged reaction when adding new attribute');
test(() => {
@ -43,7 +43,7 @@ if ('capture' in HTMLInputElement.prototype) {
instance['capture'] = 'asdf';
const logEntries = element.takeLog();
assert_array_equals(logEntries.types(), ['attributeChanged']);
assert_attribute_log_entry(logEntries.last(), {name: 'capture', oldValue: '', newValue: 'asdf', namespace: null});
assert_attribute_log_entry(logEntries.last(), {name: 'capture', oldValue: null, newValue: 'asdf', namespace: null});
}, 'capture on HTMLInputElement must enqueue an attributeChanged reaction when adding invalid value default');
test(() => {

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View file

@ -3,12 +3,16 @@
When running Chrome, there are some useful command line arguments.
You can inform `wpt` of the release channel of Chrome using `--channel`.
However, `wpt` currently does not support installing Chrome or finding the
Chrome binary of a specific channel, so you would also need to specify the path
to the Chrome binary with `--binary`. For example, to run Chrome Dev on Linux:
`wpt` is able to find the correct binary in the following cases:
* On Linux for stable, beta and dev channels if
`google-chrome-{stable,beta,unstable}` are in `PATH`;
* On Mac for stable and canary channels if the official DMGs are installed.
```
./wpt run --channel dev --binary `which google-chrome-unstable` chrome
In other cases, you will need to specify the path to the Chrome binary with
`--binary`. For example:
```bash
./wpt run --channel dev --binary /path/to/non-default/google-chrome chrome
```
Note: when the channel is "dev", `wpt` will *automatically* enable all
@ -19,7 +23,7 @@ Note: when the channel is "dev", `wpt` will *automatically* enable all
If you want to enable a specific [runtime enabled feature][1], use
`--binary-arg` to specify the flag(s) that you want to pass to Chrome:
```
```bash
./wpt run --binary-arg=--enable-blink-features=AsyncClipboard chrome clipboard-apis/
```

View file

@ -2,35 +2,21 @@
To run WPT on Chrome on an Android device, some additional set up is required.
First of all, as usual Android development, we need to have `adb` and be able to
connect to the device.
As with usual Android development, you need to have `adb` and be able to
connect to the device. Run `adb devices` to verify.
## Hosts
Currently, Android support is a prototype with some known issues:
Until we find a better way, we need to root the Android device and update the
/etc/hosts file to include the entries printed by `./wpt make-hosts-file`.
* If you have previously run `./wpt run` against Chrome, you might need to
remove `_venv/bin/chromedriver` so that we can install the correct
ChromeDriver corresponding to your Chrome for Android version.
* We do not support reftests at the moment.
* You will need to manually kill Chrome (all channels) before running tests.
## CA certificate
Note: rooting the device or installing a root CA is no longer required.
In order to run HTTPS tests, we need to add
[WPT's CA](https://github.com/web-platform-tests/wpt/blob/master/tools/certs/cacert.pem)
to the phone. First, convert the certificate from PEM to CRT:
Example (assuming you have Chrome Canary installed on your phone):
```
openssl x509 -outform der -in tools/certs/cacert.pem -out cacert.crt
```
Then copy `cacert.crt` to your phone's external storage (preferably to
Downloads/ as it'll be easier to find). Open Settings -> Security & location ->
Encryption & credentials -> Install from storage. Find and install `cacert.crt`.
(The setting entries might be slightly different based your Android version.)
Note that having this CA installed on your device outside of a test
environment represents a security risk.
Finally, we may run wpt with the `chrome_android` product
```
./wpt run chrome_android [test_list]
```bash
./wpt run --test-type=testharness --channel=canary chrome_android TESTS
```

View file

@ -18,6 +18,7 @@ There's also a load of [general guidelines](general-guidelines) that apply to al
h2tests
lint-tool
manual
reftest-tutorial
reftests
rendering
server-features

View file

@ -0,0 +1,276 @@
# Writing a reftest
<!--
Note to maintainers:
This tutorial is designed to be an authentic depiction of the WPT contribution
experience. It is not intended to be comprehensive; its scope is intentionally
limited in order to demonstrate authoring a complete test without overwhelming
the reader with features. Because typical WPT usage patterns change over time,
this should be updated periodically; please weigh extensions against the
demotivating effect that a lengthy guide can have on new contributors.
-->
Let's say you've discovered that WPT doesn't have any tests for the `dir`
attribute of [the `<bdo>`
element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/bdo). This
tutorial will guide you through the process of writing and submitting a test.
You'll need to [configure your system to use WPT's
tools](../running-tests/from-local-system), but you won't need them until
towards the end of this tutorial. Although it includes some very brief
instructions on using git, you can find more guidance in [the tutorial for git
and GitHub](../appendix/github-intro).
WPT's reftests are great for testing web-platform features that have some
visual effect. [The reftests reference page](reftests) describes them in the
abstract, but for the purposes of this guide, we'll only consider the features
we need to test the `<bdo>` element.
```eval_rst
.. contents::
:local:
```
## Setting up your workspace
To make sure you have the latest code, first type the following into a terminal
located in the root of the WPT git repository:
$ git fetch git@github.com:web-platform-tests/wpt.git
Next, we need a place to store the change set we're about to author. Here's how
to create a new git branch named `reftest-for-bdo` from the revision of WPT we
just downloaded:
$ git checkout -b reftest-for-bdo FETCH_HEAD
Now you're ready to create your patch.
## Writing the test file
First, we'll create a file that demonstrates the "feature under test." That is:
we'll write an HTML document that displays some text using a `<bdo>` element.
WPT has thousands of tests, so it can be daunting to decide where to put a new
one. Generally speaking, [test files should be placed in directories
corresponding to the specification text they are
verifying](../test-suite-design). `<bdo>` is defined in [the "text-level
semantics" chapter of the HTML
specification](https://html.spec.whatwg.org/multipage/text-level-semantics.html),
so we'll want to create our new test in the directory
`html/semantics/text-level-semantics/the-bdo-element/`. Create a file named
`rtl.html` and open it in your text editor.
Here's one way to demonstrate the feature:
```html
<!DOCTYPE html>
<meta charset="utf-8">
<title>BDO element dir=rtl</title>
<link rel="help" href="https://html.spec.whatwg.org/#the-bdo-element">
<meta name="assert" content="BDO element's DIR content attribute renders corrently given value of 'rtl'.">
<p>Test passes if WAS is displayed below.</p>
<bdo dir="rtl">SAW</bdo>
```
That's pretty dense! Let's break it down:
- ```html
<!DOCTYPE html>
<meta charset="utf-8">
```
We explicitly set the DOCTYPE and character set to be sure that browsers
don't infer them to be something we aren't expecting. We're omitting the
`<html>` and `<head>` tags. That's a common practice in WPT, preferred
because it makes tests more concise.
- ```html
<title>BDO element dir=rtl</title>
```
The document's title should succinctly describe the feature under test.
- ```html
<link rel="help" href="https://html.spec.whatwg.org/#the-bdo-element">
```
The "help" metadata should reference the specification under test so that
everyone understands the motivation. This is so helpful that [the CSS Working
Group requires it for CSS tests](css-metadata)! If you're writing a reftest
for a feature outside of CSS, feel free to omit this tag.
- ```html
<meta name="assert" content="BDO element's DIR content attribute renders corrently given value of 'rtl'.">
```
The "assert" metadata is a structured way for you to describe exactly what
you want your reftest to verify. For a direct test like the one we're writing
here, it might seem a little superfluous. It's much more helpful for
more-involved tests where reviewers might need some help understanding your
intentions.
This tag is optional, so you can skip it if you think it's unnecessary. We
recommend using it for your first few tests since it may let reviewers give
you more helpful feedback. As you get more familiar with WPT and the
specifications, you'll get a sense for when and where it's better to leave it
out.
- ```html
<p>Test passes if WAS is displayed below.</p>
```
We're communicating the "pass" condition in plain English to make the test
self-describing.
- ```html
<bdo dir="rtl">SAW</bdo>
```
This is the real focus of the test. We're including some text inside a
`<bdo>` element in order to demonstrate the feature under test.
Since this page doesn't rely on any [special WPT server
features](server-features), we can view it by loading the HTML file directly.
There are a bunch of ways to do this; one is to navigate to the
`html/semantics/text-level-semantics/the-bdo-element/` directory in a file
browser and drag the new `rtl.html` file into an open web browser window.
![](/assets/reftest-tutorial-test-screenshot.png "screen shot of the new test")
Sighted people can open that document and verify whether or not the stated
expectation is satisfied. If we were writing a [manual test](manual), we'd be
done. However, it's time-consuming for a human to run tests, so we should
prefer making tests automatic whenever possible. Remember that we set out to
write a "reference test." Now it's time to write the reference file.
## Writing a "match" reference
The "match" reference file describes what the test file is supposed to look
like. Critically, it *must not* use the technology that we are testing. The
reference file is what allows the test to be run by a computer--the computer
can verify that each pixel in the test document exactly matches the
corresponding pixel in the reference document.
Make a new file in the same
`html/semantics/text-level-semantics/the-bdo-element/` directory named
`rtl-ref.html`, and save the following markup into it:
```html
<!DOCTYPE html>
<meta charset="utf-8">
<title>BDO element dir=rtl reference</title>
<p>Test passes if WAS is displayed below.</p>
<p>WAS</p>
```
This is like a stripped-down version of the test file. In order to produce a
visual rendering which is the same as the expected rendering, it uses a `<p>`
element whose contents is the characters in right-to-left order. That way, if
the browser doesn't support the `<bdo>` element, this file will still show text
in the correct sequence.
This file is also completely functional without the WPT server, so you can open
it in a browser directly from your hard drive.
Currently, there's no way for a human operator or an automated script to know
that the two files we've created are supposed to match visually. We'll need to
add one more piece of metadata to the test file we created earlier. Open
`html/semantics/text-level-semantics/the-bdo-element/rtl.html` in your text
editor and add another `<link>` tag as described by the following change
summary:
```diff
<!DOCTYPE html>
<meta charset="utf-8">
<title>BDO element dir=rtl</title>
<link rel="author" title="Sam Smith" href="mailto:sam@example.com">
<link rel="help" href="https://html.spec.whatwg.org/#the-bdo-element">
+<link rel="match" href="rtl-ref.html">
<meta name="assert" content="BDO element's DIR content attribute renders corrently given value of 'rtl'.">
<p>Test passes if WAS is displayed below.</p>
<bdo dir="rtl">SAW</bdo>
```
Now, anyone (human or computer) reviewing the test file will know where to find
the associated reference file.
## Verifying our work
We're done writing the test, but we should make sure it fits in with the rest
of WPT before we submit it. This involves using some of the project's tools, so
this is the point you'll need to [configure your system to run
WPT](../running-tests/from-local-system).
[The lint tool](lint-tool) can detect some of the common mistakes people make
when contributing to WPT. To run it, open a command-line terminal, navigate to
the root of the WPT repository, and enter the following command:
python ./wpt lint html/semantics/text-level-semantics/the-bdo-element
If this recognizes any of those common mistakes in the new files, it will tell
you where they are and how to fix them. If you do have changes to make, you can
run the command again to make sure you got them right.
Now, we'll run the test using the automated pixel-by-pixel comparison approach
mentioned earlier. This is important for reftests because the test and the
reference may differ in very subtle ways that are hard to catch with the naked
eye. That's not to say your test has to pass in all browsers (or even in *any*
browser). But if we expect the test to pass, then running it this way will help
us catch other kinds of mistakes.
The tools support running the tests in many different browsers. We'll use
Firefox this time:
python ./wpt run firefox html/semantics/text-level-semantics/the-bdo-element/rtl.html
We expect this test to pass, so if it does, we're ready to submit it. If we
were testing a web platform feature that Firefox didn't support, we would
expect the test to fail instead.
There are a few problems to look out for in addition to passing/failing status.
The report will describe fewer tests than we expect if the test isn't run at
all. That's usually a sign of a formatting mistake, so you'll want to make sure
you've used the right file names and metadata. Separately, the web browser
might crash. That's often a sign of a browser bug, so you should consider
[reporting it to the browser's
maintainers](https://rachelandrew.co.uk/archives/2017/01/30/reporting-browser-bugs/)!
## Submitting the test
First, let's stage the new files for committing:
$ git add html/semantics/text-level-semantics/the-bdo-element/rtl.html
$ git add html/semantics/text-level-semantics/the-bdo-element/rtl-ref.html
We can make sure the commit has everything we want to submit (and nothing we
don't) by using `git diff`:
$ git diff --staged
On most systems, you can use the arrow keys to navigate through the changes,
and you can press the `q` key when you're done reviewing.
Next, we'll create a commit with the staged changes:
$ git commit -m '[html] Add test for the `<bdo>` element'
And now we can push the commit to our fork of WPT:
$ git push origin reftest-for-bdo
The last step is to submit the test for review. WPT doesn't actually need the
test we wrote in this tutorial, but if we wanted to submit it for inclusion in
the repository, we would create a pull request on GitHub. [The guide on git and
GitHub](../appendix/github-intro) has all the details on how to do that.
## More practice
Here are some ways you can keep experimenting with WPT using this test:
- Improve coverage by adding more tests for related behaviors (e.g. nested
`<bdo>` elements)
- Add another reference document which describes what the test should *not*
look like using [`rel=mismatch`](reftests)

View file

@ -3,7 +3,9 @@
Reftests are one of the primary tools for testing things relating to
rendering; they are made up of the test and one or more other pages
("references") with assertions as to whether they render identically
or not.
or not. This page describes their aspects exhaustively; [the tutorial
on writing a reftest](reftest-tutorial) offers a more limited but
grounded guide to the process.
## How to Run Reftests
@ -180,46 +182,5 @@ element works, it's possible to construct a reftest for underlining
a block element, by constructing a reference using underlines on a
```<span>``` that wraps all the content inside the block.
## Example Reftests
This example follows the recommended approach in being a
self-describing test as it has a simple statement on the page
describing how it should render to pass the tests.
### Test File
This test verifies that a right-to-left rendering of **SAW** within a
```<bdo>``` element displays as **WAS**.
```html
<!DOCTYPE html>
<meta charset="utf-8">
<title>BDO element dir=rtl</title>
<link rel="help" href="https://html.spec.whatwg.org/#the-bdo-element">
<meta name="assert" content="BDO element's DIR content attribute renders corrently given value of 'rtl'.">
<link rel="match" href="test-bdo-001.html">
<p>Pass if you see WAS displayed below.</p>
<bdo dir="rtl">SAW</bdo>
```
### Reference File
The reference file must look exactly like the test file,
except that the code behind it is different.
* All metadata is removed.
* The ```title``` need not match.
* The markup that created the actual test data is
different: here, the same effect is created with
very mundane, dependable technology.
```html
<!DOCTYPE html>
<meta charset="utf-8">
<title>HTML Reference File</title>
<p>Pass if you see WAS displayed below.</p>
<p>WAS</p>
```
[general guidelines]: general-guidelines
[rendering]: rendering

View file

@ -38,6 +38,27 @@ Hop on to the [mailing list][public-test-infra] or [IRC][]
no need to announce your review request, as soon as you make a Pull Request
GitHub will inform interested parties.
## Previews
The website [wpt-submissions.live](http://wpt-submissions.live) exists to help
contributors demonstrate their proposed changes to others. If your pull request
is open and has the GitHub label `pull-request-has-preview`, then it will be
available at `http://wpt-submissions.live/{{pull request ID}}`, where "pull
request ID" is the numeric identifier for the pull request.
For example, a pull request at https://github.com/web-platform-tests/wpt/pull/3
has a pull request ID `3`. Once that has been assigned the
`pull-request-has-preview` label, then its contents can be viewed at
http://wpt-submissions.live/3.
If you are [a GitHub
collaborator](https://help.github.com/en/articles/permission-levels-for-a-user-account-repository)
on WPT, the label and the preview will be created automatically. Because the
WPT server will execute Python code in the mirrored submissions, previews are
not created automatically for non-collaborators. Collaborators are encouraged
to enable the preview by adding the label, provided they trust the authors not
to submit malicious code.
[repo]: https://github.com/web-platform-tests/wpt/
[github flow]: https://guides.github.com/introduction/flow/
[public-test-infra]: https://lists.w3.org/Archives/Public/public-test-infra/

View file

@ -158,7 +158,7 @@ promise_test(test_function, name, properties)
```
`test_function` is a function that receives a test as an argument. It must
return a promise. The test completes when the returned promise resolves. The
return a promise. The test completes when the returned promise settles. The
test fails if the returned promise rejects.
E.g.:
@ -184,7 +184,12 @@ Note that in the promise chain constructed in `test_function` assertions don't
need to be wrapped in `step` or `step_func` calls.
Unlike Asynchronous Tests, Promise Tests don't start running until after the
previous Promise Test finishes.
previous Promise Test finishes. [Under rare
circumstances](https://github.com/web-platform-tests/wpt/pull/17924), the next
test may begin to execute before the returned promise has settled. Use
[add_cleanup](#cleanup) to register any necessary cleanup actions such as
resetting global state that need to happen consistently before the next test
starts.
`promise_rejects` can be used to test Promises that need to reject:

View file

@ -1,15 +1,4 @@
<!--
try {
var source = new EventSource("../resources/message.py")
source.onopen = function(e) {
this.close()
postMessage([true, this.readyState])
}
} catch(e) {
postMessage([false, String(e)])
}
/*-->
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<title>dedicated worker - EventSource: close()</title>
@ -21,7 +10,7 @@ try {
<script>
var test = async_test();
test.step(function() {
var worker = new Worker('#')
var worker = new Worker('eventsource-close.js')
worker.onmessage = function(e) {
test.step(function() {
assert_true(e.data[0], e.data[1])
@ -32,5 +21,4 @@ try {
})
</script>
</body>
</html>
<!--*/ //-->
</html>

View file

@ -0,0 +1,9 @@
try {
var source = new EventSource("../resources/message.py")
source.onopen = function(e) {
this.close()
postMessage([true, this.readyState])
}
} catch(e) {
postMessage([false, String(e)])
}

View file

@ -1,9 +1,4 @@
<!--
self.close()
var source = new EventSource("../resources/message.py")
postMessage(source.readyState)
/*-->
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<title>dedicated worker - EventSource created after: worker.close()</title>
@ -15,7 +10,7 @@ postMessage(source.readyState)
<script>
var test = async_test();
test.step(function() {
var worker = new Worker('#')
var worker = new Worker('eventsource-close2.js')
worker.onmessage = function(e) {
test.step(function() {
assert_equals(e.data, EventSource.CONNECTING, 'this.readyState')
@ -25,5 +20,4 @@ postMessage(source.readyState)
})
</script>
</body>
</html>
<!--*/ //-->
</html>

View file

@ -0,0 +1,3 @@
self.close()
var source = new EventSource("../resources/message.py")
postMessage(source.readyState)

View file

@ -1,15 +1,3 @@
<!--
try {
var url = decodeURIComponent(location.hash.substr(1))
var source = new EventSource(url)
source.onerror = function(e) {
postMessage([true, this.readyState, 'data' in e])
this.close();
}
} catch(e) {
postMessage([false, String(e)])
}
/*-->
<!DOCTYPE html>
<html>
<head>
@ -24,7 +12,7 @@ try {
function fetchFail(url) {
var test = async_test(document.title + " (" + url + ")")
test.step(function() {
var worker = new Worker('#'+encodeURIComponent(url))
var worker = new Worker('eventsource-constructor-non-same-origin.js#'+encodeURIComponent(url))
worker.onmessage = function(e) {
test.step(function() {
assert_true(e.data[0], e.data[1])
@ -44,4 +32,3 @@ try {
event is dispatched and not a MessageEvent -->
</body>
</html>
<!--*/ //-->

View file

@ -0,0 +1,10 @@
try {
var url = decodeURIComponent(location.hash.substr(1))
var source = new EventSource(url)
source.onerror = function(e) {
postMessage([true, this.readyState, 'data' in e])
this.close();
}
} catch(e) {
postMessage([false, String(e)])
}

View file

@ -0,0 +1,7 @@
try {
var source = new EventSource("http://this is invalid/")
postMessage([false, 'no exception thrown'])
source.close()
} catch(e) {
postMessage([true, e.code])
}

View file

@ -0,0 +1,9 @@
try {
var source = new EventSource("../resources/message.py")
source.onmessage = function(e) {
postMessage([true, e.data])
this.close()
}
} catch(e) {
postMessage([false, String(e)])
}

View file

@ -1,15 +1,4 @@
<!--
try {
var source = new EventSource("../resources/message.py")
source.onmessage = function(e) {
postMessage([true, e.data])
this.close()
}
} catch(e) {
postMessage([false, String(e)])
}
/*-->
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<title>dedicated worker - EventSource: onmessage</title>
@ -21,7 +10,7 @@ try {
<script>
var test = async_test()
test.step(function() {
var worker = new Worker('#')
var worker = new Worker('eventsource-onmesage.js')
worker.onmessage = function(e) {
test.step(function() {
assert_true(e.data[0], e.data[1])
@ -32,5 +21,4 @@ try {
})
</script>
</body>
</html>
<!--*/ //-->
</html>

View file

@ -1,15 +1,4 @@
<!--
try {
var source = new EventSource("../resources/message.py")
source.onopen = function(e) {
postMessage([true, source.readyState, 'data' in e, e.bubbles, e.cancelable])
this.close()
}
} catch(e) {
postMessage([false, String(e)])
}
/*-->
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<title>dedicated worker - EventSource: onopen (announcing the connection)</title>
@ -21,7 +10,7 @@ try {
<script>
var test = async_test()
test.step(function() {
var worker = new Worker('#')
var worker = new Worker('eventsource-onopen.js')
worker.onmessage = function(e) {
test.step(function() {
assert_true(e.data[0], e.data[1])
@ -35,5 +24,4 @@ try {
})
</script>
</body>
</html>
<!--*/ //-->
</html>

View file

@ -0,0 +1,9 @@
try {
var source = new EventSource("../resources/message.py")
source.onopen = function(e) {
postMessage([true, source.readyState, 'data' in e, e.bubbles, e.cancelable])
this.close()
}
} catch(e) {
postMessage([false, String(e)])
}

View file

@ -1,14 +1,4 @@
<!--
try {
EventSource.prototype.ReturnTrue = function() { return true }
var source = new EventSource("../resources/message.py")
postMessage([true, source.ReturnTrue(), 'EventSource' in self])
source.close()
} catch(e) {
postMessage([false, String(e)])
}
/*-->
<!DoCtYpE hTMl>
<!doctype html>
<html>
<heAd>
<title>dedicated worker - EventSource: prototype et al</tiTle>
@ -20,7 +10,7 @@ try {
<sCript>
var test = async_test();
test.step(function() {
var worker = new Worker('#')
var worker = new Worker('eventsource-prototype.js')
worker.onmessage = function(e) {
test.step(function() {
assert_true(e.data[0], e.data[1])
@ -32,5 +22,4 @@ try {
})
</scrIpt>
</bOdy>
</htMl>
<!--*/ //-->
</htMl>

View file

@ -0,0 +1,8 @@
try {
EventSource.prototype.ReturnTrue = function() { return true }
var source = new EventSource("../resources/message.py")
postMessage([true, source.ReturnTrue(), 'EventSource' in self])
source.close()
} catch(e) {
postMessage([false, String(e)])
}

View file

@ -1,13 +1,4 @@
<!--
try {
var source = new EventSource("../resources/message.py")
postMessage([true, source.url])
source.close()
} catch(e) {
postMessage([false, String(e)])
}
/*-->
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<title>dedicated worker - EventSource: url</title>
@ -20,7 +11,7 @@ try {
var test = async_test();
test.step(function() {
var url = "resources/message.py"
var worker = new Worker('#')
var worker = new Worker('eventsource-url.js')
worker.onmessage = function(e) {
test.step(function() {
assert_true(e.data[0], e.data[1]);
@ -31,5 +22,4 @@ try {
})
</script>
</body>
</html>
<!--*/ //-->
</html>

View file

@ -0,0 +1,7 @@
try {
var source = new EventSource("../resources/message.py")
postMessage([true, source.url])
source.close()
} catch(e) {
postMessage([false, String(e)])
}

View file

@ -1,18 +1,4 @@
<!--
onconnect = function(e) {
try {
var port = e.ports[0]
var source = new EventSource("../resources/message.py")
source.onopen = function(e) {
this.close()
port.postMessage([true, this.readyState])
}
} catch(e) {
port.postMessage([false, String(e)])
}
}
/*-->
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<title>shared worker - EventSource: close()</title>
@ -24,7 +10,7 @@ try {
<script>
var test = async_test();
test.step(function() {
var worker = new SharedWorker('#')
var worker = new SharedWorker('eventsource-close.js')
worker.port.onmessage = function(e) {
test.step(function() {
assert_true(e.data[0], e.data[1])
@ -35,5 +21,4 @@ try {
})
</script>
</body>
</html>
<!--*/ //-->
</html>

View file

@ -0,0 +1,12 @@
onconnect = function(e) {
try {
var port = e.ports[0]
var source = new EventSource("../resources/message.py")
source.onopen = function(e) {
this.close()
port.postMessage([true, this.readyState])
}
} catch(e) {
port.postMessage([false, String(e)])
}
}

View file

@ -1,18 +1,3 @@
<!--
onconnect = function(e) {
try {
var port = e.ports[0]
var url = decodeURIComponent(location.hash.substr(1))
var source = new EventSource(url)
source.onerror = function(e) {
port.postMessage([true, this.readyState, 'data' in e])
this.close();
}
} catch(e) {
port.postMessage([false, String(e)])
}
}
/*-->
<!DOCTYPE html>
<html>
<head>
@ -27,7 +12,7 @@ try {
function fetchFail(url) {
var test = async_test(document.title + " (" + url + ")")
test.step(function() {
var worker = new SharedWorker('#'+encodeURIComponent(url))
var worker = new SharedWorker('eventsource-constructor-non-same-origin.js#'+encodeURIComponent(url))
worker.port.onmessage = function(e) {
test.step(function() {
assert_true(e.data[0], e.data[1])
@ -47,4 +32,3 @@ try {
event is dispatched and not a MessageEvent -->
</body>
</html>
<!--*/ //-->

View file

@ -0,0 +1,13 @@
onconnect = function(e) {
try {
var port = e.ports[0]
var url = decodeURIComponent(location.hash.substr(1))
var source = new EventSource(url)
source.onerror = function(e) {
port.postMessage([true, this.readyState, 'data' in e])
this.close();
}
} catch(e) {
port.postMessage([false, String(e)])
}
}

View file

@ -0,0 +1,10 @@
onconnect = function(e) {
try {
var port = e.ports[0]
var source = new EventSource("http://this is invalid/")
port.postMessage([false, 'no exception thrown'])
source.close()
} catch(e) {
port.postMessage([true, e.code])
}
}

View file

@ -1,19 +1,4 @@
<!--
onconnect = function(e) {
try {
var port = e.ports[0]
var source = new EventSource("../resources/message.py")
source.addEventListener("message", listener, false)
function listener(e) {
port.postMessage([true, e.data])
this.close()
}
} catch(e) {
port.postMessage([false, String(e)])
}
}
/*-->
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<title>shared worker - EventSource: addEventListener()</title>
@ -25,7 +10,7 @@ try {
<script>
var test = async_test()
test.step(function() {
var worker = new SharedWorker('#')
var worker = new SharedWorker('eventsource-eventtarget.js')
worker.port.onmessage = function(e) {
test.step(function() {
assert_true(e.data[0], e.data[1])
@ -36,5 +21,4 @@ try {
})
</script>
</body>
</html>
<!--*/ //-->
</html>

View file

@ -0,0 +1,13 @@
onconnect = function(e) {
try {
var port = e.ports[0]
var source = new EventSource("../resources/message.py")
source.addEventListener("message", listener, false)
function listener(e) {
port.postMessage([true, e.data])
this.close()
}
} catch(e) {
port.postMessage([false, String(e)])
}
}

View file

@ -0,0 +1,12 @@
onconnect = function(e) {
try {
var port = e.ports[0]
var source = new EventSource("../resources/message.py")
source.onmessage = function(e) {
port.postMessage([true, e.data])
this.close()
}
} catch(e) {
port.postMessage([false, String(e)])
}
}

View file

@ -1,18 +1,4 @@
<!--
onconnect = function(e) {
try {
var port = e.ports[0]
var source = new EventSource("../resources/message.py")
source.onmessage = function(e) {
port.postMessage([true, e.data])
this.close()
}
} catch(e) {
port.postMessage([false, String(e)])
}
}
/*-->
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<title>shared worker - EventSource: onmessage</title>
@ -24,7 +10,7 @@ try {
<script>
var test = async_test()
test.step(function() {
var worker = new SharedWorker('#')
var worker = new SharedWorker('eventsource-onmesage.js')
worker.port.onmessage = function(e) {
test.step(function() {
assert_true(e.data[0], e.data[1])
@ -35,5 +21,4 @@ try {
})
</script>
</body>
</html>
<!--*/ //-->
</html>

View file

@ -1,18 +1,4 @@
<!--
onconnect = function(e) {
try {
var port = e.ports[0]
var source = new EventSource("../resources/message.py")
source.onopen = function(e) {
port.postMessage([true, source.readyState, 'data' in e, e.bubbles, e.cancelable])
this.close()
}
} catch(e) {
port.postMessage([false, String(e)])
}
}
/*-->
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<title>shared worker - EventSource: onopen (announcing the connection)</title>
@ -24,7 +10,7 @@ try {
<script>
var test = async_test()
test.step(function() {
var worker = new SharedWorker('#')
var worker = new SharedWorker('eventsource-onopen.js')
worker.port.onmessage = function(e) {
test.step(function() {
assert_true(e.data[0], e.data[1])
@ -38,5 +24,4 @@ try {
})
</script>
</body>
</html>
<!--*/ //-->
</html>

View file

@ -0,0 +1,12 @@
onconnect = function(e) {
try {
var port = e.ports[0]
var source = new EventSource("../resources/message.py")
source.onopen = function(e) {
port.postMessage([true, source.readyState, 'data' in e, e.bubbles, e.cancelable])
this.close()
}
} catch(e) {
port.postMessage([false, String(e)])
}
}

View file

@ -1,17 +1,4 @@
<!--
onconnect = function(e) {
try {
var port = e.ports[0]
EventSource.prototype.ReturnTrue = function() { return true }
var source = new EventSource("../resources/message.py")
port.postMessage([true, source.ReturnTrue(), 'EventSource' in self])
source.close()
} catch(e) {
port.postMessage([false, String(e)])
}
}
/*-->
<!DoCtYpE hTMl>
<!doctype html>
<html>
<heAd>
<title>shared worker - EventSource: prototype et al</tiTle>
@ -23,7 +10,7 @@ try {
<sCript>
var test = async_test();
test.step(function() {
var worker = new SharedWorker('#')
var worker = new SharedWorker('eventsource-prototype.js')
worker.port.onmessage = function(e) {
test.step(function() {
assert_true(e.data[0], e.data[1])
@ -35,5 +22,4 @@ try {
})
</scrIpt>
</bOdy>
</htMl>
<!--*/ //-->
</htMl>

View file

@ -0,0 +1,11 @@
onconnect = function(e) {
try {
var port = e.ports[0]
EventSource.prototype.ReturnTrue = function() { return true }
var source = new EventSource("../resources/message.py")
port.postMessage([true, source.ReturnTrue(), 'EventSource' in self])
source.close()
} catch(e) {
port.postMessage([false, String(e)])
}
}

View file

@ -1,16 +1,4 @@
<!--
onconnect = function(e) {
try {
var port = e.ports[0]
var source = new EventSource("../resources/message.py")
port.postMessage([true, source.url])
source.close()
} catch(e) {
port.postMessage([false, String(e)])
}
}
/*-->
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<title>shared worker - EventSource: url</title>
@ -23,7 +11,7 @@ try {
var test = async_test();
test.step(function() {
var url = "resources/message.py"
var worker = new SharedWorker('#')
var worker = new SharedWorker('eventsource-url.js')
worker.port.onmessage = function(e) {
test.step(function() {
assert_true(e.data[0], e.data[1]);
@ -34,5 +22,4 @@ try {
})
</script>
</body>
</html>
<!--*/ //-->
</html>

View file

@ -0,0 +1,10 @@
onconnect = function(e) {
try {
var port = e.ports[0]
var source = new EventSource("../resources/message.py")
port.postMessage([true, source.url])
source.close()
} catch(e) {
port.postMessage([false, String(e)])
}
}

Some files were not shown because too many files have changed in this diff Show more