Title: [274768] trunk/LayoutTests
Revision
274768
Author
[email protected]
Date
2021-03-22 12:00:23 -0700 (Mon, 22 Mar 2021)

Log Message

[LayoutTests] Convert http/tests/workers convert PHP to Python
https://bugs.webkit.org/show_bug.cgi?id=223522
<rdar://problem/75624689>

Reviewed by Alex Christensen.

* http/tests/workers/resources/subworker-encoded.php: Removed.
* http/tests/workers/resources/subworker-encoded.py: Added.
* http/tests/workers/resources/worker-encoded.php: Removed.
* http/tests/workers/resources/worker-encoded.py: Added.
* http/tests/workers/resources/worker-importScripts-banned-mimetype.php: Removed.
* http/tests/workers/resources/worker-importScripts-banned-mimetype.py: Added.
* http/tests/workers/resources/xhr-query-utf8.php: Removed.
* http/tests/workers/resources/xhr-query-utf8.py: Added.
* http/tests/workers/resources/xhr-response.py: Added.
* http/tests/workers/service/basic-timeout.https-expected.txt:
* http/tests/workers/service/controller-change.html:
* http/tests/workers/service/page-caching.html:
* http/tests/workers/service/registration-updateViaCache-all.html:
* http/tests/workers/service/registration-updateViaCache-none.html:
* http/tests/workers/service/resources/basic-timeout.js:
* http/tests/workers/service/resources/cacheable-script-worker.php: Removed.
* http/tests/workers/service/resources/cacheable-script-worker.py: Added.
* http/tests/workers/service/resources/download-binary.php: Removed.
* http/tests/workers/service/resources/download-binary.py: Added.
* http/tests/workers/service/resources/import-cacheable-script-worker.js:
* http/tests/workers/service/resources/self_registration_update-worker.php: Removed.
* http/tests/workers/service/resources/self_registration_update-worker.py: Added.
* http/tests/workers/service/resources/succeed-fallback-check.php: Removed.
* http/tests/workers/service/resources/succeed-fallback-check.py: Added.
* http/tests/workers/service/resources/updating-fetch-worker.php: Removed.
* http/tests/workers/service/resources/updating-fetch-worker.py: Added.
* http/tests/workers/service/resources/updating-worker.php: Removed.
* http/tests/workers/service/resources/updating-worker.py: Added.
* http/tests/workers/service/self_registration_update.html:
* http/tests/workers/service/service-worker-download-async-delegates.https-expected.txt:
* http/tests/workers/service/service-worker-download-async-delegates.https.html:
* http/tests/workers/service/service-worker-download.https-expected.txt:
* http/tests/workers/service/service-worker-download.https.html:
* http/tests/workers/service/service-worker-registration-gc-event.html:
* http/tests/workers/text-encoding.html:
* http/tests/workers/worker-importScripts-banned-mimetype-expected.txt:
* http/tests/workers/worker-importScripts-banned-mimetype.html:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (274767 => 274768)


--- trunk/LayoutTests/ChangeLog	2021-03-22 18:51:43 UTC (rev 274767)
+++ trunk/LayoutTests/ChangeLog	2021-03-22 19:00:23 UTC (rev 274768)
@@ -1,3 +1,49 @@
+2021-03-22  Chris Gambrell  <[email protected]>
+
+        [LayoutTests] Convert http/tests/workers convert PHP to Python
+        https://bugs.webkit.org/show_bug.cgi?id=223522
+        <rdar://problem/75624689>
+
+        Reviewed by Alex Christensen.
+
+        * http/tests/workers/resources/subworker-encoded.php: Removed.
+        * http/tests/workers/resources/subworker-encoded.py: Added.
+        * http/tests/workers/resources/worker-encoded.php: Removed.
+        * http/tests/workers/resources/worker-encoded.py: Added.
+        * http/tests/workers/resources/worker-importScripts-banned-mimetype.php: Removed.
+        * http/tests/workers/resources/worker-importScripts-banned-mimetype.py: Added.
+        * http/tests/workers/resources/xhr-query-utf8.php: Removed.
+        * http/tests/workers/resources/xhr-query-utf8.py: Added.
+        * http/tests/workers/resources/xhr-response.py: Added.
+        * http/tests/workers/service/basic-timeout.https-expected.txt:
+        * http/tests/workers/service/controller-change.html:
+        * http/tests/workers/service/page-caching.html:
+        * http/tests/workers/service/registration-updateViaCache-all.html:
+        * http/tests/workers/service/registration-updateViaCache-none.html:
+        * http/tests/workers/service/resources/basic-timeout.js:
+        * http/tests/workers/service/resources/cacheable-script-worker.php: Removed.
+        * http/tests/workers/service/resources/cacheable-script-worker.py: Added.
+        * http/tests/workers/service/resources/download-binary.php: Removed.
+        * http/tests/workers/service/resources/download-binary.py: Added.
+        * http/tests/workers/service/resources/import-cacheable-script-worker.js:
+        * http/tests/workers/service/resources/self_registration_update-worker.php: Removed.
+        * http/tests/workers/service/resources/self_registration_update-worker.py: Added.
+        * http/tests/workers/service/resources/succeed-fallback-check.php: Removed.
+        * http/tests/workers/service/resources/succeed-fallback-check.py: Added.
+        * http/tests/workers/service/resources/updating-fetch-worker.php: Removed.
+        * http/tests/workers/service/resources/updating-fetch-worker.py: Added.
+        * http/tests/workers/service/resources/updating-worker.php: Removed.
+        * http/tests/workers/service/resources/updating-worker.py: Added.
+        * http/tests/workers/service/self_registration_update.html:
+        * http/tests/workers/service/service-worker-download-async-delegates.https-expected.txt:
+        * http/tests/workers/service/service-worker-download-async-delegates.https.html:
+        * http/tests/workers/service/service-worker-download.https-expected.txt:
+        * http/tests/workers/service/service-worker-download.https.html:
+        * http/tests/workers/service/service-worker-registration-gc-event.html:
+        * http/tests/workers/text-encoding.html:
+        * http/tests/workers/worker-importScripts-banned-mimetype-expected.txt:
+        * http/tests/workers/worker-importScripts-banned-mimetype.html:
+
 2021-03-22  Amir Mark Jr  <[email protected]>
 
         REGRESSION (r274711): [iOS 14 Wk2] webgl/conformance/extensions/khr-parallel-shader-compile.html is consistently failing

