Diff
Modified: trunk/LayoutTests/ChangeLog (275398 => 275399)
--- trunk/LayoutTests/ChangeLog 2021-04-02 01:03:38 UTC (rev 275398)
+++ trunk/LayoutTests/ChangeLog 2021-04-02 01:07:30 UTC (rev 275399)
@@ -1,5 +1,23 @@
2021-04-01 Chris Gambrell <cgambr...@apple.com>
+ [LayoutTests] Convert http/tests/cache convert PHP to Python
+ https://bugs.webkit.org/show_bug.cgi?id=222935
+ <rdar://problem/75183314>
+
+ Reviewed by Jonathan Bedard.
+
+ * http/tests/cache/cache-redirections.html:
+ * http/tests/cache/resources/cache-control-redirect.php: Removed.
+ * http/tests/cache/resources/cache-control-redirect.py: Added.
+ * http/tests/cache/resources/permanent-redirect.php: Removed.
+ * http/tests/cache/resources/x-frame-options.php: Removed.
+ * http/tests/cache/resources/x-frame-options.py: Added.
+ * http/tests/cache/x-frame-options-304.html:
+ * http/tests/navigation/window-open-redirect-and-remove-opener.html:
+ * http/tests/xmlhttprequest/cacheable-cross-origin-redirect-crash.html:
+
+2021-04-01 Chris Gambrell <cgambr...@apple.com>
+
[LayoutTests] Convert http/tests/history convert PHP to Python
https://bugs.webkit.org/show_bug.cgi?id=222614
<rdar://problem/74946423>
@@ -257,6 +275,24 @@
2021-03-31 Chris Gambrell <cgambr...@apple.com>
+ [LayoutTests] Convert http/tests/cache convert PHP to Python
+ https://bugs.webkit.org/show_bug.cgi?id=222935
+ <rdar://problem/75183314>
+
+ Reviewed by Jonathan Bedard.
+
+ * http/tests/cache/cache-redirections.html:
+ * http/tests/cache/resources/cache-control-redirect.php: Removed.
+ * http/tests/cache/resources/cache-control-redirect.py: Added.
+ * http/tests/cache/resources/permanent-redirect.php: Removed.
+ * http/tests/cache/resources/x-frame-options.php: Removed.
+ * http/tests/cache/resources/x-frame-options.py: Added.
+ * http/tests/cache/x-frame-options-304.html:
+ * http/tests/navigation/window-open-redirect-and-remove-opener.html:
+ * http/tests/xmlhttprequest/cacheable-cross-origin-redirect-crash.html:
+
+2021-03-31 Chris Gambrell <cgambr...@apple.com>
+
[LayoutTests] Convert http/tests/appcache convert PHP to Python
https://bugs.webkit.org/show_bug.cgi?id=221286
<rdar://problem/73893844>
Modified: trunk/LayoutTests/http/tests/cache/cache-redirections.html (275398 => 275399)
--- trunk/LayoutTests/http/tests/cache/cache-redirections.html 2021-04-02 01:03:38 UTC (rev 275398)
+++ trunk/LayoutTests/http/tests/cache/cache-redirections.html 2021-04-02 01:07:30 UTC (rev 275399)
@@ -15,7 +15,7 @@
var counter = 0;
var resource = "No";
-var baseURL = "resources/cache-control-redirect.php?code=302&url=""
+var baseURL = "resources/cache-control-redirect.py?code=302&url=""
var testCases = [
{name : "Should reuse resource (cacheable redirection)", expected : true, url : baseURL + "&cache_control=public, max-age=1000", reloadDelay : 0},
{name : "Should reload resource (no-store redirection)", expected : false, url: baseURL + "&cache_control=no-store&max_age=1000", reloadDelay : 0},
Deleted: trunk/LayoutTests/http/tests/cache/resources/cache-control-redirect.php (275398 => 275399)
--- trunk/LayoutTests/http/tests/cache/resources/cache-control-redirect.php 2021-04-02 01:03:38 UTC (rev 275398)
+++ trunk/LayoutTests/http/tests/cache/resources/cache-control-redirect.php 2021-04-02 01:07:30 UTC (rev 275399)
@@ -1,27 +0,0 @@
-<?php
- $code = $_GET['code'];
- if (!isset($code))
- $code = 302;
- header('HTTP/1.1 ' . $code);
-
- $url = ""
- $random_id = $_GET['random_id'];
- if (isset($random_id)) {
- $id = '';
- $charset = 'ABCDEFGHIKLMNOPQRSTUVWXYZ0123456789';
- for ($i = 0; $i < 16; $i++)
- $id .= $charset[rand(0, strlen($charset) - 1)];
- header('Location: ' . $url . '?id=' . $id);
- }
- else
- header('Location: ' . $url);
-
- $expiration = $_GET['expiration'];
- if (isset($expiration)) {
- $expires = gmdate(DATE_RFC1123, time() + $expiration);
- header('Expires: ' . $expires);
- }
-
- $cache_control = $_GET['cache_control'];
- header('Cache-Control: ' . $cache_control);
-?>
Added: trunk/LayoutTests/http/tests/cache/resources/cache-control-redirect.py (0 => 275399)
--- trunk/LayoutTests/http/tests/cache/resources/cache-control-redirect.py (rev 0)
+++ trunk/LayoutTests/http/tests/cache/resources/cache-control-redirect.py 2021-04-02 01:07:30 UTC (rev 275399)
@@ -0,0 +1,33 @@
+#!/usr/bin/env python3
+
+import os
+import sys
+from random import randint
+from urllib.parse import parse_qs
+
+query = parse_qs(os.environ.get('QUERY_STRING', ''), keep_blank_values=True)
+cache_control = query.get('cache_control', [''])[0]
+code = query.get('code', [302])[-1]
+expiration = query.get('expiration', [None])[0]
+random_id = query.get('random_id', [None])[0]
+url = "" [''])[0]
+
+sys.stdout.write('status: {}\r\n'.format(int(code)))
+
+if random_id is not None:
+ ident = ''
+ charset = 'ABCDEFGHIKLMNOPQRSTUVWXYZ0123456789'
+ for _ in range(0, 16):
+ ident += charset[randint(0, len(charset) - 1)]
+ sys.stdout.write('Location: {}?id={}\r\n'.format(url, ident))
+else:
+ sys.stdout.write('Location: {}\r\n'.format(url))
+
+if expiration is not None:
+ expires = '{} +0000'.format(expires.strftime('%a, %d %b %Y %H:%M:%S'))
+ sys.stdout.write('Expires: {}\r\n'.format(expires))
+
+sys.stdout.write(
+ 'Content-Type: text/html\r\n'
+ 'Cache-Control: {}\r\n\r\n'.format(cache_control)
+)
\ No newline at end of file
Property changes on: trunk/LayoutTests/http/tests/cache/resources/cache-control-redirect.py
___________________________________________________________________
Added: svn:executable
+*
\ No newline at end of property
Deleted: trunk/LayoutTests/http/tests/cache/resources/permanent-redirect.php (275398 => 275399)
--- trunk/LayoutTests/http/tests/cache/resources/permanent-redirect.php 2021-04-02 01:03:38 UTC (rev 275398)
+++ trunk/LayoutTests/http/tests/cache/resources/permanent-redirect.php 2021-04-02 01:07:30 UTC (rev 275399)
@@ -1,6 +0,0 @@
-<?
-$location = $_GET['location'];
-
-header('HTTP/1.1 301 Permanent Redirect');
-header('Location:' . $location);
-?>
Deleted: trunk/LayoutTests/http/tests/cache/resources/x-frame-options.php (275398 => 275399)
--- trunk/LayoutTests/http/tests/cache/resources/x-frame-options.php 2021-04-02 01:03:38 UTC (rev 275398)
+++ trunk/LayoutTests/http/tests/cache/resources/x-frame-options.php 2021-04-02 01:07:30 UTC (rev 275399)
@@ -1,26 +0,0 @@
-<?php
-require_once '../../resources/portabilityLayer.php';
-
-clearstatcache();
-
-if ($_SERVER["HTTP_IF_MODIFIED_SINCE"]) {
- header("HTTP/1.0 304 Not Modified");
- exit();
-}
-$_one_year_ = 12 * 31 * 24 * 60 * 60;
-$last_modified = gmdate(DATE_RFC1123, time() - $one_year);
-$expires = gmdate(DATE_RFC1123, time() + $one_year);
-
-
-header('Cache-Control: no-cache, max-age=' . $one_year);
-header('Expires: ' . $expires);
-header('Content-Type: text/html');
-header('Etag: 123456789');
-header('Last-Modified: ' . $last_modified);
-header('X-FRAME-OPTIONS: ALLOWALL');
-
-echo "<body><script>\n";
-echo "window._onload_ = function() { window.parent.test(); }\n";
-echo "</script></body>\n";
-
-?>
Added: trunk/LayoutTests/http/tests/cache/resources/x-frame-options.py (0 => 275399)
--- trunk/LayoutTests/http/tests/cache/resources/x-frame-options.py (rev 0)
+++ trunk/LayoutTests/http/tests/cache/resources/x-frame-options.py 2021-04-02 01:07:30 UTC (rev 275399)
@@ -0,0 +1,29 @@
+#!/usr/bin/env python3
+
+import os
+import sys
+from datetime import datetime, timedelta
+
+modified_since = os.environ.get('HTTP_IF_MODIFIED_SINCE', '')
+
+sys.stdout.write('Content-Type: text/html\r\n')
+
+if modified_since:
+ sys.stdout.write('status: 304\r\n\r\n')
+ sys.exit(0)
+
+_one_year_ = 365 * 24 * 60 * 60
+last_modified = '{} +0000'.format((datetime.utcnow() - timedelta(seconds=one_year)).strftime('%a, %d %b %Y %H:%M:%S'))
+expires = '{} +0000'.format((datetime.utcnow() + timedelta(seconds=one_year)).strftime('%a, %d %b %Y %H:%M:%S'))
+
+sys.stdout.write(
+ 'Cache-Control: no-cache, max-age={}\r\n'
+ 'Expires: {}\r\n'
+ 'Content-Type: text/html\r\n'
+ 'Etag: 123456789\r\n'
+ 'Last-Modified: {}\r\n'
+ 'X-FRAME-OPTIONS: ALLOWALL\r\n\r\n'
+ '<body><script>\n'
+ 'window._onload_ = function() {{ window.parent.test(); }}\n'
+ '</script></body>\n'.format(one_year, expires, last_modified)
+)
\ No newline at end of file
Property changes on: trunk/LayoutTests/http/tests/cache/resources/x-frame-options.py
___________________________________________________________________
Added: svn:executable
+*
\ No newline at end of property
Modified: trunk/LayoutTests/http/tests/cache/x-frame-options-304.html (275398 => 275399)
--- trunk/LayoutTests/http/tests/cache/x-frame-options-304.html 2021-04-02 01:03:38 UTC (rev 275398)
+++ trunk/LayoutTests/http/tests/cache/x-frame-options-304.html 2021-04-02 01:07:30 UTC (rev 275399)
@@ -17,9 +17,9 @@
document.body.removeChild(document.body.lastChild);
var iframe = document.createElement("iframe");
- iframe.src = ""
+ iframe.src = ""
document.body.appendChild(iframe);
}
</script>
-<iframe src=""
+<iframe src=""
</body>
Modified: trunk/LayoutTests/http/tests/navigation/window-open-redirect-and-remove-opener.html (275398 => 275399)
--- trunk/LayoutTests/http/tests/navigation/window-open-redirect-and-remove-opener.html 2021-04-02 01:03:38 UTC (rev 275398)
+++ trunk/LayoutTests/http/tests/navigation/window-open-redirect-and-remove-opener.html 2021-04-02 01:07:30 UTC (rev 275399)
@@ -18,7 +18,7 @@
<p>Tests that we do not crash when removing the opener after using window.open() to load a resource that redirects.</p>
<iframe name="A" srcdoc='
<script>
-window.open("http://127.0.0.1:8000/cache/resources/cache-control-redirect.php?url="" "B");
+window.open("http://127.0.0.1:8000/cache/resources/cache-control-redirect.py?url="" "B");
parent.removeIframeA();
</script>
'></iframe>
Modified: trunk/LayoutTests/http/tests/xmlhttprequest/cacheable-cross-origin-redirect-crash.html (275398 => 275399)
--- trunk/LayoutTests/http/tests/xmlhttprequest/cacheable-cross-origin-redirect-crash.html 2021-04-02 01:03:38 UTC (rev 275398)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/cacheable-cross-origin-redirect-crash.html 2021-04-02 01:07:30 UTC (rev 275399)
@@ -6,7 +6,7 @@
description("Tests that we do not crash when XHR reuses a cached resource that contains a simple cross origin redirect.");
jsTestIsAsync = true;
-const url = ""
+const url = ""
xhr = new XMLHttpRequest();
xhr.withCredentials = true;