Skip to content

Commit

Permalink
Cherry pick origin policy change to wptserve
Browse files Browse the repository at this point in the history
This CL cherry picks the core part of
web-platform-tests/wpt#21705 into blinkpy.

See README.chromium for more context.

Bug: 1042034
Change-Id: I9045c9e2987ef4b22e722f934d23037635000874
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2064783
Reviewed-by: Domenic Denicola <domenic@chromium.org>
Commit-Queue: Robert Ma <robertma@chromium.org>
Cr-Commit-Position: refs/heads/master@{#742854}
  • Loading branch information
Hexcles authored and Commit Bot committed Feb 19, 2020
1 parent f415e92 commit f17ed62
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
4 changes: 3 additions & 1 deletion third_party/blink/tools/blinkpy/third_party/README.chromium
Expand Up @@ -43,4 +43,6 @@ Description: This includes code for the manifest tool, lint tool, and wptserve.
for more details on maintenance.
Local Modifications:
- 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).
35 changes: 35 additions & 0 deletions third_party/blink/tools/blinkpy/third_party/wpt/chromium.patch
Expand Up @@ -9,3 +9,38 @@ index 4528222fbf..93c97dc02b 100644
tools/manifest/
tools/serve/
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)


Expand Up @@ -366,6 +366,7 @@ def add_mount_point(self, url_base, path):
("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)
]
Expand Down Expand Up @@ -739,6 +740,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",
Expand All @@ -750,6 +754,12 @@ def _make_subdomains_product(s, depth=2):

_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)


Expand Down

0 comments on commit f17ed62

Please sign in to comment.