Title: [276731] trunk/LayoutTests
Revision
276731
Author
cgambr...@apple.com
Date
2021-04-28 13:03:35 -0700 (Wed, 28 Apr 2021)

Log Message

[ Win ] 4 http/tests/security/contentSecurityPolicy/ tests are failing
https://bugs.webkit.org/show_bug.cgi?id=225071
<rdar://problem/77172923>

Reviewed by Jonathan Bedard.

* http/tests/resources/redirect.py:
(add_cache_control):
(addCacheControl): Deleted.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (276730 => 276731)


--- trunk/LayoutTests/ChangeLog	2021-04-28 19:59:46 UTC (rev 276730)
+++ trunk/LayoutTests/ChangeLog	2021-04-28 20:03:35 UTC (rev 276731)
@@ -1,3 +1,15 @@
+2021-04-28  Chris Gambrell  <cgambr...@apple.com>
+
+        [ Win ] 4 http/tests/security/contentSecurityPolicy/ tests are failing
+        https://bugs.webkit.org/show_bug.cgi?id=225071
+        <rdar://problem/77172923>
+
+        Reviewed by Jonathan Bedard.
+
+        * http/tests/resources/redirect.py:
+        (add_cache_control):
+        (addCacheControl): Deleted.
+
 2021-04-28  Wenson Hsieh  <wenson_hs...@apple.com>
 
         Fine-tune some more selection behaviors in image overlays

Modified: trunk/LayoutTests/http/tests/resources/redirect.py (276730 => 276731)


--- trunk/LayoutTests/http/tests/resources/redirect.py	2021-04-28 19:59:46 UTC (rev 276730)
+++ trunk/LayoutTests/http/tests/resources/redirect.py	2021-04-28 20:03:35 UTC (rev 276731)
@@ -1,40 +1,50 @@
 #!/usr/bin/env python3
+
 import os
 import sys
-
 from urllib.parse import unquote
 
 
-def addCacheControl(allowCache=True):
-    if allowCache:
-        sys.stdout.write('Cache-Control: public, max-age=86400\r\n')
+def add_cache_control(allow_cache):
+    if allow_cache is not None:
+        sys.stdout.write('Cache-Control: public, max-age=86400\r\n\r\n')
     else:
-        sys.stdout.write('Cache-Control: no-store\r\n')
+        # Workaround for https://bugs.webkit.org/show_bug.cgi?id=77538
+        # Caching redirects results in flakiness in tests that dump loader delegates.
+        sys.stdout.write('Cache-Control: no-store\r\n\r\n')
 
-sys.stdout.write('Content-Type: text/html\r\n')
 
 query = {}
-for part in os.environ.get('QUERY_STRING', '').split('&'):
-    if not part:
-        continue
-    query[part.split('=')[0]] = '='.join(part.split('=')[1:])
+for key_value in os.environ.get('QUERY_STRING', '').split('&'):
+    arr = key_value.split('=')
+    if len(arr) > 1:
+        if query.get(arr[0], None) is not None and arr[1] not in query[arr[0]]:
+            query[arr[0]].append(unquote('='.join(arr[1:])))
+        else:
+            query[arr[0]] = [unquote('='.join(arr[1:]))]
+    else:
+        query[arr[0]] = ['']
 
-url = "" None))
-allowCache = True if query.get('allowCache', None) is not None else False
-refresh = query.get('refresh', None)
-code = query.get('code', '302')
 
-if refresh:
+allow_cache = query.get('allowCache', [None])[0]
+code = int(query.get('code', [302])[0])
+refresh = query.get('refresh', [None])[0]
+url = "" [''])[0]
+
+sys.stdout.write('Content-Type: text/html\r\n')
+
+if refresh is not None:
     sys.stdout.write(
         'status: 200\r\n'
         'Refresh: {}; url="" url)
     )
-    addCacheControl(allowCache)
-    sys.stdout.write('\r\n')
+
+    add_cache_control(allow_cache)
     sys.exit(0)
 
-sys.stdout.write('status: {}\r\n'.format(code))
-sys.stdout.write('Location: {}\r\n'.format(url))
-addCacheControl(allowCache)
-sys.stdout.write('\r\n')
+sys.stdout.write(
+    'status: {}\r\n'
+    'Location: {}\r\n'.format(code, url)
+)
 
+add_cache_control(allow_cache)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to