Deleted: trunk/LayoutTests/http/tests/workers/resources/subworker-encoded.php (274767 => 274768)


--- trunk/LayoutTests/http/tests/workers/resources/subworker-encoded.php	2021-03-22 18:51:43 UTC (rev 274767)
+++ trunk/LayoutTests/http/tests/workers/resources/subworker-encoded.php	2021-03-22 19:00:23 UTC (rev 274768)
@@ -1,10 +0,0 @@
-<?php
-header("Expires: Thu, 01 Dec 2003 16:00:00 GMT");
-header("Cache-Control: no-cache, must-revalidate");
-header("Pragma: no-cache");
-
-print("postMessage('Sub: Original test string: ' + String.fromCharCode(0x41F, 0x440, 0x438, 0x432, 0x435, 0x442));");
-print("postMessage('Sub: Test string encoded using koi8-r: \xF0\xD2\xC9\xD7\xC5\xD4.');");
-print("postMessage('Sub: Test string encoded using Windows-1251: \xCF\xF0\xE8\xE2\xE5\xF2.');");
-print("postMessage('Sub: Test string encoded using UTF-8: \xD0\x9F\xD1\x80\xD0\xB8\xD0\xB2\xD0\xB5\xD1\x82.');");
-?>

Added: trunk/LayoutTests/http/tests/workers/resources/subworker-encoded.py (0 => 274768)


--- trunk/LayoutTests/http/tests/workers/resources/subworker-encoded.py	                        (rev 0)
+++ trunk/LayoutTests/http/tests/workers/resources/subworker-encoded.py	2021-03-22 19:00:23 UTC (rev 274768)
@@ -0,0 +1,18 @@
+#!/usr/bin/env python3
+
+import sys
+
+koi8 = '\xF0\xD2\xC9\xD7\xC5\xD4'.encode('latin-1').decode('utf-8', 'replace')
+windows = '\xCF\xF0\xE8\xE2\xE5\xF2'.encode('latin-1').decode('utf-8', 'replace')
+utf = '\xD0\x9F\xD1\x80\xD0\xB8\xD0\xB2\xD0\xB5\xD1\x82'.encode('latin-1').decode()
+
+sys.stdout.write(
+    'Expires: Thu, 01 Dec 2003 16:00:00 GMT\r\n'
+    'Cache-Control: no-cache, must-revalidate\r\n'
+    'Pragma: no-cache\r\n'
+    'Content-Type: text/html\r\n\r\n'
+    'postMessage(\'Sub: Original test string: \' + String.fromCharCode(0x41F, 0x440, 0x438, 0x432, 0x435, 0x442));'
+    'postMessage(\'Sub: Test string encoded using koi8-r: {}.\');'
+    'postMessage(\'Sub: Test string encoded using Windows-1251: {}.\');'
+    'postMessage(\'Sub: Test string encoded using UTF-8: {}.\');'.format(koi8, windows, utf)
+)
\ No newline at end of file
Property changes on: trunk/LayoutTests/http/tests/workers/resources/subworker-encoded.py
___________________________________________________________________

Added: svn:executable

+* \ No newline at end of property

Deleted: trunk/LayoutTests/http/tests/workers/resources/worker-encoded.php (274767 => 274768)


--- trunk/LayoutTests/http/tests/workers/resources/worker-encoded.php	2021-03-22 18:51:43 UTC (rev 274767)
+++ trunk/LayoutTests/http/tests/workers/resources/worker-encoded.php	2021-03-22 19:00:23 UTC (rev 274768)
@@ -1,37 +0,0 @@
-<?php
-header("Expires: Thu, 01 Dec 2003 16:00:00 GMT");
-header("Cache-Control: no-cache, must-revalidate");
-header("Pragma: no-cache");
-
-// Parent document has Windows-1251 encoding. This test verifies that worker script gets decoded using
-// parent document encoding or the one in http header, if specified.
-$charset=$_GET['charset'];
-if ($charset == "koi8-r") {
-    header("Content-Type: text/_javascript_;charset=koi8-r");
-    print("postMessage('Has http header with charset=koi8-r');");
-} else {
-    header("Content-Type: text/_javascript_");
-    print("postMessage('Has no http header with charset');");
-}
-
-print("postMessage('Original test string: ' + String.fromCharCode(0x41F, 0x440, 0x438, 0x432, 0x435, 0x442));");
-print("postMessage('Test string encoded using koi8-r: \xF0\xD2\xC9\xD7\xC5\xD4.');");
-print("postMessage('Test string encoded using Windows-1251: \xCF\xF0\xE8\xE2\xE5\xF2.');");
-print("postMessage('Test string encoded using UTF-8: \xD0\x9F\xD1\x80\xD0\xB8\xD0\xB2\xD0\xB5\xD1\x82.');");
-
-// Test how XHR decodes its response text. Should be UTF8 or a charset from http header.
-print("var xhr = new XMLHttpRequest(); xhr.open('GET', 'xhr-response.php', false);");
-print("xhr.send(); postMessage(xhr.responseText);");
-
-print("var xhr = new XMLHttpRequest(); xhr.open('GET', 'xhr-response.php?charset=koi8-r', false);");
-print("xhr.send(); postMessage(xhr.responseText);");
-
-// Test that URL completion is done using UTF-8, regardless of the worker's script encoding.
-// The server script verifies that query parameter is encoded in UTF-8.
-print("var xhr = new XMLHttpRequest(); xhr.open('GET', 'xhr-query-utf8.php?query=' + String.fromCharCode(0x41F, 0x440, 0x438, 0x432, 0x435, 0x442), false);");
-print("xhr.send(); postMessage(xhr.responseText);");
-
-print("importScripts('subworker-encoded.php');");
-
-print("postMessage('exit');");
-?>

Added: trunk/LayoutTests/http/tests/workers/resources/worker-encoded.py (0 => 274768)


