<!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>[164689] trunk/LayoutTests</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/164689">164689</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-02-25 18:50:20 -0800 (Tue, 25 Feb 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: Port some profiler tests to inspector-protocol
https://bugs.webkit.org/show_bug.cgi?id=129353

Patch by Joseph Pecoraro &lt;pecoraro@apple.com&gt; on 2014-02-25
Reviewed by Timothy Hatcher.

* inspector-obsolete/profiler/cpu-profiler-parameterless-profile-end-crash-expected.txt: Removed.
* inspector-obsolete/profiler/cpu-profiler-parameterless-profile-end-crash.html: Removed.
* inspector-obsolete/profiler/cpu-profiler-profiling-without-inspector-expected.txt: Removed.
* inspector-obsolete/profiler/cpu-profiler-profiling-without-inspector.html: Removed.
* inspector-protocol/profiler/console-profile-expected.txt: Added.
* inspector-protocol/profiler/console-profile.html: Added.
* inspector-protocol/profiler/console-profileEnd-parameterless-expected.txt: Added.
* inspector-protocol/profiler/console-profileEnd-parameterless.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/LayoutTests/inspector-protocol/profiler/</li>
<li><a href="#trunkLayoutTestsinspectorprotocolprofilerconsoleprofileexpectedtxt">trunk/LayoutTests/inspector-protocol/profiler/console-profile-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorprotocolprofilerconsoleprofilehtml">trunk/LayoutTests/inspector-protocol/profiler/console-profile.html</a></li>
<li><a href="#trunkLayoutTestsinspectorprotocolprofilerconsoleprofileEndparameterlessexpectedtxt">trunk/LayoutTests/inspector-protocol/profiler/console-profileEnd-parameterless-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorprotocolprofilerconsoleprofileEndparameterlesshtml">trunk/LayoutTests/inspector-protocol/profiler/console-profileEnd-parameterless.html</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsinspectorobsoleteprofilercpuprofilerparameterlessprofileendcrashexpectedtxt">trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-parameterless-profile-end-crash-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorobsoleteprofilercpuprofilerparameterlessprofileendcrashhtml">trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-parameterless-profile-end-crash.html</a></li>
<li><a href="#trunkLayoutTestsinspectorobsoleteprofilercpuprofilerprofilingwithoutinspectorexpectedtxt">trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-profiling-without-inspector-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorobsoleteprofilercpuprofilerprofilingwithoutinspectorhtml">trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-profiling-without-inspector.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (164688 => 164689)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-02-26 02:28:52 UTC (rev 164688)
+++ trunk/LayoutTests/ChangeLog        2014-02-26 02:50:20 UTC (rev 164689)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2014-02-25  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: Port some profiler tests to inspector-protocol
+        https://bugs.webkit.org/show_bug.cgi?id=129353
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector-obsolete/profiler/cpu-profiler-parameterless-profile-end-crash-expected.txt: Removed.
+        * inspector-obsolete/profiler/cpu-profiler-parameterless-profile-end-crash.html: Removed.
+        * inspector-obsolete/profiler/cpu-profiler-profiling-without-inspector-expected.txt: Removed.
+        * inspector-obsolete/profiler/cpu-profiler-profiling-without-inspector.html: Removed.
+        * inspector-protocol/profiler/console-profile-expected.txt: Added.
+        * inspector-protocol/profiler/console-profile.html: Added.
+        * inspector-protocol/profiler/console-profileEnd-parameterless-expected.txt: Added.
+        * inspector-protocol/profiler/console-profileEnd-parameterless.html: Added.
+
</ins><span class="cx"> 2014-02-25  Samuel White  &lt;samuel_white@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add accessibility search predicate support for AXOutlines
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorobsoleteprofilercpuprofilerparameterlessprofileendcrashexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-parameterless-profile-end-crash-expected.txt (164688 => 164689)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-parameterless-profile-end-crash-expected.txt        2014-02-26 02:28:52 UTC (rev 164688)
+++ trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-parameterless-profile-end-crash-expected.txt        2014-02-26 02:50:20 UTC (rev 164689)
</span><span class="lines">@@ -1,6 +0,0 @@
</span><del>-Tests that &quot;console.profileEnd()&quot; do not cause crash.
-Bug 105759.
-
-Profiles count: 2
-Titled profile found.
-
</del></span></pre></div>
<a id="trunkLayoutTestsinspectorobsoleteprofilercpuprofilerparameterlessprofileendcrashhtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-parameterless-profile-end-crash.html (164688 => 164689)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-parameterless-profile-end-crash.html        2014-02-26 02:28:52 UTC (rev 164688)
+++ trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-parameterless-profile-end-crash.html        2014-02-26 02:50:20 UTC (rev 164689)
</span><span class="lines">@@ -1,49 +0,0 @@
</span><del>-&lt;html&gt;
-&lt;head&gt;
-&lt;script&gt;
-
-if (window.testRunner)
-    testRunner.dumpAsText();
-if (window.internals)
-    internals.setJavaScriptProfilingEnabled(true);
-
-function pageFunction()
-{
-    console.profile(); // Untitled
-    console.profile(&quot;titled&quot;);
-    console.profileEnd();
-    console.profileEnd();
-}
-
-function startTest()
-{
-    pageFunction();
-    printResult();
-    if (window.testRunner)
-        testRunner.notifyDone();
-}
-
-function printResult()
-{
-    var preElement = document.createElement(&quot;pre&quot;);
-    preElement.appendChild(document.createTextNode(&quot;\n&quot;));
-
-    var profiles = console.profiles;
-    preElement.appendChild(document.createTextNode(&quot;Profiles count: &quot; + profiles.length + &quot;\n&quot;));
-    for (var i = 0; i &lt; profiles.length; ++i) {
-        if (profiles[i].title === &quot;titled&quot;)
-            preElement.appendChild(document.createTextNode(&quot;Titled profile found.\n&quot;));
-    }
-    document.getElementById(&quot;output&quot;).appendChild(preElement);
-}
-
-&lt;/script&gt;
-&lt;/head&gt;
-&lt;body onload=&quot;startTest()&quot;&gt;
-&lt;p&gt;
-Tests that &quot;console.profileEnd()&quot; do not cause crash.&lt;br&gt;
-&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=105759&quot;&gt;Bug 105759.&lt;/a&gt;&lt;br&gt;
-&lt;div id=&quot;output&quot;&gt;&lt;/div&gt;
-&lt;/p&gt;
-&lt;/body&gt;
-&lt;/html&gt;
</del></span></pre></div>
<a id="trunkLayoutTestsinspectorobsoleteprofilercpuprofilerprofilingwithoutinspectorexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-profiling-without-inspector-expected.txt (164688 => 164689)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-profiling-without-inspector-expected.txt        2014-02-26 02:28:52 UTC (rev 164688)
+++ trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-profiling-without-inspector-expected.txt        2014-02-26 02:50:20 UTC (rev 164689)
</span><span class="lines">@@ -1,6 +0,0 @@
</span><del>-Tests that CPU profiling works.
-Doesn't open Inspector, uses console.profile....
-
-
-Found pageFunction
-
</del></span></pre></div>
<a id="trunkLayoutTestsinspectorobsoleteprofilercpuprofilerprofilingwithoutinspectorhtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-profiling-without-inspector.html (164688 => 164689)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-profiling-without-inspector.html        2014-02-26 02:28:52 UTC (rev 164688)
+++ trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-profiling-without-inspector.html        2014-02-26 02:50:20 UTC (rev 164689)
</span><span class="lines">@@ -1,84 +0,0 @@
</span><del>-&lt;html&gt;
-&lt;head&gt;
-&lt;script&gt;
-
-if (window.testRunner)
-    testRunner.dumpAsText();
-if (window.internals)
-    internals.setJavaScriptProfilingEnabled(true);
-
-function pageFunction()
-{
-    console.profile(&quot;outer&quot;);
-    console.profile(&quot;inner&quot;);  // [Chromium] Make sure we capture the current callstack.
-    console.profileEnd(&quot;outer&quot;);
-    console.profileEnd(&quot;inner&quot;);
-}
-
-function startTest()
-{
-    pageFunction();
-    printResult();
-    if (window.testRunner)
-        testRunner.notifyDone();
-}
-
-function printResult()
-{
-    var preElement = document.createElement(&quot;pre&quot;);
-    preElement.appendChild(document.createTextNode(&quot;\n&quot;));
-
-    var profiles = console.profiles;
-    for (var i = 0; i &lt; profiles.length; ++i) {
-        var profile = profiles[i];
-        if (profile.title !== &quot;inner&quot;)
-            continue;
-        var functionName = &quot;pageFunction&quot;;
-        if (findFunctionInProfile(profile.head, functionName))
-            preElement.appendChild(document.createTextNode(&quot;Found &quot; + functionName));
-        else {
-            preElement.appendChild(document.createTextNode(&quot;!!! Not found &quot; + functionName));
-            preElement.appendChild(document.createTextNode(&quot;\n\n&quot;));
-            printProfileNodeWithoutTime(preElement, profile.head, &quot;&quot;);
-        }
-        preElement.appendChild(document.createTextNode(&quot;\n&quot;));
-    }
-
-    document.getElementById(&quot;output&quot;).appendChild(preElement);
-}
-
-function printProfileNodeWithoutTime(preElement, node, space)
-{
-    if (!node.visible)
-        return;
-
-    var line = space + node.functionName + &quot; (line &quot; + node.lineNumber + &quot;)\n&quot;;
-    preElement.appendChild(document.createTextNode(line));
-
-    var children = node.children();
-    for (var i = 0; i &lt; children.length; ++i)
-        printProfileNodeWithoutTime(preElement, children[i], space + &quot;   &quot;);
-}
-
-function findFunctionInProfile(node, functionName)
-{
-    if (node.functionName === functionName)
-        return true;
-    var children = node.children();
-    for (var i = 0; i &lt; children.length; ++i)
-        if (findFunctionInProfile(children[i], functionName))
-            return true;
-    return false;
-}
-
-&lt;/script&gt;
-&lt;/head&gt;
-&lt;body onload=&quot;startTest()&quot;&gt;
-&lt;p&gt;
-Tests that CPU profiling works.&lt;br&gt;
-Doesn't open Inspector, uses &lt;b&gt;console.profile...&lt;/b&gt;.
-
-&lt;div id=&quot;output&quot;&gt;&lt;/div&gt;
-&lt;/p&gt;
-&lt;/body&gt;
-&lt;/html&gt;
</del></span></pre></div>
<a id="trunkLayoutTestsinspectorprotocolprofilerconsoleprofileexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector-protocol/profiler/console-profile-expected.txt (0 => 164689)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-protocol/profiler/console-profile-expected.txt                                (rev 0)
+++ trunk/LayoutTests/inspector-protocol/profiler/console-profile-expected.txt        2014-02-26 02:50:20 UTC (rev 164689)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+Tests that console.profile/profileEnd will record CPU profile when inspector front-end is connected.
+SUCCESS: retrieved 'inner' profile
+SUCCESS: found 'collectProfiles' function in the profile
+
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectorprotocolprofilerconsoleprofilehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector-protocol/profiler/console-profile.html (0 => 164689)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-protocol/profiler/console-profile.html                                (rev 0)
+++ trunk/LayoutTests/inspector-protocol/profiler/console-profile.html        2014-02-26 02:50:20 UTC (rev 164689)
</span><span class="lines">@@ -0,0 +1,87 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;script type=&quot;text/javascript&quot; src=&quot;../../http/tests/inspector-protocol/resources/protocol-test.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+function collectProfiles()
+{
+    console.profile(&quot;outer&quot;);
+    console.profile(&quot;inner&quot;);
+    console.profileEnd(&quot;outer&quot;);
+    console.profileEnd(&quot;inner&quot;);
+}
+
+function test()
+{
+    function fail(message)
+    {
+        InspectorTest.log(&quot;FAIL: &quot; + message);
+        InspectorTest.completeTest();
+    }
+
+    InspectorTest.sendCommand(&quot;Profiler.enable&quot;, {});
+    InspectorTest.sendCommand(&quot;Runtime.evaluate&quot;, {expression: &quot;collectProfiles()&quot;}, didCollectProfiles);
+
+    InspectorTest.eventHandler[&quot;Profiler.addProfileHeader&quot;] = function(messageObject)
+    {
+        InspectorTest.log(&quot;FAIL: unexpected header = &quot; + JSON.stringify(messageObject, null, 4));
+    }
+
+    function didCollectProfiles(messageObject)
+    {
+        InspectorTest.checkForError(messageObject);
+        InspectorTest.sendCommand(&quot;Profiler.getProfileHeaders&quot;, {}, didReceiveProfileHeaders);
+    }
+
+    function didReceiveProfileHeaders(messageObject)
+    {
+        InspectorTest.checkForError(messageObject);
+
+        var headers = messageObject[&quot;result&quot;][&quot;headers&quot;];
+        if (!headers || headers.length !== 2) {
+            fail(&quot;Cannot retrive headers: &quot; + JSON.stringify(messageObject, null, 4));
+            return;
+        }
+
+        for (var i = 0; i &lt; headers.length; i++) {
+            if (headers[i].title === &quot;inner&quot;) {
+                InspectorTest.sendCommand(&quot;Profiler.getCPUProfile&quot;, { uid: headers[i].uid }, didGetProfile);
+                return;
+            }
+        }
+
+        fail(&quot;Cannot find 'inner' profile header&quot;);
+    }
+
+    function didGetProfile(messageObject)
+    {
+        InspectorTest.checkForError(messageObject);
+        InspectorTest.log(&quot;SUCCESS: retrieved 'inner' profile&quot;);
+
+        var rootNodes = messageObject.result.profile.rootNodes;
+        if (!findFunctionInProfile(rootNodes, &quot;collectProfiles&quot;)) {
+            fail(&quot;collectProfiles function not found in the profile: &quot; + JSON.stringify(messageObject, null, 4));
+            return;
+        }
+
+        InspectorTest.log(&quot;SUCCESS: found 'collectProfiles' function in the profile&quot;);
+        InspectorTest.sendCommand(&quot;Profiler.clearProfiles&quot;, {});
+        InspectorTest.completeTest();
+    }
+
+    function findFunctionInProfile(rootNodes, functionName)
+    {
+        for (var i = 0; i &lt; rootNodes.length; ++i)
+            if (rootNodes[i].functionName === functionName)
+                return true;
+
+        return false;
+    }
+}
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;runTest()&quot;&gt;
+&lt;p&gt;
+Tests that console.profile/profileEnd will record CPU profile when inspector front-end is connected.&lt;br&gt;
+&lt;/p&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectorprotocolprofilerconsoleprofileEndparameterlessexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector-protocol/profiler/console-profileEnd-parameterless-expected.txt (0 => 164689)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-protocol/profiler/console-profileEnd-parameterless-expected.txt                                (rev 0)
+++ trunk/LayoutTests/inspector-protocol/profiler/console-profileEnd-parameterless-expected.txt        2014-02-26 02:50:20 UTC (rev 164689)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+Tests that &quot;console.profileEnd()&quot; does not cause crash.
+Bug 105759.
+SUCCESS: found 2 profile headers
+SUCCESS: titled profile found
+
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectorprotocolprofilerconsoleprofileEndparameterlesshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector-protocol/profiler/console-profileEnd-parameterless.html (0 => 164689)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-protocol/profiler/console-profileEnd-parameterless.html                                (rev 0)
+++ trunk/LayoutTests/inspector-protocol/profiler/console-profileEnd-parameterless.html        2014-02-26 02:50:20 UTC (rev 164689)
</span><span class="lines">@@ -0,0 +1,66 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;script type=&quot;text/javascript&quot; src=&quot;../../http/tests/inspector-protocol/resources/protocol-test.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+function collectProfiles()
+{
+    console.profile();
+    console.profile(&quot;titled&quot;);
+    console.profileEnd();
+    console.profileEnd();
+}
+
+function test()
+{
+    function fail(message)
+    {
+        InspectorTest.log(&quot;FAIL: &quot; + message);
+        InspectorTest.completeTest();
+    }
+
+    InspectorTest.sendCommand(&quot;Profiler.enable&quot;, {});
+    InspectorTest.sendCommand(&quot;Runtime.evaluate&quot;, {expression: &quot;collectProfiles()&quot;}, didCollectProfiles);
+
+    InspectorTest.eventHandler[&quot;Profiler.addProfileHeader&quot;] = function(messageObject)
+    {
+        InspectorTest.log(&quot;FAIL: unexpected header = &quot; + JSON.stringify(messageObject, null, 4));
+    }
+
+    function didCollectProfiles(messageObject)
+    {
+        InspectorTest.checkForError(messageObject);
+        InspectorTest.sendCommand(&quot;Profiler.getProfileHeaders&quot;, {}, didReceiveProfileHeaders);
+    }
+
+    function didReceiveProfileHeaders(messageObject)
+    {
+        InspectorTest.checkForError(messageObject);
+
+        var headers = messageObject[&quot;result&quot;][&quot;headers&quot;];
+        if (!headers || headers.length !== 2) {
+            fail(&quot;Cannot retrive headers: &quot; + JSON.stringify(messageObject, null, 4));
+            return;
+        }
+
+        InspectorTest.log(&quot;SUCCESS: found 2 profile headers&quot;);
+        for (var i = 0; i &lt; headers.length; i++) {
+            if (headers[i].title === &quot;titled&quot;) {
+                InspectorTest.log(&quot;SUCCESS: titled profile found&quot;);
+                InspectorTest.sendCommand(&quot;Profiler.clearProfiles&quot;, {});
+                InspectorTest.completeTest();
+                return;
+            }
+        }
+
+        fail(&quot;Cannot find titled profile&quot;);
+    }
+}
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;runTest()&quot;&gt;
+&lt;p&gt;
+Tests that &quot;console.profileEnd()&quot; does not cause crash.&lt;br&gt;
+&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=105759&quot;&gt;Bug 105759.&lt;/a&gt;&lt;br&gt;
+&lt;/p&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre>
</div>
</div>

</body>
</html>