Commit f17ed629 authored by Robert Ma's avatar Robert Ma Committed by Commit Bot

Cherry pick origin policy change to wptserve

This CL cherry picks the core part of
https://github.com/web-platform-tests/wpt/pull/21705 into blinkpy.

See README.chromium for more context.

Bug: 1042034
Change-Id: I9045c9e2987ef4b22e722f934d23037635000874
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2064783Reviewed-by: default avatarDomenic Denicola <domenic@chromium.org>
Commit-Queue: Robert Ma <robertma@chromium.org>
Cr-Commit-Position: refs/heads/master@{#742854}
parent f415e92a
...@@ -43,4 +43,6 @@ Description: This includes code for the manifest tool, lint tool, and wptserve. ...@@ -43,4 +43,6 @@ Description: This includes code for the manifest tool, lint tool, and wptserve.
for more details on maintenance. for more details on maintenance.
Local Modifications: Local Modifications:
- Removed all files except for those listed in wpt/WPTWhiteList. - Removed all files except for those listed in wpt/WPTWhiteList.
- Added --ignore-glob option for ignoring an extra glob of files (used for ignoring *-expected.txt). - Removed a few unimported subcommands from tools/wpt/path.
- Cherry-picked the server part of https://github.com/web-platform-tests/wpt/pull/21705
(we cannot yet directly roll to that revision because of MANIFEST v8 changes).
...@@ -9,3 +9,38 @@ index 4528222fbf..93c97dc02b 100644 ...@@ -9,3 +9,38 @@ index 4528222fbf..93c97dc02b 100644
tools/manifest/ tools/manifest/
tools/serve/ tools/serve/
tools/wpt/ tools/wpt/
diff --git a/tools/serve/serve.py b/tools/serve/serve.py
index 0985810cc5..055b60f1e7 100644
--- a/tools/serve/serve.py
+++ b/tools/serve/serve.py
@@ -366,6 +366,7 @@ class RoutesBuilder(object):
("GET", "*.any.serviceworker.html", ServiceWorkersHandler),
("GET", "*.any.worker.js", AnyWorkerHandler),
("GET", "*.asis", handlers.AsIsHandler),
+ ("GET", "/.well-known/origin-policy", handlers.PythonScriptHandler),
("*", "*.py", handlers.PythonScriptHandler),
("GET", "*", handlers.FileHandler)
]
@@ -742,6 +743,9 @@ def build_config(override_path=None, **kwargs):
def _make_subdomains_product(s, depth=2):
return {u".".join(x) for x in chain(*(product(s, repeat=i) for i in range(1, depth+1)))}
+def _make_origin_policy_subdomains(limit):
+ return {u"op%d" % x for x in range(1,limit+1)}
+
_subdomains = {u"www",
u"www1",
@@ -753,6 +757,12 @@ _not_subdomains = {u"nonexistent"}
_subdomains = _make_subdomains_product(_subdomains)
+# Origin policy subdomains need to not be reused by any other tests, since origin policies have
+# origin-wide impacts like installing a CSP or Feature Policy that could interfere with features
+# under test.
+# See https://github.com/web-platform-tests/rfcs/pull/44.
+_subdomains |= _make_origin_policy_subdomains(99)
+
_not_subdomains = _make_subdomains_product(_not_subdomains)
...@@ -366,6 +366,7 @@ class RoutesBuilder(object): ...@@ -366,6 +366,7 @@ class RoutesBuilder(object):
("GET", "*.any.serviceworker.html", ServiceWorkersHandler), ("GET", "*.any.serviceworker.html", ServiceWorkersHandler),
("GET", "*.any.worker.js", AnyWorkerHandler), ("GET", "*.any.worker.js", AnyWorkerHandler),
("GET", "*.asis", handlers.AsIsHandler), ("GET", "*.asis", handlers.AsIsHandler),
("GET", "/.well-known/origin-policy", handlers.PythonScriptHandler),
("*", "*.py", handlers.PythonScriptHandler), ("*", "*.py", handlers.PythonScriptHandler),
("GET", "*", handlers.FileHandler) ("GET", "*", handlers.FileHandler)
] ]
...@@ -739,6 +740,9 @@ def build_config(override_path=None, **kwargs): ...@@ -739,6 +740,9 @@ def build_config(override_path=None, **kwargs):
def _make_subdomains_product(s, depth=2): def _make_subdomains_product(s, depth=2):
return {u".".join(x) for x in chain(*(product(s, repeat=i) for i in range(1, depth+1)))} return {u".".join(x) for x in chain(*(product(s, repeat=i) for i in range(1, depth+1)))}
def _make_origin_policy_subdomains(limit):
return {u"op%d" % x for x in range(1,limit+1)}
_subdomains = {u"www", _subdomains = {u"www",
u"www1", u"www1",
...@@ -750,6 +754,12 @@ _not_subdomains = {u"nonexistent"} ...@@ -750,6 +754,12 @@ _not_subdomains = {u"nonexistent"}
_subdomains = _make_subdomains_product(_subdomains) _subdomains = _make_subdomains_product(_subdomains)
# Origin policy subdomains need to not be reused by any other tests, since origin policies have
# origin-wide impacts like installing a CSP or Feature Policy that could interfere with features
# under test.
# See https://github.com/web-platform-tests/rfcs/pull/44.
_subdomains |= _make_origin_policy_subdomains(99)
_not_subdomains = _make_subdomains_product(_not_subdomains) _not_subdomains = _make_subdomains_product(_not_subdomains)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment