Title: [220111] trunk
Revision
220111
Author
[email protected]
Date
2017-08-01 14:02:37 -0700 (Tue, 01 Aug 2017)

Log Message

Layout tests with 'https' suffix should be run over HTTPS
https://bugs.webkit.org/show_bug.cgi?id=174992

Patch by Youenn Fablet <[email protected]> on 2017-08-01
Reviewed by Chris Dumez.

Tools:

Updating the test-name <-> uri conversion routines to use https when test names contain ".https." in them.
This covers WPT tests, WPT WebKit tests and HTTP layout tests.
Covered by corresponding unit tests.

* Scripts/webkitpy/layout_tests/servers/run_webkit_httpd.py:
(run_server):
* Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py:
(base_http_url):
(base_https_url):
(base_url): Deleted.
* Scripts/webkitpy/port/base.py:
(Port.to.web_platform_test_server_base_http_url):
(Port.to):
(Port.to.web_platform_test_server_base_https_url):
(Port.to.web_platform_test_server_base_url): Deleted.
* Scripts/webkitpy/port/driver.py:
(Driver.__init__):
(Driver.wpt_test_path_to_uri):
(Driver):
(Driver.http_test_path_to_uri):
(Driver.test_to_uri):
(Driver.uri_to_test):
* Scripts/webkitpy/port/driver_unittest.py:
(DriverTest.test_test_to_uri):
(DriverTest.test_uri_to_test):

LayoutTests:

Updating test to allow display insecure content as otherwise the test would not complete now that it is run over HTTPS.
Adding WK1 expected files as the warning message is not printed.

* http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/iframe-upgrade.https-expected.txt:
* http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/iframe-upgrade.https.html:
* platform/ios-wk1/http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/iframe-upgrade.https-expected.txt: Added.
* platform/mac-wk1/http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/iframe-upgrade.https-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (220110 => 220111)


--- trunk/LayoutTests/ChangeLog	2017-08-01 20:47:21 UTC (rev 220110)
+++ trunk/LayoutTests/ChangeLog	2017-08-01 21:02:37 UTC (rev 220111)
@@ -1,3 +1,18 @@
+2017-08-01  Youenn Fablet  <[email protected]>
+
+        Layout tests with 'https' suffix should be run over HTTPS
+        https://bugs.webkit.org/show_bug.cgi?id=174992
+
+        Reviewed by Chris Dumez.
+
+        Updating test to allow display insecure content as otherwise the test would not complete now that it is run over HTTPS.
+        Adding WK1 expected files as the warning message is not printed.
+
+        * http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/iframe-upgrade.https-expected.txt:
+        * http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/iframe-upgrade.https.html:
+        * platform/ios-wk1/http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/iframe-upgrade.https-expected.txt: Added.
+        * platform/mac-wk1/http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/iframe-upgrade.https-expected.txt: Added.
+
 2017-08-01  Matt Lewis  <[email protected]>
 
         Marked imported/w3c/IndexedDB-private-browsing/idbfactory_open.html as flaky.

Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/iframe-upgrade.https-expected.txt (220110 => 220111)


--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/iframe-upgrade.https-expected.txt	2017-08-01 20:47:21 UTC (rev 220110)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/iframe-upgrade.https-expected.txt	2017-08-01 21:02:37 UTC (rev 220111)
@@ -1,5 +1,7 @@
+CONSOLE MESSAGE: line 1: The page at about:srcdoc was allowed to display insecure content from http://localhost:8000/security/resources/post-origin-to-parent.html.
 
 
+
 PASS Same-host frames are upgraded. 
 PASS Cross-host frames are upgraded. 
 PASS Upgrade policy does NOT cascade to nested, cross-host frames. 

Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/iframe-upgrade.https.html (220110 => 220111)


