Bug 1644835 [wpt PR 24091] - Python 3: port tests in workers, a=testonly
authorziransun <zsun@igalia.com>
Mon, 22 Jun 2020 10:39:56 +0000
changeset 536812 5269ab455916b53139a605e3007e57fd828de817
parent 536811 80fc16b1b57ff94527c3aaef1b76c06c2ec105f7
child 536813 d4ada8e0d394333369769f9534b1f6906768ad4f
push id119680
push userwptsync@mozilla.com
push dateTue, 23 Jun 2020 11:08:22 +0000
treeherderautoland@7ca3d4bada73 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1644835, 24091
milestone79.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1644835 [wpt PR 24091] - Python 3: port tests in workers, a=testonly Automatic update from web-platform-tests Python 3: port tests in workers (#24091) -- wpt-commits: eaae8970c1b028f67296bd6ab5f52ef31583703d wpt-pr: 24091
testing/web-platform/tests/workers/baseurl/beta/import.py
testing/web-platform/tests/workers/baseurl/beta/importScripts.py
testing/web-platform/tests/workers/baseurl/beta/sharedworker.py
testing/web-platform/tests/workers/baseurl/beta/worker.py
testing/web-platform/tests/workers/baseurl/beta/xhr-worker.py
testing/web-platform/tests/workers/baseurl/beta/xhr.py
testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/helper-redirect.py
testing/web-platform/tests/workers/modules/resources/export-credentials.py
testing/web-platform/tests/workers/modules/resources/export-referrer-checker.py
testing/web-platform/tests/workers/modules/resources/postmessage-credentials.py
testing/web-platform/tests/workers/modules/resources/postmessage-referrer-checker.py
testing/web-platform/tests/workers/semantics/encodings/003-1.py
testing/web-platform/tests/workers/support/imported_script.py
testing/web-platform/tests/workers/support/nosiniff-error-worker.py
--- a/testing/web-platform/tests/workers/baseurl/beta/import.py
+++ b/testing/web-platform/tests/workers/baseurl/beta/import.py
@@ -1,3 +1,3 @@
 def main(request, response):
-    return (302, "Moved"), [("Location", "../gamma/import.js")], "postMessage('executed redirecting script');"
+    return (302, b"Moved"), [(b"Location", b"../gamma/import.js")], u"postMessage('executed redirecting script');"
 
--- a/testing/web-platform/tests/workers/baseurl/beta/importScripts.py
+++ b/testing/web-platform/tests/workers/baseurl/beta/importScripts.py
@@ -1,3 +1,3 @@
 def main(request, response):
-    return (302, "Moved"), [("Location", "../gamma/importScripts.js")], "postMessage('executed redirecting script');"
+    return (302, b"Moved"), [(b"Location", b"../gamma/importScripts.js")], u"postMessage('executed redirecting script');"
 
--- a/testing/web-platform/tests/workers/baseurl/beta/sharedworker.py
+++ b/testing/web-platform/tests/workers/baseurl/beta/sharedworker.py
@@ -1,3 +1,3 @@
 def main(request, response):
-    return (302, "Moved"), [("Location", "../gamma/sharedworker.js")], "postMessage('executed redirecting script');"
+    return (302, b"Moved"), [(b"Location", b"../gamma/sharedworker.js")], u"postMessage('executed redirecting script');"
 
--- a/testing/web-platform/tests/workers/baseurl/beta/worker.py
+++ b/testing/web-platform/tests/workers/baseurl/beta/worker.py
@@ -1,3 +1,3 @@
 def main(request, response):
-    return (302, "Moved"), [("Location", "../gamma/worker.js")], "postMessage('executed redirecting script');"
+    return (302, b"Moved"), [(b"Location", b"../gamma/worker.js")], u"postMessage('executed redirecting script');"
 
--- a/testing/web-platform/tests/workers/baseurl/beta/xhr-worker.py
+++ b/testing/web-platform/tests/workers/baseurl/beta/xhr-worker.py
@@ -1,2 +1,2 @@
 def main(request, response):
-    return (302, "Moved"), [("Location", "../gamma/xhr-worker.js")], "postMessage('executed redirecting script');"
+    return (302, b"Moved"), [(b"Location", b"../gamma/xhr-worker.js")], u"postMessage('executed redirecting script');"
--- a/testing/web-platform/tests/workers/baseurl/beta/xhr.py
+++ b/testing/web-platform/tests/workers/baseurl/beta/xhr.py
@@ -1,3 +1,3 @@
 def main(request, response):
-    return (302, "Moved"), [("Location", "../gamma/xhr.js")], "postMessage('executed redirecting script');"
+    return (302, b"Moved"), [(b"Location", b"../gamma/xhr.js")], u"postMessage('executed redirecting script');"
 
--- a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/helper-redirect.py
+++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/helper-redirect.py
@@ -1,3 +1,3 @@
 def main(request, response):
     response.status = 302
-    response.headers.append("Location", "post-location-members.js?a")
+    response.headers.append(b"Location", b"post-location-members.js?a")
--- a/testing/web-platform/tests/workers/modules/resources/export-credentials.py
+++ b/testing/web-platform/tests/workers/modules/resources/export-credentials.py
@@ -1,15 +1,15 @@
 def main(request, response):
-    cookie = request.cookies.first("COOKIE_NAME", None)
+    cookie = request.cookies.first(b"COOKIE_NAME", None)
 
-    response_headers = [("Content-Type", "text/javascript"),
-                        ("Access-Control-Allow-Credentials", "true")]
+    response_headers = [(b"Content-Type", b"text/javascript"),
+                        (b"Access-Control-Allow-Credentials", b"true")]
 
-    origin = request.headers.get("Origin", None)
+    origin = request.headers.get(b"Origin", None)
     if origin:
-        response_headers.append(("Access-Control-Allow-Origin", origin))
+        response_headers.append((b"Access-Control-Allow-Origin", origin))
 
-    cookie_value = '';
+    cookie_value = b'';
     if cookie:
         cookie_value = cookie.value;
     return (200, response_headers,
-            "export const cookie = '"+cookie_value+"';")
+            b"export const cookie = '"+cookie_value+b"';")
--- a/testing/web-platform/tests/workers/modules/resources/export-referrer-checker.py
+++ b/testing/web-platform/tests/workers/modules/resources/export-referrer-checker.py
@@ -1,9 +1,9 @@
 # Returns a worker script that posts the request's referrer header.
 def main(request, response):
