<!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>[181567] trunk/Source/WebInspectorUI</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/181567">181567</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-03-16 11:11:59 -0700 (Mon, 16 Mar 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Unreviewed, rolling out <a href="http://trac.webkit.org/projects/webkit/changeset/181517">r181517</a>.
https://bugs.webkit.org/show_bug.cgi?id=142718
This patch broke GTK+ build (Requested by NVI on #webkit).
Reverted changeset:
"Web Inspector: Rename ConsoleMessage and ConsoleMessageImpl
to LegacyConsoleMessage and LegacyConsoleMessageImpl
respectively"
https://bugs.webkit.org/show_bug.cgi?id=142712
http://trac.webkit.org/changeset/181517</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceControllersJavaScriptLogViewControllerjs">trunk/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceControllersLogManagerjs">trunk/Source/WebInspectorUI/UserInterface/Controllers/LogManager.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceMainhtml">trunk/Source/WebInspectorUI/UserInterface/Main.html</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceModelsDefaultDashboardjs">trunk/Source/WebInspectorUI/UserInterface/Models/DefaultDashboard.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsConsoleCommandResultjs">trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleCommandResult.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsConsoleGroupjs">trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleGroup.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsLogContentViewjs">trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js</a></li>
<li><a href="#trunkSourceWebInspectorUIWebInspectorUIvcxprojWebInspectorUIvcxproj">trunk/Source/WebInspectorUI/WebInspectorUI.vcxproj/WebInspectorUI.vcxproj</a></li>
<li><a href="#trunkSourceWebInspectorUIWebInspectorUIvcxprojWebInspectorUIvcxprojfilters">trunk/Source/WebInspectorUI/WebInspectorUI.vcxproj/WebInspectorUI.vcxproj.filters</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsConsoleMessagejs">trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessage.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsConsoleMessageImpljs">trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageImpl.js</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsLegacyConsoleMessagejs">trunk/Source/WebInspectorUI/UserInterface/Views/LegacyConsoleMessage.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsLegacyConsoleMessageImpljs">trunk/Source/WebInspectorUI/UserInterface/Views/LegacyConsoleMessageImpl.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (181566 => 181567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2015-03-16 17:55:15 UTC (rev 181566)
+++ trunk/Source/WebInspectorUI/ChangeLog        2015-03-16 18:11:59 UTC (rev 181567)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2015-03-16 Commit Queue <commit-queue@webkit.org>
+
+ Unreviewed, rolling out r181517.
+ https://bugs.webkit.org/show_bug.cgi?id=142718
+
+ This patch broke GTK+ build (Requested by NVI on #webkit).
+
+ Reverted changeset:
+
+ "Web Inspector: Rename ConsoleMessage and ConsoleMessageImpl
+ to LegacyConsoleMessage and LegacyConsoleMessageImpl
+ respectively"
+ https://bugs.webkit.org/show_bug.cgi?id=142712
+ http://trac.webkit.org/changeset/181517
+
</ins><span class="cx"> 2015-03-15 Nikita Vasilyev <nvasilyev@apple.com>
</span><span class="cx">
</span><span class="cx"> Web Inspector: Console Scrolls Unexpectedly when Clicking inside un-selected Expanding Object
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceControllersJavaScriptLogViewControllerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js (181566 => 181567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js        2015-03-16 17:55:15 UTC (rev 181566)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js        2015-03-16 18:11:59 UTC (rev 181567)
</span><span class="lines">@@ -276,12 +276,12 @@
</span><span class="cx"> if (!repeatCountWasInterrupted)
</span><span class="cx"> this._previousMessage = msg;
</span><span class="cx">
</span><del>- if (msg.type === WebInspector.LegacyConsoleMessage.MessageType.EndGroup) {
</del><ins>+ if (msg.type === WebInspector.ConsoleMessage.MessageType.EndGroup) {
</ins><span class="cx"> var parentGroup = this._currentConsoleGroup.parentGroup;
</span><span class="cx"> if (parentGroup)
</span><span class="cx"> this._currentConsoleGroup = parentGroup;
</span><span class="cx"> } else {
</span><del>- if (msg.type === WebInspector.LegacyConsoleMessage.MessageType.StartGroup || msg.type === WebInspector.LegacyConsoleMessage.MessageType.StartGroupCollapsed) {
</del><ins>+ if (msg.type === WebInspector.ConsoleMessage.MessageType.StartGroup || msg.type === WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed) {
</ins><span class="cx"> var group = new WebInspector.ConsoleGroup(this._currentConsoleGroup);
</span><span class="cx"> var groupElement = group.render(msg);
</span><span class="cx"> this._currentConsoleGroup.append(groupElement);
</span><span class="lines">@@ -290,7 +290,7 @@
</span><span class="cx"> this._currentConsoleGroup.addMessage(msg);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (msg.type === WebInspector.LegacyConsoleMessage.MessageType.Result || wasScrolledToBottom)
</del><ins>+ if (msg.type === WebInspector.ConsoleMessage.MessageType.Result || wasScrolledToBottom)
</ins><span class="cx"> this.scrollToBottom();
</span><span class="cx">
</span><span class="cx"> if (this.delegate && typeof this.delegate.didAppendConsoleMessage === "function")
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceControllersLogManagerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/LogManager.js (181566 => 181567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Controllers/LogManager.js        2015-03-16 17:55:15 UTC (rev 181566)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/LogManager.js        2015-03-16 18:11:59 UTC (rev 181567)
</span><span class="lines">@@ -48,7 +48,7 @@
</span><span class="cx"> // Called from WebInspector.ConsoleObserver.
</span><span class="cx">
</span><span class="cx"> // FIXME: Pass a request. We need a way to get it from the request ID.
</span><del>- var consoleMessage = WebInspector.LegacyConsoleMessage.create(source, level, text, type, url, line, column, repeatCount, parameters, stackTrace, null);
</del><ins>+ var consoleMessage = WebInspector.ConsoleMessage.create(source, level, text, type, url, line, column, repeatCount, parameters, stackTrace, null);
</ins><span class="cx">
</span><span class="cx"> this.dispatchEventToListeners(WebInspector.LogManager.Event.MessageAdded, {message: consoleMessage});
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceMainhtml"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Main.html (181566 => 181567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Main.html        2015-03-16 17:55:15 UTC (rev 181566)
+++ trunk/Source/WebInspectorUI/UserInterface/Main.html        2015-03-16 18:11:59 UTC (rev 181567)
</span><span class="lines">@@ -291,7 +291,7 @@
</span><span class="cx"> <script src="Models/TypeSet.js"></script>
</span><span class="cx"> <script src="Models/UnitBezier.js"></script>
</span><span class="cx">
</span><del>- <script src="Views/LegacyConsoleMessage.js"></script>
</del><ins>+ <script src="Views/ConsoleMessage.js"></script>
</ins><span class="cx"> <script src="Views/ContentView.js"></script>
</span><span class="cx"> <script src="Views/DataGrid.js"></script>
</span><span class="cx"> <script src="Views/DetailsSectionRow.js"></script>
</span><span class="lines">@@ -306,7 +306,7 @@
</span><span class="cx"> <script src="Views/TreeOutline.js"></script>
</span><span class="cx">
</span><span class="cx"> <script src="Views/ButtonNavigationItem.js"></script>
</span><del>- <script src="Views/LegacyConsoleMessageImpl.js"></script>
</del><ins>+ <script src="Views/ConsoleMessageImpl.js"></script>
</ins><span class="cx"> <script src="Views/DOMTreeContentView.js"></script>
</span><span class="cx"> <script src="Views/DetailsSidebarPanel.js"></script>
</span><span class="cx"> <script src="Views/GeneralTreeElement.js"></script>
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsDefaultDashboardjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Models/DefaultDashboard.js (181566 => 181567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Models/DefaultDashboard.js        2015-03-16 17:55:15 UTC (rev 181566)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/DefaultDashboard.js        2015-03-16 18:11:59 UTC (rev 181567)
</span><span class="lines">@@ -249,13 +249,13 @@
</span><span class="cx"> _incrementConsoleMessageType: function(type, increment)
</span><span class="cx"> {
</span><span class="cx"> switch (type) {
</span><del>- case WebInspector.LegacyConsoleMessage.MessageLevel.Log:
</del><ins>+ case WebInspector.ConsoleMessage.MessageLevel.Log:
</ins><span class="cx"> this.logs += increment;
</span><span class="cx"> break;
</span><del>- case WebInspector.LegacyConsoleMessage.MessageLevel.Warning:
</del><ins>+ case WebInspector.ConsoleMessage.MessageLevel.Warning:
</ins><span class="cx"> this.issues += increment;
</span><span class="cx"> break;
</span><del>- case WebInspector.LegacyConsoleMessage.MessageLevel.Error:
</del><ins>+ case WebInspector.ConsoleMessage.MessageLevel.Error:
</ins><span class="cx"> this.errors += increment;
</span><span class="cx"> break;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsConsoleCommandResultjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleCommandResult.js (181566 => 181567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleCommandResult.js        2015-03-16 17:55:15 UTC (rev 181566)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleCommandResult.js        2015-03-16 18:11:59 UTC (rev 181567)
</span><span class="lines">@@ -29,14 +29,14 @@
</span><span class="cx">
</span><span class="cx"> WebInspector.ConsoleCommandResult = function(result, wasThrown, originatingCommand, savedResultIndex)
</span><span class="cx"> {
</span><del>- var level = (wasThrown ? WebInspector.LegacyConsoleMessage.MessageLevel.Error : WebInspector.LegacyConsoleMessage.MessageLevel.Log);
</del><ins>+ var level = (wasThrown ? WebInspector.ConsoleMessage.MessageLevel.Error : WebInspector.ConsoleMessage.MessageLevel.Log);
</ins><span class="cx"> this.originatingCommand = originatingCommand;
</span><span class="cx"> this.savedResultIndex = savedResultIndex;
</span><span class="cx">
</span><span class="cx"> if (this.savedResultIndex && this.savedResultIndex > WebInspector.ConsoleCommandResult.maximumSavedResultIndex)
</span><span class="cx"> WebInspector.ConsoleCommandResult.maximumSavedResultIndex = this.savedResultIndex;
</span><span class="cx">
</span><del>- WebInspector.LegacyConsoleMessageImpl.call(this, WebInspector.LegacyConsoleMessage.MessageSource.JS, level, "", null, WebInspector.LegacyConsoleMessage.MessageType.Result, undefined, undefined, undefined, undefined, [result]);
</del><ins>+ WebInspector.ConsoleMessageImpl.call(this, WebInspector.ConsoleMessage.MessageSource.JS, level, "", null, WebInspector.ConsoleMessage.MessageType.Result, undefined, undefined, undefined, undefined, [result]);
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> WebInspector.ConsoleCommandResult.maximumSavedResultIndex = 0;
</span><span class="lines">@@ -55,7 +55,7 @@
</span><span class="cx">
</span><span class="cx"> toMessageElement: function()
</span><span class="cx"> {
</span><del>- var element = WebInspector.LegacyConsoleMessageImpl.prototype.toMessageElement.call(this);
</del><ins>+ var element = WebInspector.ConsoleMessageImpl.prototype.toMessageElement.call(this);
</ins><span class="cx"> element.classList.add("console-user-command-result");
</span><span class="cx"> if (!element.getAttribute("data-labelprefix"))
</span><span class="cx"> element.setAttribute("data-labelprefix", WebInspector.UIString("Output: "));
</span><span class="lines">@@ -68,4 +68,4 @@
</span><span class="cx"> }
</span><span class="cx"> };
</span><span class="cx">
</span><del>-WebInspector.ConsoleCommandResult.prototype.__proto__ = WebInspector.LegacyConsoleMessageImpl.prototype;
</del><ins>+WebInspector.ConsoleCommandResult.prototype.__proto__ = WebInspector.ConsoleMessageImpl.prototype;
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsConsoleGroupjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleGroup.js (181566 => 181567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleGroup.js        2015-03-16 17:55:15 UTC (rev 181566)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleGroup.js        2015-03-16 18:11:59 UTC (rev 181567)
</span><span class="lines">@@ -50,7 +50,7 @@
</span><span class="cx"> titleElement.classList.add(WebInspector.LogContentView.ItemWrapperStyleClassName);
</span><span class="cx"> titleElement.addEventListener("click", this._titleClicked.bind(this));
</span><span class="cx"> titleElement.addEventListener("mousedown", this._titleMouseDown.bind(this));
</span><del>- if (groupElement && message.type === WebInspector.LegacyConsoleMessage.MessageType.StartGroupCollapsed)
</del><ins>+ if (groupElement && message.type === WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed)
</ins><span class="cx"> groupElement.classList.add("collapsed");
</span><span class="cx">
</span><span class="cx"> groupElement.appendChild(titleElement);
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsConsoleMessagejsfromrev181566trunkSourceWebInspectorUIUserInterfaceViewsLegacyConsoleMessagejs"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessage.js (from rev 181566, trunk/Source/WebInspectorUI/UserInterface/Views/LegacyConsoleMessage.js) (0 => 181567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessage.js         (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessage.js        2015-03-16 18:11:59 UTC (rev 181567)
</span><span class="lines">@@ -0,0 +1,98 @@
</span><ins>+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2007, 2008, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Joseph Pecoraro
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WebInspector.ConsoleMessage = function(source, level, url, line, column, repeatCount)
+{
+ this.source = source;
+ this.level = level;
+ this.url = url || null;
+ this.line = line || 0;
+ this.column = column || 0;
+
+ repeatCount = repeatCount || 1;
+ this.repeatCount = repeatCount;
+ this.repeatDelta = repeatCount;
+ this.totalRepeatCount = repeatCount;
+};
+
+WebInspector.ConsoleMessage.prototype = {
+ isErrorOrWarning: function()
+ {
+ return (this.level === WebInspector.ConsoleMessage.MessageLevel.Warning || this.level === WebInspector.ConsoleMessage.MessageLevel.Error);
+ },
+
+ updateRepeatCount: function()
+ {
+ // Implemented by concrete instances
+ },
+
+ clone: function()
+ {
+ // Implemented by concrete instances
+ }
+};
+
+WebInspector.ConsoleMessage.create = function(source, level, message, type, url, line, column, repeatCount, parameters, stackTrace, request)
+{
+ return new WebInspector.ConsoleMessageImpl(source, level, message, null, type, url, line, column, repeatCount, parameters, stackTrace, request);
+};
+
+// FIXME: Switch to ConsoleAgent.ConsoleMessageSource.
+WebInspector.ConsoleMessage.MessageSource = {
+ HTML: "html",
+ XML: "xml",
+ JS: "javascript",
+ Network: "network",
+ ConsoleAPI: "console-api",
+ Other: "other"
+};
+
+// FIXME: Switch to ConsoleAgent.ConsoleMessageType.
+WebInspector.ConsoleMessage.MessageType = {
+ Log: "log",
+ Dir: "dir",
+ DirXML: "dirxml",
+ Table: "table",
+ Trace: "trace",
+ StartGroup: "startGroup",
+ StartGroupCollapsed: "startGroupCollapsed",
+ EndGroup: "endGroup",
+ Assert: "assert",
+ Result: "result"
+};
+
+// FIXME: Switch to ConsoleAgent.ConsoleMessageLevel.
+WebInspector.ConsoleMessage.MessageLevel = {
+ Tip: "tip",
+ Log: "log",
+ Warning: "warning",
+ Error: "error",
+ Debug: "debug"
+};
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsConsoleMessageImpljsfromrev181566trunkSourceWebInspectorUIUserInterfaceViewsLegacyConsoleMessageImpljs"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageImpl.js (from rev 181566, trunk/Source/WebInspectorUI/UserInterface/Views/LegacyConsoleMessageImpl.js) (0 => 181567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageImpl.js         (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageImpl.js        2015-03-16 18:11:59 UTC (rev 181567)
</span><span class="lines">@@ -0,0 +1,801 @@
</span><ins>+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2007, 2008, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Joseph Pecoraro
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WebInspector.ConsoleMessageImpl = function(source, level, message, linkifier, type, url, line, column, repeatCount, parameters, stackTrace, request)
+{
+ WebInspector.ConsoleMessage.call(this, source, level, url, line, column, repeatCount);
+
+ this._linkifier = linkifier;
+ this.type = type || WebInspector.ConsoleMessage.MessageType.Log;
+ this._messageText = message;
+ this._parameters = parameters;
+ this._stackTrace = stackTrace;
+ this._request = request;
+
+ this._customFormatters = {
+ "object": this._formatParameterAsObject,
+ "error": this._formatParameterAsObject,
+ "map": this._formatParameterAsObject,
+ "set": this._formatParameterAsObject,
+ "weakmap": this._formatParameterAsObject,
+ "iterator": this._formatParameterAsObject,
+ "array": this._formatParameterAsArray,
+ "node": this._formatParameterAsNode,
+ "string": this._formatParameterAsString
+ };
+};
+
+WebInspector.ConsoleMessageImpl.prototype = {
+
+ enforcesClipboardPrefixString: true,
+
+ _formatMessage: function()
+ {
+ this._formattedMessage = document.createElement("span");
+ this._formattedMessage.className = "console-message-text";
+
+ var messageText;
+ if (this.source === WebInspector.ConsoleMessage.MessageSource.ConsoleAPI) {
+ switch (this.type) {
+ case WebInspector.ConsoleMessage.MessageType.Trace:
+ messageText = document.createTextNode("console.trace()");
+ break;
+ case WebInspector.ConsoleMessage.MessageType.Assert:
+ var args = [WebInspector.UIString("Assertion failed:")];
+ if (this._parameters)
+ args = args.concat(this._parameters);
+ messageText = this._format(args);
+ break;
+ case WebInspector.ConsoleMessage.MessageType.Dir:
+ var obj = this._parameters ? this._parameters[0] : undefined;
+ var args = ["%O", obj];
+ messageText = this._format(args);
+ break;
+ default:
+ var args = this._parameters || [this._messageText];
+ messageText = this._format(args);
+ }
+ } else if (this.source === WebInspector.ConsoleMessage.MessageSource.Network) {
+ if (this._request) {
+ this._stackTrace = this._request.stackTrace;
+ if (this._request.initiator && this._request.initiator.url) {
+ this.url = this._request.initiator.url;
+ this.line = this._request.initiator.lineNumber;
+ }
+ messageText = document.createElement("span");
+ if (this.level === WebInspector.ConsoleMessage.MessageLevel.Error) {
+ messageText.appendChild(document.createTextNode(this._request.requestMethod + " "));
+ messageText.appendChild(WebInspector.linkifyRequestAsNode(this._request));
+ if (this._request.failed)
+ messageText.appendChild(document.createTextNode(" " + this._request.localizedFailDescription));
+ else
+ messageText.appendChild(document.createTextNode(" " + this._request.statusCode + " (" + this._request.statusText + ")"));
+ } else {
+ var fragment = WebInspector.linkifyStringAsFragmentWithCustomLinkifier(this._messageText, WebInspector.linkifyRequestAsNode.bind(null, this._request, ""));
+ messageText.appendChild(fragment);
+ }
+ } else {
+ if (this.url) {
+ var anchor = WebInspector.linkifyURLAsNode(this.url, this.url, "console-message-url");
+ this._formattedMessage.appendChild(anchor);
+ }
+ messageText = this._format([this._messageText]);
+ }
+ } else {
+ var args = this._parameters || [this._messageText];
+ messageText = this._format(args);
+ }
+
+ if (this.source !== WebInspector.ConsoleMessage.MessageSource.Network || this._request) {
+ var firstNonNativeCallFrame = this._firstNonNativeCallFrame();
+ if (firstNonNativeCallFrame) {
+ var urlElement = this._linkifyCallFrame(firstNonNativeCallFrame);
+ this._formattedMessage.appendChild(urlElement);
+ } else if (this.url && !this._shouldHideURL(this.url)) {
+ var urlElement = this._linkifyLocation(this.url, this.line, this.column);
+ this._formattedMessage.appendChild(urlElement);
+ }
+ }
+
+ this._formattedMessage.appendChild(messageText);
+
+ if (this.savedResultIndex) {
+ var savedVariableElement = document.createElement("span");
+ savedVariableElement.className = "console-saved-variable";
+ savedVariableElement.textContent = " = $" + this.savedResultIndex;
+ if (this._objectTree)
+ this._objectTree.appendTitleSuffix(savedVariableElement);
+ else
+ this._formattedMessage.appendChild(savedVariableElement);
+ }
+
+ if (this._shouldDumpStackTrace()) {
+ var ol = document.createElement("ol");
+ ol.className = "outline-disclosure";
+ var treeOutline = new TreeOutline(ol);
+
+ var content = this._formattedMessage;
+ var root = new TreeElement(content, null, true);
+ content.treeElementForTest = root;
+ treeOutline.appendChild(root);
+ if (this.type === WebInspector.ConsoleMessage.MessageType.Trace)
+ root.expand();
+
+ this._populateStackTraceTreeElement(root);
+ this._formattedMessage = ol;
+ }
+
+ // This is used for inline message bubbles in SourceFrames, or other plain-text representations.
+ this._message = messageText.textContent;
+ },
+
+ _shouldDumpStackTrace: function()
+ {
+ return !!this._stackTrace && this._stackTrace.length && (this.source === WebInspector.ConsoleMessage.MessageSource.Network || this.level === WebInspector.ConsoleMessage.MessageLevel.Error || this.type === WebInspector.ConsoleMessage.MessageType.Trace);
+ },
+
+ _shouldHideURL: function(url)
+ {
+ return url === "undefined" || url === "[native code]";
+ },
+
+ _firstNonNativeCallFrame: function()
+ {
+ if (!this._stackTrace)
+ return null;
+
+ for (var i = 0; i < this._stackTrace.length; i++) {
+ var frame = this._stackTrace[i];
+ if (!frame.url || frame.url === "[native code]")
+ continue;
+ return frame;
+ }
+
+ return null;
+ },
+
+ get message()
+ {
+ // force message formatting
+ var formattedMessage = this.formattedMessage;
+ return this._message;
+ },
+
+ get formattedMessage()
+ {
+ if (!this._formattedMessage)
+ this._formatMessage();
+ return this._formattedMessage;
+ },
+
+ _linkifyLocation: function(url, lineNumber, columnNumber)
+ {
+ // ConsoleMessage stack trace line numbers are one-based.
+ lineNumber = lineNumber ? lineNumber - 1 : 0;
+ columnNumber = columnNumber ? columnNumber - 1 : 0;
+
+ return WebInspector.linkifyLocation(url, lineNumber, columnNumber, "console-message-url");
+ },
+
+ _linkifyCallFrame: function(callFrame)
+ {
+ return this._linkifyLocation(callFrame.url, callFrame.lineNumber, callFrame.columnNumber);
+ },
+
+ isErrorOrWarning: function()
+ {
+ return (this.level === WebInspector.ConsoleMessage.MessageLevel.Warning || this.level === WebInspector.ConsoleMessage.MessageLevel.Error);
+ },
+
+ _format: function(parameters)
+ {
+ // This node is used like a Builder. Values are continually appended onto it.
+ var formattedResult = document.createElement("span");
+ if (!parameters.length)
+ return formattedResult;
+
+ // Formatting code below assumes that parameters are all wrappers whereas frontend console
+ // API allows passing arbitrary values as messages (strings, numbers, etc.). Wrap them here.
+ for (var i = 0; i < parameters.length; ++i) {
+ // FIXME: Only pass runtime wrappers here.
+ if (parameters[i] instanceof WebInspector.RemoteObject)
+ continue;
+
+ if (typeof parameters[i] === "object")
+ parameters[i] = WebInspector.RemoteObject.fromPayload(parameters[i]);
+ else
+ parameters[i] = WebInspector.RemoteObject.fromPrimitiveValue(parameters[i]);
+ }
+
+ // There can be string log and string eval result. We distinguish between them based on message type.
+ var shouldFormatMessage = WebInspector.RemoteObject.type(parameters[0]) === "string" && this.type !== WebInspector.ConsoleMessage.MessageType.Result;
+
+ if (shouldFormatMessage) {
+ // Multiple parameters with the first being a format string. Save unused substitutions.
+ var result = this._formatWithSubstitutionString(parameters, formattedResult);
+ parameters = result.unusedSubstitutions;
+ if (parameters.length)
+ formattedResult.appendChild(document.createTextNode(" "));
+ }
+
+ if (this.type === WebInspector.ConsoleMessage.MessageType.Table) {
+ formattedResult.appendChild(this._formatParameterAsTable(parameters));
+ return formattedResult;
+ }
+
+ // Single parameter, or unused substitutions from above.
+ for (var i = 0; i < parameters.length; ++i) {
+ // Inline strings when formatting.
+ if (shouldFormatMessage && parameters[i].type === "string") {
+ var span = document.createElement("span");
+ span.classList.add("type-string");
+ span.textContent = parameters[i].description;
+ formattedResult.appendChild(span);
+ } else
+ formattedResult.appendChild(this._formatParameter(parameters[i], false));
+
+ if (i < parameters.length - 1 && !this._isExpandable(parameters[i]))
+ formattedResult.appendChild(document.createTextNode(" "));
+
+ }
+ return formattedResult;
+ },
+
+ _isExpandable: function(remoteObject) {
+ if (!remoteObject)
+ return false;
+
+ if (remoteObject.hasChildren && remoteObject.preview && remoteObject.preview.lossless)
+ return false;
+
+ return remoteObject.hasChildren;
+ },
+
+ _formatParameter: function(output, forceObjectFormat)
+ {
+ var type;
+ if (forceObjectFormat)
+ type = "object";
+ else if (output instanceof WebInspector.RemoteObject)
+ type = output.subtype || output.type;
+ else
+ type = typeof output;
+
+ var formatter = this._customFormatters[type];
+ if (!formatter)
+ formatter = this._formatParameterAsValue;
+
+ var span = document.createElement("span");
+
+ if (this._isExpandable(output))
+ span.classList.add("expandable");
+
+ formatter.call(this, output, span, forceObjectFormat);
+ return span;
+ },
+
+ _formatParameterAsValue: function(value, elem)
+ {
+ elem.appendChild(WebInspector.FormattedValue.createElementForRemoteObject(value));
+ },
+
+ _formatParameterAsObject: function(obj, elem, forceExpansion)
+ {
+ this._objectTree = new WebInspector.ObjectTreeView(obj, WebInspector.ObjectTreeView.Mode.Properties, this._rootPropertyPathForObject(obj), forceExpansion);
+ elem.appendChild(this._objectTree.element);
+ },
+
+ _formatParameterAsString: function(output, elem)
+ {
+ var span = WebInspector.FormattedValue.createLinkifiedElementString(output.description);
+ elem.appendChild(span);
+ },
+
+ _formatParameterAsNode: function(object, elem)
+ {
+ var span = WebInspector.FormattedValue.createElementForNode(object);
+ elem.appendChild(span);
+ },
+
+ _formatParameterAsArray: function(arr, elem)
+ {
+ this._objectTree = new WebInspector.ObjectTreeView(arr, WebInspector.ObjectTreeView.Mode.Properties, this._rootPropertyPathForObject(arr));
+ elem.appendChild(this._objectTree.element);
+ },
+
+ _rootPropertyPathForObject: function(object)
+ {
+ if (!this.savedResultIndex)
+ return null;
+
+ return new WebInspector.PropertyPath(object, "$" + this.savedResultIndex);
+ },
+
+ _userProvidedColumnNames: function(columnNamesArgument)
+ {
+ if (!columnNamesArgument)
+ return null;
+
+ var remoteObject = WebInspector.RemoteObject.fromPayload(columnNamesArgument);
+
+ // Single primitive argument.
+ if (remoteObject.type === "string" || remoteObject.type === "number")
+ return [String(columnNamesArgument.value)];
+
+ // Ignore everything that is not an array with property previews.
+ if (remoteObject.type !== "object" || remoteObject.subtype !== "array" || !remoteObject.preview || !remoteObject.preview.propertyPreviews)
+ return null;
+
+ // Array. Look into the preview and get string values.
+ var extractedColumnNames = [];
+ for (var propertyPreview of remoteObject.preview.propertyPreviews) {
+ if (propertyPreview.type === "string" || propertyPreview.type === "number")
+ extractedColumnNames.push(String(propertyPreview.value));
+ }
+
+ return extractedColumnNames.length ? extractedColumnNames : null;
+ },
+
+ _formatParameterAsTable: function(parameters)
+ {
+ var element = document.createElement("span");
+ var table = parameters[0];
+ if (!table || !table.preview)
+ return element;
+
+ var rows = [];
+ var columnNames = [];
+ var flatValues = [];
+ var preview = table.preview;
+ var userProvidedColumnNames = false;
+
+ // User provided columnNames.
+ var extractedColumnNames = this._userProvidedColumnNames(parameters[1]);
+ if (extractedColumnNames) {
+ userProvidedColumnNames = true;
+ columnNames = extractedColumnNames;
+ }
+
+ // Check first for valuePreviews in the properties meaning this was an array of objects.
+ if (preview.propertyPreviews) {
+ for (var i = 0; i < preview.propertyPreviews.length; ++i) {
+ var rowProperty = preview.propertyPreviews[i];
+ var rowPreview = rowProperty.valuePreview;
+ if (!rowPreview)
+ continue;
+
+ var rowValue = {};
+ const maxColumnsToRender = 10;
+ for (var j = 0; j < rowPreview.propertyPreviews.length; ++j) {
+ var cellProperty = rowPreview.propertyPreviews[j];
+ var columnRendered = columnNames.contains(cellProperty.name);
+ if (!columnRendered) {
+ if (userProvidedColumnNames || columnNames.length === maxColumnsToRender)
+ continue;
+ columnRendered = true;
+ columnNames.push(cellProperty.name);
+ }
+
+ rowValue[cellProperty.name] = WebInspector.FormattedValue.createElementForPropertyPreview(cellProperty);
+ }
+ rows.push([rowProperty.name, rowValue]);
+ }
+ }
+
+ // If there were valuePreviews, convert to a flat list.
+ if (rows.length) {
+ const emDash = "\u2014";
+ columnNames.unshift(WebInspector.UIString("(Index)"));
+ for (var i = 0; i < rows.length; ++i) {
+ var rowName = rows[i][0];
+ var rowValue = rows[i][1];
+ flatValues.push(rowName);
+ for (var j = 1; j < columnNames.length; ++j) {
+ var columnName = columnNames[j];
+ if (!(columnName in rowValue))
+ flatValues.push(emDash);
+ else
+ flatValues.push(rowValue[columnName]);
+ }
+ }
+ }
+
+ // If there were no value Previews, then check for an array of values.
+ if (!flatValues.length && preview.propertyPreviews) {
+ for (var i = 0; i < preview.propertyPreviews.length; ++i) {
+ var rowProperty = preview.propertyPreviews[i];
+ if (!("value" in rowProperty))
+ continue;
+
+ if (!columnNames.length) {
+ columnNames.push(WebInspector.UIString("Index"));
+ columnNames.push(WebInspector.UIString("Value"));
+ }
+
+ flatValues.push(rowProperty.name);
+ flatValues.push(WebInspector.FormattedValue.createElementForPropertyPreview(rowProperty));
+ }
+ }
+
+ // If lossless or not table data, output the object so full data can be gotten.
+ if (!preview.lossless || !flatValues.length) {
+ element.appendChild(this._formatParameter(table));
+ if (!flatValues.length)
+ return element;
+ }
+
+ var dataGridContainer = element.createChild("span");
+ var dataGrid = WebInspector.DataGrid.createSortableDataGrid(columnNames, flatValues);
+ dataGrid.element.classList.add("inline");
+ dataGridContainer.appendChild(dataGrid.element);
+
+ return element;
+ },
+
+ _formatWithSubstitutionString: function(parameters, formattedResult)
+ {
+ var formatters = {};
+
+ function parameterFormatter(force, obj)
+ {
+ return this._formatParameter(obj, force);
+ }
+
+ function stringFormatter(obj)
+ {
+ return obj.description;
+ }
+
+ function floatFormatter(obj)
+ {
+ if (typeof obj.value !== "number")
+ return parseFloat(obj.description);
+ return obj.value;
+ }
+
+ function integerFormatter(obj)
+ {
+ if (typeof obj.value !== "number")
+ return parseInt(obj.description);
+ return Math.floor(obj.value);
+ }
+
+ var currentStyle = null;
+ function styleFormatter(obj)
+ {
+ currentStyle = {};
+ var buffer = document.createElement("span");
+ buffer.setAttribute("style", obj.description);
+ for (var i = 0; i < buffer.style.length; i++) {
+ var property = buffer.style[i];
+ if (isWhitelistedProperty(property))
+ currentStyle[property] = buffer.style[property];
+ }
+ }
+
+ function isWhitelistedProperty(property)
+ {
+ var prefixes = ["background", "border", "color", "font", "line", "margin", "padding", "text", "-webkit-background", "-webkit-border", "-webkit-font", "-webkit-margin", "-webkit-padding", "-webkit-text"];
+ for (var i = 0; i < prefixes.length; i++) {
+ if (property.startsWith(prefixes[i]))
+ return true;
+ }
+ return false;
+ }
+
+ // Firebug uses %o for formatting objects.
+ formatters.o = parameterFormatter.bind(this, false);
+ formatters.s = stringFormatter;
+ formatters.f = floatFormatter;
+
+ // Firebug allows both %i and %d for formatting integers.
+ formatters.i = integerFormatter;
+ formatters.d = integerFormatter;
+
+ // Firebug uses %c for styling the message.
+ formatters.c = styleFormatter;
+
+ // Support %O to force object formatting, instead of the type-based %o formatting.
+ formatters.O = parameterFormatter.bind(this, true);
+
+ function append(a, b)
+ {
+ if (b instanceof Node)
+ a.appendChild(b);
+ else if (b) {
+ var toAppend = WebInspector.linkifyStringAsFragment(b.toString());
+ if (currentStyle) {
+ var wrapper = document.createElement("span");
+ for (var key in currentStyle)
+ wrapper.style[key] = currentStyle[key];
+ wrapper.appendChild(toAppend);
+ toAppend = wrapper;
+ }
+ var span = document.createElement("span");
+ span.className = "type-string";
+ span.appendChild(toAppend);
+ a.appendChild(span);
+ }
+ return a;
+ }
+
+ // String.format does treat formattedResult like a Builder, result is an object.
+ return String.format(parameters[0].description, parameters.slice(1), formatters, formattedResult, append);
+ },
+
+ decorateMessageElement: function(element)
+ {
+ if (this._element)
+ return this._element;
+
+ element.message = this;
+ element.classList.add("console-message");
+
+ this._element = element;
+
+ switch (this.level) {
+ case WebInspector.ConsoleMessage.MessageLevel.Tip:
+ element.classList.add("console-tip-level");
+ element.setAttribute("data-labelprefix", WebInspector.UIString("Tip: "));
+ break;
+ case WebInspector.ConsoleMessage.MessageLevel.Log:
+ element.classList.add("console-log-level");
+ element.setAttribute("data-labelprefix", WebInspector.UIString("Log: "));
+ break;
+ case WebInspector.ConsoleMessage.MessageLevel.Debug:
+ element.classList.add("console-debug-level");
+ element.setAttribute("data-labelprefix", WebInspector.UIString("Debug: "));
+ break;
+ case WebInspector.ConsoleMessage.MessageLevel.Warning:
+ element.classList.add("console-warning-level");
+ element.setAttribute("data-labelprefix", WebInspector.UIString("Warning: "));
+ break;
+ case WebInspector.ConsoleMessage.MessageLevel.Error:
+ element.classList.add("console-error-level");
+ element.setAttribute("data-labelprefix", WebInspector.UIString("Error: "));
+ break;
+ }
+
+ if (this.type === WebInspector.ConsoleMessage.MessageType.StartGroup || this.type === WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed)
+ element.classList.add("console-group-title");
+
+ element.appendChild(this.formattedMessage);
+
+ if (this.repeatCount > 1)
+ this.updateRepeatCount();
+
+ return element;
+ },
+
+ toMessageElement: function()
+ {
+ if (this._element)
+ return this._element;
+
+ var element = document.createElement("div");
+
+ return this.decorateMessageElement(element);
+ },
+
+ _populateStackTraceTreeElement: function(parentTreeElement)
+ {
+ for (var i = 0; i < this._stackTrace.length; i++) {
+ var frame = this._stackTrace[i];
+
+ var content = document.createElement("div");
+ var messageTextElement = document.createElement("span");
+ messageTextElement.className = "console-message-text";
+ var functionName = frame.functionName || WebInspector.UIString("(anonymous function)");
+ messageTextElement.appendChild(document.createTextNode(functionName));
+ content.appendChild(messageTextElement);
+
+ if (frame.url && !this._shouldHideURL(frame.url)) {
+ var urlElement = this._linkifyCallFrame(frame);
+ content.appendChild(urlElement);
+ }
+
+ var treeElement = new TreeElement(content);
+ parentTreeElement.appendChild(treeElement);
+ }
+ },
+
+ updateRepeatCount: function() {
+ if (!this.repeatCountElement) {
+ this.repeatCountElement = document.createElement("span");
+ this.repeatCountElement.className = "bubble";
+
+ this._element.insertBefore(this.repeatCountElement, this._element.firstChild);
+ }
+ this.repeatCountElement.textContent = this.repeatCount;
+ },
+
+ toString: function()
+ {
+ var sourceString;
+ switch (this.source) {
+ case WebInspector.ConsoleMessage.MessageSource.HTML:
+ sourceString = "HTML";
+ break;
+ case WebInspector.ConsoleMessage.MessageSource.XML:
+ sourceString = "XML";
+ break;
+ case WebInspector.ConsoleMessage.MessageSource.JS:
+ sourceString = "JS";
+ break;
+ case WebInspector.ConsoleMessage.MessageSource.Network:
+ sourceString = "Network";
+ break;
+ case WebInspector.ConsoleMessage.MessageSource.ConsoleAPI:
+ sourceString = "ConsoleAPI";
+ break;
+ case WebInspector.ConsoleMessage.MessageSource.Other:
+ sourceString = "Other";
+ break;
+ }
+
+ var typeString;
+ switch (this.type) {
+ case WebInspector.ConsoleMessage.MessageType.Log:
+ typeString = "Log";
+ break;
+ case WebInspector.ConsoleMessage.MessageType.Dir:
+ typeString = "Dir";
+ break;
+ case WebInspector.ConsoleMessage.MessageType.DirXML:
+ typeString = "Dir XML";
+ break;
+ case WebInspector.ConsoleMessage.MessageType.Trace:
+ typeString = "Trace";
+ break;
+ case WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed:
+ case WebInspector.ConsoleMessage.MessageType.StartGroup:
+ typeString = "Start Group";
+ break;
+ case WebInspector.ConsoleMessage.MessageType.EndGroup:
+ typeString = "End Group";
+ break;
+ case WebInspector.ConsoleMessage.MessageType.Assert:
+ typeString = "Assert";
+ break;
+ case WebInspector.ConsoleMessage.MessageType.Result:
+ typeString = "Result";
+ break;
+ }
+
+ return sourceString + " " + typeString + " " + this.levelString + ": " + this.formattedMessage.textContent + "\n" + this.url + " line " + this.line;
+ },
+
+ get text()
+ {
+ return this._messageText;
+ },
+
+ isEqual: function(msg)
+ {
+ if (!msg)
+ return false;
+
+ if (this._stackTrace) {
+ if (!msg._stackTrace)
+ return false;
+ var l = this._stackTrace;
+ var r = msg._stackTrace;
+ for (var i = 0; i < l.length; i++) {
+ if (l[i].url !== r[i].url ||
+ l[i].functionName !== r[i].functionName ||
+ l[i].lineNumber !== r[i].lineNumber ||
+ l[i].columnNumber !== r[i].columnNumber)
+ return false;
+ }
+ }
+
+ return (this.source === msg.source)
+ && (this.type === msg.type)
+ && (this.level === msg.level)
+ && (this.line === msg.line)
+ && (this.url === msg.url)
+ && (this.message === msg.message)
+ && (this._request === msg._request);
+ },
+
+ get stackTrace()
+ {
+ return this._stackTrace;
+ },
+
+ clone: function()
+ {
+ return WebInspector.ConsoleMessage.create(this.source, this.level, this._messageText, this.type, this.url, this.line, this.column, this.repeatCount, this._parameters, this._stackTrace, this._request);
+ },
+
+ get levelString()
+ {
+ switch (this.level) {
+ case WebInspector.ConsoleMessage.MessageLevel.Tip:
+ return "Tip";
+ case WebInspector.ConsoleMessage.MessageLevel.Log:
+ return "Log";
+ case WebInspector.ConsoleMessage.MessageLevel.Warning:
+ return "Warning";
+ case WebInspector.ConsoleMessage.MessageLevel.Debug:
+ return "Debug";
+ case WebInspector.ConsoleMessage.MessageLevel.Error:
+ return "Error";
+ }
+ },
+
+ get clipboardPrefixString()
+ {
+ return "[" + this.levelString + "] ";
+ },
+
+ toClipboardString: function(isPrefixOptional)
+ {
+ var isTrace = this._shouldDumpStackTrace();
+
+ var clipboardString = "";
+ if (this._formattedMessage && !isTrace)
+ clipboardString = this._formattedMessage.querySelector("span").innerText;
+ else
+ clipboardString = this.type === WebInspector.ConsoleMessage.MessageType.Trace ? "console.trace()" : this._message || this._messageText;
+
+ if (!isPrefixOptional || this.enforcesClipboardPrefixString)
+ clipboardString = this.clipboardPrefixString + clipboardString;
+
+ if (isTrace) {
+ this._stackTrace.forEach(function(frame) {
+ clipboardString += "\n\t" + (frame.functionName || WebInspector.UIString("(anonymous function)"));
+ if (frame.url)
+ clipboardString += " (" + WebInspector.displayNameForURL(frame.url) + ", line " + frame.lineNumber + ")";
+ });
+ } else {
+ var repeatString = this.repeatCount > 1 ? "x" + this.repeatCount : "";
+
+ var urlLine = "";
+ if (this.url) {
+ var components = [WebInspector.displayNameForURL(this.url), "line " + this.line];
+ if (repeatString)
+ components.push(repeatString);
+ urlLine = " (" + components.join(", ") + ")";
+ } else if (repeatString)
+ urlLine = " (" + repeatString + ")";
+
+ if (urlLine) {
+ var lines = clipboardString.split("\n");
+ lines[0] += urlLine;
+ clipboardString = lines.join("\n");
+ }
+ }
+
+ return clipboardString;
+ }
+};
+
+WebInspector.ConsoleMessageImpl.prototype.__proto__ = WebInspector.ConsoleMessage.prototype;
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsLegacyConsoleMessagejs"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebInspectorUI/UserInterface/Views/LegacyConsoleMessage.js (181566 => 181567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/LegacyConsoleMessage.js        2015-03-16 17:55:15 UTC (rev 181566)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/LegacyConsoleMessage.js        2015-03-16 18:11:59 UTC (rev 181567)
</span><span class="lines">@@ -1,98 +0,0 @@
</span><del>-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- * Copyright (C) 2007, 2008, 2013 Apple Inc. All rights reserved.
- * Copyright (C) 2009 Joseph Pecoraro
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-WebInspector.LegacyConsoleMessage = function(source, level, url, line, column, repeatCount)
-{
- this.source = source;
- this.level = level;
- this.url = url || null;
- this.line = line || 0;
- this.column = column || 0;
-
- repeatCount = repeatCount || 1;
- this.repeatCount = repeatCount;
- this.repeatDelta = repeatCount;
- this.totalRepeatCount = repeatCount;
-};
-
-WebInspector.LegacyConsoleMessage.prototype = {
- isErrorOrWarning: function()
- {
- return (this.level === WebInspector.LegacyConsoleMessage.MessageLevel.Warning || this.level === WebInspector.LegacyConsoleMessage.MessageLevel.Error);
- },
-
- updateRepeatCount: function()
- {
- // Implemented by concrete instances
- },
-
- clone: function()
- {
- // Implemented by concrete instances
- }
-};
-
-WebInspector.LegacyConsoleMessage.create = function(source, level, message, type, url, line, column, repeatCount, parameters, stackTrace, request)
-{
- return new WebInspector.LegacyConsoleMessageImpl(source, level, message, null, type, url, line, column, repeatCount, parameters, stackTrace, request);
-};
-
-// FIXME: Switch to ConsoleAgent.ConsoleMessageSource.
-WebInspector.LegacyConsoleMessage.MessageSource = {
- HTML: "html",
- XML: "xml",
- JS: "javascript",
- Network: "network",
- ConsoleAPI: "console-api",
- Other: "other"
-};
-
-// FIXME: Switch to ConsoleAgent.ConsoleMessageType.
-WebInspector.LegacyConsoleMessage.MessageType = {
- Log: "log",
- Dir: "dir",
- DirXML: "dirxml",
- Table: "table",
- Trace: "trace",
- StartGroup: "startGroup",
- StartGroupCollapsed: "startGroupCollapsed",
- EndGroup: "endGroup",
- Assert: "assert",
- Result: "result"
-};
-
-// FIXME: Switch to ConsoleAgent.ConsoleMessageLevel.
-WebInspector.LegacyConsoleMessage.MessageLevel = {
- Tip: "tip",
- Log: "log",
- Warning: "warning",
- Error: "error",
- Debug: "debug"
-};
</del></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsLegacyConsoleMessageImpljs"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebInspectorUI/UserInterface/Views/LegacyConsoleMessageImpl.js (181566 => 181567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/LegacyConsoleMessageImpl.js        2015-03-16 17:55:15 UTC (rev 181566)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/LegacyConsoleMessageImpl.js        2015-03-16 18:11:59 UTC (rev 181567)
</span><span class="lines">@@ -1,801 +0,0 @@
</span><del>-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- * Copyright (C) 2007, 2008, 2013 Apple Inc. All rights reserved.
- * Copyright (C) 2009 Joseph Pecoraro
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-WebInspector.LegacyConsoleMessageImpl = function(source, level, message, linkifier, type, url, line, column, repeatCount, parameters, stackTrace, request)
-{
- WebInspector.LegacyConsoleMessage.call(this, source, level, url, line, column, repeatCount);
-
- this._linkifier = linkifier;
- this.type = type || WebInspector.LegacyConsoleMessage.MessageType.Log;
- this._messageText = message;
- this._parameters = parameters;
- this._stackTrace = stackTrace;
- this._request = request;
-
- this._customFormatters = {
- "object": this._formatParameterAsObject,
- "error": this._formatParameterAsObject,
- "map": this._formatParameterAsObject,
- "set": this._formatParameterAsObject,
- "weakmap": this._formatParameterAsObject,
- "iterator": this._formatParameterAsObject,
- "array": this._formatParameterAsArray,
- "node": this._formatParameterAsNode,
- "string": this._formatParameterAsString
- };
-};
-
-WebInspector.LegacyConsoleMessageImpl.prototype = {
-
- enforcesClipboardPrefixString: true,
-
- _formatMessage: function()
- {
- this._formattedMessage = document.createElement("span");
- this._formattedMessage.className = "console-message-text";
-
- var messageText;
- if (this.source === WebInspector.LegacyConsoleMessage.MessageSource.ConsoleAPI) {
- switch (this.type) {
- case WebInspector.LegacyConsoleMessage.MessageType.Trace:
- messageText = document.createTextNode("console.trace()");
- break;
- case WebInspector.LegacyConsoleMessage.MessageType.Assert:
- var args = [WebInspector.UIString("Assertion failed:")];
- if (this._parameters)
- args = args.concat(this._parameters);
- messageText = this._format(args);
- break;
- case WebInspector.LegacyConsoleMessage.MessageType.Dir:
- var obj = this._parameters ? this._parameters[0] : undefined;
- var args = ["%O", obj];
- messageText = this._format(args);
- break;
- default:
- var args = this._parameters || [this._messageText];
- messageText = this._format(args);
- }
- } else if (this.source === WebInspector.LegacyConsoleMessage.MessageSource.Network) {
- if (this._request) {
- this._stackTrace = this._request.stackTrace;
- if (this._request.initiator && this._request.initiator.url) {
- this.url = this._request.initiator.url;
- this.line = this._request.initiator.lineNumber;
- }
- messageText = document.createElement("span");
- if (this.level === WebInspector.LegacyConsoleMessage.MessageLevel.Error) {
- messageText.appendChild(document.createTextNode(this._request.requestMethod + " "));
- messageText.appendChild(WebInspector.linkifyRequestAsNode(this._request));
- if (this._request.failed)
- messageText.appendChild(document.createTextNode(" " + this._request.localizedFailDescription));
- else
- messageText.appendChild(document.createTextNode(" " + this._request.statusCode + " (" + this._request.statusText + ")"));
- } else {
- var fragment = WebInspector.linkifyStringAsFragmentWithCustomLinkifier(this._messageText, WebInspector.linkifyRequestAsNode.bind(null, this._request, ""));
- messageText.appendChild(fragment);
- }
- } else {
- if (this.url) {
- var anchor = WebInspector.linkifyURLAsNode(this.url, this.url, "console-message-url");
- this._formattedMessage.appendChild(anchor);
- }
- messageText = this._format([this._messageText]);
- }
- } else {
- var args = this._parameters || [this._messageText];
- messageText = this._format(args);
- }
-
- if (this.source !== WebInspector.LegacyConsoleMessage.MessageSource.Network || this._request) {
- var firstNonNativeCallFrame = this._firstNonNativeCallFrame();
- if (firstNonNativeCallFrame) {
- var urlElement = this._linkifyCallFrame(firstNonNativeCallFrame);
- this._formattedMessage.appendChild(urlElement);
- } else if (this.url && !this._shouldHideURL(this.url)) {
- var urlElement = this._linkifyLocation(this.url, this.line, this.column);
- this._formattedMessage.appendChild(urlElement);
- }
- }
-
- this._formattedMessage.appendChild(messageText);
-
- if (this.savedResultIndex) {
- var savedVariableElement = document.createElement("span");
- savedVariableElement.className = "console-saved-variable";
- savedVariableElement.textContent = " = $" + this.savedResultIndex;
- if (this._objectTree)
- this._objectTree.appendTitleSuffix(savedVariableElement);
- else
- this._formattedMessage.appendChild(savedVariableElement);
- }
-
- if (this._shouldDumpStackTrace()) {
- var ol = document.createElement("ol");
- ol.className = "outline-disclosure";
- var treeOutline = new TreeOutline(ol);
-
- var content = this._formattedMessage;
- var root = new TreeElement(content, null, true);
- content.treeElementForTest = root;
- treeOutline.appendChild(root);
- if (this.type === WebInspector.LegacyConsoleMessage.MessageType.Trace)
- root.expand();
-
- this._populateStackTraceTreeElement(root);
- this._formattedMessage = ol;
- }
-
- // This is used for inline message bubbles in SourceFrames, or other plain-text representations.
- this._message = messageText.textContent;
- },
-
- _shouldDumpStackTrace: function()
- {
- return !!this._stackTrace && this._stackTrace.length && (this.source === WebInspector.LegacyConsoleMessage.MessageSource.Network || this.level === WebInspector.LegacyConsoleMessage.MessageLevel.Error || this.type === WebInspector.LegacyConsoleMessage.MessageType.Trace);
- },
-
- _shouldHideURL: function(url)
- {
- return url === "undefined" || url === "[native code]";
- },
-
- _firstNonNativeCallFrame: function()
- {
- if (!this._stackTrace)
- return null;
-
- for (var i = 0; i < this._stackTrace.length; i++) {
- var frame = this._stackTrace[i];
- if (!frame.url || frame.url === "[native code]")
- continue;
- return frame;
- }
-
- return null;
- },
-
- get message()
- {
- // force message formatting
- var formattedMessage = this.formattedMessage;
- return this._message;
- },
-
- get formattedMessage()
- {
- if (!this._formattedMessage)
- this._formatMessage();
- return this._formattedMessage;
- },
-
- _linkifyLocation: function(url, lineNumber, columnNumber)
- {
- // ConsoleMessage stack trace line numbers are one-based.
- lineNumber = lineNumber ? lineNumber - 1 : 0;
- columnNumber = columnNumber ? columnNumber - 1 : 0;
-
- return WebInspector.linkifyLocation(url, lineNumber, columnNumber, "console-message-url");
- },
-
- _linkifyCallFrame: function(callFrame)
- {
- return this._linkifyLocation(callFrame.url, callFrame.lineNumber, callFrame.columnNumber);
- },
-
- isErrorOrWarning: function()
- {
- return (this.level === WebInspector.LegacyConsoleMessage.MessageLevel.Warning || this.level === WebInspector.LegacyConsoleMessage.MessageLevel.Error);
- },
-
- _format: function(parameters)
- {
- // This node is used like a Builder. Values are continually appended onto it.
- var formattedResult = document.createElement("span");
- if (!parameters.length)
- return formattedResult;
-
- // Formatting code below assumes that parameters are all wrappers whereas frontend console
- // API allows passing arbitrary values as messages (strings, numbers, etc.). Wrap them here.
- for (var i = 0; i < parameters.length; ++i) {
- // FIXME: Only pass runtime wrappers here.
- if (parameters[i] instanceof WebInspector.RemoteObject)
- continue;
-
- if (typeof parameters[i] === "object")
- parameters[i] = WebInspector.RemoteObject.fromPayload(parameters[i]);
- else
- parameters[i] = WebInspector.RemoteObject.fromPrimitiveValue(parameters[i]);
- }
-
- // There can be string log and string eval result. We distinguish between them based on message type.
- var shouldFormatMessage = WebInspector.RemoteObject.type(parameters[0]) === "string" && this.type !== WebInspector.LegacyConsoleMessage.MessageType.Result;
-
- if (shouldFormatMessage) {
- // Multiple parameters with the first being a format string. Save unused substitutions.
- var result = this._formatWithSubstitutionString(parameters, formattedResult);
- parameters = result.unusedSubstitutions;
- if (parameters.length)
- formattedResult.appendChild(document.createTextNode(" "));
- }
-
- if (this.type === WebInspector.LegacyConsoleMessage.MessageType.Table) {
- formattedResult.appendChild(this._formatParameterAsTable(parameters));
- return formattedResult;
- }
-
- // Single parameter, or unused substitutions from above.
- for (var i = 0; i < parameters.length; ++i) {
- // Inline strings when formatting.
- if (shouldFormatMessage && parameters[i].type === "string") {
- var span = document.createElement("span");
- span.classList.add("type-string");
- span.textContent = parameters[i].description;
- formattedResult.appendChild(span);
- } else
- formattedResult.appendChild(this._formatParameter(parameters[i], false));
-
- if (i < parameters.length - 1 && !this._isExpandable(parameters[i]))
- formattedResult.appendChild(document.createTextNode(" "));
-
- }
- return formattedResult;
- },
-
- _isExpandable: function(remoteObject) {
- if (!remoteObject)
- return false;
-
- if (remoteObject.hasChildren && remoteObject.preview && remoteObject.preview.lossless)
- return false;
-
- return remoteObject.hasChildren;
- },
-
- _formatParameter: function(output, forceObjectFormat)
- {
- var type;
- if (forceObjectFormat)
- type = "object";
- else if (output instanceof WebInspector.RemoteObject)
- type = output.subtype || output.type;
- else
- type = typeof output;
-
- var formatter = this._customFormatters[type];
- if (!formatter)
- formatter = this._formatParameterAsValue;
-
- var span = document.createElement("span");
-
- if (this._isExpandable(output))
- span.classList.add("expandable");
-
- formatter.call(this, output, span, forceObjectFormat);
- return span;
- },
-
- _formatParameterAsValue: function(value, elem)
- {
- elem.appendChild(WebInspector.FormattedValue.createElementForRemoteObject(value));
- },
-
- _formatParameterAsObject: function(obj, elem, forceExpansion)
- {
- this._objectTree = new WebInspector.ObjectTreeView(obj, WebInspector.ObjectTreeView.Mode.Properties, this._rootPropertyPathForObject(obj), forceExpansion);
- elem.appendChild(this._objectTree.element);
- },
-
- _formatParameterAsString: function(output, elem)
- {
- var span = WebInspector.FormattedValue.createLinkifiedElementString(output.description);
- elem.appendChild(span);
- },
-
- _formatParameterAsNode: function(object, elem)
- {
- var span = WebInspector.FormattedValue.createElementForNode(object);
- elem.appendChild(span);
- },
-
- _formatParameterAsArray: function(arr, elem)
- {
- this._objectTree = new WebInspector.ObjectTreeView(arr, WebInspector.ObjectTreeView.Mode.Properties, this._rootPropertyPathForObject(arr));
- elem.appendChild(this._objectTree.element);
- },
-
- _rootPropertyPathForObject: function(object)
- {
- if (!this.savedResultIndex)
- return null;
-
- return new WebInspector.PropertyPath(object, "$" + this.savedResultIndex);
- },
-
- _userProvidedColumnNames: function(columnNamesArgument)
- {
- if (!columnNamesArgument)
- return null;
-
- var remoteObject = WebInspector.RemoteObject.fromPayload(columnNamesArgument);
-
- // Single primitive argument.
- if (remoteObject.type === "string" || remoteObject.type === "number")
- return [String(columnNamesArgument.value)];
-
- // Ignore everything that is not an array with property previews.
- if (remoteObject.type !== "object" || remoteObject.subtype !== "array" || !remoteObject.preview || !remoteObject.preview.propertyPreviews)
- return null;
-
- // Array. Look into the preview and get string values.
- var extractedColumnNames = [];
- for (var propertyPreview of remoteObject.preview.propertyPreviews) {
- if (propertyPreview.type === "string" || propertyPreview.type === "number")
- extractedColumnNames.push(String(propertyPreview.value));
- }
-
- return extractedColumnNames.length ? extractedColumnNames : null;
- },
-
- _formatParameterAsTable: function(parameters)
- {
- var element = document.createElement("span");
- var table = parameters[0];
- if (!table || !table.preview)
- return element;
-
- var rows = [];
- var columnNames = [];
- var flatValues = [];
- var preview = table.preview;
- var userProvidedColumnNames = false;
-
- // User provided columnNames.
- var extractedColumnNames = this._userProvidedColumnNames(parameters[1]);
- if (extractedColumnNames) {
- userProvidedColumnNames = true;
- columnNames = extractedColumnNames;
- }
-
- // Check first for valuePreviews in the properties meaning this was an array of objects.
- if (preview.propertyPreviews) {
- for (var i = 0; i < preview.propertyPreviews.length; ++i) {
- var rowProperty = preview.propertyPreviews[i];
- var rowPreview = rowProperty.valuePreview;
- if (!rowPreview)
- continue;
-
- var rowValue = {};
- const maxColumnsToRender = 10;
- for (var j = 0; j < rowPreview.propertyPreviews.length; ++j) {
- var cellProperty = rowPreview.propertyPreviews[j];
- var columnRendered = columnNames.contains(cellProperty.name);
- if (!columnRendered) {
- if (userProvidedColumnNames || columnNames.length === maxColumnsToRender)
- continue;
- columnRendered = true;
- columnNames.push(cellProperty.name);
- }
-
- rowValue[cellProperty.name] = WebInspector.FormattedValue.createElementForPropertyPreview(cellProperty);
- }
- rows.push([rowProperty.name, rowValue]);
- }
- }
-
- // If there were valuePreviews, convert to a flat list.
- if (rows.length) {
- const emDash = "\u2014";
- columnNames.unshift(WebInspector.UIString("(Index)"));
- for (var i = 0; i < rows.length; ++i) {
- var rowName = rows[i][0];
- var rowValue = rows[i][1];
- flatValues.push(rowName);
- for (var j = 1; j < columnNames.length; ++j) {
- var columnName = columnNames[j];
- if (!(columnName in rowValue))
- flatValues.push(emDash);
- else
- flatValues.push(rowValue[columnName]);
- }
- }
- }
-
- // If there were no value Previews, then check for an array of values.
- if (!flatValues.length && preview.propertyPreviews) {
- for (var i = 0; i < preview.propertyPreviews.length; ++i) {
- var rowProperty = preview.propertyPreviews[i];
- if (!("value" in rowProperty))
- continue;
-
- if (!columnNames.length) {
- columnNames.push(WebInspector.UIString("Index"));
- columnNames.push(WebInspector.UIString("Value"));
- }
-
- flatValues.push(rowProperty.name);
- flatValues.push(WebInspector.FormattedValue.createElementForPropertyPreview(rowProperty));
- }
- }
-
- // If lossless or not table data, output the object so full data can be gotten.
- if (!preview.lossless || !flatValues.length) {
- element.appendChild(this._formatParameter(table));
- if (!flatValues.length)
- return element;
- }
-
- var dataGridContainer = element.createChild("span");
- var dataGrid = WebInspector.DataGrid.createSortableDataGrid(columnNames, flatValues);
- dataGrid.element.classList.add("inline");
- dataGridContainer.appendChild(dataGrid.element);
-
- return element;
- },
-
- _formatWithSubstitutionString: function(parameters, formattedResult)
- {
- var formatters = {};
-
- function parameterFormatter(force, obj)
- {
- return this._formatParameter(obj, force);
- }
-
- function stringFormatter(obj)
- {
- return obj.description;
- }
-
- function floatFormatter(obj)
- {
- if (typeof obj.value !== "number")
- return parseFloat(obj.description);
- return obj.value;
- }
-
- function integerFormatter(obj)
- {
- if (typeof obj.value !== "number")
- return parseInt(obj.description);
- return Math.floor(obj.value);
- }
-
- var currentStyle = null;
- function styleFormatter(obj)
- {
- currentStyle = {};
- var buffer = document.createElement("span");
- buffer.setAttribute("style", obj.description);
- for (var i = 0; i < buffer.style.length; i++) {
- var property = buffer.style[i];
- if (isWhitelistedProperty(property))
- currentStyle[property] = buffer.style[property];
- }
- }
-
- function isWhitelistedProperty(property)
- {
- var prefixes = ["background", "border", "color", "font", "line", "margin", "padding", "text", "-webkit-background", "-webkit-border", "-webkit-font", "-webkit-margin", "-webkit-padding", "-webkit-text"];
- for (var i = 0; i < prefixes.length; i++) {
- if (property.startsWith(prefixes[i]))
- return true;
- }
- return false;
- }
-
- // Firebug uses %o for formatting objects.
- formatters.o = parameterFormatter.bind(this, false);
- formatters.s = stringFormatter;
- formatters.f = floatFormatter;
-
- // Firebug allows both %i and %d for formatting integers.
- formatters.i = integerFormatter;
- formatters.d = integerFormatter;
-
- // Firebug uses %c for styling the message.
- formatters.c = styleFormatter;
-
- // Support %O to force object formatting, instead of the type-based %o formatting.
- formatters.O = parameterFormatter.bind(this, true);
-
- function append(a, b)
- {
- if (b instanceof Node)
- a.appendChild(b);
- else if (b) {
- var toAppend = WebInspector.linkifyStringAsFragment(b.toString());
- if (currentStyle) {
- var wrapper = document.createElement("span");
- for (var key in currentStyle)
- wrapper.style[key] = currentStyle[key];
- wrapper.appendChild(toAppend);
- toAppend = wrapper;
- }
- var span = document.createElement("span");
- span.className = "type-string";
- span.appendChild(toAppend);
- a.appendChild(span);
- }
- return a;
- }
-
- // String.format does treat formattedResult like a Builder, result is an object.
- return String.format(parameters[0].description, parameters.slice(1), formatters, formattedResult, append);
- },
-
- decorateMessageElement: function(element)
- {
- if (this._element)
- return this._element;
-
- element.message = this;
- element.classList.add("console-message");
-
- this._element = element;
-
- switch (this.level) {
- case WebInspector.LegacyConsoleMessage.MessageLevel.Tip:
- element.classList.add("console-tip-level");
- element.setAttribute("data-labelprefix", WebInspector.UIString("Tip: "));
- break;
- case WebInspector.LegacyConsoleMessage.MessageLevel.Log:
- element.classList.add("console-log-level");
- element.setAttribute("data-labelprefix", WebInspector.UIString("Log: "));
- break;
- case WebInspector.LegacyConsoleMessage.MessageLevel.Debug:
- element.classList.add("console-debug-level");
- element.setAttribute("data-labelprefix", WebInspector.UIString("Debug: "));
- break;
- case WebInspector.LegacyConsoleMessage.MessageLevel.Warning:
- element.classList.add("console-warning-level");
- element.setAttribute("data-labelprefix", WebInspector.UIString("Warning: "));
- break;
- case WebInspector.LegacyConsoleMessage.MessageLevel.Error:
- element.classList.add("console-error-level");
- element.setAttribute("data-labelprefix", WebInspector.UIString("Error: "));
- break;
- }
-
- if (this.type === WebInspector.LegacyConsoleMessage.MessageType.StartGroup || this.type === WebInspector.LegacyConsoleMessage.MessageType.StartGroupCollapsed)
- element.classList.add("console-group-title");
-
- element.appendChild(this.formattedMessage);
-
- if (this.repeatCount > 1)
- this.updateRepeatCount();
-
- return element;
- },
-
- toMessageElement: function()
- {
- if (this._element)
- return this._element;
-
- var element = document.createElement("div");
-
- return this.decorateMessageElement(element);
- },
-
- _populateStackTraceTreeElement: function(parentTreeElement)
- {
- for (var i = 0; i < this._stackTrace.length; i++) {
- var frame = this._stackTrace[i];
-
- var content = document.createElement("div");
- var messageTextElement = document.createElement("span");
- messageTextElement.className = "console-message-text";
- var functionName = frame.functionName || WebInspector.UIString("(anonymous function)");
- messageTextElement.appendChild(document.createTextNode(functionName));
- content.appendChild(messageTextElement);
-
- if (frame.url && !this._shouldHideURL(frame.url)) {
- var urlElement = this._linkifyCallFrame(frame);
- content.appendChild(urlElement);
- }
-
- var treeElement = new TreeElement(content);
- parentTreeElement.appendChild(treeElement);
- }
- },
-
- updateRepeatCount: function() {
- if (!this.repeatCountElement) {
- this.repeatCountElement = document.createElement("span");
- this.repeatCountElement.className = "bubble";
-
- this._element.insertBefore(this.repeatCountElement, this._element.firstChild);
- }
- this.repeatCountElement.textContent = this.repeatCount;
- },
-
- toString: function()
- {
- var sourceString;
- switch (this.source) {
- case WebInspector.LegacyConsoleMessage.MessageSource.HTML:
- sourceString = "HTML";
- break;
- case WebInspector.LegacyConsoleMessage.MessageSource.XML:
- sourceString = "XML";
- break;
- case WebInspector.LegacyConsoleMessage.MessageSource.JS:
- sourceString = "JS";
- break;
- case WebInspector.LegacyConsoleMessage.MessageSource.Network:
- sourceString = "Network";
- break;
- case WebInspector.LegacyConsoleMessage.MessageSource.ConsoleAPI:
- sourceString = "ConsoleAPI";
- break;
- case WebInspector.LegacyConsoleMessage.MessageSource.Other:
- sourceString = "Other";
- break;
- }
-
- var typeString;
- switch (this.type) {
- case WebInspector.LegacyConsoleMessage.MessageType.Log:
- typeString = "Log";
- break;
- case WebInspector.LegacyConsoleMessage.MessageType.Dir:
- typeString = "Dir";
- break;
- case WebInspector.LegacyConsoleMessage.MessageType.DirXML:
- typeString = "Dir XML";
- break;
- case WebInspector.LegacyConsoleMessage.MessageType.Trace:
- typeString = "Trace";
- break;
- case WebInspector.LegacyConsoleMessage.MessageType.StartGroupCollapsed:
- case WebInspector.LegacyConsoleMessage.MessageType.StartGroup:
- typeString = "Start Group";
- break;
- case WebInspector.LegacyConsoleMessage.MessageType.EndGroup:
- typeString = "End Group";
- break;
- case WebInspector.LegacyConsoleMessage.MessageType.Assert:
- typeString = "Assert";
- break;
- case WebInspector.LegacyConsoleMessage.MessageType.Result:
- typeString = "Result";
- break;
- }
-
- return sourceString + " " + typeString + " " + this.levelString + ": " + this.formattedMessage.textContent + "\n" + this.url + " line " + this.line;
- },
-
- get text()
- {
- return this._messageText;
- },
-
- isEqual: function(msg)
- {
- if (!msg)
- return false;
-
- if (this._stackTrace) {
- if (!msg._stackTrace)
- return false;
- var l = this._stackTrace;
- var r = msg._stackTrace;
- for (var i = 0; i < l.length; i++) {
- if (l[i].url !== r[i].url ||
- l[i].functionName !== r[i].functionName ||
- l[i].lineNumber !== r[i].lineNumber ||
- l[i].columnNumber !== r[i].columnNumber)
- return false;
- }
- }
-
- return (this.source === msg.source)
- && (this.type === msg.type)
- && (this.level === msg.level)
- && (this.line === msg.line)
- && (this.url === msg.url)
- && (this.message === msg.message)
- && (this._request === msg._request);
- },
-
- get stackTrace()
- {
- return this._stackTrace;
- },
-
- clone: function()
- {
- return WebInspector.LegacyConsoleMessage.create(this.source, this.level, this._messageText, this.type, this.url, this.line, this.column, this.repeatCount, this._parameters, this._stackTrace, this._request);
- },
-
- get levelString()
- {
- switch (this.level) {
- case WebInspector.LegacyConsoleMessage.MessageLevel.Tip:
- return "Tip";
- case WebInspector.LegacyConsoleMessage.MessageLevel.Log:
- return "Log";
- case WebInspector.LegacyConsoleMessage.MessageLevel.Warning:
- return "Warning";
- case WebInspector.LegacyConsoleMessage.MessageLevel.Debug:
- return "Debug";
- case WebInspector.LegacyConsoleMessage.MessageLevel.Error:
- return "Error";
- }
- },
-
- get clipboardPrefixString()
- {
- return "[" + this.levelString + "] ";
- },
-
- toClipboardString: function(isPrefixOptional)
- {
- var isTrace = this._shouldDumpStackTrace();
-
- var clipboardString = "";
- if (this._formattedMessage && !isTrace)
- clipboardString = this._formattedMessage.querySelector("span").innerText;
- else
- clipboardString = this.type === WebInspector.LegacyConsoleMessage.MessageType.Trace ? "console.trace()" : this._message || this._messageText;
-
- if (!isPrefixOptional || this.enforcesClipboardPrefixString)
- clipboardString = this.clipboardPrefixString + clipboardString;
-
- if (isTrace) {
- this._stackTrace.forEach(function(frame) {
- clipboardString += "\n\t" + (frame.functionName || WebInspector.UIString("(anonymous function)"));
- if (frame.url)
- clipboardString += " (" + WebInspector.displayNameForURL(frame.url) + ", line " + frame.lineNumber + ")";
- });
- } else {
- var repeatString = this.repeatCount > 1 ? "x" + this.repeatCount : "";
-
- var urlLine = "";
- if (this.url) {
- var components = [WebInspector.displayNameForURL(this.url), "line " + this.line];
- if (repeatString)
- components.push(repeatString);
- urlLine = " (" + components.join(", ") + ")";
- } else if (repeatString)
- urlLine = " (" + repeatString + ")";
-
- if (urlLine) {
- var lines = clipboardString.split("\n");
- lines[0] += urlLine;
- clipboardString = lines.join("\n");
- }
- }
-
- return clipboardString;
- }
-};
-
-WebInspector.LegacyConsoleMessageImpl.prototype.__proto__ = WebInspector.LegacyConsoleMessage.prototype;
</del></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsLogContentViewjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js (181566 => 181567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js        2015-03-16 17:55:15 UTC (rev 181566)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js        2015-03-16 18:11:59 UTC (rev 181567)
</span><span class="lines">@@ -176,7 +176,7 @@
</span><span class="cx"> WebInspector.quickConsole.updateLayout();
</span><span class="cx">
</span><span class="cx"> // Nest the message.
</span><del>- if (message.type !== WebInspector.LegacyConsoleMessage.MessageType.EndGroup) {
</del><ins>+ if (message.type !== WebInspector.ConsoleMessage.MessageType.EndGroup) {
</ins><span class="cx"> var x = 16 * this._nestingLevel;
</span><span class="cx"> var messageElement = message.toMessageElement();
</span><span class="cx"> messageElement.style.left = x + "px";
</span><span class="lines">@@ -185,11 +185,11 @@
</span><span class="cx">
</span><span class="cx"> // Update the nesting level.
</span><span class="cx"> switch (message.type) {
</span><del>- case WebInspector.LegacyConsoleMessage.MessageType.StartGroup:
- case WebInspector.LegacyConsoleMessage.MessageType.StartGroupCollapsed:
</del><ins>+ case WebInspector.ConsoleMessage.MessageType.StartGroup:
+ case WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed:
</ins><span class="cx"> ++this._nestingLevel;
</span><span class="cx"> break;
</span><del>- case WebInspector.LegacyConsoleMessage.MessageType.EndGroup:
</del><ins>+ case WebInspector.ConsoleMessage.MessageType.EndGroup:
</ins><span class="cx"> --this._nestingLevel;
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="lines">@@ -202,7 +202,7 @@
</span><span class="cx">
</span><span class="cx"> // We only auto show the console if the message is a result.
</span><span class="cx"> // This is when the user evaluated something directly in the prompt.
</span><del>- if (message.type !== WebInspector.LegacyConsoleMessage.MessageType.Result)
</del><ins>+ if (message.type !== WebInspector.ConsoleMessage.MessageType.Result)
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (!WebInspector.isShowingConsoleView())
</span><span class="lines">@@ -330,7 +330,7 @@
</span><span class="cx"> this._provisionalMessages.push(event.data.message);
</span><span class="cx">
</span><span class="cx"> var message = this._logViewController.appendConsoleMessage(event.data.message);
</span><del>- if (message.type !== WebInspector.LegacyConsoleMessage.MessageType.EndGroup)
</del><ins>+ if (message.type !== WebInspector.ConsoleMessage.MessageType.EndGroup)
</ins><span class="cx"> this._filterMessages([message.toMessageElement()]);
</span><span class="cx"> },
</span><span class="cx">
</span><span class="lines">@@ -677,14 +677,14 @@
</span><span class="cx"> var visible = showsAll || message.command instanceof WebInspector.ConsoleCommand || message.message instanceof WebInspector.ConsoleCommandResult;
</span><span class="cx"> if (!visible) {
</span><span class="cx"> switch(message.message.level) {
</span><del>- case WebInspector.LegacyConsoleMessage.MessageLevel.Warning:
</del><ins>+ case WebInspector.ConsoleMessage.MessageLevel.Warning:
</ins><span class="cx"> visible = showsWarnings;
</span><span class="cx"> break;
</span><del>- case WebInspector.LegacyConsoleMessage.MessageLevel.Error:
</del><ins>+ case WebInspector.ConsoleMessage.MessageLevel.Error:
</ins><span class="cx"> visible = showsErrors;
</span><span class="cx"> break;
</span><del>- case WebInspector.LegacyConsoleMessage.MessageLevel.Log:
- case WebInspector.LegacyConsoleMessage.MessageLevel.Debug:
</del><ins>+ case WebInspector.ConsoleMessage.MessageLevel.Log:
+ case WebInspector.ConsoleMessage.MessageLevel.Debug:
</ins><span class="cx"> visible = showsLogs;
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="lines">@@ -996,7 +996,7 @@
</span><span class="cx">
</span><span class="cx"> for (var provisionalMessage of this._provisionalMessages) {
</span><span class="cx"> var message = this._logViewController.appendConsoleMessage(provisionalMessage);
</span><del>- if (message.type !== WebInspector.LegacyConsoleMessage.MessageType.EndGroup)
</del><ins>+ if (message.type !== WebInspector.ConsoleMessage.MessageType.EndGroup)
</ins><span class="cx"> this._filterMessages([message.toMessageElement()]);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIWebInspectorUIvcxprojWebInspectorUIvcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/WebInspectorUI.vcxproj/WebInspectorUI.vcxproj (181566 => 181567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/WebInspectorUI.vcxproj/WebInspectorUI.vcxproj        2015-03-16 17:55:15 UTC (rev 181566)
+++ trunk/Source/WebInspectorUI/WebInspectorUI.vcxproj/WebInspectorUI.vcxproj        2015-03-16 18:11:59 UTC (rev 181567)
</span><span class="lines">@@ -315,8 +315,8 @@
</span><span class="cx"> <None Include="..\UserInterface\ConsoleCommand.js" />
</span><span class="cx"> <None Include="..\UserInterface\ConsoleCommandResult.js" />
</span><span class="cx"> <None Include="..\UserInterface\ConsoleGroup.js" />
</span><del>- <None Include="..\UserInterface\LegacyConsoleMessage.js" />
- <None Include="..\UserInterface\LegacyConsoleMessageImpl.js" />
</del><ins>+ <None Include="..\UserInterface\ConsoleMessage.js" />
+ <None Include="..\UserInterface\ConsoleMessageImpl.js" />
</ins><span class="cx"> <None Include="..\UserInterface\ConsoleObserver.js" />
</span><span class="cx"> <None Include="..\UserInterface\ConsolePrompt.css" />
</span><span class="cx"> <None Include="..\UserInterface\ConsolePrompt.js" />
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIWebInspectorUIvcxprojWebInspectorUIvcxprojfilters"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/WebInspectorUI.vcxproj/WebInspectorUI.vcxproj.filters (181566 => 181567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/WebInspectorUI.vcxproj/WebInspectorUI.vcxproj.filters        2015-03-16 17:55:15 UTC (rev 181566)
+++ trunk/Source/WebInspectorUI/WebInspectorUI.vcxproj/WebInspectorUI.vcxproj.filters        2015-03-16 18:11:59 UTC (rev 181567)
</span><span class="lines">@@ -195,10 +195,10 @@
</span><span class="cx"> <None Include="..\UserInterface\ConsoleGroup.js">
</span><span class="cx"> <Filter>UserInterface</Filter>
</span><span class="cx"> </None>
</span><del>- <None Include="..\UserInterface\LegacyConsoleMessage.js">
</del><ins>+ <None Include="..\UserInterface\ConsoleMessage.js">
</ins><span class="cx"> <Filter>UserInterface</Filter>
</span><span class="cx"> </None>
</span><del>- <None Include="..\UserInterface\LegacyConsoleMessageImpl.js">
</del><ins>+ <None Include="..\UserInterface\ConsoleMessageImpl.js">
</ins><span class="cx"> <Filter>UserInterface</Filter>
</span><span class="cx"> </None>
</span><span class="cx"> <None Include="..\UserInterface\ConsoleObserver.js">
</span></span></pre>
</div>
</div>
</body>
</html>