<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[209143] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/209143">209143</a></dd>
<dt>Author</dt> <dd>joepeck@webkit.org</dd>
<dt>Date</dt> <dd>2016-11-30 11:48:04 -0800 (Wed, 30 Nov 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: Clicking on link in Web Inspector can cause UIProcess to crash
https://bugs.webkit.org/show_bug.cgi?id=165157
&lt;rdar://problem/27896562&gt;

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 &quot;/&quot; 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.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsinspectorunittestsurlutilitiesexpectedtxt">trunk/LayoutTests/inspector/unit-tests/url-utilities-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorunittestsurlutilitieshtml">trunk/LayoutTests/inspector/unit-tests/url-utilities.html</a></li>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceBaseURLUtilitiesjs">trunk/Source/WebInspectorUI/UserInterface/Base/URLUtilities.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (209142 => 209143)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-11-30 19:39:12 UTC (rev 209142)
+++ trunk/LayoutTests/ChangeLog        2016-11-30 19:48:04 UTC (rev 209143)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2016-11-30  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: Clicking on link in Web Inspector can cause UIProcess to crash
+        https://bugs.webkit.org/show_bug.cgi?id=165157
+        &lt;rdar://problem/27896562&gt;
+
+        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.
+
</ins><span class="cx"> 2016-11-30  Dave Hyatt  &lt;hyatt@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [CSS Parser] Fix a typo in a layout test for transforms
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorunittestsurlutilitiesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/unit-tests/url-utilities-expected.txt (209142 => 209143)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,16 +1,242 @@
</span><span class="cx"> 
</span><span class="cx"> == Running test suite: URLUtilities
</span><ins>+-- 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&amp;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&amp;b=2'
+PASS: fragment should be: 'null'
+PASS: lastPathComponent should be: 'page.html'
+
+Test Valid: http://example.com/path/to/page.html?a=1&amp;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&amp;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&amp;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&amp;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 &lt;https://webkit.org/b/165155&gt;
+
+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: &quot;http&quot;
+    Actual: null
+FAIL: host should be: 'example.com'
+    Expected: &quot;example.com&quot;
+    Actual: null
+PASS: port should be: 'null'
+FAIL: path should be: '/'
+    Expected: &quot;/&quot;
+    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: &quot;http&quot;
+    Actual: null
+FAIL: host should be: 'example.com'
+    Expected: &quot;example.com&quot;
+    Actual: null
+PASS: port should be: 'null'
+FAIL: path should be: '/'
+    Expected: &quot;/&quot;
+    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: &quot;http&quot;
+    Actual: null
+FAIL: host should be: 'example.com'
+    Expected: &quot;example.com&quot;
+    Actual: null
+PASS: port should be: 'null'
+FAIL: path should be: '/'
+    Expected: &quot;/&quot;
+    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: &quot;example.com&quot;
+    Actual: &quot;example.com?key=alpha&quot;
+PASS: port should be: 'null'
+FAIL: path should be: 'null'
+    Expected: null
+    Actual: &quot;/beta&quot;
+FAIL: queryString should be: 'key=alpha/beta'
+    Expected: &quot;key=alpha/beta&quot;
+    Actual: null
+PASS: fragment should be: 'null'
+FAIL: lastPathComponent should be: 'null'
+    Expected: null
+    Actual: &quot;beta&quot;
+
</ins><span class="cx"> -- Running test case: parseDataURL
</span><del>-Test: https://webkit.org
</del><ins>+
+Test Invalid: https://webkit.org
</ins><span class="cx"> PASS: Should not be a data URL
</span><del>-Test: data:
</del><ins>+
+Test Invalid: data:
</ins><span class="cx"> PASS: Should not be a data URL
</span><del>-Test: data:text/plain;test
</del><ins>+
+Test Invalid: data:text/plain;test
</ins><span class="cx"> PASS: Should not be a data URL
</span><del>-Test: data:text/plain;base64;test
</del><ins>+
+Test Invalid: data:text/plain;base64;test
</ins><span class="cx"> PASS: Should not be a data URL
</span><span class="cx"> 
</span><del>-Test: data:,
</del><ins>+Test Valid: data:,
+PASS: scheme should always be 'data'
</ins><span class="cx"> PASS: mimeType should be: 'text/plain'
</span><span class="cx"> PASS: charset should be: 'US-ASCII'
</span><span class="cx"> PASS: base64 should be: 'false'
</span><span class="lines">@@ -17,7 +243,8 @@
</span><span class="cx"> PASS: data should be: ''
</span><span class="cx"> PASS: Resolved content should be: ''
</span><span class="cx"> 
</span><del>-Test: data:,test
</del><ins>+Test Valid: data:,test
+PASS: scheme should always be 'data'
</ins><span class="cx"> PASS: mimeType should be: 'text/plain'
</span><span class="cx"> PASS: charset should be: 'US-ASCII'
</span><span class="cx"> PASS: base64 should be: 'false'
</span><span class="lines">@@ -24,7 +251,8 @@
</span><span class="cx"> PASS: data should be: 'test'
</span><span class="cx"> PASS: Resolved content should be: 'test'
</span><span class="cx"> 
</span><del>-Test: data:text/plain,test
</del><ins>+Test Valid: data:text/plain,test
+PASS: scheme should always be 'data'
</ins><span class="cx"> PASS: mimeType should be: 'text/plain'
</span><span class="cx"> PASS: charset should be: 'US-ASCII'
</span><span class="cx"> PASS: base64 should be: 'false'
</span><span class="lines">@@ -31,7 +259,8 @@
</span><span class="cx"> PASS: data should be: 'test'
</span><span class="cx"> PASS: Resolved content should be: 'test'
</span><span class="cx"> 
</span><del>-Test: data:text/plain;charset=TEST,test
</del><ins>+Test Valid: data:text/plain;charset=TEST,test
+PASS: scheme should always be 'data'
</ins><span class="cx"> PASS: mimeType should be: 'text/plain'
</span><span class="cx"> PASS: charset should be: 'TEST'
</span><span class="cx"> PASS: base64 should be: 'false'
</span><span class="lines">@@ -38,7 +267,8 @@
</span><span class="cx"> PASS: data should be: 'test'
</span><span class="cx"> PASS: Resolved content should be: 'test'
</span><span class="cx"> 
</span><del>-Test: data:application/json,{&quot;name&quot;:&quot;test&quot;,&quot;list&quot;:[1,2,3]}
</del><ins>+Test Valid: data:application/json,{&quot;name&quot;:&quot;test&quot;,&quot;list&quot;:[1,2,3]}
+PASS: scheme should always be 'data'
</ins><span class="cx"> PASS: mimeType should be: 'application/json'
</span><span class="cx"> PASS: charset should be: 'US-ASCII'
</span><span class="cx"> PASS: base64 should be: 'false'
</span><span class="lines">@@ -45,7 +275,8 @@
</span><span class="cx"> PASS: data should be: '{&quot;name&quot;:&quot;test&quot;,&quot;list&quot;:[1,2,3]}'
</span><span class="cx"> PASS: Resolved content should be: '{&quot;name&quot;:&quot;test&quot;,&quot;list&quot;:[1,2,3]}'
</span><span class="cx"> 
</span><del>-Test: data:application/json,%7B%22name%22%3A%22test%22%2C%22list%22%3A%5B1%2C2%2C3%5D%7D
</del><ins>+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'
</ins><span class="cx"> PASS: mimeType should be: 'application/json'
</span><span class="cx"> PASS: charset should be: 'US-ASCII'
</span><span class="cx"> PASS: base64 should be: 'false'
</span><span class="lines">@@ -52,7 +283,8 @@
</span><span class="cx"> PASS: data should be: '{&quot;name&quot;:&quot;test&quot;,&quot;list&quot;:[1,2,3]}'
</span><span class="cx"> PASS: Resolved content should be: '{&quot;name&quot;:&quot;test&quot;,&quot;list&quot;:[1,2,3]}'
</span><span class="cx"> 
</span><del>-Test: data:application/json;base64,eyJuYW1lIjoidGVzdCIsImxpc3QiOlsxLDIsM119
</del><ins>+Test Valid: data:application/json;base64,eyJuYW1lIjoidGVzdCIsImxpc3QiOlsxLDIsM119
+PASS: scheme should always be 'data'
</ins><span class="cx"> PASS: mimeType should be: 'application/json'
</span><span class="cx"> PASS: charset should be: 'US-ASCII'
</span><span class="cx"> PASS: base64 should be: 'true'
</span><span class="lines">@@ -59,7 +291,8 @@
</span><span class="cx"> PASS: data should be: 'eyJuYW1lIjoidGVzdCIsImxpc3QiOlsxLDIsM119'
</span><span class="cx"> PASS: Resolved content should be: '{&quot;name&quot;:&quot;test&quot;,&quot;list&quot;:[1,2,3]}'
</span><span class="cx"> 
</span><del>-Test: data:application/json;charset=utf-8;base64,eyJuYW1lIjoidGVzdCIsImxpc3QiOlsxLDIsM119
</del><ins>+Test Valid: data:application/json;charset=utf-8;base64,eyJuYW1lIjoidGVzdCIsImxpc3QiOlsxLDIsM119
+PASS: scheme should always be 'data'
</ins><span class="cx"> PASS: mimeType should be: 'application/json'
</span><span class="cx"> PASS: charset should be: 'utf-8'
</span><span class="cx"> PASS: base64 should be: 'true'
</span><span class="lines">@@ -66,7 +299,8 @@
</span><span class="cx"> PASS: data should be: 'eyJuYW1lIjoidGVzdCIsImxpc3QiOlsxLDIsM119'
</span><span class="cx"> PASS: Resolved content should be: '{&quot;name&quot;:&quot;test&quot;,&quot;list&quot;:[1,2,3]}'
</span><span class="cx"> 
</span><del>-Test: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==
</del><ins>+Test Valid: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==
+PASS: scheme should always be 'data'
</ins><span class="cx"> PASS: mimeType should be: 'image/png'
</span><span class="cx"> PASS: charset should be: 'US-ASCII'
</span><span class="cx"> PASS: base64 should be: 'true'
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorunittestsurlutilitieshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/unit-tests/url-utilities.html (209142 => 209143)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -8,16 +8,255 @@
</span><span class="cx">     let suite = InspectorTest.createSyncSuite(&quot;URLUtilities&quot;);
</span><span class="cx"> 
</span><span class="cx">     suite.addTestCase({
</span><ins>+        name: &quot;parseURL&quot;,
+        test() {
+            function testInvalid(url) {
+                InspectorTest.log(&quot;&quot;);
+                InspectorTest.log(&quot;Test Invalid: &quot; + url);
+                InspectorTest.expectThat(parseURL(url).scheme === null, &quot;Should not be a complete URL&quot;);
+
+                try {
+                    new URL(url);
+                    InspectorTest.fail(&quot;URL constructor thinks this is valid&quot;);
+                } catch (e) {
+                    InspectorTest.pass(&quot;URL constructor thinks this is invalid&quot;);
+                }
+            }
+
+            function testValid(url, expected) {
+                InspectorTest.log(&quot;&quot;);
+                InspectorTest.log(&quot;Test Valid: &quot; + 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(&quot;a&quot;);
+            testInvalid(&quot;/http://example.com&quot;);
+
+            testValid(&quot;http://example.com&quot;, {
+                scheme: &quot;http&quot;,
+                host: &quot;example.com&quot;,
+                port: null,
+                path: null,
+                queryString: null,
+                fragment: null,
+                lastPathComponent: null,
+            });
+
+            testValid(&quot;http://example.com/&quot;, {
+                scheme: &quot;http&quot;,
+                host: &quot;example.com&quot;,
+                port: null,
+                path: &quot;/&quot;,
+                queryString: null,
+                fragment: null,
+                lastPathComponent: null,
+            });
+
+            testValid(&quot;http://example.com:80/&quot;, {
+                scheme: &quot;http&quot;,
+                host: &quot;example.com&quot;,
+                port: 80,
+                path: &quot;/&quot;,
+                queryString: null,
+                fragment: null,
+                lastPathComponent: null,
+            });
+
+            testValid(&quot;http://example.com/path/to/page.html&quot;, {
+                scheme: &quot;http&quot;,
+                host: &quot;example.com&quot;,
+                port: null,
+                path: &quot;/path/to/page.html&quot;,
+                queryString: null,
+                fragment: null,
+                lastPathComponent: &quot;page.html&quot;,
+            });
+
+            testValid(&quot;http://example.com/path/to/page.html?&quot;, {
+                scheme: &quot;http&quot;,
+                host: &quot;example.com&quot;,
+                port: null,
+                path: &quot;/path/to/page.html&quot;,
+                queryString: &quot;&quot;,
+                fragment: null,
+                lastPathComponent: &quot;page.html&quot;,
+            });
+
+            testValid(&quot;http://example.com/path/to/page.html?a=1&quot;, {
+                scheme: &quot;http&quot;,
+                host: &quot;example.com&quot;,
+                port: null,
+                path: &quot;/path/to/page.html&quot;,
+                queryString: &quot;a=1&quot;,
+                fragment: null,
+                lastPathComponent: &quot;page.html&quot;,
+            });
+
+            testValid(&quot;http://example.com/path/to/page.html?a=1&amp;b=2&quot;, {
+                scheme: &quot;http&quot;,
+                host: &quot;example.com&quot;,
+                port: null,
+                path: &quot;/path/to/page.html&quot;,
+                queryString: &quot;a=1&amp;b=2&quot;,
+                fragment: null,
+                lastPathComponent: &quot;page.html&quot;,
+            });
+
+            testValid(&quot;http://example.com/path/to/page.html?a=1&amp;b=2#test&quot;, {
+                scheme: &quot;http&quot;,
+                host: &quot;example.com&quot;,
+                port: null,
+                path: &quot;/path/to/page.html&quot;,
+                queryString: &quot;a=1&amp;b=2&quot;,
+                fragment: &quot;test&quot;,
+                lastPathComponent: &quot;page.html&quot;,
+            });
+
+            testValid(&quot;http://example.com:123/path/to/page.html?a=1&amp;b=2#test&quot;, {
+                scheme: &quot;http&quot;,
+                host: &quot;example.com&quot;,
+                port: 123,
+                path: &quot;/path/to/page.html&quot;,
+                queryString: &quot;a=1&amp;b=2&quot;,
+                fragment: &quot;test&quot;,
+                lastPathComponent: &quot;page.html&quot;,
+            });
+
+            testValid(&quot;http://example.com/path/to/page.html#test&quot;, {
+                scheme: &quot;http&quot;,
+                host: &quot;example.com&quot;,
+                port: null,
+                path: &quot;/path/to/page.html&quot;,
+                queryString: null,
+                fragment: &quot;test&quot;,
+                lastPathComponent: &quot;page.html&quot;,
+            });
+
+            testValid(&quot;http://example.com#alpha/beta&quot;, {
+                scheme: &quot;http&quot;,
+                host: &quot;example.com&quot;,
+                port: null,
+                path: null,
+                queryString: null,
+                fragment: &quot;alpha/beta&quot;,
+                lastPathComponent: null,
+            });
+
+            testValid(&quot;app-specific://example.com&quot;, {
+                scheme: &quot;app-specific&quot;,
+                host: &quot;example.com&quot;,
+                port: null,
+                path: null,
+                queryString: null,
+                fragment: null,
+                lastPathComponent: null,
+            });
+
+            testValid(&quot;http://example&quot;, {
+                scheme: &quot;http&quot;,
+                host: &quot;example&quot;,
+                port: null,
+                path: null,
+                queryString: null,
+                fragment: null,
+                lastPathComponent: null,
+            });
+
+            testValid(&quot;http://my.example.com&quot;, {
+                scheme: &quot;http&quot;,
+                host: &quot;my.example.com&quot;,
+                port: null,
+                path: null,
+                queryString: null,
+                fragment: null,
+                lastPathComponent: null,
+            });
+
+            // Data URLs just spit back the scheme.
+            testValid(&quot;data:text/plain,test&quot;, {
+                scheme: &quot;data&quot;,
+                host: null,
+                port: null,
+                path: null,
+                queryString: null,
+                fragment: null,
+                lastPathComponent: null,
+            });
+
+            // FIXME: &lt;https://webkit.org/b/165155&gt; Web Inspector: Use URL constructor to better handle all kinds of URLs
+            InspectorTest.log(&quot;&quot;);
+            InspectorTest.log(&quot;-- Known issues &lt;https://webkit.org/b/165155&gt;&quot;);
+
+            testInvalid(&quot;http://&quot;);
+            testInvalid(&quot;http://example.com:999999999&quot;);
+
+            testValid(&quot;http:example.com/&quot;, {
+                scheme: &quot;http&quot;,
+                host: &quot;example.com&quot;,
+                port: null,
+                path: &quot;/&quot;,
+                queryString: null,
+                fragment: null,
+                lastPathComponent: null,
+            });
+
+            testValid(&quot;http:/example.com/&quot;, {
+                scheme: &quot;http&quot;,
+                host: &quot;example.com&quot;,
+                port: null,
+                path: &quot;/&quot;,
+                queryString: null,
+                fragment: null,
+                lastPathComponent: null,
+            });
+
+            testValid(&quot;http://user@pass:example.com/&quot;, {
+                scheme: &quot;http&quot;,
+                host: &quot;example.com&quot;,
+                port: null,
+                path: &quot;/&quot;,
+                queryString: null,
+                fragment: null,
+                lastPathComponent: null,
+            });
+
+            testValid(&quot;http://example.com?key=alpha/beta&quot;, {
+                scheme: &quot;http&quot;,
+                host: &quot;example.com&quot;,
+                port: null,
+                path: null,
+                queryString: &quot;key=alpha/beta&quot;,
+                fragment: null,
+                lastPathComponent: null,
+            });
+
+            return true;
+        }
+    });
+
+
+    suite.addTestCase({
</ins><span class="cx">         name: &quot;parseDataURL&quot;,
</span><del>-        test: () =&gt; {
</del><ins>+        test() {
</ins><span class="cx">             function testInvalid(url) {
</span><del>-                InspectorTest.log(&quot;Test: &quot; + url);
</del><ins>+                InspectorTest.log(&quot;&quot;);
+                InspectorTest.log(&quot;Test Invalid: &quot; + url);
</ins><span class="cx">                 InspectorTest.expectThat(parseDataURL(url) === null, &quot;Should not be a data URL&quot;);
</span><span class="cx">             }
</span><span class="cx"> 
</span><span class="cx">             function testValid(url, expected) {
</span><span class="cx">                 InspectorTest.log(&quot;&quot;);
</span><del>-                InspectorTest.log(&quot;Test: &quot; + url);
</del><ins>+                InspectorTest.log(&quot;Test Valid: &quot; + url);
</ins><span class="cx"> 
</span><span class="cx">                 let {mimeType: expectedMimeType, charset: expectedCharset, base64: expectedBase64, data: expectedData, content: expectedContent} = expected;
</span><span class="cx">                 let {mimeType: actualMimeType, charset: actualCharset, base64: actualBase64, data: actualData, scheme: actualScheme} = parseDataURL(url);
</span><span class="lines">@@ -25,11 +264,11 @@
</span><span class="cx">                 if (actualBase64)
</span><span class="cx">                     actualContent = atob(actualContent);
</span><span class="cx"> 
</span><del>-                InspectorTest.assert(actualScheme === &quot;data&quot;, &quot;scheme should always be 'data'&quot;);
-                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}'`);
</del><ins>+                InspectorTest.expectEqual(actualScheme, &quot;data&quot;, &quot;scheme should always be 'data'&quot;);
+                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}'`);
</ins><span class="cx">                 if (expectedContent !== null)
</span><span class="cx">                     InspectorTest.expectThat(actualContent === expectedContent, `Resolved content should be: '${expectedContent}'`);
</span><span class="cx">             }
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (209142 => 209143)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2016-11-30  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: Clicking on link in Web Inspector can cause UIProcess to crash
+        https://bugs.webkit.org/show_bug.cgi?id=165157
+        &lt;rdar://problem/27896562&gt;
+
+        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 &quot;/&quot; characters in the scheme portion. (/http://example.com)
+        Allow path to be optional before a fragment portion. (http://example.com#frag)
+
</ins><span class="cx"> 2016-11-29  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Improve name sorting in HeapSnapshot data grids
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceBaseURLUtilitiesjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Base/URLUtilities.js (209142 => 209143)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -23,6 +23,8 @@
</span><span class="cx">  * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><ins>+// FIXME: &lt;https://webkit.org/b/165155&gt; Web Inspector: Use URL constructor to better handle all kinds of URLs
+
</ins><span class="cx"> function removeURLFragment(url)
</span><span class="cx"> {
</span><span class="cx">     var hashIndex = url.indexOf(&quot;#&quot;);
</span><span class="lines">@@ -96,7 +98,7 @@
</span><span class="cx">     if (url.startsWith(&quot;data:&quot;))
</span><span class="cx">         return {scheme: &quot;data&quot;, host: null, port: null, path: null, queryString: null, fragment: null, lastPathComponent: null};
</span><span class="cx"> 
</span><del>-    var match = url.match(/^([^:]+):\/\/([^\/:]*)(?::([\d]+))?(?:(\/[^#]*)(?:#(.*))?)?$/i);
</del><ins>+    var match = url.match(/^([^\/:]+):\/\/([^\/#:]*)(?::([\d]+))?(?:(\/[^#]*)?(?:#(.*))?)?$/i);
</ins><span class="cx">     if (!match)
</span><span class="cx">         return {scheme: null, host: null, port: null, path: null, queryString: null, fragment: null, lastPathComponent: null};
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>