--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/iframe-upgrade.https.html	2017-08-01 20:47:21 UTC (rev 220110)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/iframe-upgrade.https.html	2017-08-01 21:02:37 UTC (rev 220111)
@@ -40,6 +40,10 @@
 }, "Cross-host frames are upgraded.");
 
 async_test(t => {
+    // WEBKIT change: updated the test to allow display of insecure content.
+    if (window.internals)
+        internals.settings.setAllowDisplayOfInsecureContent(true);
+
     var iframe = document.createElement('iframe');
     iframe.srcdoc = "<a href=''>Navigate!</a>" +
                "<script>document.querySelector('a').click()</scr" + "ipt>";

Copied: trunk/LayoutTests/platform/ios-wk1/http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/iframe-upgrade.https-expected.txt (from rev 220110, trunk/LayoutTests/http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/iframe-upgrade.https-expected.txt) (0 => 220111)


--- trunk/LayoutTests/platform/ios-wk1/http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/iframe-upgrade.https-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/ios-wk1/http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/iframe-upgrade.https-expected.txt	2017-08-01 21:02:37 UTC (rev 220111)
@@ -0,0 +1,6 @@
+
+
+PASS Same-host frames are upgraded. 
+PASS Cross-host frames are upgraded. 
+PASS Upgrade policy does NOT cascade to nested, cross-host frames. 
+

Copied: trunk/LayoutTests/platform/mac-wk1/http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/iframe-upgrade.https-expected.txt (from rev 220110, trunk/LayoutTests/http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/iframe-upgrade.https-expected.txt) (0 => 220111)


--- trunk/LayoutTests/platform/mac-wk1/http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/iframe-upgrade.https-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-wk1/http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/iframe-upgrade.https-expected.txt	2017-08-01 21:02:37 UTC (rev 220111)
@@ -0,0 +1,6 @@
+
+
+PASS Same-host frames are upgraded. 
+PASS Cross-host frames are upgraded. 
+PASS Upgrade policy does NOT cascade to nested, cross-host frames. 
+

Modified: trunk/Tools/ChangeLog (220110 => 220111)


--- trunk/Tools/ChangeLog	2017-08-01 20:47:21 UTC (rev 220110)
+++ trunk/Tools/ChangeLog	2017-08-01 21:02:37 UTC (rev 220111)
@@ -1,3 +1,36 @@
+2017-08-01  Youenn Fablet  <[email protected]>
+
+        Layout tests with 'https' suffix should be run over HTTPS
+        https://bugs.webkit.org/show_bug.cgi?id=174992
+
+        Reviewed by Chris Dumez.
+
+        Updating the test-name <-> uri conversion routines to use https when test names contain ".https." in them.
+        This covers WPT tests, WPT WebKit tests and HTTP layout tests.
+        Covered by corresponding unit tests.
+
+        * Scripts/webkitpy/layout_tests/servers/run_webkit_httpd.py:
+        (run_server):
+        * Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py:
+        (base_http_url):
+        (base_https_url):
+        (base_url): Deleted.
+        * Scripts/webkitpy/port/base.py:
+        (Port.to.web_platform_test_server_base_http_url):
+        (Port.to):
+        (Port.to.web_platform_test_server_base_https_url):
+        (Port.to.web_platform_test_server_base_url): Deleted.
+        * Scripts/webkitpy/port/driver.py:
+        (Driver.__init__):
+        (Driver.wpt_test_path_to_uri):
+        (Driver):
+        (Driver.http_test_path_to_uri):
+        (Driver.test_to_uri):
+        (Driver.uri_to_test):
+        * Scripts/webkitpy/port/driver_unittest.py:
+        (DriverTest.test_test_to_uri):
+        (DriverTest.test_uri_to_test):
+
 2017-07-26  Jiewen Tan  <[email protected]>
 
         Add tests to detect mistakes in backward compatibility when the structured clone algorithm is changed in the future

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/servers/run_webkit_httpd.py (220110 => 220111)


--- trunk/Tools/Scripts/webkitpy/layout_tests/servers/run_webkit_httpd.py	2017-08-01 20:47:21 UTC (rev 220110)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/servers/run_webkit_httpd.py	2017-08-01 21:02:37 UTC (rev 220111)
@@ -68,7 +68,7 @@
         return EXCEPTIONAL_EXIT_STATUS
 
     if options.web_platform_test_server:
-        print "Starting web-platform-tests server on <%s>" % web_platform_test_server.base_url(port)
+        print "Starting web-platform-tests server on <%s> and <%s>" % (web_platform_test_server.base_http_url(port), web_platform_test_server.base_https_url(port))
         port.start_web_platform_test_server()
 
     if options.httpd_server:

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py (220110 => 220111)


--- trunk/Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py	2017-08-01 20:47:21 UTC (rev 220110)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py	2017-08-01 21:02:37 UTC (rev 220111)
@@ -45,7 +45,7 @@
     return json.loads(json_data)
 
 
-def base_url(port_obj):
+def base_http_url(port_obj):
     config = wpt_config_json(port_obj)
     if not config:
         # This should only be hit by webkitpy unit tests
@@ -55,6 +55,16 @@
     return "http://" + config["host"] + ":" + str(ports["http"][0]) + "/"
 
 
+def base_https_url(port_obj):
+    config = wpt_config_json(port_obj)
+    if not config:
+        # This should only be hit by webkitpy unit tests
+        _log.debug("No WPT config file found")
+        return "https://localhost:9443/"
+    ports = config["ports"]
+    return "https://" + config["host"] + ":" + str(ports["https"][0]) + "/"
+
+
 def is_wpt_server_running(port_obj):
     config = wpt_config_json(port_obj)
     if not config:

Modified: trunk/Tools/Scripts/webkitpy/port/base.py (220110 => 220111)


--- trunk/Tools/Scripts/webkitpy/port/base.py	2017-08-01 20:47:21 UTC (rev 220110)
+++ trunk/Tools/Scripts/webkitpy/port/base.py	2017-08-01 21:02:37 UTC (rev 220111)
@@ -1017,9 +1017,12 @@
     def web_platform_test_server_doc_root(self):
         return web_platform_test_server.doc_root(self) + self.TEST_PATH_SEPARATOR
 
-    def web_platform_test_server_base_url(self):
-        return web_platform_test_server.base_url(self)
+    def web_platform_test_server_base_http_url(self):
+        return web_platform_test_server.base_http_url(self)
 
+    def web_platform_test_server_base_https_url(self):
+        return web_platform_test_server.base_https_url(self)
+
     def http_server_supports_ipv6(self):
         # Cygwin is the only platform to still use Apache 1.3, which only supports IPV4.
         # Once it moves to Apache 2, we can drop this method altogether.

Modified: trunk/Tools/Scripts/webkitpy/port/driver.py (220110 => 220111)


--- trunk/Tools/Scripts/webkitpy/port/driver.py	2017-08-01 20:47:21 UTC (rev 220110)
+++ trunk/Tools/Scripts/webkitpy/port/driver.py	2017-08-01 21:02:37 UTC (rev 220111)
@@ -167,7 +167,8 @@
             self._profiler = None
 
         self.web_platform_test_server_doc_root = self._port.web_platform_test_server_doc_root()
-        self.web_platform_test_server_base_url = self._port.web_platform_test_server_base_url()
+        self.web_platform_test_server_base_http_url = self._port.web_platform_test_server_base_http_url()
+        self.web_platform_test_server_base_https_url = self._port.web_platform_test_server_base_https_url()
 
     def __del__(self):
         self.stop()
@@ -266,23 +267,24 @@
     def is_web_platform_test(self, test_name):
         return test_name.startswith(self.web_platform_test_server_doc_root)
 
+    def wpt_test_path_to_uri(self, path):
+        return self.web_platform_test_server_base_https_url + path if ".https." in path else self.web_platform_test_server_base_http_url + path
+
+    def http_test_path_to_uri(self, path):
+        return "https://127.0.0.1:8443/" + path if path.startswith("ssl") or ".https." in path else "http://127.0.0.1:8000/" + path
+
     def test_to_uri(self, test_name):
         """Convert a test name to a URI."""
         if self.is_web_platform_test(test_name):
-            return self.web_platform_test_server_base_url + test_name[len(self.web_platform_test_server_doc_root):]
+            return self.wpt_test_path_to_uri(test_name[len(self.web_platform_test_server_doc_root):])
         if self.is_webkit_specific_web_platform_test(test_name):
-            return self.web_platform_test_server_base_url + self.WEBKIT_WEB_PLATFORM_TEST_SERVER_ROUTE + test_name[len(self.WEBKIT_SPECIFIC_WEB_PLATFORM_TEST_SUBDIR):]
+            return self.wpt_test_path_to_uri(self.WEBKIT_WEB_PLATFORM_TEST_SERVER_ROUTE + test_name[len(self.WEBKIT_SPECIFIC_WEB_PLATFORM_TEST_SUBDIR):])
 
         if not self.is_http_test(test_name):
             return path.abspath_to_uri(self._port.host.platform, self._port.abspath_for_test(test_name))
 
-        relative_path = test_name[len(self.HTTP_DIR):]
+        return self.http_test_path_to_uri(test_name[len(self.HTTP_DIR):])
 
-        # TODO(dpranke): remove the SSL reference?
-        if relative_path.startswith("ssl/"):
-            return "https://127.0.0.1:8443/" + relative_path
-        return "http://127.0.0.1:8000/" + relative_path
-
     def uri_to_test(self, uri):
         """Return the base layout test name for a given URI.
 
@@ -296,10 +298,14 @@
             if not prefix.endswith('/'):
                 prefix += '/'
             return uri[len(prefix):]
-        if uri.startswith(self.web_platform_test_server_base_url + self.WEBKIT_WEB_PLATFORM_TEST_SERVER_ROUTE):
-            return uri.replace(self.web_platform_test_server_base_url + self.WEBKIT_WEB_PLATFORM_TEST_SERVER_ROUTE, self.WEBKIT_SPECIFIC_WEB_PLATFORM_TEST_SUBDIR)
-        if uri.startswith(self.web_platform_test_server_base_url):
-            return uri.replace(self.web_platform_test_server_base_url, self.web_platform_test_server_doc_root)
+        if uri.startswith(self.web_platform_test_server_base_http_url + self.WEBKIT_WEB_PLATFORM_TEST_SERVER_ROUTE):
+            return uri.replace(self.web_platform_test_server_base_http_url + self.WEBKIT_WEB_PLATFORM_TEST_SERVER_ROUTE, self.WEBKIT_SPECIFIC_WEB_PLATFORM_TEST_SUBDIR)
+        if uri.startswith(self.web_platform_test_server_base_https_url + self.WEBKIT_WEB_PLATFORM_TEST_SERVER_ROUTE):
+            return uri.replace(self.web_platform_test_server_base_https_url + self.WEBKIT_WEB_PLATFORM_TEST_SERVER_ROUTE, self.WEBKIT_SPECIFIC_WEB_PLATFORM_TEST_SUBDIR)
+        if uri.startswith(self.web_platform_test_server_base_http_url):
+            return uri.replace(self.web_platform_test_server_base_http_url, self.web_platform_test_server_doc_root)
+        if uri.startswith(self.web_platform_test_server_base_https_url):
+            return uri.replace(self.web_platform_test_server_base_https_url, self.web_platform_test_server_doc_root)
         if uri.startswith("http://"):
             return uri.replace('http://127.0.0.1:8000/', self.HTTP_DIR)
         if uri.startswith("https://"):

Modified: trunk/Tools/Scripts/webkitpy/port/driver_unittest.py (220110 => 220111)


--- trunk/Tools/Scripts/webkitpy/port/driver_unittest.py	2017-08-01 20:47:21 UTC (rev 220110)
+++ trunk/Tools/Scripts/webkitpy/port/driver_unittest.py	2017-08-01 21:02:37 UTC (rev 220111)
@@ -118,7 +118,9 @@
         self.assertEqual(driver.test_to_uri('http/tests/foo.html'), 'http://127.0.0.1:8000/foo.html')
         self.assertEqual(driver.test_to_uri('http/tests/ssl/bar.html'), 'https://127.0.0.1:8443/ssl/bar.html')
         self.assertEqual(driver.test_to_uri('imported/w3c/web-platform-tests/foo/bar.html'), 'http://localhost:8800/foo/bar.html')
+        self.assertEqual(driver.test_to_uri('imported/w3c/web-platform-tests/foo/bar.https.html'), 'https://localhost:9443/foo/bar.https.html')
         self.assertEqual(driver.test_to_uri('http/wpt/bar2.html'), 'http://localhost:8800/WebKit/bar2.html')
+        self.assertEqual(driver.test_to_uri('http/wpt/bar2.https.html'), 'https://localhost:9443/WebKit/bar2.https.html')
 
     def test_uri_to_test(self):
         port = self.make_port()
@@ -126,8 +128,10 @@
         self.assertEqual(driver.uri_to_test('file://%s/foo/bar.html' % port.layout_tests_dir()), 'foo/bar.html')
         self.assertEqual(driver.uri_to_test('http://127.0.0.1:8000/foo.html'), 'http/tests/foo.html')
         self.assertEqual(driver.uri_to_test('https://127.0.0.1:8443/ssl/bar.html'), 'http/tests/ssl/bar.html')
+        self.assertEqual(driver.uri_to_test('https://127.0.0.1:8443/ssl/bar.https.html'), 'http/tests/ssl/bar.https.html')
         self.assertEqual(driver.uri_to_test('http://localhost:8800/foo/bar.html'), 'imported/w3c/web-platform-tests/foo/bar.html')
         self.assertEqual(driver.uri_to_test('http://localhost:8800/WebKit/bar2.html'), 'http/wpt/bar2.html')
+        self.assertEqual(driver.uri_to_test('https://localhost:9443/WebKit/bar2.https.html'), 'http/wpt/bar2.https.html')
 
     def test_read_block(self):
         port = TestWebKitPort()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to