зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1459723 [wpt PR 10878] - Improve definition of non-existent origin, a=testonly
Automatic update from web-platform-tests[wptserve] Correct domain configuration on *nix Because Windows and UNIX-like systems differ in how they interpret the IP address `0.0.0.0`, the hosts file contents generated for use with the WPT server must take the platform into account. Extend the hosts file generation logic and introduce "infrastructure assumptions" tests to assert the inavailibility of the domain. -- [infra] Rename nonexistent domain Contributors have expressed confusion over the term "nonexistent origin" to describe a domain that is not intended to exist. Rename the subdomain to "nonexistent" to clarify its role. -- wpt-commits: 136154864a88788cb58d6ff079e6d030cbe8c60f, 927cd2216d34dc2f9824a6899476f26b6b11dd31 wpt-pr: 10878
This commit is contained in:
Родитель
3a64944c1d
Коммит
19633055bf
|
@ -406351,7 +406351,7 @@
|
|||
"support"
|
||||
],
|
||||
"acid/acid3/reference.sub.html": [
|
||||
"764c07c1072c831cb69719372aca734fa49d827a",
|
||||
"43768481bea5dc6c30343d60f218d895cf624a61",
|
||||
"support"
|
||||
],
|
||||
"acid/acid3/support-a.png": [
|
||||
|
@ -427463,7 +427463,7 @@
|
|||
"testharness"
|
||||
],
|
||||
"content-security-policy/base-uri/report-uri-does-not-respect-base-uri.sub.html": [
|
||||
"7dd8bccbd166c7ac938699c406bc2209a7f5677f",
|
||||
"a8c074a65a874df3f2a0f7f994c2094f4c8647b9",
|
||||
"testharness"
|
||||
],
|
||||
"content-security-policy/base-uri/report-uri-does-not-respect-base-uri.sub.html.sub.headers": [
|
||||
|
@ -555415,7 +555415,7 @@
|
|||
"support"
|
||||
],
|
||||
"docs/_running-tests/chrome_android.md": [
|
||||
"082b7697eed61caefcc0a280cba6cee24ff12e7d",
|
||||
"7a26348aabd414f1d8e2da68717dd0a16d3f6ce8",
|
||||
"support"
|
||||
],
|
||||
"docs/_running-tests/index.md": [
|
||||
|
@ -555475,7 +555475,7 @@
|
|||
"support"
|
||||
],
|
||||
"docs/_writing-tests/server-features.md": [
|
||||
"d8b7a6c0aa09ec31b5053fd6caf44be8697a3a61",
|
||||
"31af790d058eda13ec0ecf06e1c65d13419e4920",
|
||||
"support"
|
||||
],
|
||||
"docs/_writing-tests/submission-process.md": [
|
||||
|
@ -582439,7 +582439,7 @@
|
|||
"testharness"
|
||||
],
|
||||
"infrastructure/server/wpt-server-http.sub.html": [
|
||||
"c39602efd7574944e8495e9ed0d98c6811f9e2e7",
|
||||
"2a400478de23a6aecf31bdc08b187784c36be629",
|
||||
"testharness"
|
||||
],
|
||||
"infrastructure/server/wpt-server-websocket.sub.html": [
|
||||
|
@ -614267,7 +614267,7 @@
|
|||
"testharness"
|
||||
],
|
||||
"webrtc/RTCPeerConnection-getIdentityAssertion.html": [
|
||||
"91b55a4f1d9a10cda7cb0e11ba42243bf94a0dfa",
|
||||
"e87f8367bcd63ed4407e256b6fea42f9f66ecd40",
|
||||
"testharness"
|
||||
],
|
||||
"webrtc/RTCPeerConnection-getStats.https.html": [
|
||||
|
@ -614491,7 +614491,7 @@
|
|||
"testharness"
|
||||
],
|
||||
"webrtc/identity-helper.js": [
|
||||
"c7639c627cceaad0e122d83ccde429d044c0773d",
|
||||
"7e12bca67dadbdcec5cbba31817dbec3f01da57c",
|
||||
"support"
|
||||
],
|
||||
"webrtc/interfaces.https.html": [
|
||||
|
@ -620391,11 +620391,11 @@
|
|||
"testharness"
|
||||
],
|
||||
"xhr/event-error-order.sub.html": [
|
||||
"5d0328ace02c4e7075bcc310392940bb67bd627d",
|
||||
"684305e60b6b116cf191992df94d46d98c077ea6",
|
||||
"testharness"
|
||||
],
|
||||
"xhr/event-error.sub.html": [
|
||||
"040207a85f39b12755bfb909afc3c31b0d823698",
|
||||
"0504023101398c690fd231b7c301ce973aae8967",
|
||||
"testharness"
|
||||
],
|
||||
"xhr/event-load.htm": [
|
||||
|
@ -621355,11 +621355,11 @@
|
|||
"testharness"
|
||||
],
|
||||
"xhr/send-network-error-async-events.sub.htm": [
|
||||
"85d0484051e19077c1dd0fde8845761fdca45b5a",
|
||||
"7bf76749e25cfcd6472e45673fccedb121cc58f4",
|
||||
"testharness"
|
||||
],
|
||||
"xhr/send-network-error-sync-events.sub.htm": [
|
||||
"8dd189e5d654c1fc46808dbd860ed0b055851227",
|
||||
"fdc6135b6834556c49943cc9a4d1fa8e75983e65",
|
||||
"testharness"
|
||||
],
|
||||
"xhr/send-no-response-event-loadend.htm": [
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
|
||||
<html>
|
||||
<title>The Acid3 Test (Reference Rendering)</title>
|
||||
<link rel="icon" href="http://nonexistent-origin.{{host}}">
|
||||
<link rel="icon" href="http://nonexistent.{{host}}">
|
||||
<style type="text/css">
|
||||
html { margin: 0; padding: 0; }
|
||||
body { background: #c0c0c0 url(reference.png) top left no-repeat; margin: 0; padding: 0; }
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<script src='/resources/testharness.js'></script>
|
||||
<script src='/resources/testharnessreport.js'></script>
|
||||
<!-- if base is used for resolving the URL to report to then we will not get a report -->
|
||||
<base href="http://nonexistent-origin.web-platform.test">
|
||||
<base href="http://nonexistent.web-platform.test">
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
|
|
|
@ -19,7 +19,6 @@ Until we find a better way, we need to root the Android device and update the
|
|||
127.0.0.1 www2.web-platform.test
|
||||
127.0.0.1 xn--n8j6ds53lwwkrqhv28a.web-platform.test
|
||||
127.0.0.1 xn--lve-6lad.web-platform.test
|
||||
0.0.0.0 nonexistent-origin.web-platform.test
|
||||
```
|
||||
|
||||
## CA certificate
|
||||
|
|
|
@ -17,10 +17,10 @@ generation. This is supported through the
|
|||
Our test servers are guaranteed to be accessible through two domains
|
||||
and five subdomains under each. The 'main' domain is unnamed; the
|
||||
other is called 'alt'. These subdomains are: `www`, `www1`, `www2`,
|
||||
`天気の良い日`, and `élève`; there is also `nonexistent-origin` which
|
||||
is guaranteed not to resolve. In addition, the HTTP server listens on
|
||||
two ports, and the WebSockets server on one. These subdomains and
|
||||
ports must be used for cross-origin tests.
|
||||
`天気の良い日`, and `élève`; there is also `nonexistent` which is
|
||||
guaranteed not to resolve. In addition, the HTTP server listens on two
|
||||
ports, and the WebSockets server on one. These subdomains and ports
|
||||
must be used for cross-origin tests.
|
||||
|
||||
Tests must not hardcode the hostname of the server that they expect to
|
||||
be running on or the port numbers, as these are not guaranteed by the
|
||||
|
|
|
@ -120,6 +120,22 @@ async_test(function(t) {
|
|||
}));
|
||||
}, 'HTTP protocol, punycode subdomain #2, port #2');
|
||||
|
||||
async_test(function(t) {
|
||||
check('http', 'nonexistent.{{domains[]}}', {{ports[http][0]}}, t.step_func(function(result) {
|
||||
assert_false(result);
|
||||
|
||||
t.done();
|
||||
}));
|
||||
}, 'HTTP protocol, non-existent domain, port #1');
|
||||
|
||||
async_test(function(t) {
|
||||
check('http', 'nonexistent.{{domains[]}}', {{ports[http][1]}}, t.step_func(function(result) {
|
||||
assert_false(result);
|
||||
|
||||
t.done();
|
||||
}));
|
||||
}, 'HTTP protocol, non-existent domain, port #2');
|
||||
|
||||
async_test(function(t) {
|
||||
check('https', '{{browser_host}}', {{ports[https][0]}}, t.step_func(function(result) {
|
||||
assert_true(result);
|
||||
|
@ -167,6 +183,22 @@ async_test(function(t) {
|
|||
t.done();
|
||||
}));
|
||||
}, 'HTTPS protocol, punycode subdomain #2');
|
||||
|
||||
async_test(function(t) {
|
||||
check('https', 'nonexistent.{{domains[]}}', {{ports[http][0]}}, t.step_func(function(result) {
|
||||
assert_false(result);
|
||||
|
||||
t.done();
|
||||
}));
|
||||
}, 'HTTPS protocol, non-existent domain, port #1');
|
||||
|
||||
async_test(function(t) {
|
||||
check('https', 'nonexistent.{{domains[]}}', {{ports[http][1]}}, t.step_func(function(result) {
|
||||
assert_false(result);
|
||||
|
||||
t.done();
|
||||
}));
|
||||
}, 'HTTPS protocol, non-existent domain, port #2');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -7,6 +7,7 @@ import argparse
|
|||
import json
|
||||
import logging
|
||||
import os
|
||||
import platform
|
||||
import socket
|
||||
import sys
|
||||
import threading
|
||||
|
@ -447,8 +448,16 @@ def make_hosts_file(config, host):
|
|||
for domain in config.domains_set:
|
||||
rv.append("%s\t%s\n" % (host, domain))
|
||||
|
||||
for not_domain in config.not_domains_set:
|
||||
rv.append("0.0.0.0\t%s\n" % not_domain)
|
||||
# Windows interpets the IP address 0.0.0.0 as non-existent, making it an
|
||||
# appropriate alias for non-existent hosts. However, UNIX-like systems
|
||||
# interpret the same address to mean any IP address, which is inappropraite
|
||||
# for this context. These systems do not reserve any value for this
|
||||
# purpose, so the inavailability of the domains must be taken for granted.
|
||||
#
|
||||
# https://github.com/w3c/web-platform-tests/issues/10560
|
||||
if platform.uname()[0] == "Windows":
|
||||
for not_domain in config.not_domains_set:
|
||||
rv.append("0.0.0.0\t%s\n" % not_domain)
|
||||
|
||||
return "".join(rv)
|
||||
|
||||
|
@ -656,7 +665,7 @@ _subdomains = {u"www",
|
|||
u"天気の良い日",
|
||||
u"élève"}
|
||||
|
||||
_not_subdomains = {u"nonexistent-origin"}
|
||||
_not_subdomains = {u"nonexistent"}
|
||||
|
||||
|
||||
class Config(config.Config):
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pickle
|
||||
import platform
|
||||
import os
|
||||
|
||||
import pytest
|
||||
|
@ -8,13 +9,36 @@ from . import serve
|
|||
from .serve import Config
|
||||
|
||||
|
||||
def test_make_hosts_file():
|
||||
@pytest.mark.skipif(platform.uname()[0] == "Windows",
|
||||
reason="Expected contents are platform-dependent")
|
||||
def test_make_hosts_file_nix():
|
||||
c = Config(browser_host="foo.bar", alternate_hosts={"alt": "foo2.bar"})
|
||||
hosts = serve.make_hosts_file(c, "192.168.42.42")
|
||||
lines = hosts.split("\n")
|
||||
assert set(lines) == {"",
|
||||
"0.0.0.0\tnonexistent-origin.foo.bar",
|
||||
"0.0.0.0\tnonexistent-origin.foo2.bar",
|
||||
"192.168.42.42\tfoo.bar",
|
||||
"192.168.42.42\tfoo2.bar",
|
||||
"192.168.42.42\twww.foo.bar",
|
||||
"192.168.42.42\twww.foo2.bar",
|
||||
"192.168.42.42\twww1.foo.bar",
|
||||
"192.168.42.42\twww1.foo2.bar",
|
||||
"192.168.42.42\twww2.foo.bar",
|
||||
"192.168.42.42\twww2.foo2.bar",
|
||||
"192.168.42.42\txn--lve-6lad.foo.bar",
|
||||
"192.168.42.42\txn--lve-6lad.foo2.bar",
|
||||
"192.168.42.42\txn--n8j6ds53lwwkrqhv28a.foo.bar",
|
||||
"192.168.42.42\txn--n8j6ds53lwwkrqhv28a.foo2.bar"}
|
||||
assert lines[-1] == ""
|
||||
|
||||
@pytest.mark.skipif(platform.uname()[0] != "Windows",
|
||||
reason="Expected contents are platform-dependent")
|
||||
def test_make_hosts_file_windows():
|
||||
c = Config(browser_host="foo.bar", alternate_hosts={"alt": "foo2.bar"})
|
||||
hosts = serve.make_hosts_file(c, "192.168.42.42")
|
||||
lines = hosts.split("\n")
|
||||
assert set(lines) == {"",
|
||||
"0.0.0.0\tnonexistent.foo.bar",
|
||||
"0.0.0.0\tnonexistent.foo2.bar",
|
||||
"192.168.42.42\tfoo.bar",
|
||||
"192.168.42.42\tfoo2.bar",
|
||||
"192.168.42.42\twww.foo.bar",
|
||||
|
|
|
@ -97,12 +97,18 @@ otherwise install OpenSSL and ensure that it's on your $PATH.""")
|
|||
def check_environ(product):
|
||||
if product not in ("firefox", "servo"):
|
||||
config = serve.load_config(os.path.join(wpt_root, "config.json"))
|
||||
expected_hosts = set(config.all_domains_set)
|
||||
expected_hosts = set(config.domains_set)
|
||||
is_windows = platform.uname()[0] == "Windows"
|
||||
|
||||
if is_windows:
|
||||
expected_hosts.update(config.not_domains_set)
|
||||
|
||||
missing_hosts = set(expected_hosts)
|
||||
if platform.uname()[0] != "Windows":
|
||||
hosts_path = "/etc/hosts"
|
||||
else:
|
||||
if is_windows:
|
||||
hosts_path = "C:\Windows\System32\drivers\etc\hosts"
|
||||
else:
|
||||
hosts_path = "/etc/hosts"
|
||||
|
||||
with open(hosts_path, "r") as f:
|
||||
for line in f:
|
||||
line = line.split("#", 1)[0].strip()
|
||||
|
@ -111,16 +117,16 @@ def check_environ(product):
|
|||
for host in hosts:
|
||||
missing_hosts.discard(host)
|
||||
if missing_hosts:
|
||||
if platform.uname()[0] != "Windows":
|
||||
message = """Missing hosts file configuration. Run
|
||||
|
||||
./wpt make-hosts-file | sudo tee -a %s""" % hosts_path
|
||||
else:
|
||||
if is_windows:
|
||||
message = """Missing hosts file configuration. Run
|
||||
|
||||
python wpt make-hosts-file | Out-File %SystemRoot%\System32\drivers\etc\hosts -Encoding ascii -Append
|
||||
|
||||
in PowerShell with Administrator privileges.""" % hosts_path
|
||||
else:
|
||||
message = """Missing hosts file configuration. Run
|
||||
|
||||
./wpt make-hosts-file | sudo tee -a %s""" % hosts_path
|
||||
raise WptrunError(message)
|
||||
|
||||
|
||||
|
|
|
@ -217,7 +217,7 @@
|
|||
promise_test(t => {
|
||||
const pc = new RTCPeerConnection();
|
||||
|
||||
pc.setIdentityProvider('nonexistent-origin.web-platform.test', {
|
||||
pc.setIdentityProvider('nonexistent.web-platform.test', {
|
||||
protocol: `non-existent`,
|
||||
usernameHint: `alice@example.org`,
|
||||
});
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
127.0.0.1 www2.web-platform.test
|
||||
127.0.0.1 xn--n8j6ds53lwwkrqhv28a.web-platform.test
|
||||
127.0.0.1 xn--lve-6lad.web-platform.test
|
||||
0.0.0.0 nonexistent-origin.web-platform.test
|
||||
0.0.0.0 nonexistent.web-platform.test
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
});
|
||||
});
|
||||
|
||||
xhr.open("POST", "http://nonexistent-origin.{{host}}:{{ports[http][0]}}", true);
|
||||
xhr.open("POST", "http://nonexistent.{{host}}:{{ports[http][0]}}", true);
|
||||
xhr.send("Test Message");
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -18,7 +18,7 @@ async_test(function (t) {
|
|||
t.done();
|
||||
});
|
||||
|
||||
client.open("GET", "http://nonexistent-origin.{{host}}:{{ports[http][0]}}");
|
||||
client.open("GET", "http://nonexistent.{{host}}:{{ports[http][0]}}");
|
||||
client.send("null");
|
||||
}, document.title);
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
xhr.upload.onloadend = test.step_func(e => { actual.push("upload." + e.type); })
|
||||
xhr.upload.onerror = test.step_func(e => { actual.push("upload." + e.type); })
|
||||
|
||||
xhr.open("POST", "http://nonexistent-origin.{{host}}:{{ports[http][0]}}", true);
|
||||
xhr.open("POST", "http://nonexistent.{{host}}:{{ports[http][0]}}", true);
|
||||
xhr.send("Test Message");
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
{
|
||||
var xhr = new XMLHttpRequest();
|
||||
|
||||
xhr.open("POST", "http://nonexistent-origin.{{host}}:{{ports[http][0]}}", false);
|
||||
xhr.open("POST", "http://nonexistent.{{host}}:{{ports[http][0]}}", false);
|
||||
|
||||
assert_throws("NetworkError", function()
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче