Changeset 220111 in webkit


Ignore:
Timestamp:
Aug 1, 2017 2:02:37 PM (7 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Youenn Fablet <youenn@apple.com> 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.
Location:
trunk
Files:
2 added
9 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r220110 r220111  
     12017-08-01  Youenn Fablet  <youenn@apple.com>
     2
     3        Layout tests with 'https' suffix should be run over HTTPS
     4        https://bugs.webkit.org/show_bug.cgi?id=174992
     5
     6        Reviewed by Chris Dumez.
     7
     8        Updating test to allow display insecure content as otherwise the test would not complete now that it is run over HTTPS.
     9        Adding WK1 expected files as the warning message is not printed.
     10
     11        * http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/iframe-upgrade.https-expected.txt:
     12        * http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/iframe-upgrade.https.html:
     13        * platform/ios-wk1/http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/iframe-upgrade.https-expected.txt: Added.
     14        * platform/mac-wk1/http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/iframe-upgrade.https-expected.txt: Added.
     15
    1162017-08-01  Matt Lewis  <jlewis3@apple.com>
    217
  • trunk/LayoutTests/http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/iframe-upgrade.https-expected.txt

    r201753 r220111  
     1CONSOLE 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.
     2
    13
    24
  • trunk/LayoutTests/http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/iframe-upgrade.https.html

    r212178 r220111  
    4141
    4242async_test(t => {
     43    // WEBKIT change: updated the test to allow display of insecure content.
     44    if (window.internals)
     45        internals.settings.setAllowDisplayOfInsecureContent(true);
     46
    4347    var iframe = document.createElement('iframe');
    4448    iframe.srcdoc = "<a href='HTTP://localhost:8000/security/resources/post-origin-to-parent.html'>Navigate!</a>" +
  • trunk/Tools/ChangeLog

    r220109 r220111  
     12017-08-01  Youenn Fablet  <youenn@apple.com>
     2
     3        Layout tests with 'https' suffix should be run over HTTPS
     4        https://bugs.webkit.org/show_bug.cgi?id=174992
     5
     6        Reviewed by Chris Dumez.
     7
     8        Updating the test-name <-> uri conversion routines to use https when test names contain ".https." in them.
     9        This covers WPT tests, WPT WebKit tests and HTTP layout tests.
     10        Covered by corresponding unit tests.
     11
     12        * Scripts/webkitpy/layout_tests/servers/run_webkit_httpd.py:
     13        (run_server):
     14        * Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py:
     15        (base_http_url):
     16        (base_https_url):
     17        (base_url): Deleted.
     18        * Scripts/webkitpy/port/base.py:
     19        (Port.to.web_platform_test_server_base_http_url):
     20        (Port.to):
     21        (Port.to.web_platform_test_server_base_https_url):
     22        (Port.to.web_platform_test_server_base_url): Deleted.
     23        * Scripts/webkitpy/port/driver.py:
     24        (Driver.__init__):
     25        (Driver.wpt_test_path_to_uri):
     26        (Driver):
     27        (Driver.http_test_path_to_uri):
     28        (Driver.test_to_uri):
     29        (Driver.uri_to_test):
     30        * Scripts/webkitpy/port/driver_unittest.py:
     31        (DriverTest.test_test_to_uri):
     32        (DriverTest.test_uri_to_test):
     33
    1342017-07-26  Jiewen Tan  <jiewen_tan@apple.com>
    235
  • trunk/Tools/Scripts/webkitpy/layout_tests/servers/run_webkit_httpd.py

    r217276 r220111  
    6969
    7070    if options.web_platform_test_server:
    71         print "Starting web-platform-tests server on <%s>" % web_platform_test_server.base_url(port)
     71        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))
    7272        port.start_web_platform_test_server()
    7373
  • trunk/Tools/Scripts/webkitpy/layout_tests/servers/web_platform_test_server.py

    r217913 r220111  
    4646
    4747
    48 def base_url(port_obj):
     48def base_http_url(port_obj):
    4949    config = wpt_config_json(port_obj)
    5050    if not config:
     
    5454    ports = config["ports"]
    5555    return "http://" + config["host"] + ":" + str(ports["http"][0]) + "/"
     56
     57
     58def base_https_url(port_obj):
     59    config = wpt_config_json(port_obj)
     60    if not config:
     61        # This should only be hit by webkitpy unit tests
     62        _log.debug("No WPT config file found")
     63        return "https://localhost:9443/"
     64    ports = config["ports"]
     65    return "https://" + config["host"] + ":" + str(ports["https"][0]) + "/"
    5666
    5767
  • trunk/Tools/Scripts/webkitpy/port/base.py

    r218482 r220111  
    10181018        return web_platform_test_server.doc_root(self) + self.TEST_PATH_SEPARATOR
    10191019
    1020     def web_platform_test_server_base_url(self):
    1021         return web_platform_test_server.base_url(self)
     1020    def web_platform_test_server_base_http_url(self):
     1021        return web_platform_test_server.base_http_url(self)
     1022
     1023    def web_platform_test_server_base_https_url(self):
     1024        return web_platform_test_server.base_https_url(self)
    10221025
    10231026    def http_server_supports_ipv6(self):
  • trunk/Tools/Scripts/webkitpy/port/driver.py

    r218482 r220111  
    168168
    169169        self.web_platform_test_server_doc_root = self._port.web_platform_test_server_doc_root()
    170         self.web_platform_test_server_base_url = self._port.web_platform_test_server_base_url()
     170        self.web_platform_test_server_base_http_url = self._port.web_platform_test_server_base_http_url()
     171        self.web_platform_test_server_base_https_url = self._port.web_platform_test_server_base_https_url()
    171172
    172173    def __del__(self):
     
    267268        return test_name.startswith(self.web_platform_test_server_doc_root)
    268269
     270    def wpt_test_path_to_uri(self, path):
     271        return self.web_platform_test_server_base_https_url + path if ".https." in path else self.web_platform_test_server_base_http_url + path
     272
     273    def http_test_path_to_uri(self, path):
     274        return "https://127.0.0.1:8443/" + path if path.startswith("ssl") or ".https." in path else "http://127.0.0.1:8000/" + path
     275
    269276    def test_to_uri(self, test_name):
    270277        """Convert a test name to a URI."""
    271278        if self.is_web_platform_test(test_name):
    272             return self.web_platform_test_server_base_url + test_name[len(self.web_platform_test_server_doc_root):]
     279            return self.wpt_test_path_to_uri(test_name[len(self.web_platform_test_server_doc_root):])
    273280        if self.is_webkit_specific_web_platform_test(test_name):
    274             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):]
     281            return self.wpt_test_path_to_uri(self.WEBKIT_WEB_PLATFORM_TEST_SERVER_ROUTE + test_name[len(self.WEBKIT_SPECIFIC_WEB_PLATFORM_TEST_SUBDIR):])
    275282
    276283        if not self.is_http_test(test_name):
    277284            return path.abspath_to_uri(self._port.host.platform, self._port.abspath_for_test(test_name))
    278285
    279         relative_path = test_name[len(self.HTTP_DIR):]
    280 
    281         # TODO(dpranke): remove the SSL reference?
    282         if relative_path.startswith("ssl/"):
    283             return "https://127.0.0.1:8443/" + relative_path
    284         return "http://127.0.0.1:8000/" + relative_path
     286        return self.http_test_path_to_uri(test_name[len(self.HTTP_DIR):])
    285287
    286288    def uri_to_test(self, uri):
     
    297299                prefix += '/'
    298300            return uri[len(prefix):]
    299         if uri.startswith(self.web_platform_test_server_base_url + self.WEBKIT_WEB_PLATFORM_TEST_SERVER_ROUTE):
    300             return uri.replace(self.web_platform_test_server_base_url + self.WEBKIT_WEB_PLATFORM_TEST_SERVER_ROUTE, self.WEBKIT_SPECIFIC_WEB_PLATFORM_TEST_SUBDIR)
    301         if uri.startswith(self.web_platform_test_server_base_url):
    302             return uri.replace(self.web_platform_test_server_base_url, self.web_platform_test_server_doc_root)
     301        if uri.startswith(self.web_platform_test_server_base_http_url + self.WEBKIT_WEB_PLATFORM_TEST_SERVER_ROUTE):
     302            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)
     303        if uri.startswith(self.web_platform_test_server_base_https_url + self.WEBKIT_WEB_PLATFORM_TEST_SERVER_ROUTE):
     304            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)
     305        if uri.startswith(self.web_platform_test_server_base_http_url):
     306            return uri.replace(self.web_platform_test_server_base_http_url, self.web_platform_test_server_doc_root)
     307        if uri.startswith(self.web_platform_test_server_base_https_url):
     308            return uri.replace(self.web_platform_test_server_base_https_url, self.web_platform_test_server_doc_root)
    303309        if uri.startswith("http://"):
    304310            return uri.replace('http://127.0.0.1:8000/', self.HTTP_DIR)
  • trunk/Tools/Scripts/webkitpy/port/driver_unittest.py

    r218482 r220111  
    119119        self.assertEqual(driver.test_to_uri('http/tests/ssl/bar.html'), 'https://127.0.0.1:8443/ssl/bar.html')
    120120        self.assertEqual(driver.test_to_uri('imported/w3c/web-platform-tests/foo/bar.html'), 'http://localhost:8800/foo/bar.html')
     121        self.assertEqual(driver.test_to_uri('imported/w3c/web-platform-tests/foo/bar.https.html'), 'https://localhost:9443/foo/bar.https.html')
    121122        self.assertEqual(driver.test_to_uri('http/wpt/bar2.html'), 'http://localhost:8800/WebKit/bar2.html')
     123        self.assertEqual(driver.test_to_uri('http/wpt/bar2.https.html'), 'https://localhost:9443/WebKit/bar2.https.html')
    122124
    123125    def test_uri_to_test(self):
     
    127129        self.assertEqual(driver.uri_to_test('http://127.0.0.1:8000/foo.html'), 'http/tests/foo.html')
    128130        self.assertEqual(driver.uri_to_test('https://127.0.0.1:8443/ssl/bar.html'), 'http/tests/ssl/bar.html')
     131        self.assertEqual(driver.uri_to_test('https://127.0.0.1:8443/ssl/bar.https.html'), 'http/tests/ssl/bar.https.html')
    129132        self.assertEqual(driver.uri_to_test('http://localhost:8800/foo/bar.html'), 'imported/w3c/web-platform-tests/foo/bar.html')
    130133        self.assertEqual(driver.uri_to_test('http://localhost:8800/WebKit/bar2.html'), 'http/wpt/bar2.html')
     134        self.assertEqual(driver.uri_to_test('https://localhost:9443/WebKit/bar2.https.html'), 'http/wpt/bar2.https.html')
    131135
    132136    def test_read_block(self):
Note: See TracChangeset for help on using the changeset viewer.