Auto merge of #25527 - servo-wpt-sync:wpt_update_15-01-2020, r=servo-wpt-sync

Sync WPT with upstream (15-01-2020)

Automated downstream sync of changes from upstream as of 15-01-2020.
[no-wpt-sync]
r? @servo-wpt-sync
This commit is contained in:
bors-servo 2020-01-15 14:31:19 -05:00 committed by GitHub
commit eb8fbddca9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
119 changed files with 1456 additions and 594 deletions

View file

@ -7,7 +7,7 @@
expected: FAIL
[Opening a blob URL in a new window immediately before revoking it works.]
expected: TIMEOUT
expected: FAIL
[Opening a blob URL in a noopener about:blank window immediately before revoking it works.]
expected: FAIL

File diff suppressed because it is too large Load diff

View file

@ -6,3 +6,6 @@
[preflight first request, second from cache, wait, third should preflight again]
expected: FAIL
[age = blank, should be cached]
expected: FAIL

View file

@ -0,0 +1,2 @@
[bidi-span-003.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[table-as-item-wide-content.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[white-space-zero-fontsize-002.html]
expected: FAIL

View file

@ -1,4 +0,0 @@
[CaretPosition-001.html]
[Element at (400, 100)]
expected: FAIL

View file

@ -312,21 +312,24 @@
[fetch(): separate response Content-Type: text/plain ]
expected: NOTRUN
[<iframe>: combined response Content-Type: text/html;" \\" text/plain]
expected: FAIL
[<iframe>: separate response Content-Type: text/plain */*]
expected: FAIL
[<iframe>: combined response Content-Type: text/html */*;charset=gbk]
expected: FAIL
[<iframe>: separate response Content-Type: text/html;x=" text/plain]
expected: FAIL
[<iframe>: separate response Content-Type: text/html;" \\" text/plain]
expected: FAIL
[<iframe>: separate response Content-Type: text/plain */*;charset=gbk]
[<iframe>: combined response Content-Type: text/html;" text/plain]
expected: FAIL
[<iframe>: combined response Content-Type: */* text/html]
expected: FAIL
[<iframe>: combined response Content-Type: text/html */*]
expected: FAIL
[<iframe>: separate response Content-Type: text/html */*;charset=gbk]
expected: FAIL
[<iframe>: combined response Content-Type: text/html;x=" text/plain]
expected: FAIL

View file

@ -53,3 +53,6 @@
[combined text/javascript ]
expected: FAIL
[separate text/javascript x/x]
expected: FAIL

View file

@ -14,6 +14,6 @@
[X-Content-Type-Options%3A%20%40%23%24%23%25%25%26%5E%26%5E*()()11!%2Cnosniff]
expected: FAIL
[X-Content-Type-Options%3A%20%2Cnosniff]
[X-Content-Type-Options%3A%20%22nosniFF%22]
expected: FAIL

View file

@ -1,4 +0,0 @@
[traverse_the_history_4.html]
[Multiple history traversals, last would be aborted]
expected: FAIL

View file

@ -0,0 +1,4 @@
[location_reload_javascript_url.html]
[location_reload_javascript_url]
expected: FAIL

View file

@ -1,4 +1,8 @@
[skip-document-with-fragment.html]
expected: TIMEOUT
[Autofocus elements in iframed documents with URL fragments should be skipped.]
expected: FAIL
[Autofocus elements in top-level browsing context's documents with URI fragments should be skipped.]
expected: TIMEOUT

View file

@ -1,6 +1,6 @@
[iframe_sandbox_popups_escaping-3.html]
type: testharness
expected: TIMEOUT
expected: CRASH
[Check that popups from a sandboxed iframe escape the sandbox if\n allow-popups-to-escape-sandbox is used]
expected: TIMEOUT

View file

@ -1,5 +1,6 @@
[iframe_sandbox_popups_nonescaping-3.html]
type: testharness
expected: TIMEOUT
[Check that popups from a sandboxed iframe do not escape the sandbox]
expected: FAIL
expected: NOTRUN

View file

@ -10,6 +10,3 @@
[Verifies the resolution of entry.startTime is at least 20 microseconds.]
expected: TIMEOUT
[Verifies the resolution of performance.now() is at least 5 microseconds.]
expected: FAIL

View file

@ -0,0 +1,5 @@
[017.html]
expected: TIMEOUT
[origin of the script that invoked the method, about:blank]
expected: TIMEOUT

View file

@ -0,0 +1,7 @@
[xrDevice_isSessionSupported_immersive-ar.https.html]
[isSessionSupported resolves to true for immersive-ar on a supported device]
expected: FAIL
[isSessionSupported resolves to false for immersive-ar on an unsupported device]
expected: FAIL

View file

@ -0,0 +1,4 @@
[xrDevice_requestSession_immersive-ar.https.html]
[Tests requestSession rejects immersive-ar mode when unsupported]
expected: FAIL

View file

@ -0,0 +1,4 @@
[xrSession_environmentBlendMode.https.html]
[Tests environmentBlendMode for an AR device]
expected: FAIL

View file

@ -1,5 +1,4 @@
[005.html]
expected: ERROR
[dedicated worker in shared worker in dedicated worker]
expected: FAIL

View file

@ -114,4 +114,18 @@ test(() => {
element.style = "color: green";
});
}, "TypeError when getter of [PutForwards] attribute returns non-object");
test(() => {
var element = document.createElement("div");
var element_style = element.style;
Object.defineProperty(element.style, "cssText", {
value: null,
writable: false,
});
element.style = "color: green";
assert_equals(element.style, element_style);
assert_equals(element.style.cssText, null);
}, "Does not throw when setter of [PutForwards] attribute returns false");
</script>

View file

@ -1,106 +0,0 @@
<!doctype html>
<meta name="timeout" content="long">
<title>Accept-CH-Lifetime test</title>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="resources/accept-ch-lifetime-test.js"></script>
<script>
setup({ explicit_done: true });
// Cross-origin header tests
run_test({ name: "cross origin iframe not setting other origins",
initial_url: echo,
accept_url: host_info.HTTPS_REMOTE_ORIGIN + accept,
expect_url: do_not_expect,
type: "iframe" });
run_test({ name: "cross origin iframe not setting own origin",
initial_url: host_info.HTTPS_REMOTE_ORIGIN + echo,
accept_url: host_info.HTTPS_REMOTE_ORIGIN + accept,
expect_url: host_info.HTTPS_REMOTE_ORIGIN + do_not_expect,
type: "iframe" });
run_test({ name: "cross origin navigation",
initial_url: echo,
accept_url: host_info.HTTPS_REMOTE_ORIGIN + accept,
expect_url: host_info.HTTPS_REMOTE_ORIGIN + expect,
type: "navigation" });
run_test({ name: "cross origin subresource",
initial_url: host_info.HTTPS_REMOTE_ORIGIN + echo,
accept_url: host_info.HTTPS_REMOTE_ORIGIN + accept,
expect_url: host_info.HTTPS_REMOTE_ORIGIN + do_not_expect,
type: "subresource" });
// Same origin header tests
run_test({ name: "same origin iframe",
initial_url: echo,
accept_url: accept,
expect_url: expect,
type: "iframe" });
run_test({ name: "same origin navigation",
initial_url: echo,
accept_url: accept,
expect_url: expect,
type: "navigation" });
run_test({ name: "same origin subresource",
initial_url: echo,
accept_url: accept,
expect_url: do_not_expect,
type: "subresource" });
// Cross-origin http-equiv tests
run_test({ name: "http-equiv cross origin iframe not setting other origins",
initial_url: echo,
accept_url: host_info.HTTPS_REMOTE_ORIGIN + httpequiv_accept,
expect_url: do_not_expect,
type: "iframe" });
run_test({ name: "http-equiv cross origin iframe not setting own origin",
initial_url: host_info.HTTPS_REMOTE_ORIGIN + echo,
accept_url: host_info.HTTPS_REMOTE_ORIGIN + httpequiv_accept,
expect_url: host_info.HTTPS_REMOTE_ORIGIN + do_not_expect,
type: "iframe" });
run_test({ name: "http-equiv cross origin navigation",
initial_url: echo,
accept_url: host_info.HTTPS_REMOTE_ORIGIN + httpequiv_accept,
expect_url: host_info.HTTPS_REMOTE_ORIGIN + expect,
type: "navigation" });
run_test({ name: "http-equiv cross origin subresource",
initial_url: host_info.HTTPS_REMOTE_ORIGIN + echo,
accept_url: host_info.HTTPS_REMOTE_ORIGIN + httpequiv_accept,
expect_url: host_info.HTTPS_REMOTE_ORIGIN + do_not_expect,
type: "subresource" });
// same-origin http-equiv tests
run_test({ name: "http-equiv same origin iframe",
initial_url: echo,
accept_url: httpequiv_accept,
expect_url: expect,
type: "iframe" });
run_test({ name: "http-equiv same origin navigation",
initial_url: echo,
accept_url: httpequiv_accept,
expect_url: expect,
type: "navigation" });
run_test({ name: "http-equiv same origin subresource",
initial_url: echo,
accept_url: httpequiv_accept,
expect_url: do_not_expect,
type: "subresource" });
done();
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!doctype html>
<meta name="timeout" content="long">
<title>Accept-CH Persistence test</title>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="resources/accept-ch-test.js"></script>
<script>
run_test({ name: "cross origin iframe not setting other origins",
initial_url: echo,
accept_url: host_info.HTTPS_REMOTE_ORIGIN + accept,
expect_url: do_not_expect,
type: "iframe" });
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!doctype html>
<meta name="timeout" content="long">
<title>Accept-CH Persistence test</title>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="resources/accept-ch-test.js"></script>
<script>
run_test({ name: "cross origin iframe not setting own origin",
initial_url: host_info.HTTPS_REMOTE_ORIGIN + echo,
accept_url: host_info.HTTPS_REMOTE_ORIGIN + accept,
expect_url: host_info.HTTPS_REMOTE_ORIGIN + do_not_expect,
type: "iframe" });
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!doctype html>
<meta name="timeout" content="long">
<title>Accept-CH Persistence test</title>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="resources/accept-ch-test.js"></script>
<script>
run_test({ name: "cross origin navigation",
initial_url: echo,
accept_url: host_info.HTTPS_REMOTE_ORIGIN + accept,
expect_url: host_info.HTTPS_REMOTE_ORIGIN + expect,
type: "navigation" });
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!doctype html>
<meta name="timeout" content="long">
<title>Accept-CH Persistence test</title>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="resources/accept-ch-test.js"></script>
<script>
run_test({ name: "cross origin subresource",
initial_url: host_info.HTTPS_REMOTE_ORIGIN + echo,
accept_url: host_info.HTTPS_REMOTE_ORIGIN + accept,
expect_url: host_info.HTTPS_REMOTE_ORIGIN + do_not_expect,
type: "subresource" });
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!doctype html>
<meta name="timeout" content="long">
<title>Accept-CH Persistence test</title>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="resources/accept-ch-test.js"></script>
<script>
run_test({ name: "http-equiv cross origin iframe not setting other origins",
initial_url: echo,
accept_url: host_info.HTTPS_REMOTE_ORIGIN + httpequiv_accept,
expect_url: do_not_expect,
type: "iframe" });
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!doctype html>
<meta name="timeout" content="long">
<title>Accept-CH Persistence test</title>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="resources/accept-ch-test.js"></script>
<script>
run_test({ name: "http-equiv cross origin iframe not setting own origin",
initial_url: host_info.HTTPS_REMOTE_ORIGIN + echo,
accept_url: host_info.HTTPS_REMOTE_ORIGIN + httpequiv_accept,
expect_url: host_info.HTTPS_REMOTE_ORIGIN + do_not_expect,
type: "iframe" });
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!doctype html>
<meta name="timeout" content="long">
<title>Accept-CH Persistence test</title>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="resources/accept-ch-test.js"></script>
<script>
run_test({ name: "http-equiv cross origin navigation",
initial_url: echo,
accept_url: host_info.HTTPS_REMOTE_ORIGIN + httpequiv_accept,
expect_url: host_info.HTTPS_REMOTE_ORIGIN + expect,
type: "navigation" });
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!doctype html>
<meta name="timeout" content="long">
<title>Accept-CH Persistence test</title>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="resources/accept-ch-test.js"></script>
<script>
run_test({ name: "http-equiv cross origin subresource",
initial_url: host_info.HTTPS_REMOTE_ORIGIN + echo,
accept_url: host_info.HTTPS_REMOTE_ORIGIN + httpequiv_accept,
expect_url: host_info.HTTPS_REMOTE_ORIGIN + do_not_expect,
type: "subresource" });
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!doctype html>
<!-- <meta name="timeout" content="long"> -->
<title>Accept-CH Persistence test</title>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="resources/accept-ch-test.js"></script>
<script>
run_test({ name: "http-equiv same origin iframe",
initial_url: echo,
accept_url: httpequiv_accept,
expect_url: expect,
type: "iframe" });
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!doctype html>
<meta name="timeout" content="long">
<title>Accept-CH Persistence test</title>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="resources/accept-ch-test.js"></script>
<script>
run_test({ name: "http-equiv same origin navigation",
initial_url: echo,
accept_url: httpequiv_accept,
expect_url: expect,
type: "navigation" });
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!doctype html>
<meta name="timeout" content="long">
<title>Accept-CH Persistence test</title>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="resources/accept-ch-test.js"></script>
<script>
run_test({ name: "http-equiv same origin subresource",
initial_url: echo,
accept_url: httpequiv_accept,
expect_url: do_not_expect,
type: "subresource" });
</script>
</body>
</html>

View file

@ -1,8 +1,8 @@
const echo = "/client-hints/echo_client_hints_received.py";
const accept = "/client-hints/resources/accept_ch_lifetime.html";
const httpequiv_accept = "/client-hints/resources/http_equiv_accept_ch_lifetime.html";
const expect = "/client-hints/resources/expect_client_hints_headers.html"
const do_not_expect = "/client-hints/resources/do_not_expect_client_hints_headers.html"
const echo = "/client-hints/accept-ch-stickiness/resources/echo-client-hints-received.py";
const accept = "/client-hints/accept-ch-stickiness/resources/accept-ch.html";
const httpequiv_accept = "/client-hints/accept-ch-stickiness/resources/http-equiv-accept-ch.html";
const expect = "/client-hints/accept-ch-stickiness/resources/expect-client-hints-headers.html"
const do_not_expect = "/client-hints/accept-ch-stickiness/resources/do-not-expect-client-hints-headers.html"
const host_info = get_host_info();
const run_test = test => {
@ -53,7 +53,7 @@ const run_test = test => {
assert_unreached("unknown test type");
}
});
}, test.name + " set Accept-CH-Lifetime");
}, test.name + " set Accept-CH");
// Finally, verify that CH are actually sent (or not) on requests
promise_test(t => {
@ -62,7 +62,7 @@ const run_test = test => {
window.addEventListener('message', t.step_func(function(e) {
win.close();
assert_equals(e.data, "PASS", "message from opened page");
fetch("/client-hints/resources/clear-site-data.html").then(resolve);
fetch("/client-hints/accept-ch-stickiness/resources/clear-site-data.html").then(resolve);
}));
// Open a new window. Verify that the user agent attaches client hints.
win = window.open(test.expect_url);

View file

@ -2,10 +2,11 @@
<body>
<!-- An empty webpage whose response headers include Accept-CH
and Accept-CH-Lifetime header. Fetching this webpage should cause
header. Fetching this webpage should cause
user-agent to persist origin preferences for the client hints
specified in the Accept-CH header for a duration specified in
the Accept-CH-Lifetime header.-->
specified in the Accept-CH header until a Clear-Site-Data header
is sent or user action is take to clear the session or data about
the origin.-->
<script>
window.top.opener.postMessage('Loaded', '*');
</script>

View file

@ -5,10 +5,10 @@
// This test checks if browser attaches the device-memory client hint in the
// HTTP request headers.
// echo_client_hints_received.py sets the response headers depending on the set
// echo-client-hints-received.py sets the response headers depending on the set
// of client hints it receives in the request headers.
fetch("../echo_client_hints_received.py").then(r => {
fetch("/client-hints/accept-ch-stickiness/resources/echo-client-hints-received.py").then(r => {
if(r.status == 200 && !r.headers.has("device-memory-received")) {
window.top.opener.postMessage('PASS', '*');
}

View file

@ -0,0 +1,12 @@
def main(request, response):
"""
Simple handler that sets a response header based on which client hint
request headers were received.
"""
response.headers.append("Access-Control-Allow-Origin", "*")
response.headers.append("Access-Control-Allow-Headers", "*")
response.headers.append("Access-Control-Expose-Headers", "*")
if "device-memory" in request.headers:
response.headers.set("device-memory-received", request.headers.get("device-memory"))

View file

@ -0,0 +1,22 @@
<html>
<body>
<script>
// This test checks if browser attaches the device-memory client hint in the
// HTTP request headers.
// echo-client-hints-received.py sets the response headers depending on the set
// of client hints it receives in the request headers.
fetch("/client-hints/accept-ch-stickiness/resources/echo-client-hints-received.py").then(r => {
if(r.status == 200 && r.headers.has("device-memory-received")) {
window.top.opener.postMessage('PASS', '*');
}
else {
window.top.opener.postMessage('FAIL', '*');
}
});
</script>
</body>
</html>

View file

@ -1,6 +1,5 @@
<html>
<meta http-equiv="Accept-CH" content="device-memory">
<meta http-equiv="Accept-CH-Lifetime" content="5">
<body>
<script>
window.top.opener.postMessage('Loaded', '*');

View file

@ -0,0 +1,19 @@
<!doctype html>
<meta name="timeout" content="long">
<title>Accept-CH Persistence test</title>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="resources/accept-ch-test.js"></script>
<script>
run_test({ name: "same origin iframe",
initial_url: echo,
accept_url: accept,
expect_url: expect,
type: "iframe" });
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!doctype html>
<meta name="timeout" content="long">
<title>Accept-CH Persistence test</title>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="resources/accept-ch-test.js"></script>
<script>
run_test({ name: "same origin navigation",
initial_url: echo,
accept_url: accept,
expect_url: expect,
type: "navigation" });
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!doctype html>
<meta name="timeout" content="long">
<title>Accept-CH Persistence test</title>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="resources/accept-ch-test.js"></script>
<script>
run_test({ name: "same origin subresource",
initial_url: echo,
accept_url: accept,
expect_url: do_not_expect,
type: "subresource" });
</script>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

View file

@ -39,28 +39,25 @@ project-directory/ (e.g. referrer-policy/)
├── spec.src.json
├── generic/
│ ├── test-case.sub.js - Per-project test helper
└── tools/
└── generator.py - Per-project generator script
├── sanity-checker.js (Used by debug target only)
└── spec_json.js (Used by debug target only)
└── gen/ - generated tests
```
Invoking `project-directory/generic/tools/generate.py` will parse the spec JSON and determine which tests to generate (or skip) while using templates.
## Generating the tests
The repository already contains generated tests, so if you're making changes, see the [Removing all generated tests](#removing-all-generated-tests) section below, on how to remove them before you start generating tests which include your changes.
Note: When the repository already contains generated tests, [remove all generated tests](#removing-all-generated-tests) first.
```bash
# Chdir into the project directory.
cd ~/web-platform-tests/project-directory
# Generate the test files under gen/ (HTMLs and .headers files).
./generic/tools/generate.py
path/to/common/security-features/tools/generate.py --spec path/to/project-directory/
# Add all generated tests to the repo.
git add gen/ && git commit -m "Add generated tests"
git add path/to/project-directory/gen/ && git commit -m "Add generated tests"
```
This will parse the spec JSON (`project-directory/spec.src.json`) and determine which tests to generate (or skip) while using templates.
During the generation, the spec is validated by ```common/security-features/tools/spec_validator.py```. This is specially important when you're making changes to `spec.src.json`. Make sure it's a valid JSON (no comments or trailing commas). The validator reports specific errors (missing keys etc.), if any.
### Removing all generated tests
@ -68,18 +65,14 @@ During the generation, the spec is validated by ```common/security-features/tool
Simply remove all files under `project-directory/gen/`.
```bash
# Chdir into the project directory.
cd ~/web-platform-tests/project-directory
# Remove all generated tests.
rm -r gen/
rm -r path/to/project-directory/gen/
```
### Options for generating tests
Note: this section is currently obsolete. Only the release template is working.
The generator script ```./generic/tools/generate.py``` has two targets: ```release``` and ```debug```.
The generator script has two targets: ```release``` and ```debug```.
* Using **release** for the target will produce tests using a template for optimizing size and performance. The release template is intended for the official web-platform-tests and possibly other test suites. No sanity checking is done in release mode. Use this option whenever you're checking into web-platform-tests.

View file

@ -1,3 +1,5 @@
#!/usr/bin/env python
from __future__ import print_function
import argparse
@ -64,7 +66,7 @@ def dump_test_parameters(selection):
cls=util.CustomEncoder)
def get_test_filename(config, selection):
def get_test_filename(spec_directory, spec_json, selection):
'''Returns the filname for the main test HTML file'''
selection_for_filename = copy.deepcopy(selection)
@ -72,8 +74,9 @@ def get_test_filename(config, selection):
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)
return os.path.join(
spec_directory,
spec_json['test_file_path_pattern'] % selection_for_filename)
def handle_deliveries(policy_deliveries):
@ -127,9 +130,9 @@ def handle_deliveries(policy_deliveries):
return {"meta": meta, "headers": headers}
def generate_selection(spec_json, config, selection, spec,
def generate_selection(spec_directory, spec_json, selection, spec,
test_html_template_basename):
test_filename = get_test_filename(config, selection)
test_filename = get_test_filename(spec_directory, spec_json, selection)
target_policy_delivery = util.PolicyDelivery(selection['delivery_type'],
selection['delivery_key'],
@ -175,16 +178,23 @@ def generate_selection(spec_json, config, selection, spec,
"\n", indent)
selection['spec_name'] = spec['name']
selection[
'test_page_title'] = config.test_page_title_template % spec['title']
selection['test_page_title'] = spec_json['test_page_title_template'] % spec
selection['spec_description'] = spec['description']
selection['spec_specification_url'] = spec['specification_url']
selection['helper_js'] = config.helper_js
selection['sanity_checker_js'] = config.sanity_checker_js
selection['spec_json_js'] = config.spec_json_js
test_directory = os.path.dirname(test_filename)
selection['helper_js'] = os.path.relpath(
os.path.join(spec_directory, 'generic', 'test-case.sub.js'),
test_directory)
selection['sanity_checker_js'] = os.path.relpath(
os.path.join(spec_directory, 'generic', 'sanity-checker.js'),
test_directory)
selection['spec_json_js'] = os.path.relpath(
os.path.join(spec_directory, 'generic', 'spec_json.js'),
test_directory)
test_headers_filename = test_filename + ".headers"
test_directory = os.path.dirname(test_filename)
test_html_template = util.get_template(test_html_template_basename)
disclaimer_template = util.get_template('disclaimer.template')
@ -194,13 +204,13 @@ def generate_selection(spec_json, config, selection, spec,
generated_disclaimer = disclaimer_template \
% {'generating_script_filename': os.path.relpath(sys.argv[0],
util.test_root_directory),
'html_template_filename': os.path.relpath(html_template_filename,
'spec_directory': os.path.relpath(spec_directory,
util.test_root_directory)}
# Adjust the template for the test invoking JS. Indent it to look nice.
selection['generated_disclaimer'] = generated_disclaimer.rstrip()
selection[
'test_description'] = config.test_description_template % selection
selection['test_description'] = spec_json[
'test_description_template'] % selection
selection['test_description'] = \
selection['test_description'].rstrip().replace("\n", "\n" + " " * 33)
@ -227,12 +237,12 @@ def generate_selection(spec_json, config, selection, spec,
util.write_file(test_filename, test_html_template % selection)
def generate_test_source_files(config, spec_json, target):
def generate_test_source_files(spec_directory, spec_json, target):
test_expansion_schema = spec_json['test_expansion_schema']
specification = spec_json['specification']
spec_json_js_template = util.get_template('spec_json.js.template')
generated_spec_json_filename = os.path.join(config.spec_directory,
generated_spec_json_filename = os.path.join(spec_directory, "generic",
"spec_json.js")
util.write_file(
generated_spec_json_filename,
@ -251,7 +261,8 @@ def generate_test_source_files(config, spec_json, target):
expand_pattern(excluded_pattern, test_expansion_schema)
for excluded_selection in permute_expansion(excluded_expansion,
artifact_order):
excluded_selection_path = config.selection_pattern % excluded_selection
excluded_selection_path = spec_json[
'selection_pattern'] % excluded_selection
exclusion_dict[excluded_selection_path] = True
for spec in specification:
@ -264,7 +275,7 @@ def generate_test_source_files(config, spec_json, target):
test_expansion_schema)
for selection in permute_expansion(expansion, artifact_order):
selection['delivery_key'] = spec_json['delivery_key']
selection_path = config.selection_pattern % selection
selection_path = spec_json['selection_pattern'] % selection
if not selection_path in exclusion_dict:
if selection_path in output_dict:
if expansion_pattern['expansion'] != 'override':
@ -280,13 +291,13 @@ def generate_test_source_files(config, spec_json, target):
for selection_path in output_dict:
selection = output_dict[selection_path]
try:
generate_selection(spec_json, config, selection, spec,
generate_selection(spec_directory, spec_json, selection, spec,
html_template)
except util.ShouldSkip:
continue
def main(config):
def main():
parser = argparse.ArgumentParser(
description='Test suite generator utility')
parser.add_argument(
@ -300,16 +311,19 @@ def main(config):
'-s',
'--spec',
type=str,
default=None,
default=os.getcwd(),
help='Specify a file used for describing and generating the tests')
# TODO(kristijanburnik): Add option for the spec_json file.
args = parser.parse_args()
if args.spec:
config.spec_directory = args.spec
spec_directory = os.path.abspath(args.spec)
spec_filename = os.path.join(config.spec_directory, "spec.src.json")
spec_filename = os.path.join(spec_directory, "spec.src.json")
spec_json = util.load_spec_json(spec_filename)
spec_validator.assert_valid_spec_json(spec_json)
generate_test_source_files(config, spec_json, args.target)
generate_test_source_files(spec_directory, spec_json, args.target)
if __name__ == '__main__':
main()

View file

@ -87,6 +87,8 @@ def validate(spec_json, details):
details['object'] = spec_json
assert_contains_only_fields(spec_json, [
"selection_pattern", "test_file_path_pattern",
"test_description_template", "test_page_title_template",
"specification", "delivery_key", "subresource_schema",
"source_context_schema", "source_context_list_schema",
"test_expansion_schema", "excluded_tests"

View file

@ -1 +1 @@
<!-- DO NOT EDIT! Generated by %(generating_script_filename)s using %(html_template_filename)s. -->
<!-- DO NOT EDIT! Generated by `%(generating_script_filename)s --spec %(spec_directory)s/` -->

View file

@ -60,6 +60,15 @@ test(function() {
},
'preflight for x-print should be cached')
test(function() {
var time = new Date().getTime()
var client = new XMLHttpRequest()
var id = did_preflight(true, client, {extra:'max_age='})
did_preflight(false, client, {extra:'max_age=', token: id})
},
'age = blank, should be cached')
test(function() {
var time = new Date().getTime()
var client = new XMLHttpRequest()

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<style>
.container {
width: 300px;
background: pink;
}
div {
margin-bottom: 10px;
text-align: right;
}
.purple {
border: purple solid 5px;
}
.orange {
background: orange;
}
</style>
<body>
<div class="container">
<div>
<span class="purple">inspect</span><span class="orange">pause</span>
</div>
<div>
<span class="purple">inspect</span> <span class="orange">pause</span>
</div
<div>
<span class="purple">inspect<span class="orange">pause</span></span>
</div>
</div>
</body>

View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<title>CSS Test: Bidi reordering with inline boxes</title>
<link rel="match" href="bidi-span-003-ref.html">
<link rel="help" href="https://drafts.csswg.org/css2/visuren.html#direction">
<link rel="author" title="Koji Ishii" href="mailto:kojii@chromium.org">
<style>
.container {
width: 300px;
background: pink;
}
div {
margin-bottom: 10px;
}
.purple {
border: purple solid 5px;
}
.orange {
background: orange;
}
</style>
<body>
<div class="container">
<div dir=rtl>
<span class="purple">inspect</span><span class="orange">pause</span>
</div>
<div dir=rtl>
<span class="purple">inspect</span> <span class="orange">pause</span>
</div>
<div dir=rtl>
<span class="purple">inspect<span class="orange">pause</span></span>
</div>
</div>
</body>

View file

@ -0,0 +1,12 @@
<!DOCTYPE html>
<title>CSS Flexbox Test: Flex item as table, specified width and min-width less than minimum intrinsic width</title>
<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
<link rel="author" title="David Grogan" href="mailto:dgrogan@chromium.org">
<link rel="help" href="https://www.w3.org/TR/css-flexbox-1/#layout-algorithm" title="9. Flex Layout Algorithm">
<link rel="match" href="../reference/ref-filled-green-100px-square.xht">
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div style="display:flex; width:100px; background:red;">
<div style="display:table; min-width: 5px; width: 10px; max-width:10px; height:100px; background:green;">
<div style="width:100px; height:10px; background:green;"></div>
</div>
</div>

View file

@ -1,12 +1,24 @@
<!DOCTYPE html>
<title>CSS Flexbox Test: Flex item as table with wide content</title>
<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
<link rel="help" href="https://www.w3.org/TR/css-flexbox-1/#layout-algorithm" title="9. Flex Layout Algorithm">
<meta name="assert" content="A flex item as a table uses the sizing algorithm of the flexbox">
<link rel="match" href="../reference/ref-filled-green-100px-square-only.html">
<p>Test passes if there is a filled green square.</p>
<div style="display:flex; width:100px;">
<link rel="author" title="David Grogan" href="mailto:dgrogan@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-flexbox/#algo-main-item" title="Sentence beginning with 'The hypothetical main size is...'">
<meta name="assert" content="A flex item respects the _used_ min size of an item, which tables define specially.">
<link rel="bookmark" href="https://github.com/w3c/csswg-drafts/issues/2442" />
<link rel="match" href="../reference/ref-filled-green-100px-square.xht">
<style>
#reference-overlapped-red {
position: absolute;
background-color: red;
width: 100px;
height: 100px;
z-index: -1;
}
</style>
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div id=reference-overlapped-red></div>
<div style="display:flex; width:50px;">
<div style="min-width:0; flex:1 1; display:table; background:green;">
<div style="width:500px; height:100px;"></div>
<div style="width:100px; height:100px;"></div>
</div>
</div>

View file

@ -6,6 +6,7 @@
<meta name="flags" content="ahem">
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
<link rel="stylesheet" href="/css/support/grid.css">
<link rel="stylesheet" href="/css/support/alignment.css">
<style>
@ -21,6 +22,11 @@
grid-auto-rows: auto;
}
.width300height400 {
width: 300px;
height: 400px;
}
.thirdRowFirstColumn {
background-color: green;
grid-column: 1;
@ -145,13 +151,13 @@
<div style="position: relative">
<p>direction: LTR | align-content: 'stretch'</p>
<div class="grid stretchedGrid alignContentStretch verticalLR" data-expected-width="400" data-expected-height="300">
<div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="0" data-expected-width="133" data-expected-height="20"></div>
<div class="firstRowSecondColumn" data-offset-x="0" data-offset-y="20" data-expected-width="133" data-expected-height="20"></div>
<div class="secondRowFirstColumn" data-offset-x="133" data-offset-y="0" data-expected-width="133" data-expected-height="20"></div>
<div class="secondRowSecondColumn" data-offset-x="133" data-offset-y="20" data-expected-width="133" data-expected-height="20"></div>
<div class="thirdRowFirstColumn" data-offset-x="267" data-offset-y="0" data-expected-width="133" data-expected-height="20"></div>
<div class="thirdRowSecondColumn" data-offset-x="267" data-offset-y="20" data-expected-width="133" data-expected-height="20"></div>
<div class="grid stretchedGrid width300height400 alignContentStretch verticalLR" data-expected-width="300" data-expected-height="400">
<div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="0" data-expected-width="100" data-expected-height="20"></div>
<div class="firstRowSecondColumn" data-offset-x="0" data-offset-y="20" data-expected-width="100" data-expected-height="20"></div>
<div class="secondRowFirstColumn" data-offset-x="100" data-offset-y="0" data-expected-width="100" data-expected-height="20"></div>
<div class="secondRowSecondColumn" data-offset-x="100" data-offset-y="20" data-expected-width="100" data-expected-height="20"></div>
<div class="thirdRowFirstColumn" data-offset-x="200" data-offset-y="0" data-expected-width="100" data-expected-height="20"></div>
<div class="thirdRowSecondColumn" data-offset-x="200" data-offset-y="20" data-expected-width="100" data-expected-height="20"></div>
</div>
</div>
@ -290,13 +296,13 @@
<div style="position: relative">
<p>direction: RTL | align-content: 'stretch'</p>
<div class="grid stretchedGrid alignContentStretch verticalLR directionRTL" data-expected-width="400" data-expected-height="300">
<div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="280" data-expected-width="133" data-expected-height="20"></div>
<div class="firstRowSecondColumn" data-offset-x="0" data-offset-y="260" data-expected-width="133" data-expected-height="20"></div>
<div class="secondRowFirstColumn" data-offset-x="133" data-offset-y="280" data-expected-width="133" data-expected-height="20"></div>
<div class="secondRowSecondColumn" data-offset-x="133" data-offset-y="260" data-expected-width="133" data-expected-height="20"></div>
<div class="thirdRowFirstColumn" data-offset-x="267" data-offset-y="280" data-expected-width="133" data-expected-height="20"></div>
<div class="thirdRowSecondColumn" data-offset-x="267" data-offset-y="260" data-expected-width="133" data-expected-height="20"></div>
<div class="grid stretchedGrid width300height400 alignContentStretch verticalLR directionRTL" data-expected-width="300" data-expected-height="400">
<div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="380" data-expected-width="100" data-expected-height="20"></div>
<div class="firstRowSecondColumn" data-offset-x="0" data-offset-y="360" data-expected-width="100" data-expected-height="20"></div>
<div class="secondRowFirstColumn" data-offset-x="100" data-offset-y="380" data-expected-width="100" data-expected-height="20"></div>
<div class="secondRowSecondColumn" data-offset-x="100" data-offset-y="360" data-expected-width="100" data-expected-height="20"></div>
<div class="thirdRowFirstColumn" data-offset-x="200" data-offset-y="380" data-expected-width="100" data-expected-height="20"></div>
<div class="thirdRowSecondColumn" data-offset-x="200" data-offset-y="360" data-expected-width="100" data-expected-height="20"></div>
</div>
</div>

View file

@ -6,6 +6,7 @@
<meta name="flags" content="ahem">
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
<link rel="stylesheet" href="/css/support/grid.css">
<link rel="stylesheet" href="/css/support/alignment.css">
<style>
@ -21,6 +22,11 @@
grid-auto-rows: auto;
}
.width300height400 {
width: 300px;
height: 400px;
}
.thirdRowFirstColumn {
background-color: green;
grid-column: 1;
@ -145,13 +151,13 @@
<div style="position: relative">
<p>direction: LTR | align-content: 'stretch'</p>
<div class="grid stretchedGrid alignContentStretch verticalRL" data-expected-width="400" data-expected-height="300">
<div class="firstRowFirstColumn" data-offset-x="267" data-offset-y="0" data-expected-width="133" data-expected-height="20"></div>
<div class="firstRowSecondColumn" data-offset-x="267" data-offset-y="20" data-expected-width="133" data-expected-height="20"></div>
<div class="secondRowFirstColumn" data-offset-x="133" data-offset-y="0" data-expected-width="133" data-expected-height="20"></div>
<div class="secondRowSecondColumn" data-offset-x="133" data-offset-y="20" data-expected-width="133" data-expected-height="20"></div>
<div class="thirdRowFirstColumn" data-offset-x="0" data-offset-y="0" data-expected-width="133" data-expected-height="20"></div>
<div class="thirdRowSecondColumn" data-offset-x="0" data-offset-y="20" data-expected-width="133" data-expected-height="20"></div>
<div class="grid stretchedGrid width300height400 alignContentStretch verticalRL" data-expected-width="300" data-expected-height="400">
<div class="firstRowFirstColumn" data-offset-x="200" data-offset-y="0" data-expected-width="100" data-expected-height="20"></div>
<div class="firstRowSecondColumn" data-offset-x="200" data-offset-y="20" data-expected-width="100" data-expected-height="20"></div>
<div class="secondRowFirstColumn" data-offset-x="100" data-offset-y="0" data-expected-width="100" data-expected-height="20"></div>
<div class="secondRowSecondColumn" data-offset-x="100" data-offset-y="20" data-expected-width="100" data-expected-height="20"></div>
<div class="thirdRowFirstColumn" data-offset-x="0" data-offset-y="0" data-expected-width="100" data-expected-height="20"></div>
<div class="thirdRowSecondColumn" data-offset-x="0" data-offset-y="20" data-expected-width="100" data-expected-height="20"></div>
</div>
</div>
@ -290,13 +296,13 @@
<div style="position: relative">
<p>direction: RTL | align-content: 'stretch'</p>
<div class="grid stretchedGrid alignContentStretch verticalRL directionRTL" data-expected-width="400" data-expected-height="300">
<div class="firstRowFirstColumn" data-offset-x="267" data-offset-y="280" data-expected-width="133" data-expected-height="20"></div>
<div class="firstRowSecondColumn" data-offset-x="267" data-offset-y="260" data-expected-width="133" data-expected-height="20"></div>
<div class="secondRowFirstColumn" data-offset-x="133" data-offset-y="280" data-expected-width="133" data-expected-height="20"></div>
<div class="secondRowSecondColumn" data-offset-x="133" data-offset-y="260" data-expected-width="133" data-expected-height="20"></div>
<div class="thirdRowFirstColumn" data-offset-x="0" data-offset-y="280" data-expected-width="133" data-expected-height="20"></div>
<div class="thirdRowSecondColumn" data-offset-x="0" data-offset-y="260" data-expected-width="133" data-expected-height="20"></div>
<div class="grid stretchedGrid width300height400 alignContentStretch verticalRL directionRTL" data-expected-width="300" data-expected-height="400">
<div class="firstRowFirstColumn" data-offset-x="200" data-offset-y="380" data-expected-width="100" data-expected-height="20"></div>
<div class="firstRowSecondColumn" data-offset-x="200" data-offset-y="360" data-expected-width="100" data-expected-height="20"></div>
<div class="secondRowFirstColumn" data-offset-x="100" data-offset-y="380" data-expected-width="100" data-expected-height="20"></div>
<div class="secondRowSecondColumn" data-offset-x="100" data-offset-y="360" data-expected-width="100" data-expected-height="20"></div>
<div class="thirdRowFirstColumn" data-offset-x="0" data-offset-y="380" data-expected-width="100" data-expected-height="20"></div>
<div class="thirdRowSecondColumn" data-offset-x="0" data-offset-y="360" data-expected-width="100" data-expected-height="20"></div>
</div>
</div>

View file

@ -6,6 +6,7 @@
<meta name="flags" content="ahem">
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
<link rel="stylesheet" href="/css/support/grid.css">
<link rel="stylesheet" href="/css/support/alignment.css">
<style>

View file

@ -79,8 +79,8 @@
}({
'grid-template-columns': { // named 'grid-definition-columns' in last draft
initial: '150px',
'none': ['none', '150px'],
initial: 'none',
'none': ['none', 'none'],
'<line-names>': ['[a] auto [b] auto [c]', '[a] 150px [b] 100px [c]'],
'<track-size>.auto': ['auto', '150px'],
'<track-size>.<track-breadth>.<length>': ['100px', '100px'],
@ -89,20 +89,20 @@
'<track-size>.<track-breadth>.min-content': ['min-content', '100px'],
'<track-size>.<track-breadth>.max-content': ['max-content', '150px'],
'<track-size>.<track-breadth>.minmax()': ['minmax(100px, 200px)', '200px'],
'reset': ['none', '150px'],
'reset': ['none', 'none'],
},
'grid-template-rows': { // named 'grid-definition-rows' in last draft
initial: '50px 50px 50px',
'none': ['none', '50px 50px 50px'],
'<line-names>': ['[a] auto [b] auto [c]', '[a] 50px [b] 50px [c] 50px'],
'<track-size>.auto': ['auto', '50px 50px 50px'],
'<track-size>.<track-breadth>.<length>': ['100px', '100px 50px 50px'],
'<track-size>.<track-breadth>.<percentage>': ['100%', '150px 50px 50px'],
'<track-size>.<track-breadth>.<flex>': ['1fr', '50px 50px 50px'],
'<track-size>.<track-breadth>.min-content': ['min-content', '50px 50px 50px'],
'<track-size>.<track-breadth>.max-content': ['max-content', '50px 50px 50px'],
'<track-size>.<track-breadth>.minmax()': ['minmax(100px, 200px)', '200px 50px 50px'],
'reset': ['none', '50px 50px 50px'],
initial: 'none',
'none': ['none', 'none'],
'<line-names>': ['[a] auto [b] auto [c]', '[a] 50px [b] 50px [c]'],
'<track-size>.auto': ['auto', '50px'],
'<track-size>.<track-breadth>.<length>': ['100px', '100px'],
'<track-size>.<track-breadth>.<percentage>': ['100%', '50px'],
'<track-size>.<track-breadth>.<flex>': ['1fr', '50px'],
'<track-size>.<track-breadth>.min-content': ['min-content', '50px'],
'<track-size>.<track-breadth>.max-content': ['max-content', '50px'],
'<track-size>.<track-breadth>.minmax()': ['minmax(100px, 200px)', '200px'],
'reset': ['none', 'none'],
},
'grid-template-areas': {
initial: 'none',

View file

@ -0,0 +1,18 @@
<!DOCTYPE html>
<link rel="author" title="Mozilla" href="https://mozilla.org">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1606485">
<style>
* {
grid-template-rows: subgrid;
display: grid;
overflow: scroll;
contain: strict;
}
</style>
<script>
document.addEventListener('DOMContentLoaded', function() {
let e = document.createElement('s');
document.documentElement.appendChild(e);
document.documentElement.getBoundingClientRect() // Update layout
});
</script>

View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<head>
<title>contain: strict element with subgrid properties</title>
<link rel="author" title="Mozilla" href="https://mozilla.org">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1606485">
</head>
<style>
#gridcontainer {
display: grid;
contain: strict;
}
.item {
display: grid;
grid: subgrid [x] / subgrid [x];
}
</style>
<div id="gridcontainer">
<div class="item">Text1</div>
</div>

View file

@ -0,0 +1,16 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>CSS Text test reference</title>
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
<style>
pre {
font-size: 12px;
float: left;
border: 1px solid black;
margin: 12px;
}
</style>
<pre>
foo
bar
</pre>

View file

@ -0,0 +1,17 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>CSS Text test reference</title>
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
<style>
pre {
font-size: 12px;
float: left;
border: 1px solid black;
margin: 12px;
-moz-tab-size: 100px;
tab-size: 100px;
}
</style>
<pre>
<span>foo</span>&#x9;<span>bar</span>
</pre>

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>CSS Text Test: preserved white space with zero font-size</title>
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-property">
<link rel="match" href="reference/white-space-zero-fontsize-001-ref.html">
<meta name="assert" content="Forced line break in preserved white space is respected even when font-size is zero">
<style>
pre {
font-size: 0;
float: left;
border: 1px solid black;
margin: 12px;
}
span { font-size: 12px; }
</style>
<pre>
<span>foo</span>
<span>bar</span>
</pre>

View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>CSS Text Test: preserved white space with zero font-size</title>
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-property">
<link rel="match" href="reference/white-space-zero-fontsize-002-ref.html">
<meta name="assert" content="Tab in preserved white space is respected even when font-size is zero">
<style>
pre {
font-size: 0;
float: left;
border: 1px solid black;
margin: 12px;
-moz-tab-size: 100px;
tab-size: 100px;
}
span { font-size: 12px; }
</style>
<pre>
<span>foo</span>&#x9;<span>bar</span>
</pre>

View file

@ -43,6 +43,21 @@ The wptserver implements a number of Python APIs for controlling traffic.
/tools/wptserve/docs/stash
```
### Python3 compatibility
Even though Python3 is not fully supported at this point, some work is being
done to add compatibility for it. This is why you can see in multiple places
the use of the `six` python module which is meant to provide a set of simple
utilities that work for both generation of python (see
[docs](https://six.readthedocs.io/)). The module is vendored in
tools/third_party/six/six.py.
When an handler is added, it should be at least syntax-compatible with Python3.
You can check that by running:
```
python3 -m py_compile <path/to/handler.py>
```
## Example: Dynamic HTTP headers
The following code defines a Python handler that allows the requester to

View file

@ -38,4 +38,9 @@ function runTest(config, qualifier)
promise_test(
() => checkEncryptionScheme('cbcs'),
testnamePrefix(qualifier, config.keysystem) + ' support for "cbcs" encryption scheme.');
promise_test(
() => checkEncryptionScheme('cbcs-1-9'),
testnamePrefix(qualifier, config.keysystem) +
' support for "cbcs-1-9" encryption scheme.');
}

View file

@ -1,7 +1,8 @@
from datetime import datetime
from six import ensure_str
def main(request, response):
last_event_id = request.headers.get("Last-Event-Id", "")
last_event_id = ensure_str(request.headers.get("Last-Event-Id", ""))
ident = request.GET.first('ident', "test")
cookie = "COOKIE" if ident in request.cookies else "NO_COOKIE"
origin = request.GET.first('origin', request.headers["origin"])

View file

@ -4,7 +4,7 @@ from wptserve import pipes
def run_other(request, response, path):
#This is a terrible hack
environ = {"__file__": path}
execfile(path, environ, environ)
exec(compile(open(path, "r").read(), path, 'exec'), environ, environ)
rv = environ["main"](request, response)
return rv

View file

@ -1,7 +1,9 @@
from six import ensure_str
def main(request, response):
response.headers.set("Content-Type", "text/event-stream")
last_event_id = request.headers.get("Last-Event-ID", None)
last_event_id = ensure_str(request.headers.get("Last-Event-ID", ""))
if last_event_id:
return "data: " + last_event_id + "\n\n"
else:

View file

@ -0,0 +1,60 @@
<!DOCTYPE HTML>
<html>
<head>
<title>location_reload_javascript_url</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
<iframe></iframe>
<script>
async_test(function(t) {
const URL = "/common/blank.html";
const URL2 = "/common/blank.html#foo";
const JS_URL_TEXT = "javascript generated page";
const JS_URL = "javascript:'<html>" + JS_URL_TEXT + "</html>'";
var iframe = document.querySelector("iframe");
var count = 0;
iframe.onload = t.step_func(function() {
// The URL should initially be "blank.html", and then "blank.html#foo";
// The textContent of the iframe's document should initially be blank,
// then become js generated text, and then be blank again after reload.
switch (count) {
case 0:
assert_equals(iframe.contentWindow.document.URL,
location.href.replace(location.pathname, URL),
"iframe url (" + count + ")");
assert_equals(iframe.contentDocument.body.textContent, "",
"text of blank page");
iframe.contentWindow.location = JS_URL;
iframe.contentWindow.location = URL2;
break;
case 1:
assert_equals(iframe.contentWindow.document.URL,
location.href.replace(location.pathname, URL2),
"iframe url (" + count + ")");
assert_equals(iframe.contentDocument.body.textContent,
JS_URL_TEXT, "text of js generated page");
iframe.contentWindow.location.reload();
break;
case 2:
assert_equals(iframe.contentWindow.document.URL,
location.href.replace(location.pathname, URL2),
"iframe url (" + count + ")");
assert_equals(iframe.contentDocument.body.textContent, "",
"text of blank page");
t.done();
break;
}
count++;
});
iframe.src = URL;
});
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

View file

@ -1,40 +0,0 @@
#!/usr/bin/env python
import os
import sys
sys.path.insert(
0,
os.path.join(
os.path.dirname(os.path.abspath(__file__)), '..', '..', '..', 'common',
'security-features', 'tools'))
import generate
class MixedContentConfig(object):
def __init__(self):
self.selection_pattern = \
'%(source_context_list)s.%(delivery_type)s/' + \
'%(delivery_value)s/' + \
'%(subresource)s/' + \
'%(origin)s.%(redirection)s.%(source_scheme)s'
self.test_file_path_pattern = 'gen/' + self.selection_pattern + '.html'
self.test_description_template = 'Mixed-Content: Expects %(expectation)s for %(subresource)s to %(origin)s origin and %(redirection)s redirection from %(source_scheme)s context.'
self.test_page_title_template = 'Mixed-Content: %s'
self.helper_js = '/mixed-content/generic/test-case.sub.js'
# For debug target only.
self.sanity_checker_js = '/mixed-content/generic/sanity-checker.js'
self.spec_json_js = '/mixed-content/spec_json.js'
script_directory = os.path.dirname(os.path.abspath(__file__))
self.spec_directory = os.path.abspath(
os.path.join(script_directory, '..', '..'))
if __name__ == '__main__':
generate.main(MixedContentConfig())

View file

@ -1,4 +1,8 @@
{
"selection_pattern": "%(source_context_list)s.%(delivery_type)s/%(delivery_value)s/%(subresource)s/%(origin)s.%(redirection)s.%(source_scheme)s",
"test_file_path_pattern": "gen/%(source_context_list)s.%(delivery_type)s/%(delivery_value)s/%(subresource)s/%(origin)s.%(redirection)s.%(source_scheme)s.html",
"test_description_template": "Mixed-Content: Expects %(expectation)s for %(subresource)s to %(origin)s origin and %(redirection)s redirection from %(source_scheme)s context.",
"test_page_title_template": "Mixed-Content: %(title)s",
"specification": [
{
"name": "optionally-blockable",

File diff suppressed because one or more lines are too long

View file

@ -27,6 +27,9 @@ async_test((t) => {
});
window.onmessage = t.step_func((e) => {
// Ignore messages that are not part of the test.
if (e.source != iframe.contentWindow) return;
i++;
if (i === 1) {
// 5. This is the first message we receive, from the first load.

View file

@ -22,11 +22,15 @@ async_test((t) => {
iframe.contentWindow.postMessage('What is the result of new PaymentRequest(...)?', '*');
});
window.onmessage = t.step_func_done((e) => {
window.onmessage = t.step_func((e) => {
// Ignore messages that are not part of the test.
if (e.source != iframe.contentWindow) return;
assert_equals(e.data.message, 'Exception');
assert_equals(4, e.data.details.length);
// The last entry is the error stacktrace. Ignore it in comparison.
assert_array_equals(e.data.details.slice(0, 3), [true /* ex instanceof DOMException */, DOMException.SECURITY_ERR, 'SecurityError']);
t.done();
});
document.body.appendChild(iframe);

View file

@ -20,6 +20,9 @@ async_test((t) => {
});
window.onmessage = t.step_func((e) => {
// Ignore messages that are not part of the test.
if (e.source != iframe.contentWindow) return;
i++;
if (i === 1) {
assert_equals(e.data.message, 'Exception', 'before navigation');

File diff suppressed because one or more lines are too long

View file

@ -1,40 +0,0 @@
#!/usr/bin/env python
import os
import sys
sys.path.insert(
0,
os.path.join(
os.path.dirname(os.path.abspath(__file__)), '..', '..', '..', 'common',
'security-features', 'tools'))
import generate
class ReferrerPolicyConfig(object):
def __init__(self):
self.selection_pattern = \
'%(source_context_list)s.%(delivery_type)s/' + \
'%(delivery_value)s/' + \
'%(subresource)s/' + \
'%(origin)s.%(redirection)s.%(source_scheme)s'
self.test_file_path_pattern = 'gen/' + self.selection_pattern + '.html'
self.test_description_template = 'Referrer Policy: Expects %(expectation)s for %(subresource)s to %(origin)s origin and %(redirection)s redirection from %(source_scheme)s context.'
self.test_page_title_template = 'Referrer-Policy: %s'
self.helper_js = '/referrer-policy/generic/test-case.sub.js'
# For debug target only.
self.sanity_checker_js = '/referrer-policy/generic/sanity-checker.js'
self.spec_json_js = '/referrer-policy/spec_json.js'
script_directory = os.path.dirname(os.path.abspath(__file__))
self.spec_directory = os.path.abspath(
os.path.join(script_directory, '..', '..'))
if __name__ == '__main__':
generate.main(ReferrerPolicyConfig())

View file

@ -1,4 +1,8 @@
{
"selection_pattern": "%(source_context_list)s.%(delivery_type)s/%(delivery_value)s/%(subresource)s/%(origin)s.%(redirection)s.%(source_scheme)s",
"test_file_path_pattern": "gen/%(source_context_list)s.%(delivery_type)s/%(delivery_value)s/%(subresource)s/%(origin)s.%(redirection)s.%(source_scheme)s.html",
"test_description_template": "Referrer Policy: Expects %(expectation)s for %(subresource)s to %(origin)s origin and %(redirection)s redirection from %(source_scheme)s context.",
"test_page_title_template": "Referrer-Policy: %(title)s",
"specification": [
{
"name": "unset-referrer-policy",

File diff suppressed because one or more lines are too long

View file

@ -891,6 +891,11 @@ class MockXRInputSource {
case 'tracked-pointer':
input_desc.targetRayMode = device.mojom.XRTargetRayMode.POINTING;
break;
case 'screen':
input_desc.targetRayMode = device.mojom.XRTargetRayMode.TAPPING;
break;
default:
throw new Error('Unhandled target ray mode ' + this.target_ray_mode_);
}
switch (this.handedness_) {

View file

@ -2,11 +2,12 @@ import copy
import json
import os
import ssl
import sys
import subprocess
import html5lib
import py
import pytest
from selenium import webdriver
from six import text_type
from six.moves import urllib
@ -18,6 +19,9 @@ HARNESS = os.path.join(HERE, 'harness.html')
TEST_TYPES = ('functional', 'unit')
DEFAULT_VARIANTS = ["?default"]
sys.path.insert(0, os.path.normpath(os.path.join(WPT_ROOT, "tools", "webdriver")))
import webdriver
def pytest_addoption(parser):
parser.addoption("--binary", action="store", default=None, help="path to browser binary")
@ -38,8 +42,16 @@ def pytest_collect_file(path, parent):
def pytest_configure(config):
config.driver = webdriver.Firefox(firefox_binary=config.getoption("--binary"))
config.add_cleanup(config.driver.quit)
config.proc = subprocess.Popen(["geckodriver"])
config.add_cleanup(config.proc.kill)
capabilities = {"alwaysMatch": {"acceptInsecureCerts": True}}
if config.getoption("--binary"):
capabilities["alwaysMatch"]["moz:firefoxOptions"] = {"binary": config.getoption("--binary")}
config.driver = webdriver.Session("localhost", 4444,
capabilities=capabilities)
config.add_cleanup(config.driver.end)
config.server = WPTServer(WPT_ROOT)
config.server.start()
@ -149,7 +161,7 @@ class HTMLItem(pytest.Item, pytest.Collector):
driver = self.session.config.driver
server = self.session.config.server
driver.get(server.url(HARNESS))
driver.url = server.url(HARNESS)
actual = driver.execute_async_script(
'runTest("%s", "foo", arguments[0])' % self.url
@ -172,7 +184,7 @@ class HTMLItem(pytest.Item, pytest.Collector):
driver = self.session.config.driver
server = self.session.config.server
driver.get(server.url(HARNESS))
driver.url = server.url(HARNESS)
test_url = self.url + variant
actual = driver.execute_async_script('runTest("%s", "foo", arguments[0])' % test_url)

View file

@ -10,7 +10,6 @@ deps =
html5lib
pytest>=2.9
pyvirtualdisplay
selenium
six
requests

View file

@ -351,7 +351,7 @@ class RoutesBuilder(object):
if headers is None:
headers = {}
handler = handlers.StaticHandler(path, format_args, content_type, **headers)
self.add_handler(b"GET", str(route), handler)
self.add_handler("GET", str(route), handler)
def add_mount_point(self, url_base, path):
url_base = "/%s/" % url_base.strip("/") if url_base != "/" else "/"

View file

@ -6,14 +6,14 @@ import stat
import errno
import subprocess
import tempfile
import urlparse
from abc import ABCMeta, abstractmethod
from datetime import datetime, timedelta
from distutils.spawn import find_executable
from six.moves.urllib.parse import urlsplit
import requests
from utils import call, get, untar, unzip
from .utils import call, get, untar, unzip
uname = platform.uname()
@ -172,7 +172,7 @@ class Firefox(Browser):
filename = filenames[0]
if not filename:
filename = urlparse.urlsplit(resp.url).path.rsplit("/", 1)[1]
filename = urlsplit(resp.url).path.rsplit("/", 1)[1]
if not filename:
filename = "firefox.tar.bz2"

View file

@ -1,6 +1,6 @@
import argparse
import browser
import sys
from . import browser
latest_channels = {

View file

@ -2,7 +2,8 @@ html5lib==1.0.1
mozinfo==1.1.0
mozlog==5.0
mozdebug==0.1.1
pillow==6.2.1
# Pillow 7 requires Python 3
pillow==6.2.1 # pyup: <7.0
urllib3[secure]==1.25.7
requests==2.22.0
six==1.13.0

View file

@ -192,7 +192,7 @@ class TestEnvironment(object):
data += fp.read()
with open(os.path.join(here, "testdriver-extra.js"), "rb") as fp:
data += fp.read()
route_builder.add_handler(b"GET", b"/resources/testdriver.js",
route_builder.add_handler("GET", "/resources/testdriver.js",
StringHandler(data, "text/javascript"))
for url_base, paths in iteritems(self.test_paths):

View file

@ -3,9 +3,10 @@ import os
import threading
import time
import traceback
import urlparse
import uuid
from six.moves.urllib.parse import urljoin
errors = None
marionette = None
pytestrunner = None
@ -132,8 +133,7 @@ class MarionetteTestharnessProtocolPart(TestharnessProtocolPart):
# Check if we previously had a test window open, and if we did make sure it's closed
if self.runner_handle:
self._close_windows()
url = urlparse.urljoin(self.parent.executor.server_url(url_protocol),
"/testharness_runner.html")
url = urljoin(self.parent.executor.server_url(url_protocol), "/testharness_runner.html")
self.logger.debug("Loading %s" % url)
try:
self.dismiss_alert(lambda: self.marionette.navigate(url))
@ -893,7 +893,7 @@ class InternalRefTestImplementation(RefTestImplementation):
def setup(self, screenshot="unexpected"):
data = {"screenshot": screenshot}
if self.executor.group_metadata is not None:
data["urlCount"] = {urlparse.urljoin(self.executor.server_url(key[0]), key[1]):value
data["urlCount"] = {urljoin(self.executor.server_url(key[0]), key[1]):value
for key, value in self.executor.group_metadata.get("url_count", {}).iteritems()
if value > 1}
self.executor.protocol.marionette.set_context(self.executor.protocol.marionette.CONTEXT_CHROME)

View file

@ -7,7 +7,7 @@ import tempfile
import threading
import traceback
import uuid
from six import iteritems
from six import ensure_str, iteritems
from mozprocess import ProcessHandler
@ -260,10 +260,10 @@ class ServoRefTestExecutor(ProcessTestExecutor):
if rv != 0 or not os.path.exists(output_path):
return False, ("CRASH", None)
with open(output_path) as f:
with open(output_path, "rb") as f:
# Might need to strip variable headers or something here
data = f.read()
return True, base64.b64encode(data)
return True, ensure_str(base64.b64encode(data))
def do_test(self, test):
result = self.implementation.run_test(test)

View file

@ -93,7 +93,7 @@ class RunInfo(dict):
self._update_mozinfo(metadata_root)
self.update(mozinfo.info)
from update.tree import GitTree
from .update.tree import GitTree
try:
# GitTree.__init__ throws if we are not in a git tree.
rev = GitTree(log_error=False).rev

View file

@ -37,6 +37,7 @@
<script>
var wheelbox = document.getElementById("wheelbox");
var scrollbox = document.getElementById("scrollbox");
var test_wheel = async_test("wheel event test");
EventRecorder.configure({
mergeEventTypes: ['wheel'],
@ -55,18 +56,20 @@
e.stopPropagation();
this.className = "green";
endTest();
done();
test_wheel.done();
});
function endTest() {
EventRecorder.stop();
var results = EventRecorder.getRecords();
test_wheel.step(function () {
// Check results:
assert_equals(results.length, 2, "Two mousemove events");
assert_equals(results[0].event.type, 'wheel', "First event is a wheel event");
assert_equals(results[1].event.type, 'wheel', "Second event is a wheel event");
assert_equals(results[0].event.target, 'div#wheelbox', "First event targetted wheelbox");
assert_equals(results[1].event.target, 'div#scrollbox', "Second event targetted scrollbox");
});
}
EventRecorder.start();

View file

@ -34,6 +34,7 @@
<script>
var wheelbox = document.getElementById("wheelbox");
var test_wheel_scrolling = async_test("wheel scrolling test");
EventRecorder.configure({
mergeEventTypes: ['wheel'],
@ -46,16 +47,18 @@
e.stopPropagation();
this.className = "green";
endTest();
done();
test_wheel_scrolling.done();
});
function endTest() {
EventRecorder.stop();
var results = EventRecorder.getRecords();
test_wheel_scrolling.step(function () {
// Check results:
assert_equals(results.length, 1, "One mousemove event");
assert_equals(results[0].event.type, 'wheel', "First event is a wheel event");
assert_equals(results[0].event.target, 'div#wheelbox', "First event targetted wheelbox");
});
}
EventRecorder.start();

File diff suppressed because one or more lines are too long

View file

@ -1,40 +0,0 @@
#!/usr/bin/env python
import os
import sys
sys.path.insert(
0,
os.path.join(
os.path.dirname(os.path.abspath(__file__)), '..', '..', '..', 'common',
'security-features', 'tools'))
import generate
class UpgradeInsecureRequestsConfig(object):
def __init__(self):
self.selection_pattern = \
'%(source_context_list)s.%(delivery_type)s/' + \
'%(delivery_value)s/' + \
'%(subresource)s/' + \
'%(origin)s.%(redirection)s.%(source_scheme)s'
self.test_file_path_pattern = 'gen/' + self.selection_pattern + '.html'
self.test_description_template = 'Upgrade-Insecure-Requests: Expects %(expectation)s for %(subresource)s to %(origin)s origin and %(redirection)s redirection from %(source_scheme)s context.'
self.test_page_title_template = 'Upgrade-Insecure-Requests: %s'
self.helper_js = '/upgrade-insecure-requests/generic/test-case.sub.js'
# For debug target only.
self.sanity_checker_js = '/upgrade-insecure-requests/generic/sanity-checker.js'
self.spec_json_js = '/upgrade-insecure-requests/spec_json.js'
script_directory = os.path.dirname(os.path.abspath(__file__))
self.spec_directory = os.path.abspath(
os.path.join(script_directory, '..', '..'))
if __name__ == '__main__':
generate.main(UpgradeInsecureRequestsConfig())

View file

@ -1,4 +1,8 @@
{
"selection_pattern": "%(source_context_list)s.%(delivery_type)s/%(delivery_value)s/%(subresource)s/%(origin)s.%(redirection)s.%(source_scheme)s",
"test_file_path_pattern": "gen/%(source_context_list)s.%(delivery_type)s/%(delivery_value)s/%(subresource)s/%(origin)s.%(redirection)s.%(source_scheme)s.html",
"test_description_template": "Upgrade-Insecure-Requests: Expects %(expectation)s for %(subresource)s to %(origin)s origin and %(redirection)s redirection from %(source_scheme)s context.",
"test_page_title_template": "Upgrade-Insecure-Requests: %(title)s",
"specification": [
{
"name": "No upgrade-insecure-request",

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