--- trunk/LayoutTests/http/tests/workers/resources/worker-encoded.py	                        (rev 0)
+++ trunk/LayoutTests/http/tests/workers/resources/worker-encoded.py	2021-03-22 19:00:23 UTC (rev 274768)
@@ -0,0 +1,53 @@
+#!/usr/bin/env python3
+
+import os
+import sys
+from urllib.parse import parse_qs
+
+koi8 = '\xF0\xD2\xC9\xD7\xC5\xD4'
+windows = '\xCF\xF0\xE8\xE2\xE5\xF2'
+utf = '\xD0\x9F\xD1\x80\xD0\xB8\xD0\xB2\xD0\xB5\xD1\x82'
+
+charset = parse_qs(os.environ.get('QUERY_STRING', ''), keep_blank_values=True).get('charset', [''])[0]
+
+sys.stdout.write(
+    'Expires: Thu, 01 Dec 2003 16:00:00 GMT\r\n'
+    'Cache-Control: no-cache, must-revalidate\r\n'
+    'Pragma: no-cache\r\n'
+    'Content-Type: text/_javascript_\r\n\r\n'
+)
+
+content_type = 'utf-8'
+if charset == 'koi8-r':
+    content_type = 'koi8-r'
+    sys.stdout.write('postMessage(\'Has http header with charset=koi8-r\');')
+else:
+    sys.stdout.write('postMessage(\'Has no http header with charset\');')
+
+koi8 = koi8.encode('latin-1').decode(content_type, 'replace')
+windows = windows.encode('latin-1').decode(content_type, 'replace')
+utf = utf.encode('latin-1').decode(content_type, 'replace')
+
+sys.stdout.write(
+    'postMessage(\'Original test string: \' + String.fromCharCode(0x41F, 0x440, 0x438, 0x432, 0x435, 0x442));'
+    'postMessage(\'Test string encoded using koi8-r: {}.\');'
+    'postMessage(\'Test string encoded using Windows-1251: {}.\');'
+    'postMessage(\'Test string encoded using UTF-8: {}.\');'.format(koi8, windows, utf)
+)
+
+# Test how XHR decodes its response text. Should be UTF8 or a charset from http header.
+sys.stdout.write(
+    'var xhr = new XMLHttpRequest(); xhr.open(\'GET\', \'xhr-response.php\', false);'
+    'xhr.send(); postMessage(xhr.responseText);'
+    'var xhr = new XMLHttpRequest(); xhr.open(\'GET\', \'xhr-response.php?charset=koi8-r\', false);'
+    'xhr.send(); postMessage(xhr.responseText);'
+)
+
+# Test that URL completion is done using UTF-8, regardless of the worker's script encoding.
+# The server script verifies that query parameter is encoded in UTF-8.
+sys.stdout.write(
+    'var xhr = new XMLHttpRequest(); xhr.open(\'GET\', \'xhr-query-utf8.py?query=\' + String.fromCharCode(0x41F, 0x440, 0x438, 0x432, 0x435, 0x442), false);'
+    'xhr.send(); postMessage(xhr.responseText);'
+    'importScripts(\'subworker-encoded.py\');'
+    'postMessage(\'exit\');'
+)
\ No newline at end of file
Property changes on: trunk/LayoutTests/http/tests/workers/resources/worker-encoded.py
___________________________________________________________________

Added: svn:executable

+* \ No newline at end of property

Deleted: trunk/LayoutTests/http/tests/workers/resources/worker-importScripts-banned-mimetype.php (274767 => 274768)


--- trunk/LayoutTests/http/tests/workers/resources/worker-importScripts-banned-mimetype.php	2021-03-22 18:51:43 UTC (rev 274767)
+++ trunk/LayoutTests/http/tests/workers/resources/worker-importScripts-banned-mimetype.php	2021-03-22 19:00:23 UTC (rev 274768)
@@ -1,37 +0,0 @@
-<?php
-header("Content-Type: text/_javascript_; charset=UTF-8");
-?>
-importScripts("/js-test-resources/js-test.js");
-
-// This is not a comprehensive list.
-var bannedMIMETypes = [
-    "audio/mp4",
-    "audio/mpeg",
-    "audio/ogg",
-    "audio/wav",
-    "audio/x-aiff",
-    "image/gif",
-    "image/png",
-    "text/csv",
-    "video/mpeg",
-    "video/ogg",
-    "video/quicktime",
-];
-
-self.scriptsSuccessfullyLoaded = 0;
-
-description("Test that an external _javascript_ script is blocked if has a banned MIME type.");
-
-for (let mimeType of bannedMIMETypes) {
-    try {
-        importScripts(`../../security/contentTypeOptions/resources/script-with-header.pl?mime=${mimeType}&no-content-type-options=1`);
-    } catch (e) { }
-}
-
-try {
-    // For some reason this causes "SyntaxError: Invalid character '\ufffd'" when non-script MIME types are allowed to be executed.
-    importScripts("../../security/resources/abe-that-increments-scriptsSuccessfullyLoaded.jpg");
-} catch (e) { }
-
-shouldBeZero("self.scriptsSuccessfullyLoaded");
-finishJSTest();

Added: trunk/LayoutTests/http/tests/workers/resources/worker-importScripts-banned-mimetype.py (0 => 274768)


--- trunk/LayoutTests/http/tests/workers/resources/worker-importScripts-banned-mimetype.py	                        (rev 0)
+++ trunk/LayoutTests/http/tests/workers/resources/worker-importScripts-banned-mimetype.py	2021-03-22 19:00:23 UTC (rev 274768)
@@ -0,0 +1,41 @@
+#!/usr/bin/env python3
+
+import sys
+
+sys.stdout.write(
+    'Content-Type: text/_javascript_; charset=UTF-8\r\n\r\n'
+    'importScripts("/js-test-resources/js-test.js");\n'
+    '\n'
+    '// This is not a comprehensive list.\n'
+    'var bannedMIMETypes = [\n'
+    '    "audio/mp4",\n'
+    '    "audio/mpeg",\n'
+    '    "audio/ogg",\n'
+    '    "audio/wav",\n'
+    '    "audio/x-aiff",\n'
+    '    "image/gif",\n'
+    '    "image/png",\n'
+    '    "text/csv",\n'
+    '    "video/mpeg",\n'
+    '    "video/ogg",\n'
+    '    "video/quicktime",\n'
+    '];\n'
+    '\n'
+    'self.scriptsSuccessfullyLoaded = 0;\n'
+    '\n'
+    'description("Test that an external _javascript_ script is blocked if has a banned MIME type.");\n'
+    '\n'
+    'for (let mimeType of bannedMIMETypes) {\n'
+    '    try {\n'
+    '        importScripts(`../../security/contentTypeOptions/resources/script-with-header.pl?mime=${mimeType}&no-content-type-options=1`);\n'
+    '    } catch (e) { }\n'
+    '}\n'
+    '\n'
+    'try {\n'
+    '    // For some reason this causes "SyntaxError: Invalid character \'\ufffd\'" when non-script MIME types are allowed to be executed.\n'
+    '    importScripts("../../security/resources/abe-that-increments-scriptsSuccessfullyLoaded.jpg");\n'
+    '} catch (e) { }\n'
+    '\n'
+    'shouldBeZero("self.scriptsSuccessfullyLoaded");\n'
+    'finishJSTest();\n'
+)
\ No newline at end of file
Property changes on: trunk/LayoutTests/http/tests/workers/resources/worker-importScripts-banned-mimetype.py
___________________________________________________________________

Added: svn:executable

+* \ No newline at end of property

Deleted: trunk/LayoutTests/http/tests/workers/resources/xhr-query-utf8.php (274767 => 274768)


--- trunk/LayoutTests/http/tests/workers/resources/xhr-query-utf8.php	2021-03-22 18:51:43 UTC (rev 274767)
+++ trunk/LayoutTests/http/tests/workers/resources/xhr-query-utf8.php	2021-03-22 19:00:23 UTC (rev 274768)
@@ -1,14 +0,0 @@
-<?php
-header("Expires: Thu, 01 Dec 2003 16:00:00 GMT");
-header("Cache-Control: no-cache, must-revalidate");
-header("Pragma: no-cache");
-
-$query=$_GET['query'];
-if ($query == "\xD0\x9F\xD1\x80\xD0\xB8\xD0\xB2\xD0\xB5\xD1\x82") {
-    print("PASS: XHR query was encoded in UTF-8: ");
-    print($query);
-} else {
-    print("FAIL: XHR query was NOT encoded in UTF-8: ");
-    print($query);
-}
-?>

Added: trunk/LayoutTests/http/tests/workers/resources/xhr-query-utf8.py (0 => 274768)


--- trunk/LayoutTests/http/tests/workers/resources/xhr-query-utf8.py	                        (rev 0)
+++ trunk/LayoutTests/http/tests/workers/resources/xhr-query-utf8.py	2021-03-22 19:00:23 UTC (rev 274768)
@@ -0,0 +1,19 @@
+#!/usr/bin/env python3
+
+import os
+import sys
+from urllib.parse import parse_qs
+
+query = parse_qs(os.environ.get('QUERY_STRING', ''), keep_blank_values=True).get('query', [''])[0]
+
+sys.stdout.write(
+    'Expires: Thu, 01 Dec 2003 16:00:00 GMT\r\n'
+    'Cache-Control: no-cache, must-revalidate\r\n'
+    'Pragma: no-cache\r\n'
+    'Content-Type: text/html\r\n\r\n'
+)
+
+if query == '\xD0\x9F\xD1\x80\xD0\xB8\xD0\xB2\xD0\xB5\xD1\x82'.encode('latin-1').decode('utf-8'):
+    sys.stdout.write('PASS: XHR query was encoded in UTF-8: {}'.format(query))
+else:
+    sys.stdout.write('FAIL: XHR query was NOT encoded in UTF-8: {}'.format(query))
\ No newline at end of file
Property changes on: trunk/LayoutTests/http/tests/workers/resources/xhr-query-utf8.py
___________________________________________________________________

Added: svn:executable

+* \ No newline at end of property

Added: trunk/LayoutTests/http/tests/workers/resources/xhr-response.py (0 => 274768)


--- trunk/LayoutTests/http/tests/workers/resources/xhr-response.py	                        (rev 0)
+++ trunk/LayoutTests/http/tests/workers/resources/xhr-response.py	2021-03-22 19:00:23 UTC (rev 274768)
@@ -0,0 +1,19 @@
+#!/usr/bin/env python3
+
+import os
+import sys
+from urllib.parse import parse_qs
+
+charset = parse_qs(os.environ.get('QUERY_STRING', ''), keep_blank_values=True).get('charset', [''])[0]
+
+sys.stdout.write(
+    'Expires: Thu, 01 Dec 2003 16:00:00 GMT\r\n'
+    'Cache-Control: no-cache, must-revalidate\r\n'
+    'Pragma: no-cache\r\n'
+    'Content-Type: text/plain;\r\n\r\n'
+)
+
+if charset == 'koi8-r':
+    sys.stdout.write('XHR: {}'.format('\xF0\xD2\xC9\xD7\xC5\xD4'.encode('latin-1').decode('koi8-r')))
+else:
+    sys.stdout.write('XHR: Привет')
\ No newline at end of file
Property changes on: trunk/LayoutTests/http/tests/workers/resources/xhr-response.py
___________________________________________________________________

Added: svn:executable

+* \ No newline at end of property

Modified: trunk/LayoutTests/http/tests/workers/service/basic-timeout.https-expected.txt (274767 => 274768)


--- trunk/LayoutTests/http/tests/workers/service/basic-timeout.https-expected.txt	2021-03-22 18:51:43 UTC (rev 274767)
+++ trunk/LayoutTests/http/tests/workers/service/basic-timeout.https-expected.txt	2021-03-22 19:00:23 UTC (rev 274768)
@@ -5,10 +5,10 @@
 URL 1 - https://127.0.0.1:8443/workers/service/resources/timeout-no-fallback.html
 Status code 1 - 404
 Source' header 1 - null
-URL 2 - https://127.0.0.1:8443/workers/service/resources/succeed-fallback-check.php
+URL 2 - https://127.0.0.1:8443/workers/service/resources/succeed-fallback-check.py
 Status code 2 - 200
 Source' header 2 - network
-URL 3 - https://127.0.0.1:8443/workers/service/resources/succeed-fallback-check.php
+URL 3 - https://127.0.0.1:8443/workers/service/resources/succeed-fallback-check.py
 Status code 3 - 200
 Source' header 3 - network
 

Modified: trunk/LayoutTests/http/tests/workers/service/controller-change.html (274767 => 274768)


--- trunk/LayoutTests/http/tests/workers/service/controller-change.html	2021-03-22 18:51:43 UTC (rev 274767)
+++ trunk/LayoutTests/http/tests/workers/service/controller-change.html	2021-03-22 19:00:23 UTC (rev 274768)
@@ -23,7 +23,7 @@
 
 async function test() {
     let scopeURL = "/workers/service/resources/";
-    let registration = await registerAndWaitForActive("resources/updating-fetch-worker.php", scopeURL);
+    let registration = await registerAndWaitForActive("resources/updating-fetch-worker.py", scopeURL);
     let frame = await withFrame(scopeURL);
     initialController = frame.contentWindow.navigator.serviceWorker.controller;
     if (initialController === null) {

Modified: trunk/LayoutTests/http/tests/workers/service/page-caching.html (274767 => 274768)


--- trunk/LayoutTests/http/tests/workers/service/page-caching.html	2021-03-22 18:51:43 UTC (rev 274767)
+++ trunk/LayoutTests/http/tests/workers/service/page-caching.html	2021-03-22 19:00:23 UTC (rev 274768)
@@ -32,7 +32,7 @@
 
 async function test() {
     let scopeURL = "/workers/service/resources/";
-    registration = await registerAndWaitForActive("resources/updating-fetch-worker.php", scopeURL);
+    registration = await registerAndWaitForActive("resources/updating-fetch-worker.py", scopeURL);
     worker = registration.active;
     if (!worker) {
         log("FAIL: No active service worker");

Modified: trunk/LayoutTests/http/tests/workers/service/registration-updateViaCache-all.html (274767 => 274768)


--- trunk/LayoutTests/http/tests/workers/service/registration-updateViaCache-all.html	2021-03-22 18:51:43 UTC (rev 274767)
+++ trunk/LayoutTests/http/tests/workers/service/registration-updateViaCache-all.html	2021-03-22 19:00:23 UTC (rev 274768)
@@ -18,7 +18,7 @@
 async function test()
 {
     try {
-        let registration = await navigator.serviceWorker.register("resources/cacheable-script-worker.php", { updateViaCache: "all" });
+        let registration = await navigator.serviceWorker.register("resources/cacheable-script-worker.py", { updateViaCache: "all" });
         let worker1 = registration.installing;
         await waitForState(worker1, "activated");
         let randomId1 = await getRandomIdFromWorker(worker1);

Modified: trunk/LayoutTests/http/tests/workers/service/registration-updateViaCache-none.html (274767 => 274768)


--- trunk/LayoutTests/http/tests/workers/service/registration-updateViaCache-none.html	2021-03-22 18:51:43 UTC (rev 274767)
+++ trunk/LayoutTests/http/tests/workers/service/registration-updateViaCache-none.html	2021-03-22 19:00:23 UTC (rev 274768)
@@ -18,13 +18,13 @@
 async function test()
 {
     try {
-        let registration = await navigator.serviceWorker.register("resources/cacheable-script-worker.php", { updateViaCache: "none" });
+        let registration = await navigator.serviceWorker.register("resources/cacheable-script-worker.py", { updateViaCache: "none" });
         let worker1 = registration.installing;
         await waitForState(worker1, "activated");
         let randomId1 = await getRandomIdFromWorker(worker1);
 
         await registration.unregister();
-        registration = await navigator.serviceWorker.register("resources/cacheable-script-worker.php", { updateViaCache: "none" });
+        registration = await navigator.serviceWorker.register("resources/cacheable-script-worker.py", { updateViaCache: "none" });
         let worker2 = registration.installing;
         await waitForState(worker2, "activated");
         let randomId2 = await getRandomIdFromWorker(worker2);

Modified: trunk/LayoutTests/http/tests/workers/service/resources/basic-timeout.js (274767 => 274768)


--- trunk/LayoutTests/http/tests/workers/service/resources/basic-timeout.js	2021-03-22 18:51:43 UTC (rev 274767)
+++ trunk/LayoutTests/http/tests/workers/service/resources/basic-timeout.js	2021-03-22 19:00:23 UTC (rev 274768)
@@ -44,7 +44,7 @@
         // The service worker knows how to handle the following fetch *and* has 60 seconds to do so.
         // But will be cancelled with the above fetches since we're terminating the service worker, and 
         // therefore it will then fallback to the network.
-        fetch("succeed-fallback-check.php").then(function(response) {
+        fetch("succeed-fallback-check.py").then(function(response) {
             urlResults[2] = response.url;
             statusResults[2] = response.status;
             headerResults[2] = response.headers.get("Source");   
@@ -57,7 +57,7 @@
         // Now we can fetch that same URL again, which *could* relaunch the service worker and handle it there, but for now this service worker registration is inert and fetches through it will go to the network instead.
         // I'm leaving this in to cover future cases where we do relaunch the SW to handle it.
         function checkSuccessAgain() {
-            fetch("succeed-fallback-check.php").then(function(response) {
+            fetch("succeed-fallback-check.py").then(function(response) {
                 urlResults[3] = response.url;
                 statusResults[3] = response.status;
                 headerResults[3] = response.headers.get("Source");   

Deleted: trunk/LayoutTests/http/tests/workers/service/resources/cacheable-script-worker.php (274767 => 274768)


--- trunk/LayoutTests/http/tests/workers/service/resources/cacheable-script-worker.php	2021-03-22 18:51:43 UTC (rev 274767)
+++ trunk/LayoutTests/http/tests/workers/service/resources/cacheable-script-worker.php	2021-03-22 19:00:23 UTC (rev 274768)
@@ -1,16 +0,0 @@
-<?php
-    $max_age = 12 * 31 * 24 * 60 * 60; //one year
-    header('Cache-Control: public, max-age=' . $max_age);
-    header('Content-Type: text/_javascript_');
-
-    $randomId = '';
-    $charset = 'ABCDEFGHIKLMNOPQRSTUVWXYZ0123456789';
-    for ($i = 0; $i < 16; $i++)
-        $randomId .= $charset[rand(0, strlen($charset) - 1)];
-
-    echo 'let randomId = "' . $randomId . '";';
-?>
-
-self.addEventListener("message", function(e) {
-   e.source.postMessage(randomId);
-});

Added: trunk/LayoutTests/http/tests/workers/service/resources/cacheable-script-worker.py (0 => 274768)


--- trunk/LayoutTests/http/tests/workers/service/resources/cacheable-script-worker.py	                        (rev 0)
+++ trunk/LayoutTests/http/tests/workers/service/resources/cacheable-script-worker.py	2021-03-22 19:00:23 UTC (rev 274768)
@@ -0,0 +1,23 @@
+#!/usr/bin/env python3
+
+import sys
+from random import randint
+
+max_age = 12 * 31 * 24 * 60 * 60
+
+sys.stdout.write(
+    'Cache-Control: public, max-age={}\r\n'
+    'Content-Type: text/_javascript_\r\n\r\n'.format(max_age)
+)
+
+randomId = ''
+charset = 'ABCDEFGHIKLMNOPQRSTUVWXYZ0123456789'
+for _ in range(0, 16):
+    randomId += charset[randint(0, len(charset) - 1)]
+
+sys.stdout.write(
+    'let randomId = "{}";\n'
+    'self.addEventListener("message", function(e) {{\n'
+    '   e.source.postMessage(randomId);\n'
+    '}});\n'.format(randomId)
+)
\ No newline at end of file
Property changes on: trunk/LayoutTests/http/tests/workers/service/resources/cacheable-script-worker.py
___________________________________________________________________

Added: svn:executable

+* \ No newline at end of property

Deleted: trunk/LayoutTests/http/tests/workers/service/resources/download-binary.php (274767 => 274768)


--- trunk/LayoutTests/http/tests/workers/service/resources/download-binary.php	2021-03-22 18:51:43 UTC (rev 274767)
+++ trunk/LayoutTests/http/tests/workers/service/resources/download-binary.php	2021-03-22 19:00:23 UTC (rev 274768)
@@ -1,4 +0,0 @@
-<?php
-header("Content-Type: application/my-super-binary");
-echo "[1, 2, 3]";
-?>

Added: trunk/LayoutTests/http/tests/workers/service/resources/download-binary.py (0 => 274768)


--- trunk/LayoutTests/http/tests/workers/service/resources/download-binary.py	                        (rev 0)
+++ trunk/LayoutTests/http/tests/workers/service/resources/download-binary.py	2021-03-22 19:00:23 UTC (rev 274768)
@@ -0,0 +1,8 @@
+#!/usr/bin/env python3
+
+import sys
+
+sys.stdout.write(
+    'Content-Type: application/my-super-binary\r\n\r\n'
+    '[1, 2, 3]'
+)
\ No newline at end of file
Property changes on: trunk/LayoutTests/http/tests/workers/service/resources/download-binary.py
___________________________________________________________________

Added: svn:executable

+* \ No newline at end of property

Modified: trunk/LayoutTests/http/tests/workers/service/resources/import-cacheable-script-worker.js (274767 => 274768)


--- trunk/LayoutTests/http/tests/workers/service/resources/import-cacheable-script-worker.js	2021-03-22 18:51:43 UTC (rev 274767)
+++ trunk/LayoutTests/http/tests/workers/service/resources/import-cacheable-script-worker.js	2021-03-22 19:00:23 UTC (rev 274768)
@@ -1,2 +1,2 @@
-importScripts("cacheable-script-worker.php");
+importScripts("cacheable-script-worker.py");
 

Deleted: trunk/LayoutTests/http/tests/workers/service/resources/self_registration_update-worker.php (274767 => 274768)


--- trunk/LayoutTests/http/tests/workers/service/resources/self_registration_update-worker.php	2021-03-22 18:51:43 UTC (rev 274767)
+++ trunk/LayoutTests/http/tests/workers/service/resources/self_registration_update-worker.php	2021-03-22 19:00:23 UTC (rev 274768)
@@ -1,15 +0,0 @@
-<?php
-    header('Content-Type: text/_javascript_');
-
-    $randomId = '';
-    $charset = 'ABCDEFGHIKLMNOPQRSTUVWXYZ0123456789';
-    for ($i = 0; $i < 16; $i++)
-        $randomId .= $charset[rand(0, strlen($charset) - 1)];
-
-    echo 'let randomId = "' . $randomId . '";';
-?>
-
-self.addEventListener("message", (event) => {
-    self.registration.update();
-});
-

Added: trunk/LayoutTests/http/tests/workers/service/resources/self_registration_update-worker.py (0 => 274768)


--- trunk/LayoutTests/http/tests/workers/service/resources/self_registration_update-worker.py	                        (rev 0)
+++ trunk/LayoutTests/http/tests/workers/service/resources/self_registration_update-worker.py	2021-03-22 19:00:23 UTC (rev 274768)
@@ -0,0 +1,18 @@
+#!/usr/bin/env python3
+
+import sys
+from random import randint
+
+sys.stdout.write('Content-Type: text/_javascript_\r\n\r\n')
+
+randomId = ''
+charset = 'ABCDEFGHIKLMNOPQRSTUVWXYZ0123456789'
+for _ in range(0, 16):
+    randomId += charset[randint(0, len(charset) - 1)]
+
+sys.stdout.write(
+    'let randomId = "{}";\n'
+    'self.addEventListener("message", (event) => {{\n'
+    '    self.registration.update();\n'
+    '}});\n'.format(randomId)
+)
\ No newline at end of file
Property changes on: trunk/LayoutTests/http/tests/workers/service/resources/self_registration_update-worker.py
___________________________________________________________________

Added: svn:executable

+* \ No newline at end of property

Deleted: trunk/LayoutTests/http/tests/workers/service/resources/succeed-fallback-check.php (274767 => 274768)


--- trunk/LayoutTests/http/tests/workers/service/resources/succeed-fallback-check.php	2021-03-22 18:51:43 UTC (rev 274767)
+++ trunk/LayoutTests/http/tests/workers/service/resources/succeed-fallback-check.php	2021-03-22 19:00:23 UTC (rev 274768)
@@ -1,3 +0,0 @@
-<?php
-    header('Source: network');
-?>Success!
\ No newline at end of file

Added: trunk/LayoutTests/http/tests/workers/service/resources/succeed-fallback-check.py (0 => 274768)


--- trunk/LayoutTests/http/tests/workers/service/resources/succeed-fallback-check.py	                        (rev 0)
+++ trunk/LayoutTests/http/tests/workers/service/resources/succeed-fallback-check.py	2021-03-22 19:00:23 UTC (rev 274768)
@@ -0,0 +1,9 @@
+#!/usr/bin/env python3
+
+import sys
+
+sys.stdout.write(
+    'Source: network\r\n'
+    'Content-Type: text/html\r\n\r\n'
+    'Success!'
+)
\ No newline at end of file
Property changes on: trunk/LayoutTests/http/tests/workers/service/resources/succeed-fallback-check.py
___________________________________________________________________

Added: svn:executable

+* \ No newline at end of property

Deleted: trunk/LayoutTests/http/tests/workers/service/resources/updating-fetch-worker.php (274767 => 274768)


--- trunk/LayoutTests/http/tests/workers/service/resources/updating-fetch-worker.php	2021-03-22 18:51:43 UTC (rev 274767)
+++ trunk/LayoutTests/http/tests/workers/service/resources/updating-fetch-worker.php	2021-03-22 19:00:23 UTC (rev 274768)
@@ -1,16 +0,0 @@
-<?php
-    header('Content-Type: text/_javascript_');
-
-    $randomId = '';
-    $charset = 'ABCDEFGHIKLMNOPQRSTUVWXYZ0123456789';
-    for ($i = 0; $i < 16; $i++)
-        $randomId .= $charset[rand(0, strlen($charset) - 1)];
-
-    echo 'let randomId = "' . $randomId . '";';
-?>
-
-self.skipWaiting();
-
-self.addEventListener("fetch", (event) => {
-    event.respondWith(new Response(null, {status: 200, statusText: "Found"}));
-});

Added: trunk/LayoutTests/http/tests/workers/service/resources/updating-fetch-worker.py (0 => 274768)


--- trunk/LayoutTests/http/tests/workers/service/resources/updating-fetch-worker.py	                        (rev 0)
+++ trunk/LayoutTests/http/tests/workers/service/resources/updating-fetch-worker.py	2021-03-22 19:00:23 UTC (rev 274768)
@@ -0,0 +1,20 @@
+#!/usr/bin/env python3
+
+import sys
+from random import randint
+
+sys.stdout.write('Content-Type: text/_javascript_\r\n\r\n')
+
+randomId = ''
+charset = 'ABCDEFGHIKLMNOPQRSTUVWXYZ0123456789'
+for _ in range(0, 16):
+    randomId += charset[randint(0, len(charset) - 1)]
+
+sys.stdout.write(
+    'let randomId = "{}";\n'
+    'self.skipWaiting();\n'
+    '\n'
+    'self.addEventListener("fetch", (event) => {{\n'
+    '    event.respondWith(new Response(null, {{status: 200, statusText: "Found"}}));\n'
+    '}});\n'.format(randomId)
+)
\ No newline at end of file
Property changes on: trunk/LayoutTests/http/tests/workers/service/resources/updating-fetch-worker.py
___________________________________________________________________

Added: svn:executable

+* \ No newline at end of property

Deleted: trunk/LayoutTests/http/tests/workers/service/resources/updating-worker.php (274767 => 274768)


--- trunk/LayoutTests/http/tests/workers/service/resources/updating-worker.php	2021-03-22 18:51:43 UTC (rev 274767)
+++ trunk/LayoutTests/http/tests/workers/service/resources/updating-worker.php	2021-03-22 19:00:23 UTC (rev 274768)
@@ -1,10 +0,0 @@
-<?php
-    header('Content-Type: text/_javascript_');
-
-    $randomId = '';
-    $charset = 'ABCDEFGHIKLMNOPQRSTUVWXYZ0123456789';
-    for ($i = 0; $i < 16; $i++)
-        $randomId .= $charset[rand(0, strlen($charset) - 1)];
-
-    echo 'let randomId = "' . $randomId . '";';
-?>

Added: trunk/LayoutTests/http/tests/workers/service/resources/updating-worker.py (0 => 274768)


--- trunk/LayoutTests/http/tests/workers/service/resources/updating-worker.py	                        (rev 0)
+++ trunk/LayoutTests/http/tests/workers/service/resources/updating-worker.py	2021-03-22 19:00:23 UTC (rev 274768)
@@ -0,0 +1,13 @@
+#!/usr/bin/env python3
+
+import sys
+from random import randint
+
+sys.stdout.write('Content-Type: text/_javascript_\r\n\r\n')
+
+randomId = ''
+charset = 'ABCDEFGHIKLMNOPQRSTUVWXYZ0123456789'
+for _ in range(0, 16):
+    randomId += charset[randint(0, len(charset) - 1)]
+
+sys.stdout.write('let randomId = "{}";'.format(randomId))
\ No newline at end of file
Property changes on: trunk/LayoutTests/http/tests/workers/service/resources/updating-worker.py
___________________________________________________________________

Added: svn:executable

+* \ No newline at end of property

Modified: trunk/LayoutTests/http/tests/workers/service/self_registration_update.html (274767 => 274768)


--- trunk/LayoutTests/http/tests/workers/service/self_registration_update.html	2021-03-22 18:51:43 UTC (rev 274767)
+++ trunk/LayoutTests/http/tests/workers/service/self_registration_update.html	2021-03-22 19:00:23 UTC (rev 274768)
@@ -6,7 +6,7 @@
 log("* Add basic testing for ServiceWorkerGlobalScope.registration.update()");
 log("");
 
-navigator.serviceWorker.register("resources/self_registration_update-worker.php", { }).then(function(_registration) {
+navigator.serviceWorker.register("resources/self_registration_update-worker.py", { }).then(function(_registration) {
     registration = _registration;
     worker = registration.installing;
 

Modified: trunk/LayoutTests/http/tests/workers/service/service-worker-download-async-delegates.https-expected.txt (274767 => 274768)


--- trunk/LayoutTests/http/tests/workers/service/service-worker-download-async-delegates.https-expected.txt	2021-03-22 18:51:43 UTC (rev 274767)
+++ trunk/LayoutTests/http/tests/workers/service/service-worker-download-async-delegates.https-expected.txt	2021-03-22 19:00:23 UTC (rev 274768)
@@ -1,4 +1,4 @@
 Download started.
-Downloading URL with suggested filename "download-binary.php"
+Downloading URL with suggested filename "download-binary.py"
 Download completed.
 

Modified: trunk/LayoutTests/http/tests/workers/service/service-worker-download-async-delegates.https.html (274767 => 274768)


--- trunk/LayoutTests/http/tests/workers/service/service-worker-download-async-delegates.https.html	2021-03-22 18:51:43 UTC (rev 274767)
+++ trunk/LayoutTests/http/tests/workers/service/service-worker-download-async-delegates.https.html	2021-03-22 19:00:23 UTC (rev 274768)
@@ -16,7 +16,7 @@
 async function doTest()
 {
     await interceptedFrame("resources/service-worker-download-worker.js", "/workers/service/resources/");
-    window.location = "/workers/service/resources/download-binary.php";
+    window.location = "/workers/service/resources/download-binary.py";
 }
 doTest();
 </script>

Modified: trunk/LayoutTests/http/tests/workers/service/service-worker-download.https-expected.txt (274767 => 274768)


--- trunk/LayoutTests/http/tests/workers/service/service-worker-download.https-expected.txt	2021-03-22 18:51:43 UTC (rev 274767)
+++ trunk/LayoutTests/http/tests/workers/service/service-worker-download.https-expected.txt	2021-03-22 19:00:23 UTC (rev 274768)
@@ -1,4 +1,4 @@
 Download started.
-Downloading URL with suggested filename "download-binary.php"
+Downloading URL with suggested filename "download-binary.py"
 Download completed.
 

Modified: trunk/LayoutTests/http/tests/workers/service/service-worker-download.https.html (274767 => 274768)


--- trunk/LayoutTests/http/tests/workers/service/service-worker-download.https.html	2021-03-22 18:51:43 UTC (rev 274767)
+++ trunk/LayoutTests/http/tests/workers/service/service-worker-download.https.html	2021-03-22 19:00:23 UTC (rev 274768)
@@ -14,7 +14,7 @@
 async function doTest()
 {
     await interceptedFrame("resources/service-worker-download-worker.js", "/workers/service/resources/");
-    window.location = "/workers/service/resources/download-binary.php";
+    window.location = "/workers/service/resources/download-binary.py";
 }
 doTest();
 </script>

Modified: trunk/LayoutTests/http/tests/workers/service/service-worker-registration-gc-event.html (274767 => 274768)


--- trunk/LayoutTests/http/tests/workers/service/service-worker-registration-gc-event.html	2021-03-22 18:51:43 UTC (rev 274767)
+++ trunk/LayoutTests/http/tests/workers/service/service-worker-registration-gc-event.html	2021-03-22 19:00:23 UTC (rev 274768)
@@ -7,7 +7,7 @@
 <script>
 let updatefoundCount = 0;
 
-navigator.serviceWorker.register("resources/updating-worker.php", { }).then(function(registration) {
+navigator.serviceWorker.register("resources/updating-worker.py", { }).then(function(registration) {
     registration.addEventListener("updatefound", function() {
         gc();
         log("updatefound event fired");

Modified: trunk/LayoutTests/http/tests/workers/text-encoding.html (274767 => 274768)


--- trunk/LayoutTests/http/tests/workers/text-encoding.html	2021-03-22 18:51:43 UTC (rev 274767)
+++ trunk/LayoutTests/http/tests/workers/text-encoding.html	2021-03-22 19:00:23 UTC (rev 274768)
@@ -53,15 +53,15 @@
 log("Document, Workers", "All XHR responses should match this: " + String.fromCharCode(0x41F, 0x440, 0x438, 0x432, 0x435, 0x442));
 
 // Run a worker w/o http header. It should inherit the encoding of the document.
-var worker1 = new Worker("resources/worker-encoded.php");
+var worker1 = new Worker("resources/worker-encoded.py");
 worker1._onmessage_ = function(evt) { log("worker 1", evt.data); };
 
 // Run a worker with http header specifying charset. This new charset should be in effect.
-var worker2 = new Worker("resources/worker-encoded.php?charset=koi8-r");
+var worker2 = new Worker("resources/worker-encoded.py?charset=koi8-r");
 worker2._onmessage_ = function(evt) { log("worker 2", evt.data); };
 
 // Request some content. It should be decoded using UTF-8 even though current document is Windows-1251.
-var xhr = new XMLHttpRequest();xhr.open("GET", "resources/xhr-response.php", false);
+var xhr = new XMLHttpRequest();xhr.open("GET", "resources/xhr-response.py", false);
 xhr.send();log("Document: ", xhr.responseText);
 
 </script>

Modified: trunk/LayoutTests/http/tests/workers/worker-importScripts-banned-mimetype-expected.txt (274767 => 274768)


--- trunk/LayoutTests/http/tests/workers/worker-importScripts-banned-mimetype-expected.txt	2021-03-22 18:51:43 UTC (rev 274767)
+++ trunk/LayoutTests/http/tests/workers/worker-importScripts-banned-mimetype-expected.txt	2021-03-22 19:00:23 UTC (rev 274768)
@@ -3,7 +3,7 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-Starting worker: resources/worker-importScripts-banned-mimetype.php
+Starting worker: resources/worker-importScripts-banned-mimetype.py
 PASS [Worker] self.scriptsSuccessfullyLoaded is 0
 PASS successfullyParsed is true
 

Modified: trunk/LayoutTests/http/tests/workers/worker-importScripts-banned-mimetype.html (274767 => 274768)


--- trunk/LayoutTests/http/tests/workers/worker-importScripts-banned-mimetype.html	2021-03-22 18:51:43 UTC (rev 274767)
+++ trunk/LayoutTests/http/tests/workers/worker-importScripts-banned-mimetype.html	2021-03-22 19:00:23 UTC (rev 274768)
@@ -6,7 +6,7 @@
 </head>
 <body>
 <script>
-startWorker("resources/worker-importScripts-banned-mimetype.php");
+startWorker("resources/worker-importScripts-banned-mimetype.py");
 </script>
 </body>
 </html>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to