-    referrer = request.headers.get("referer", "")
+    referrer = request.headers.get(b"referer", b"")
 
-    response_headers = [("Content-Type", "text/javascript"),
-                        ("Access-Control-Allow-Origin", "*")]
+    response_headers = [(b"Content-Type", b"text/javascript"),
+                        (b"Access-Control-Allow-Origin", b"*")]
 
     return (200, response_headers,
-            "export const referrer = '"+referrer+"';")
+            b"export const referrer = '"+referrer+b"';")
--- a/testing/web-platform/tests/workers/modules/resources/postmessage-credentials.py
+++ b/testing/web-platform/tests/workers/modules/resources/postmessage-credentials.py
@@ -1,22 +1,22 @@
 def main(request, response):
-    cookie = request.cookies.first("COOKIE_NAME", None)
+    cookie = request.cookies.first(b"COOKIE_NAME", None)
 
-    response_headers = [("Content-Type", "text/javascript"),
-                        ("Access-Control-Allow-Credentials", "true")]
+    response_headers = [(b"Content-Type", b"text/javascript"),
+                        (b"Access-Control-Allow-Credentials", b"true")]
 
-    origin = request.headers.get("Origin", None)
+    origin = request.headers.get(b"Origin", None)
     if origin:
-        response_headers.append(("Access-Control-Allow-Origin", origin))
+        response_headers.append((b"Access-Control-Allow-Origin", origin))
 
