Title: [209143] trunk
Revision
209143
Author
[email protected]
Date
2016-11-30 11:48:04 -0800 (Wed, 30 Nov 2016)

Log Message

Web Inspector: Clicking on link in Web Inspector can cause UIProcess to crash
https://bugs.webkit.org/show_bug.cgi?id=165157
<rdar://problem/27896562>

Reviewed by Brian Burg.

Source/WebInspectorUI:

By correctly disallowing slashes in the scheme Web Inspector resolves
the correct absolute URL and doesn't end up trying to navigate to an
incorrect file URL.

* UserInterface/Base/URLUtilities.js:
(parseURL):
Disallow "/" characters in the scheme portion. (/http://example.com)
Allow path to be optional before a fragment portion. (http://example.com#frag)

LayoutTests:

* inspector/unit-tests/url-utilities-expected.txt:
* inspector/unit-tests/url-utilities.html:
Add some tests for expected valid and invalid parseURL cases.
Note some cases that we don't handle properly and would benefit
by switching to URL constructor which is a much larger change.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (209142 => 209143)


--- trunk/LayoutTests/ChangeLog	2016-11-30 19:39:12 UTC (rev 209142)
+++ trunk/LayoutTests/ChangeLog	2016-11-30 19:48:04 UTC (rev 209143)
@@ -1,3 +1,17 @@
+2016-11-30  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Clicking on link in Web Inspector can cause UIProcess to crash
+        https://bugs.webkit.org/show_bug.cgi?id=165157
+        <rdar://problem/27896562>
+
+        Reviewed by Brian Burg.
+
+        * inspector/unit-tests/url-utilities-expected.txt:
+        * inspector/unit-tests/url-utilities.html:
+        Add some tests for expected valid and invalid parseURL cases.
+        Note some cases that we don't handle properly and would benefit
+        by switching to URL constructor which is a much larger change.
+
 2016-11-30  Dave Hyatt  <[email protected]>
 
         [CSS Parser] Fix a typo in a layout test for transforms

Modified: trunk/LayoutTests/inspector/unit-tests/url-utilities-expected.txt (209142 => 209143)


--- trunk/LayoutTests/inspector/unit-tests/url-utilities-expected.txt	2016-11-30 19:39:12 UTC (rev 209142)
+++ trunk/LayoutTests/inspector/unit-tests/url-utilities-expected.txt	2016-11-30 19:48:04 UTC (rev 209143)
@@ -1,16 +1,242 @@
 
 == Running test suite: URLUtilities
+-- Running test case: parseURL
+
+Test Invalid: a
+PASS: Should not be a complete URL
+PASS: URL constructor thinks this is invalid
+
+Test Invalid: /http://example.com
+PASS: Should not be a complete URL
+PASS: URL constructor thinks this is invalid
+
+Test Valid: http://example.com
+PASS: scheme should be: 'http'
+PASS: host should be: 'example.com'
+PASS: port should be: 'null'
+PASS: path should be: 'null'
+PASS: queryString should be: 'null'
+PASS: fragment should be: 'null'
+PASS: lastPathComponent should be: 'null'
+
+Test Valid: http://example.com/
+PASS: scheme should be: 'http'
+PASS: host should be: 'example.com'
+PASS: port should be: 'null'
+PASS: path should be: '/'
+PASS: queryString should be: 'null'
+PASS: fragment should be: 'null'
+PASS: lastPathComponent should be: 'null'
+
+Test Valid: http://example.com:80/
+PASS: scheme should be: 'http'
+PASS: host should be: 'example.com'
+PASS: port should be: '80'
+PASS: path should be: '/'
+PASS: queryString should be: 'null'
+PASS: fragment should be: 'null'
+PASS: lastPathComponent should be: 'null'
+
+Test Valid: http://example.com/path/to/page.html
+PASS: scheme should be: 'http'
+PASS: host should be: 'example.com'
+PASS: port should be: 'null'
+PASS: path should be: '/path/to/page.html'
+PASS: queryString should be: 'null'
+PASS: fragment should be: 'null'
+PASS: lastPathComponent should be: 'page.html'
+
+Test Valid: http://example.com/path/to/page.html?
+PASS: scheme should be: 'http'
+PASS: host should be: 'example.com'
+PASS: port should be: 'null'
+PASS: path should be: '/path/to/page.html'
+PASS: queryString should be: ''
+PASS: fragment should be: 'null'
+PASS: lastPathComponent should be: 'page.html'
+
+Test Valid: http://example.com/path/to/page.html?a=1
+PASS: scheme should be: 'http'
+PASS: host should be: 'example.com'
+PASS: port should be: 'null'
+PASS: path should be: '/path/to/page.html'
+PASS: queryString should be: 'a=1'
+PASS: fragment should be: 'null'
+PASS: lastPathComponent should be: 'page.html'
+
+Test Valid: http://example.com/path/to/page.html?a=1&b=2
+PASS: scheme should be: 'http'
+PASS: host should be: 'example.com'
+PASS: port should be: 'null'
+PASS: path should be: '/path/to/page.html'
+PASS: queryString should be: 'a=1&b=2'
+PASS: fragment should be: 'null'
+PASS: lastPathComponent should be: 'page.html'
+
+Test Valid: http://example.com/path/to/page.html?a=1&b=2#test
+PASS: scheme should be: 'http'
+PASS: host should be: 'example.com'
+PASS: port should be: 'null'
+PASS: path should be: '/path/to/page.html'
+PASS: queryString should be: 'a=1&b=2'
+PASS: fragment should be: 'test'
+PASS: lastPathComponent should be: 'page.html'
+
+Test Valid: http://example.com:123/path/to/page.html?a=1&b=2#test
+PASS: scheme should be: 'http'
+PASS: host should be: 'example.com'
+PASS: port should be: '123'
+PASS: path should be: '/path/to/page.html'
+PASS: queryString should be: 'a=1&b=2'
+PASS: fragment should be: 'test'
+PASS: lastPathComponent should be: 'page.html'
+
+Test Valid: http://example.com/path/to/page.html#test
+PASS: scheme should be: 'http'
+PASS: host should be: 'example.com'
+PASS: port should be: 'null'
+PASS: path should be: '/path/to/page.html'
+PASS: queryString should be: 'null'
+PASS: fragment should be: 'test'
+PASS: lastPathComponent should be: 'page.html'
+
+Test Valid: http://example.com#alpha/beta
+PASS: scheme should be: 'http'
+PASS: host should be: 'example.com'
+PASS: port should be: 'null'
+PASS: path should be: 'null'
+PASS: queryString should be: 'null'
+PASS: fragment should be: 'alpha/beta'
+PASS: lastPathComponent should be: 'null'
+
+Test Valid: app-specific://example.com
+PASS: scheme should be: 'app-specific'
+PASS: host should be: 'example.com'
+PASS: port should be: 'null'
+PASS: path should be: 'null'
+PASS: queryString should be: 'null'
+PASS: fragment should be: 'null'
+PASS: lastPathComponent should be: 'null'
+
+Test Valid: http://example
+PASS: scheme should be: 'http'
+PASS: host should be: 'example'
+PASS: port should be: 'null'
+PASS: path should be: 'null'
+PASS: queryString should be: 'null'
+PASS: fragment should be: 'null'
+PASS: lastPathComponent should be: 'null'
+
+Test Valid: http://my.example.com
+PASS: scheme should be: 'http'
+PASS: host should be: 'my.example.com'
+PASS: port should be: 'null'
+PASS: path should be: 'null'
+PASS: queryString should be: 'null'
+PASS: fragment should be: 'null'
+PASS: lastPathComponent should be: 'null'
+
+Test Valid: data:text/plain,test
+PASS: scheme should be: 'data'
+PASS: host should be: 'null'
+PASS: port should be: 'null'
+PASS: path should be: 'null'
+PASS: queryString should be: 'null'
+PASS: fragment should be: 'null'
+PASS: lastPathComponent should be: 'null'
+
+-- Known issues <https://webkit.org/b/165155>
+
+Test Invalid: http://
+FAIL: Should not be a complete URL
+    Expected: truthy
+    Actual: false
+PASS: URL constructor thinks this is invalid
+
+Test Invalid: http://example.com:999999999
+FAIL: Should not be a complete URL
+    Expected: truthy
+    Actual: false
+PASS: URL constructor thinks this is invalid
+
+Test Valid: http:example.com/
+FAIL: scheme should be: 'http'
+    Expected: "http"
+    Actual: null
+FAIL: host should be: 'example.com'
+    Expected: "example.com"
+    Actual: null
+PASS: port should be: 'null'
+FAIL: path should be: '/'
+    Expected: "/"
+    Actual: null
+PASS: queryString should be: 'null'
+PASS: fragment should be: 'null'
+PASS: lastPathComponent should be: 'null'
+
+Test Valid: http:/example.com/
+FAIL: scheme should be: 'http'
+    Expected: "http"
+    Actual: null
+FAIL: host should be: 'example.com'
+    Expected: "example.com"
+    Actual: null
+PASS: port should be: 'null'
+FAIL: path should be: '/'
+    Expected: "/"
+    Actual: null
+PASS: queryString should be: 'null'
+PASS: fragment should be: 'null'
+PASS: lastPathComponent should be: 'null'
+
+Test Valid: http://user@pass:example.com/
+FAIL: scheme should be: 'http'
+    Expected: "http"
+    Actual: null
+FAIL: host should be: 'example.com'
+    Expected: "example.com"
+    Actual: null
+PASS: port should be: 'null'
+FAIL: path should be: '/'
+    Expected: "/"
+    Actual: null
+PASS: queryString should be: 'null'
+PASS: fragment should be: 'null'
+PASS: lastPathComponent should be: 'null'
+
+Test Valid: http://example.com?key=alpha/beta
+PASS: scheme should be: 'http'
+FAIL: host should be: 'example.com'
+    Expected: "example.com"
+    Actual: "example.com?key=alpha"
+PASS: port should be: 'null'
+FAIL: path should be: 'null'
+    Expected: null
+    Actual: "/beta"
+FAIL: queryString should be: 'key=alpha/beta'
+    Expected: "key=alpha/beta"
+    Actual: null
+PASS: fragment should be: 'null'
+FAIL: lastPathComponent should be: 'null'
+    Expected: null
+    Actual: "beta"
+
 -- Running test case: parseDataURL
-Test: https://webkit.org
+
+Test Invalid: https://webkit.org
 PASS: Should not be a data URL
-Test: data:
+
+Test Invalid: data:
 PASS: Should not be a data URL
-Test: data:text/plain;test
+
+Test Invalid: data:text/plain;test
 PASS: Should not be a data URL
-Test: data:text/plain;base64;test
+
+Test Invalid: data:text/plain;base64;test
 PASS: Should not be a data URL
 
-Test: data:,
+Test Valid: data:,
+PASS: scheme should always be 'data'
 PASS: mimeType should be: 'text/plain'
 PASS: charset should be: 'US-ASCII'
 PASS: base64 should be: 'false'
@@ -17,7 +243,8 @@
 PASS: data should be: ''
 PASS: Resolved content should be: ''
 
-Test: data:,test
+Test Valid: data:,test
+PASS: scheme should always be 'data'
 PASS: mimeType should be: 'text/plain'
 PASS: charset should be: 'US-ASCII'
 PASS: base64 should be: 'false'
@@ -24,7 +251,8 @@
 PASS: data should be: 'test'
 PASS: Resolved content should be: 'test'
 
-Test: data:text/plain,test
+Test Valid: data:text/plain,test
+PASS: scheme should always be 'data'
 PASS: mimeType should be: 'text/plain'
 PASS: charset should be: 'US-ASCII'
 PASS: base64 should be: 'false'
@@ -31,7 +259,8 @@
 PASS: data should be: 'test'
 PASS: Resolved content should be: 'test'
 
-Test: data:text/plain;charset=TEST,test
+Test Valid: data:text/plain;charset=TEST,test
+PASS: scheme should always be 'data'
 PASS: mimeType should be: 'text/plain'
 PASS: charset should be: 'TEST'
 PASS: base64 should be: 'false'
@@ -38,7 +267,8 @@
 PASS: data should be: 'test'
 PASS: Resolved content should be: 'test'
 
-Test: data:application/json,{"name":"test","list":[1,2,3]}
+Test Valid: data:application/json,{"name":"test","list":[1,2,3]}
+PASS: scheme should always be 'data'
 PASS: mimeType should be: 'application/json'
 PASS: charset should be: 'US-ASCII'
 PASS: base64 should be: 'false'
@@ -45,7 +275,8 @@
 PASS: data should be: '{"name":"test","list":[1,2,3]}'
 PASS: Resolved content should be: '{"name":"test","list":[1,2,3]}'
 
-Test: data:application/json,%7B%22name%22%3A%22test%22%2C%22list%22%3A%5B1%2C2%2C3%5D%7D
+Test Valid: data:application/json,%7B%22name%22%3A%22test%22%2C%22list%22%3A%5B1%2C2%2C3%5D%7D
+PASS: scheme should always be 'data'
 PASS: mimeType should be: 'application/json'
 PASS: charset should be: 'US-ASCII'
 PASS: base64 should be: 'false'
@@ -52,7 +283,8 @@
 PASS: data should be: '{"name":"test","list":[1,2,3]}'
 PASS: Resolved content should be: '{"name":"test","list":[1,2,3]}'
 
-Test: data:application/json;base64,eyJuYW1lIjoidGVzdCIsImxpc3QiOlsxLDIsM119
+Test Valid: data:application/json;base64,eyJuYW1lIjoidGVzdCIsImxpc3QiOlsxLDIsM119
+PASS: scheme should always be 'data'
 PASS: mimeType should be: 'application/json'
 PASS: charset should be: 'US-ASCII'
 PASS: base64 should be: 'true'
@@ -59,7 +291,8 @@
 PASS: data should be: 'eyJuYW1lIjoidGVzdCIsImxpc3QiOlsxLDIsM119'
 PASS: Resolved content should be: '{"name":"test","list":[1,2,3]}'
 
-Test: data:application/json;charset=utf-8;base64,eyJuYW1lIjoidGVzdCIsImxpc3QiOlsxLDIsM119
+Test Valid: data:application/json;charset=utf-8;base64,eyJuYW1lIjoidGVzdCIsImxpc3QiOlsxLDIsM119
+PASS: scheme should always be 'data'
 PASS: mimeType should be: 'application/json'
 PASS: charset should be: 'utf-8'
 PASS: base64 should be: 'true'
@@ -66,7 +299,8 @@
 PASS: data should be: 'eyJuYW1lIjoidGVzdCIsImxpc3QiOlsxLDIsM119'
 PASS: Resolved content should be: '{"name":"test","list":[1,2,3]}'
 
-Test: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==
+Test Valid: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==
+PASS: scheme should always be 'data'
 PASS: mimeType should be: 'image/png'
 PASS: charset should be: 'US-ASCII'
 PASS: base64 should be: 'true'

Modified: trunk/LayoutTests/inspector/unit-tests/url-utilities.html (209142 => 209143)


--- trunk/LayoutTests/inspector/unit-tests/url-utilities.html	2016-11-30 19:39:12 UTC (rev 209142)
+++ trunk/LayoutTests/inspector/unit-tests/url-utilities.html	2016-11-30 19:48:04 UTC (rev 209143)
@@ -8,16 +8,255 @@
     let suite = InspectorTest.createSyncSuite("URLUtilities");
 
     suite.addTestCase({
+        name: "parseURL",
+        test() {
+            function testInvalid(url) {
+                InspectorTest.log("");
+                InspectorTest.log("Test Invalid: " + url);
+                InspectorTest.expectThat(parseURL(url).scheme === null, "Should not be a complete URL");
+
+                try {
+                    new URL(url);
+                    InspectorTest.fail("URL constructor thinks this is valid");
+                } catch (e) {
+                    InspectorTest.pass("URL constructor thinks this is invalid");
+                }
+            }
+
+            function testValid(url, expected) {
+                InspectorTest.log("");
+                InspectorTest.log("Test Valid: " + url);
+
+                let {scheme: expectedScheme, host: expectedHost, port: expectedPort, path: expectedPath, queryString: expectedQueryString, fragment: expectedFragment, lastPathComponent: expectedLastPathComponent} = expected;
+                let {scheme: actualScheme, host: actualHost, port: actualPort, path: actualPath, queryString: actualQueryString, fragment: actualFragment, lastPathComponent: actualLastPathComponent} = parseURL(url);
+
+                InspectorTest.expectEqual(actualScheme, expectedScheme, `scheme should be: '${expectedScheme}'`);
+                InspectorTest.expectEqual(actualHost, expectedHost, `host should be: '${expectedHost}'`);
+                InspectorTest.expectEqual(actualPort, expectedPort, `port should be: '${expectedPort}'`);
+                InspectorTest.expectEqual(actualPath, expectedPath, `path should be: '${expectedPath}'`);
+                InspectorTest.expectEqual(actualQueryString, expectedQueryString, `queryString should be: '${expectedQueryString}'`);
+                InspectorTest.expectEqual(actualFragment, expectedFragment, `fragment should be: '${expectedFragment}'`);
+                InspectorTest.expectEqual(actualLastPathComponent, expectedLastPathComponent, `lastPathComponent should be: '${expectedLastPathComponent}'`);
+            }
+
+            testInvalid("a");
+            testInvalid("/http://example.com");
+
+            testValid("http://example.com", {
+                scheme: "http",
+                host: "example.com",
+                port: null,
+                path: null,
+                queryString: null,
+                fragment: null,
+                lastPathComponent: null,
+            });
+
+            testValid("http://example.com/", {
+                scheme: "http",
+                host: "example.com",
+                port: null,
+                path: "/",
+                queryString: null,
+                fragment: null,
+                lastPathComponent: null,
+            });
+
+            testValid("http://example.com:80/", {
+                scheme: "http",
+                host: "example.com",
+                port: 80,
+                path: "/",
+                queryString: null,
+                fragment: null,
+                lastPathComponent: null,
+            });
+
+            testValid("http://example.com/path/to/page.html", {
+                scheme: "http",
+                host: "example.com",
+                port: null,
+                path: "/path/to/page.html",
+                queryString: null,
+                fragment: null,
+                lastPathComponent: "page.html",
+            });
+
+            testValid("http://example.com/path/to/page.html?", {
+                scheme: "http",
+                host: "example.com",
+                port: null,
+                path: "/path/to/page.html",
+                queryString: "",
+                fragment: null,
+                lastPathComponent: "page.html",
+            });
+
+            testValid("http://example.com/path/to/page.html?a=1", {
+                scheme: "http",
+                host: "example.com",
+                port: null,
+                path: "/path/to/page.html",
+                queryString: "a=1",
+                fragment: null,
+                lastPathComponent: "page.html",
+            });
+
+            testValid("http://example.com/path/to/page.html?a=1&b=2", {
+                scheme: "http",
+                host: "example.com",
+                port: null,
+                path: "/path/to/page.html",
+                queryString: "a=1&b=2",
+                fragment: null,
+                lastPathComponent: "page.html",
+            });
+
+            testValid("http://example.com/path/to/page.html?a=1&b=2#test", {
+                scheme: "http",
+                host: "example.com",
+                port: null,
+                path: "/path/to/page.html",
+                queryString: "a=1&b=2",
+                fragment: "test",
+                lastPathComponent: "page.html",
+            });
+
+            testValid("http://example.com:123/path/to/page.html?a=1&b=2#test", {
+                scheme: "http",
+                host: "example.com",
+                port: 123,
+                path: "/path/to/page.html",
+                queryString: "a=1&b=2",
+                fragment: "test",
+                lastPathComponent: "page.html",
+            });
+
+            testValid("http://example.com/path/to/page.html#test", {
+                scheme: "http",
+                host: "example.com",
+                port: null,
+                path: "/path/to/page.html",
+                queryString: null,
+                fragment: "test",
+                lastPathComponent: "page.html",
+            });
+
+            testValid("http://example.com#alpha/beta", {
+                scheme: "http",
+                host: "example.com",
+                port: null,
+                path: null,
+                queryString: null,
+                fragment: "alpha/beta",
+                lastPathComponent: null,
+            });
+
+            testValid("app-specific://example.com", {
+                scheme: "app-specific",
+                host: "example.com",
+                port: null,
+                path: null,
+                queryString: null,
+                fragment: null,
+                lastPathComponent: null,
+            });
+
+            testValid("http://example", {
+                scheme: "http",
+                host: "example",
+                port: null,
+                path: null,
+                queryString: null,
+                fragment: null,
+                lastPathComponent: null,
+            });
+
+            testValid("http://my.example.com", {
+                scheme: "http",
+                host: "my.example.com",
+                port: null,
+                path: null,
+                queryString: null,
+                fragment: null,
+                lastPathComponent: null,
+            });
+
+            // Data URLs just spit back the scheme.
+            testValid("data:text/plain,test", {
+                scheme: "data",
+                host: null,
+                port: null,
+                path: null,
+                queryString: null,
+                fragment: null,
+                lastPathComponent: null,
+            });
+
+            // FIXME: <https://webkit.org/b/165155> Web Inspector: Use URL constructor to better handle all kinds of URLs
+            InspectorTest.log("");
+            InspectorTest.log("-- Known issues <https://webkit.org/b/165155>");
+
+            testInvalid("http://");
+            testInvalid("http://example.com:999999999");
+
+            testValid("http:example.com/", {
+                scheme: "http",
+                host: "example.com",
+                port: null,
+                path: "/",
+                queryString: null,
+                fragment: null,
+                lastPathComponent: null,
+            });
+
+            testValid("http:/example.com/", {
+                scheme: "http",
+                host: "example.com",
+                port: null,
+                path: "/",
+                queryString: null,
+                fragment: null,
+                lastPathComponent: null,
+            });
+
+            testValid("http://user@pass:example.com/", {
+                scheme: "http",
+                host: "example.com",
+                port: null,
+                path: "/",
+                queryString: null,
+                fragment: null,
+                lastPathComponent: null,
+            });
+
+            testValid("http://example.com?key=alpha/beta", {
+                scheme: "http",
+                host: "example.com",
+                port: null,
+                path: null,
+                queryString: "key=alpha/beta",
+                fragment: null,
+                lastPathComponent: null,
+            });
+
+            return true;
+        }
+    });
+
+
+    suite.addTestCase({
         name: "parseDataURL",
-        test: () => {
+        test() {
             function testInvalid(url) {
-                InspectorTest.log("Test: " + url);
+                InspectorTest.log("");
+                InspectorTest.log("Test Invalid: " + url);
                 InspectorTest.expectThat(parseDataURL(url) === null, "Should not be a data URL");
             }
 
             function testValid(url, expected) {
                 InspectorTest.log("");
-                InspectorTest.log("Test: " + url);
+                InspectorTest.log("Test Valid: " + url);
 
                 let {mimeType: expectedMimeType, charset: expectedCharset, base64: expectedBase64, data: expectedData, content: expectedContent} = expected;
                 let {mimeType: actualMimeType, charset: actualCharset, base64: actualBase64, data: actualData, scheme: actualScheme} = parseDataURL(url);
@@ -25,11 +264,11 @@
                 if (actualBase64)
                     actualContent = atob(actualContent);
 
-                InspectorTest.assert(actualScheme === "data", "scheme should always be 'data'");
-                InspectorTest.expectThat(actualMimeType === expectedMimeType, `mimeType should be: '${expectedMimeType}'`);
-                InspectorTest.expectThat(actualCharset === expectedCharset, `charset should be: '${expectedCharset}'`);
-                InspectorTest.expectThat(actualBase64 === expectedBase64, `base64 should be: '${expectedBase64}'`);
-                InspectorTest.expectThat(actualData === expectedData, `data should be: '${expectedData}'`);
+                InspectorTest.expectEqual(actualScheme, "data", "scheme should always be 'data'");
+                InspectorTest.expectEqual(actualMimeType, expectedMimeType, `mimeType should be: '${expectedMimeType}'`);
+                InspectorTest.expectEqual(actualCharset, expectedCharset, `charset should be: '${expectedCharset}'`);
+                InspectorTest.expectEqual(actualBase64, expectedBase64, `base64 should be: '${expectedBase64}'`);
+                InspectorTest.expectEqual(actualData, expectedData, `data should be: '${expectedData}'`);
                 if (expectedContent !== null)
                     InspectorTest.expectThat(actualContent === expectedContent, `Resolved content should be: '${expectedContent}'`);
             }

Modified: trunk/Source/WebInspectorUI/ChangeLog (209142 => 209143)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-11-30 19:39:12 UTC (rev 209142)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-11-30 19:48:04 UTC (rev 209143)
@@ -1,3 +1,20 @@
+2016-11-30  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Clicking on link in Web Inspector can cause UIProcess to crash
+        https://bugs.webkit.org/show_bug.cgi?id=165157
+        <rdar://problem/27896562>
+
+        Reviewed by Brian Burg.
+
+        By correctly disallowing slashes in the scheme Web Inspector resolves
+        the correct absolute URL and doesn't end up trying to navigate to an
+        incorrect file URL.
+
+        * UserInterface/Base/URLUtilities.js:
+        (parseURL):
+        Disallow "/" characters in the scheme portion. (/http://example.com)
+        Allow path to be optional before a fragment portion. (http://example.com#frag)
+
 2016-11-29  Joseph Pecoraro  <[email protected]>
 
         Web Inspector: Improve name sorting in HeapSnapshot data grids

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/URLUtilities.js (209142 => 209143)


--- trunk/Source/WebInspectorUI/UserInterface/Base/URLUtilities.js	2016-11-30 19:39:12 UTC (rev 209142)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/URLUtilities.js	2016-11-30 19:48:04 UTC (rev 209143)
@@ -23,6 +23,8 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+// FIXME: <https://webkit.org/b/165155> Web Inspector: Use URL constructor to better handle all kinds of URLs
+
 function removeURLFragment(url)
 {
     var hashIndex = url.indexOf("#");
@@ -96,7 +98,7 @@
     if (url.startsWith("data:"))
         return {scheme: "data", host: null, port: null, path: null, queryString: null, fragment: null, lastPathComponent: null};
 
-    var match = url.match(/^([^:]+):\/\/([^\/:]*)(?::([\d]+))?(?:(\/[^#]*)(?:#(.*))?)?$/i);
+    var match = url.match(/^([^\/:]+):\/\/([^\/#:]*)(?::([\d]+))?(?:(\/[^#]*)?(?:#(.*))?)?$/i);
     if (!match)
         return {scheme: null, host: null, port: null, path: null, queryString: null, fragment: null, lastPathComponent: null};
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to