<!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>[225892] 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/225892">225892</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2017-12-13 20:47:34 -0800 (Wed, 13 Dec 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>REGRESSION: Web Inspector: Opening inspector crashes page if there are empty resources
https://bugs.webkit.org/show_bug.cgi?id=180787
<rdar://problem/35934838>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-12-13
Reviewed by Brian Burg.

Source/JavaScriptCore:

* inspector/ContentSearchUtilities.cpp:
(Inspector::ContentSearchUtilities::findMagicComment):
For empty / null strings just return. There is no use
trying to search them for a long common syntax.

Source/WebInspectorUI:

* UserInterface/Test/TestUtilities.js:
Add a generic sanitizeURL used by many tests.

* UserInterface/TestStub.html:
Include TestUtilities.

LayoutTests:

* inspector/page/resources/empty.css: Added.
* inspector/page/resources/empty.js: Added.
* inspector/page/empty-or-missing-resources-expected.txt: Added.
* inspector/page/empty-or-missing-resources.html: Added.
Test no crashes inspecting a page with empty/missing resources.
Previously the test would crash.

* inspector/canvas/recording-webgl-snapshots.html:
* inspector/canvas/resources/create-context-utilities.js:
* inspector/canvas/resources/recording-utilities.js:
* inspector/css/getAllStyleSheets.html:
* inspector/css/stylesheet-events-basic.html:
* inspector/css/stylesheet-events-imports.html:
* inspector/css/stylesheet-events-multiple-documents.html:
* inspector/worker/console-basic.html:
* inspector/worker/debugger-scripts.html:
* inspector/worker/resources-in-worker.html:
* inspector/worker/runtime-basic.html:
* inspector/worker/worker-create-and-terminate.html:
Promote sanitizeURL to a TestUtility function since it is common.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsinspectorcanvasrecordingwebglsnapshotshtml">trunk/LayoutTests/inspector/canvas/recording-webgl-snapshots.html</a></li>
<li><a href="#trunkLayoutTestsinspectorcanvasresourcescreatecontextutilitiesjs">trunk/LayoutTests/inspector/canvas/resources/create-context-utilities.js</a></li>
<li><a href="#trunkLayoutTestsinspectorcanvasresourcesrecordingutilitiesjs">trunk/LayoutTests/inspector/canvas/resources/recording-utilities.js</a></li>
<li><a href="#trunkLayoutTestsinspectorcssgetAllStyleSheetshtml">trunk/LayoutTests/inspector/css/getAllStyleSheets.html</a></li>
<li><a href="#trunkLayoutTestsinspectorcssstylesheeteventsbasichtml">trunk/LayoutTests/inspector/css/stylesheet-events-basic.html</a></li>
<li><a href="#trunkLayoutTestsinspectorcssstylesheeteventsimportshtml">trunk/LayoutTests/inspector/css/stylesheet-events-imports.html</a></li>
<li><a href="#trunkLayoutTestsinspectorcssstylesheeteventsmultipledocumentshtml">trunk/LayoutTests/inspector/css/stylesheet-events-multiple-documents.html</a></li>
<li><a href="#trunkLayoutTestsinspectorworkerconsolebasichtml">trunk/LayoutTests/inspector/worker/console-basic.html</a></li>
<li><a href="#trunkLayoutTestsinspectorworkerdebuggerscriptshtml">trunk/LayoutTests/inspector/worker/debugger-scripts.html</a></li>
<li><a href="#trunkLayoutTestsinspectorworkerresourcesinworkerhtml">trunk/LayoutTests/inspector/worker/resources-in-worker.html</a></li>
<li><a href="#trunkLayoutTestsinspectorworkerruntimebasichtml">trunk/LayoutTests/inspector/worker/runtime-basic.html</a></li>
<li><a href="#trunkLayoutTestsinspectorworkerworkercreateandterminatehtml">trunk/LayoutTests/inspector/worker/worker-create-and-terminate.html</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorContentSearchUtilitiescpp">trunk/Source/JavaScriptCore/inspector/ContentSearchUtilities.cpp</a></li>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceTestTestUtilitiesjs">trunk/Source/WebInspectorUI/UserInterface/Test/TestUtilities.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceTestStubhtml">trunk/Source/WebInspectorUI/UserInterface/TestStub.html</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsinspectorpageemptyormissingresourcesexpectedtxt">trunk/LayoutTests/inspector/page/empty-or-missing-resources-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorpageemptyormissingresourceshtml">trunk/LayoutTests/inspector/page/empty-or-missing-resources.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (225891 => 225892)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2017-12-14 04:10:02 UTC (rev 225891)
+++ trunk/LayoutTests/ChangeLog 2017-12-14 04:47:34 UTC (rev 225892)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2017-12-13  Joseph Pecoraro  <pecoraro@apple.com>
+
+        REGRESSION: Web Inspector: Opening inspector crashes page if there are empty resources
+        https://bugs.webkit.org/show_bug.cgi?id=180787
+        <rdar://problem/35934838>
+
+        Reviewed by Brian Burg.
+
+        * inspector/page/resources/empty.css: Added.
+        * inspector/page/resources/empty.js: Added.
+        * inspector/page/empty-or-missing-resources-expected.txt: Added.
+        * inspector/page/empty-or-missing-resources.html: Added.
+        Test no crashes inspecting a page with empty/missing resources.
+        Previously the test would crash.
+
+        * inspector/canvas/recording-webgl-snapshots.html:
+        * inspector/canvas/resources/create-context-utilities.js:
+        * inspector/canvas/resources/recording-utilities.js:
+        * inspector/css/getAllStyleSheets.html:
+        * inspector/css/stylesheet-events-basic.html:
+        * inspector/css/stylesheet-events-imports.html:
+        * inspector/css/stylesheet-events-multiple-documents.html:
+        * inspector/worker/console-basic.html:
+        * inspector/worker/debugger-scripts.html:
+        * inspector/worker/resources-in-worker.html:
+        * inspector/worker/runtime-basic.html:
+        * inspector/worker/worker-create-and-terminate.html:
+        Promote sanitizeURL to a TestUtility function since it is common.
+
</ins><span class="cx"> 2017-12-13  Daniel Bates  <dabates@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Add more auto fill button types
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorcanvasrecordingwebglsnapshotshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/canvas/recording-webgl-snapshots.html (225891 => 225892)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/canvas/recording-webgl-snapshots.html        2017-12-14 04:10:02 UTC (rev 225891)
+++ trunk/LayoutTests/inspector/canvas/recording-webgl-snapshots.html   2017-12-14 04:47:34 UTC (rev 225892)
</span><span class="lines">@@ -88,10 +88,6 @@
</span><span class="cx"> function test() {
</span><span class="cx">     let suite = InspectorTest.createAsyncSuite("Canvas.recordingWebGL");
</span><span class="cx"> 
</span><del>-    function sanitizeURL(url) {
-        return url.replace(/^.*?LayoutTests\//, "");
-    }
-
</del><span class="cx">     suite.addTestCase({
</span><span class="cx">         name: "Canvas.recordingWebGL.snapshots",
</span><span class="cx">         description: "Check that the snapshot taken after each visual action is different.",
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorcanvasresourcescreatecontextutilitiesjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/canvas/resources/create-context-utilities.js (225891 => 225892)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/canvas/resources/create-context-utilities.js 2017-12-14 04:10:02 UTC (rev 225891)
+++ trunk/LayoutTests/inspector/canvas/resources/create-context-utilities.js    2017-12-14 04:47:34 UTC (rev 225892)
</span><span class="lines">@@ -30,10 +30,6 @@
</span><span class="cx"> TestPage.registerInitializer(() => {
</span><span class="cx">     let suite = null;
</span><span class="cx"> 
</span><del>-    function sanitizeURL(url) {
-        return url.replace(/^.*?LayoutTests\//, "");
-    }
-
</del><span class="cx">     function awaitCanvasAdded(contextType) {
</span><span class="cx">         return WI.canvasManager.awaitEvent(WI.CanvasManager.Event.CanvasAdded)
</span><span class="cx">         .then((event) => {
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorcanvasresourcesrecordingutilitiesjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/canvas/resources/recording-utilities.js (225891 => 225892)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/canvas/resources/recording-utilities.js      2017-12-14 04:10:02 UTC (rev 225891)
+++ trunk/LayoutTests/inspector/canvas/resources/recording-utilities.js 2017-12-14 04:47:34 UTC (rev 225892)
</span><span class="lines">@@ -1,8 +1,4 @@
</span><span class="cx"> TestPage.registerInitializer(() => {
</span><del>-    function sanitizeURL(url) {
-        return url.replace(/^.*?LayoutTests\//, "");
-    }
-
</del><span class="cx">     function log(object, indent) {
</span><span class="cx">         for (let key of Object.keys(object)) {
</span><span class="cx">             let value = object[key];
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorcssgetAllStyleSheetshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/css/getAllStyleSheets.html (225891 => 225892)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/css/getAllStyleSheets.html   2017-12-14 04:10:02 UTC (rev 225891)
+++ trunk/LayoutTests/inspector/css/getAllStyleSheets.html      2017-12-14 04:47:34 UTC (rev 225892)
</span><span class="lines">@@ -19,10 +19,6 @@
</span><span class="cx"> <script>
</span><span class="cx"> function test()
</span><span class="cx"> {
</span><del>-    function sanitizeURL(url) {
-        return url.replace(/^.*?LayoutTests\//, "");
-    }
-
</del><span class="cx">     WI.cssStyleManager.fetchStyleSheetsIfNeeded();
</span><span class="cx">     InspectorBackend.runAfterPendingDispatches(function() {
</span><span class="cx">         let styleSheets = WI.cssStyleManager.styleSheets;
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorcssstylesheeteventsbasichtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/css/stylesheet-events-basic.html (225891 => 225892)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/css/stylesheet-events-basic.html     2017-12-14 04:10:02 UTC (rev 225891)
+++ trunk/LayoutTests/inspector/css/stylesheet-events-basic.html        2017-12-14 04:47:34 UTC (rev 225892)
</span><span class="lines">@@ -44,10 +44,6 @@
</span><span class="cx"> 
</span><span class="cx"> function test()
</span><span class="cx"> {
</span><del>-    function sanitizeURL(url) {
-        return url.replace(/^.*?LayoutTests\//, "");
-    }
-
</del><span class="cx">     let suite = InspectorTest.createAsyncSuite("CSS.StyleSheetEvents.Basic");
</span><span class="cx"> 
</span><span class="cx">     suite.addTestCase({
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorcssstylesheeteventsimportshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/css/stylesheet-events-imports.html (225891 => 225892)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/css/stylesheet-events-imports.html   2017-12-14 04:10:02 UTC (rev 225891)
+++ trunk/LayoutTests/inspector/css/stylesheet-events-imports.html      2017-12-14 04:47:34 UTC (rev 225892)
</span><span class="lines">@@ -21,10 +21,6 @@
</span><span class="cx"> 
</span><span class="cx"> function test()
</span><span class="cx"> {
</span><del>-    function sanitizeURL(url) {
-        return url.replace(/^.*?LayoutTests\//, "");
-    }
-
</del><span class="cx">     function collectEvents(n, then) {
</span><span class="cx">         let remaining = n;
</span><span class="cx">         let collection = [];
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorcssstylesheeteventsmultipledocumentshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/css/stylesheet-events-multiple-documents.html (225891 => 225892)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/css/stylesheet-events-multiple-documents.html        2017-12-14 04:10:02 UTC (rev 225891)
+++ trunk/LayoutTests/inspector/css/stylesheet-events-multiple-documents.html   2017-12-14 04:47:34 UTC (rev 225892)
</span><span class="lines">@@ -17,10 +17,6 @@
</span><span class="cx"> 
</span><span class="cx"> function test()
</span><span class="cx"> {
</span><del>-    function sanitizeURL(url) {
-        return url.replace(/^.*?LayoutTests\//, "");
-    }
-
</del><span class="cx">     function logStyleSheets() {
</span><span class="cx">         WI.cssStyleManager.styleSheets.sort((a, b) => a.url.localeCompare(b.url)).forEach((styleSheet) => {
</span><span class="cx">             let frameString = styleSheet.parentFrame.id === WI.frameResourceManager.mainFrame.id ? "<mainframe>" : "<childframe>";
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorpageemptyormissingresourcesexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/page/empty-or-missing-resources-expected.txt (0 => 225892)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/page/empty-or-missing-resources-expected.txt                         (rev 0)
+++ trunk/LayoutTests/inspector/page/empty-or-missing-resources-expected.txt    2017-12-14 04:47:34 UTC (rev 225892)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test that Page.getResourceTree does not crash with empty or missing resources.
+
+
+== Running test suite: Page.getResourceTree.EmptyResources
+-- Running test case: Page.getResourceTree.EmptyResources
+inspector/page/empty.js
+inspector/page/missing.js
+inspector/page/resources/empty.css
+inspector/page/resources/missing.css
+
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectorpageemptyormissingresourceshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/page/empty-or-missing-resources.html (0 => 225892)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/page/empty-or-missing-resources.html                         (rev 0)
+++ trunk/LayoutTests/inspector/page/empty-or-missing-resources.html    2017-12-14 04:47:34 UTC (rev 225892)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
+<link rel="stylesheet" href="resources/empty.css">
+<link rel="stylesheet" href="resources/missing.css">
+<script src="empty.js"></script>
+<script src="missing.js"></script>
+<script>
+function test()
+{
+    let suite = InspectorTest.createAsyncSuite("Page.getResourceTree.EmptyResources");
+
+    suite.addTestCase({
+        name: "Page.getResourceTree.EmptyResources",
+        description: "Should not crash if there are empty or missing resources.",
+        async test(resolve, reject) {
+            let resources = [...WI.frameResourceManager.mainFrame.resourceCollection.items];
+            let resourceURLs = resources.map(x => x.url).filter(x => /(empty|missing)/.test(x)).sort();
+            for (let url of resourceURLs)
+                InspectorTest.log(sanitizeURL(url));
+        }
+    });
+
+    suite.runTestCasesAndFinish();
+}
+</script>
+</head>
+<body onload="runTest()">
+<p>Test that Page.getResourceTree does not crash with empty or missing resources.</p>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectorworkerconsolebasichtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/worker/console-basic.html (225891 => 225892)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/worker/console-basic.html    2017-12-14 04:10:02 UTC (rev 225891)
+++ trunk/LayoutTests/inspector/worker/console-basic.html       2017-12-14 04:47:34 UTC (rev 225892)
</span><span class="lines">@@ -11,10 +11,6 @@
</span><span class="cx"> 
</span><span class="cx"> function test()
</span><span class="cx"> {
</span><del>-    function sanitizeURL(url) {
-        return url.replace(/^.*?LayoutTests\//, "");
-    }
-
</del><span class="cx">     function consoleMessageJSONFilter(key, value) {
</span><span class="cx">         if (key === "_target" || key === "_hasChildren" || key === "_listeners")
</span><span class="cx">             return undefined;
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorworkerdebuggerscriptshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/worker/debugger-scripts.html (225891 => 225892)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/worker/debugger-scripts.html 2017-12-14 04:10:02 UTC (rev 225891)
+++ trunk/LayoutTests/inspector/worker/debugger-scripts.html    2017-12-14 04:47:34 UTC (rev 225892)
</span><span class="lines">@@ -7,10 +7,6 @@
</span><span class="cx"> 
</span><span class="cx"> function test()
</span><span class="cx"> {
</span><del>-    function sanitizeURL(url) {
-        return url.replace(/^.*?LayoutTests\//, "");
-    }
-
</del><span class="cx">     let mainTarget = WI.mainTarget;
</span><span class="cx">     let workerTarget = Array.from(WI.targets).find((target) => target.type === WI.Target.Type.Worker);
</span><span class="cx">     let mainDebuggerData = WI.debuggerManager.dataForTarget(mainTarget);
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorworkerresourcesinworkerhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/worker/resources-in-worker.html (225891 => 225892)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/worker/resources-in-worker.html      2017-12-14 04:10:02 UTC (rev 225891)
+++ trunk/LayoutTests/inspector/worker/resources-in-worker.html 2017-12-14 04:47:34 UTC (rev 225892)
</span><span class="lines">@@ -39,10 +39,6 @@
</span><span class="cx">     let workerTarget = null;
</span><span class="cx">     let mainTarget = WI.mainTarget;
</span><span class="cx"> 
</span><del>-    function sanitizeURL(url) {
-        return url.replace(/^.*?LayoutTests\//, "");
-    }
-
</del><span class="cx">     function dumpWorkerResources() {
</span><span class="cx">         InspectorTest.log("RESOURCES:");
</span><span class="cx">         for (let resource of workerTarget.resourceCollection.items)
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorworkerruntimebasichtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/worker/runtime-basic.html (225891 => 225892)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/worker/runtime-basic.html    2017-12-14 04:10:02 UTC (rev 225891)
+++ trunk/LayoutTests/inspector/worker/runtime-basic.html       2017-12-14 04:47:34 UTC (rev 225892)
</span><span class="lines">@@ -8,10 +8,6 @@
</span><span class="cx"> 
</span><span class="cx"> function test()
</span><span class="cx"> {
</span><del>-    function sanitizeURL(url) {
-        return url.replace(/^.*?LayoutTests\//, "");
-    }
-
</del><span class="cx">     let mainTarget = WI.mainTarget;
</span><span class="cx">     let workerTarget = Array.from(WI.targets).find((target) => target.type === WI.Target.Type.Worker);
</span><span class="cx">     if (!workerTarget) {
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorworkerworkercreateandterminatehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/worker/worker-create-and-terminate.html (225891 => 225892)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/worker/worker-create-and-terminate.html      2017-12-14 04:10:02 UTC (rev 225891)
+++ trunk/LayoutTests/inspector/worker/worker-create-and-terminate.html 2017-12-14 04:47:34 UTC (rev 225892)
</span><span class="lines">@@ -43,11 +43,7 @@
</span><span class="cx">             ProtocolTest.log("No Workers");
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    function sanitizeURL(url) {
-        return url.replace(/^.*?LayoutTests\//, "");
-    }
</del><span class="cx"> 
</span><del>-
</del><span class="cx">     let triggerNextCreate;
</span><span class="cx">     let triggerNextTerminate;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (225891 => 225892)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog    2017-12-14 04:10:02 UTC (rev 225891)
+++ trunk/Source/JavaScriptCore/ChangeLog       2017-12-14 04:47:34 UTC (rev 225892)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2017-12-13  Joseph Pecoraro  <pecoraro@apple.com>
+
+        REGRESSION: Web Inspector: Opening inspector crashes page if there are empty resources
+        https://bugs.webkit.org/show_bug.cgi?id=180787
+        <rdar://problem/35934838>
+
+        Reviewed by Brian Burg.
+
+        * inspector/ContentSearchUtilities.cpp:
+        (Inspector::ContentSearchUtilities::findMagicComment):
+        For empty / null strings just return. There is no use
+        trying to search them for a long common syntax.
+
</ins><span class="cx"> 2017-12-13  Saam Barati  <sbarati@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Arrow functions need their own structure because they have different properties than sloppy functions
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorContentSearchUtilitiescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/ContentSearchUtilities.cpp (225891 => 225892)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/ContentSearchUtilities.cpp 2017-12-14 04:10:02 UTC (rev 225891)
+++ trunk/Source/JavaScriptCore/inspector/ContentSearchUtilities.cpp    2017-12-14 04:47:34 UTC (rev 225892)
</span><span class="lines">@@ -174,7 +174,9 @@
</span><span class="cx"> 
</span><span class="cx"> static String findMagicComment(const String& content, const String& patternString)
</span><span class="cx"> {
</span><del>-    ASSERT(!content.isNull());
</del><ins>+    if (content.isEmpty())
+        return String();
+
</ins><span class="cx">     const char* error = nullptr;
</span><span class="cx">     YarrPattern pattern(patternString, JSC::RegExpFlags::FlagMultiline, &error);
</span><span class="cx">     ASSERT(!error);
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (225891 => 225892)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog    2017-12-14 04:10:02 UTC (rev 225891)
+++ trunk/Source/WebInspectorUI/ChangeLog       2017-12-14 04:47:34 UTC (rev 225892)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2017-12-13  Joseph Pecoraro  <pecoraro@apple.com>
+
+        REGRESSION: Web Inspector: Opening inspector crashes page if there are empty resources
+        https://bugs.webkit.org/show_bug.cgi?id=180787
+        <rdar://problem/35934838>
+
+        Reviewed by Brian Burg.
+
+        * UserInterface/Test/TestUtilities.js:
+        Add a generic sanitizeURL used by many tests.
+
+        * UserInterface/TestStub.html:
+        Include TestUtilities.
+
</ins><span class="cx"> 2017-12-13  Devin Rousso  <webkit@devinrousso.com>
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: add instrumentation for ImageBitmapRenderingContext
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceTestTestUtilitiesjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Test/TestUtilities.js (225891 => 225892)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Test/TestUtilities.js  2017-12-14 04:10:02 UTC (rev 225891)
+++ trunk/Source/WebInspectorUI/UserInterface/Test/TestUtilities.js     2017-12-14 04:47:34 UTC (rev 225892)
</span><span class="lines">@@ -52,3 +52,7 @@
</span><span class="cx">         }
</span><span class="cx">     });
</span><span class="cx"> }
</span><ins>+
+function sanitizeURL(url) {
+    return url.replace(/^.*?LayoutTests\//, "");
+}
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceTestStubhtml"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/TestStub.html (225891 => 225892)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/TestStub.html  2017-12-14 04:10:02 UTC (rev 225891)
+++ trunk/Source/WebInspectorUI/UserInterface/TestStub.html     2017-12-14 04:47:34 UTC (rev 225892)
</span><span class="lines">@@ -42,6 +42,7 @@
</span><span class="cx">     <script src="Test/TestSuite.js"></script>
</span><span class="cx">     <script src="Test/TestHarness.js"></script>
</span><span class="cx">     <script src="Test/ProtocolTestHarness.js"></script>
</span><ins>+    <script src="Test/TestUtilities.js"></script>
</ins><span class="cx"> 
</span><span class="cx">     <script src="Test/InspectorProtocol.js"></script>
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>