-    cookie_value = '';
+    cookie_value = b'';
     if cookie:
         cookie_value = cookie.value;
     return (200, response_headers,
-            "if ('DedicatedWorkerGlobalScope' in self &&" +
-            "    self instanceof DedicatedWorkerGlobalScope) {" +
-            "  postMessage('"+cookie_value+"');" +
-            "} else if (" +
-            "    'SharedWorkerGlobalScope' in self &&" +
-            "    self instanceof SharedWorkerGlobalScope) {" +
-            "  onconnect = e => e.ports[0].postMessage('"+cookie_value+"');" +
-            "}")
+            b"if ('DedicatedWorkerGlobalScope' in self &&" +
+            b"    self instanceof DedicatedWorkerGlobalScope) {" +
+            b"  postMessage('"+cookie_value+b"');" +
+            b"} else if (" +
+            b"    'SharedWorkerGlobalScope' in self &&" +
+            b"    self instanceof SharedWorkerGlobalScope) {" +
+            b"  onconnect = e => e.ports[0].postMessage('"+cookie_value+b"');" +
+            b"}")
--- a/testing/web-platform/tests/workers/modules/resources/postmessage-referrer-checker.py
+++ b/testing/web-platform/tests/workers/modules/resources/postmessage-referrer-checker.py
@@ -1,16 +1,16 @@
 # Returns a worker script that posts the request's referrer header.
 def main(request, response):
-    referrer = request.headers.get("referer", "")
+    referrer = request.headers.get(b"referer", b"")
 
-    response_headers = [("Content-Type", "text/javascript"),
-                        ("Access-Control-Allow-Origin", "*")]
+    response_headers = [(b"Content-Type", b"text/javascript"),
+                        (b"Access-Control-Allow-Origin", b"*")]
 
     return (200, response_headers,
-            "if ('DedicatedWorkerGlobalScope' in self &&" +
-            "    self instanceof DedicatedWorkerGlobalScope) {" +
-            "  postMessage('"+referrer+"');" +
-            "} else if (" +
-            "    'SharedWorkerGlobalScope' in self &&" +
-            "    self instanceof SharedWorkerGlobalScope) {" +
-            "  onconnect = e => e.ports[0].postMessage('"+referrer+"');" +
-            "}")
+            b"if ('DedicatedWorkerGlobalScope' in self &&" +
+            b"    self instanceof DedicatedWorkerGlobalScope) {" +
+            b"  postMessage('"+referrer+b"');" +
+            b"} else if (" +
+            b"    'SharedWorkerGlobalScope' in self &&" +
+            b"    self instanceof SharedWorkerGlobalScope) {" +
+            b"  onconnect = e => e.ports[0].postMessage('"+referrer+b"');" +
+            b"}")
--- a/testing/web-platform/tests/workers/semantics/encodings/003-1.py
+++ b/testing/web-platform/tests/workers/semantics/encodings/003-1.py
@@ -1,4 +1,4 @@
  # -*- coding: utf-8 -*-
 
 def main(request, response):
-    return "PASS" if request.GET.first('x') == 'å' else "FAIL"
+    return u"PASS" if request.GET.first(b'x').decode('utf-8') == u'å' else u"FAIL"
--- a/testing/web-platform/tests/workers/support/imported_script.py
+++ b/testing/web-platform/tests/workers/support/imported_script.py
@@ -1,2 +1,2 @@
 def main(request, response):
-    return [('Content-Type', request.GET['mime'])], ""
+    return [(b'Content-Type', request.GET[b'mime'])], u""
--- a/testing/web-platform/tests/workers/support/nosiniff-error-worker.py
+++ b/testing/web-platform/tests/workers/support/nosiniff-error-worker.py
@@ -1,3 +1,3 @@
 def main(request, response):
-    return [('Content-Type', 'text/html'),
-            ('X-Content-Type-Options', 'nosniff')], ""
+    return [(b'Content-Type', b'text/html'),
+            (b'X-Content-Type-Options', b'nosniff')], u""