<!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>[180715] trunk</title>
</head>
<body>

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

<h3>Log Message</h3>
<pre>Web Inspector: Save Console Evaluations into Command Line variables $1-$99 ($n)
https://bugs.webkit.org/show_bug.cgi?id=142061

Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

* inspector/protocol/Debugger.json:
* inspector/protocol/Runtime.json:
Input flag &quot;saveResult&quot; on whether we should try to save a result.
Output int &quot;savedResultIndex&quot; to tell the frontend the saved state.

* inspector/InjectedScriptSource.js:
Handle saving and clearing $1-$99 values.
Include in BasicCommandLineAPI for JSContext inspection.

* inspector/InjectedScriptBase.cpp:
(Inspector::InjectedScriptBase::makeEvalCall):
* inspector/InjectedScriptBase.h:
Allow an optional &quot;savedResultIndex&quot; out value on evals.

* inspector/InjectedScript.cpp:
(Inspector::InjectedScript::evaluate):
(Inspector::InjectedScript::evaluateOnCallFrame):
* inspector/InjectedScript.h:
* inspector/agents/InspectorDebuggerAgent.cpp:
(Inspector::InspectorDebuggerAgent::evaluateOnCallFrame):
* inspector/agents/InspectorDebuggerAgent.h:
* inspector/agents/InspectorRuntimeAgent.cpp:
(Inspector::InspectorRuntimeAgent::evaluate):
* inspector/agents/InspectorRuntimeAgent.h:
Plumbing for new in and out parameters.

Source/WebCore:

* inspector/CommandLineAPIModuleSource.js:
Replace $1-$4 &quot;inspected objects&quot; with $1-$99 &quot;saved results&quot;.

* bindings/js/JSCommandLineAPIHostCustom.cpp:
(WebCore::JSCommandLineAPIHost::inspectedObject):
* inspector/CommandLineAPIHost.cpp:
(WebCore::CommandLineAPIHost::CommandLineAPIHost):
(WebCore::CommandLineAPIHost::InspectableObject::get):
(WebCore::CommandLineAPIHost::addInspectedObject):
(WebCore::CommandLineAPIHost::inspectedObject):
(WebCore::CommandLineAPIHost::clearInspectedObjects): Deleted.
* inspector/CommandLineAPIHost.h:
* inspector/CommandLineAPIHost.idl:
Since we now just save the single $0 inspected object, eliminate
keeping track of a list of 5 values.

Source/WebInspectorUI:

* UserInterface/Controllers/RuntimeManager.js:
(WebInspector.RuntimeManager.prototype.evalCallback):
(WebInspector.RuntimeManager.prototype.evaluateInInspectedWindow):
Add a saveResult parameter for the new protocol command in parameter.

* UserInterface/Views/ConsoleMessageImpl.js:
(WebInspector.ConsoleMessageImpl.prototype._formatMessage):
(WebInspector.ConsoleMessageImpl.prototype._formatParameterAsObject):
(WebInspector.ConsoleMessageImpl.prototype._formatParameterAsArray):
(WebInspector.ConsoleMessageImpl.prototype._rootPropertyPathForObject):
* UserInterface/Views/ObjectTreeView.js:
(WebInspector.ObjectTreeView.prototype.appendTitleSuffix):
For console evaluation results, show a &quot;= $n&quot; when the evaluation was
given a saved result index.

* UserInterface/Views/LogContentView.css:
(.console-saved-variable):
* UserInterface/Views/ObjectPreviewView.css:
(.object-preview-name):
Make $n and class names in previews always non-italics.

* UserInterface/Controllers/JavaScriptLogViewController.js:
(WebInspector.JavaScriptLogViewController.prototype.printResult):
(WebInspector.JavaScriptLogViewController.prototype.consolePromptTextCommitted):
* UserInterface/Controllers/JavaScriptRuntimeCompletionProvider.js:
(get WebInspector.JavaScriptRuntimeCompletionProvider.prototype.):
* UserInterface/Controllers/LogManager.js:
(WebInspector.LogManager.prototype.messagesCleared):
(WebInspector.LogManager.prototype._mainResourceDidChange):
Try to provide better autocompletion for $n, by populating autocompletion menus
from $1-$n where n is the maximum saved result index seen. Clear the maximum
when we clear the console.

* UserInterface/Views/ConsoleCommandResult.js:
(WebInspector.ConsoleCommandResult):
(WebInspector.ConsoleCommandResult.clearMaximumSavedResultIndex):
Keep track of the maximum savedResultIndex for console evaluation results.

LayoutTests:

* inspector/debugger/command-line-api-exception-nested-catch.html:
* inspector/debugger/command-line-api-exception.html:
* inspector/model/remote-object-get-properties.html:
* inspector/model/remote-object-weak-collection.html:
* inspector/model/remote-object.html:
Update evaluateInInspectedWindow call sites for new parameter.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsinspectordebuggercommandlineapiexceptionnestedcatchhtml">trunk/LayoutTests/inspector/debugger/command-line-api-exception-nested-catch.html</a></li>
<li><a href="#trunkLayoutTestsinspectordebuggercommandlineapiexceptionhtml">trunk/LayoutTests/inspector/debugger/command-line-api-exception.html</a></li>
<li><a href="#trunkLayoutTestsinspectormodelremoteobjectgetpropertieshtml">trunk/LayoutTests/inspector/model/remote-object-get-properties.html</a></li>
<li><a href="#trunkLayoutTestsinspectormodelremoteobjectweakcollectionhtml">trunk/LayoutTests/inspector/model/remote-object-weak-collection.html</a></li>
<li><a href="#trunkLayoutTestsinspectormodelremoteobjecthtml">trunk/LayoutTests/inspector/model/remote-object.html</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorInjectedScriptcpp">trunk/Source/JavaScriptCore/inspector/InjectedScript.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorInjectedScripth">trunk/Source/JavaScriptCore/inspector/InjectedScript.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorInjectedScriptBasecpp">trunk/Source/JavaScriptCore/inspector/InjectedScriptBase.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorInjectedScriptBaseh">trunk/Source/JavaScriptCore/inspector/InjectedScriptBase.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorInjectedScriptSourcejs">trunk/Source/JavaScriptCore/inspector/InjectedScriptSource.js</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectoragentsInspectorDebuggerAgentcpp">trunk/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectoragentsInspectorDebuggerAgenth">trunk/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectoragentsInspectorRuntimeAgentcpp">trunk/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectoragentsInspectorRuntimeAgenth">trunk/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorprotocolDebuggerjson">trunk/Source/JavaScriptCore/inspector/protocol/Debugger.json</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorprotocolRuntimejson">trunk/Source/JavaScriptCore/inspector/protocol/Runtime.json</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSCommandLineAPIHostCustomcpp">trunk/Source/WebCore/bindings/js/JSCommandLineAPIHostCustom.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorCommandLineAPIHostcpp">trunk/Source/WebCore/inspector/CommandLineAPIHost.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorCommandLineAPIHosth">trunk/Source/WebCore/inspector/CommandLineAPIHost.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorCommandLineAPIHostidl">trunk/Source/WebCore/inspector/CommandLineAPIHost.idl</a></li>
<li><a href="#trunkSourceWebCoreinspectorCommandLineAPIModuleSourcejs">trunk/Source/WebCore/inspector/CommandLineAPIModuleSource.js</a></li>
<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="#trunkSourceWebInspectorUIUserInterfaceControllersJavaScriptRuntimeCompletionProviderjs">trunk/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptRuntimeCompletionProvider.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceControllersLogManagerjs">trunk/Source/WebInspectorUI/UserInterface/Controllers/LogManager.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceControllersRuntimeManagerjs">trunk/Source/WebInspectorUI/UserInterface/Controllers/RuntimeManager.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceTesthtml">trunk/Source/WebInspectorUI/UserInterface/Test.html</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsConsoleCommandResultjs">trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleCommandResult.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsConsoleMessageImpljs">trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageImpl.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsLogContentViewcss">trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.css</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsObjectPreviewViewcss">trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.css</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsObjectTreeViewjs">trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/LayoutTests/ChangeLog        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2015-02-26  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: Save Console Evaluations into Command Line variables $1-$99 ($n)
+        https://bugs.webkit.org/show_bug.cgi?id=142061
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/debugger/command-line-api-exception-nested-catch.html:
+        * inspector/debugger/command-line-api-exception.html:
+        * inspector/model/remote-object-get-properties.html:
+        * inspector/model/remote-object-weak-collection.html:
+        * inspector/model/remote-object.html:
+        Update evaluateInInspectedWindow call sites for new parameter.
+
</ins><span class="cx"> 2015-02-26  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Win] More Debug assertion updates.
</span></span></pre></div>
<a id="trunkLayoutTestsinspectordebuggercommandlineapiexceptionnestedcatchhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/debugger/command-line-api-exception-nested-catch.html (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/debugger/command-line-api-exception-nested-catch.html        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/LayoutTests/inspector/debugger/command-line-api-exception-nested-catch.html        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -16,13 +16,13 @@
</span><span class="cx">     WebInspector.debuggerManager.allExceptionsBreakpoint.disabled = false;
</span><span class="cx"> 
</span><span class="cx">     function dumpCommandLineAPIValue(prefix) {
</span><del>-        WebInspector.runtimeManager.evaluateInInspectedWindow(&quot;$exception&quot;, &quot;test&quot;, true, true, false, false, function(result, wasThrown) {
</del><ins>+        WebInspector.runtimeManager.evaluateInInspectedWindow(&quot;$exception&quot;, &quot;test&quot;, true, true, false, false, false, function(result, wasThrown) {
</ins><span class="cx">             InspectorTest.log(prefix + &quot;: $exception =&gt; &quot; + result.description);
</span><span class="cx">         });
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     function checkIfExceptionValueMatchesVariable(varName) {
</span><del>-        WebInspector.runtimeManager.evaluateInInspectedWindow(&quot;$exception === &quot; + varName, &quot;test&quot;, true, true, false, false, function(result, wasThrown) {
</del><ins>+        WebInspector.runtimeManager.evaluateInInspectedWindow(&quot;$exception === &quot; + varName, &quot;test&quot;, true, true, false, false, false, function(result, wasThrown) {
</ins><span class="cx">             InspectorTest.log(&quot;  CATCH: $exception === &quot; + varName + &quot; ? &quot; + result.description);
</span><span class="cx">         });
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkLayoutTestsinspectordebuggercommandlineapiexceptionhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/debugger/command-line-api-exception.html (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/debugger/command-line-api-exception.html        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/LayoutTests/inspector/debugger/command-line-api-exception.html        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -40,13 +40,13 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     function dumpCommandLineAPIValue(prefix) {
</span><del>-        WebInspector.runtimeManager.evaluateInInspectedWindow(&quot;$exception&quot;, &quot;test&quot;, true, true, false, false, function(result, wasThrown) {
</del><ins>+        WebInspector.runtimeManager.evaluateInInspectedWindow(&quot;$exception&quot;, &quot;test&quot;, true, true, false, false, false, function(result, wasThrown) {
</ins><span class="cx">             InspectorTest.log(prefix + &quot;: $exception =&gt; &quot; + result.description);
</span><span class="cx">         });
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     function checkIfExceptionValueMatchesCatchVariable() {
</span><del>-        WebInspector.runtimeManager.evaluateInInspectedWindow(&quot;$exception === e&quot;, &quot;test&quot;, true, true, false, false, function(result, wasThrown) {
</del><ins>+        WebInspector.runtimeManager.evaluateInInspectedWindow(&quot;$exception === e&quot;, &quot;test&quot;, true, true, false, false, false, function(result, wasThrown) {
</ins><span class="cx">             InspectorTest.log(&quot;STEPPED OUT TO CATCH BLOCK: $exception === e ? &quot; + result.description);
</span><span class="cx">         });
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkLayoutTestsinspectormodelremoteobjectgetpropertieshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/model/remote-object-get-properties.html (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/model/remote-object-get-properties.html        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/LayoutTests/inspector/model/remote-object-get-properties.html        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -73,7 +73,7 @@
</span><span class="cx">         InspectorTest.log(&quot;-----------------------------------------------------&quot;);
</span><span class="cx">         InspectorTest.log(&quot;EXPRESSION: &quot; + step.expression);
</span><span class="cx"> 
</span><del>-        WebInspector.runtimeManager.evaluateInInspectedWindow(step.expression, &quot;test&quot;, false, true, false, false, function(remoteObject, wasThrown) {
</del><ins>+        WebInspector.runtimeManager.evaluateInInspectedWindow(step.expression, &quot;test&quot;, false, true, false, false, false, function(remoteObject, wasThrown) {
</ins><span class="cx">             InspectorTest.assert(remoteObject instanceof WebInspector.RemoteObject);
</span><span class="cx">             InspectorTest.log(&quot;type: &quot; + remoteObject.type);
</span><span class="cx">             if (remoteObject.subtype)
</span></span></pre></div>
<a id="trunkLayoutTestsinspectormodelremoteobjectweakcollectionhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/model/remote-object-weak-collection.html (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/model/remote-object-weak-collection.html        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/LayoutTests/inspector/model/remote-object-weak-collection.html        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -53,8 +53,8 @@
</span><span class="cx"> 
</span><span class="cx">         // Run the expression, and then run a garbage collection on a different
</span><span class="cx">         // event loop so no objects are kept alive by the stack.
</span><del>-        WebInspector.runtimeManager.evaluateInInspectedWindow(step.expression, &quot;test&quot;, false, true, false, true, function(remoteObject, wasThrown) {
-            WebInspector.runtimeManager.evaluateInInspectedWindow(&quot;GCController.collect()&quot;, &quot;test&quot;, false, true, false, false, function() {
</del><ins>+        WebInspector.runtimeManager.evaluateInInspectedWindow(step.expression, &quot;test&quot;, false, true, false, true, false, function(remoteObject, wasThrown) {
+            WebInspector.runtimeManager.evaluateInInspectedWindow(&quot;GCController.collect()&quot;, &quot;test&quot;, false, true, false, false, false, function() {
</ins><span class="cx">                 InspectorTest.assert(remoteObject instanceof WebInspector.RemoteObject);
</span><span class="cx">                 remoteObject.getCollectionEntries(0, 100, function(entries) {
</span><span class="cx">                     InspectorTest.log(&quot;ENTRIES:&quot;);
</span></span></pre></div>
<a id="trunkLayoutTestsinspectormodelremoteobjecthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/model/remote-object.html (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/model/remote-object.html        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/LayoutTests/inspector/model/remote-object.html        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -176,7 +176,7 @@
</span><span class="cx">         InspectorTest.log(&quot;-----------------------------------------------------&quot;);
</span><span class="cx">         InspectorTest.log(&quot;EXPRESSION: &quot; + step.expression);
</span><span class="cx"> 
</span><del>-        WebInspector.runtimeManager.evaluateInInspectedWindow(step.expression, &quot;test&quot;, false, true, false, true, function(remoteObject, wasThrown) {
</del><ins>+        WebInspector.runtimeManager.evaluateInInspectedWindow(step.expression, &quot;test&quot;, false, true, false, true, false, function(remoteObject, wasThrown) {
</ins><span class="cx">             InspectorTest.assert(remoteObject instanceof WebInspector.RemoteObject);
</span><span class="cx">             InspectorTest.log(JSON.stringify(remoteObject, remoteObjectJSONFilter, &quot;  &quot;));
</span><span class="cx">             runNextStep();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -1,3 +1,36 @@
</span><ins>+2015-02-26  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: Save Console Evaluations into Command Line variables $1-$99 ($n)
+        https://bugs.webkit.org/show_bug.cgi?id=142061
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/protocol/Debugger.json:
+        * inspector/protocol/Runtime.json:
+        Input flag &quot;saveResult&quot; on whether we should try to save a result.
+        Output int &quot;savedResultIndex&quot; to tell the frontend the saved state.
+
+        * inspector/InjectedScriptSource.js:
+        Handle saving and clearing $1-$99 values.
+        Include in BasicCommandLineAPI for JSContext inspection.
+
+        * inspector/InjectedScriptBase.cpp:
+        (Inspector::InjectedScriptBase::makeEvalCall):
+        * inspector/InjectedScriptBase.h:
+        Allow an optional &quot;savedResultIndex&quot; out value on evals.
+
+        * inspector/InjectedScript.cpp:
+        (Inspector::InjectedScript::evaluate):
+        (Inspector::InjectedScript::evaluateOnCallFrame):
+        * inspector/InjectedScript.h:
+        * inspector/agents/InspectorDebuggerAgent.cpp:
+        (Inspector::InspectorDebuggerAgent::evaluateOnCallFrame):
+        * inspector/agents/InspectorDebuggerAgent.h:
+        * inspector/agents/InspectorRuntimeAgent.cpp:
+        (Inspector::InspectorRuntimeAgent::evaluate):
+        * inspector/agents/InspectorRuntimeAgent.h:
+        Plumbing for new in and out parameters.
+
</ins><span class="cx"> 2015-02-26  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         The bool returning form of BytecodeGenerator::addVar() can be removed
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorInjectedScriptcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/InjectedScript.cpp (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/InjectedScript.cpp        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/Source/JavaScriptCore/inspector/InjectedScript.cpp        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -56,7 +56,7 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void InjectedScript::evaluate(ErrorString&amp; errorString, const String&amp; expression, const String&amp; objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, RefPtr&lt;Inspector::Protocol::Runtime::RemoteObject&gt;* result, Inspector::Protocol::OptOutput&lt;bool&gt;* wasThrown)
</del><ins>+void InjectedScript::evaluate(ErrorString&amp; errorString, const String&amp; expression, const String&amp; objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, bool saveResult, RefPtr&lt;Inspector::Protocol::Runtime::RemoteObject&gt;* result, Inspector::Protocol::OptOutput&lt;bool&gt;* wasThrown, Inspector::Protocol::OptOutput&lt;int&gt;* savedResultIndex)
</ins><span class="cx"> {
</span><span class="cx">     Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral(&quot;evaluate&quot;), inspectorEnvironment()-&gt;functionCallHandler());
</span><span class="cx">     function.appendArgument(expression);
</span><span class="lines">@@ -64,7 +64,8 @@
</span><span class="cx">     function.appendArgument(includeCommandLineAPI);
</span><span class="cx">     function.appendArgument(returnByValue);
</span><span class="cx">     function.appendArgument(generatePreview);
</span><del>-    makeEvalCall(errorString, function, result, wasThrown);
</del><ins>+    function.appendArgument(saveResult);
+    makeEvalCall(errorString, function, result, wasThrown, savedResultIndex);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InjectedScript::callFunctionOn(ErrorString&amp; errorString, const String&amp; objectId, const String&amp; expression, const String&amp; arguments, bool returnByValue, bool generatePreview, RefPtr&lt;Inspector::Protocol::Runtime::RemoteObject&gt;* result, Inspector::Protocol::OptOutput&lt;bool&gt;* wasThrown)
</span><span class="lines">@@ -78,7 +79,7 @@
</span><span class="cx">     makeEvalCall(errorString, function, result, wasThrown);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void InjectedScript::evaluateOnCallFrame(ErrorString&amp; errorString, const Deprecated::ScriptValue&amp; callFrames, const String&amp; callFrameId, const String&amp; expression, const String&amp; objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, RefPtr&lt;Inspector::Protocol::Runtime::RemoteObject&gt;* result, Inspector::Protocol::OptOutput&lt;bool&gt;* wasThrown)
</del><ins>+void InjectedScript::evaluateOnCallFrame(ErrorString&amp; errorString, const Deprecated::ScriptValue&amp; callFrames, const String&amp; callFrameId, const String&amp; expression, const String&amp; objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, bool saveResult, RefPtr&lt;Inspector::Protocol::Runtime::RemoteObject&gt;* result, Inspector::Protocol::OptOutput&lt;bool&gt;* wasThrown, Inspector::Protocol::OptOutput&lt;int&gt;* savedResultIndex)
</ins><span class="cx"> {
</span><span class="cx">     Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral(&quot;evaluateOnCallFrame&quot;), inspectorEnvironment()-&gt;functionCallHandler());
</span><span class="cx">     function.appendArgument(callFrames);
</span><span class="lines">@@ -88,7 +89,8 @@
</span><span class="cx">     function.appendArgument(includeCommandLineAPI);
</span><span class="cx">     function.appendArgument(returnByValue);
</span><span class="cx">     function.appendArgument(generatePreview);
</span><del>-    makeEvalCall(errorString, function, result, wasThrown);
</del><ins>+    function.appendArgument(saveResult);
+    makeEvalCall(errorString, function, result, wasThrown, savedResultIndex);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InjectedScript::getFunctionDetails(ErrorString&amp; errorString, const String&amp; functionId, RefPtr&lt;Inspector::Protocol::Debugger::FunctionDetails&gt;* result)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorInjectedScripth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/InjectedScript.h (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/InjectedScript.h        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/Source/JavaScriptCore/inspector/InjectedScript.h        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -52,9 +52,9 @@
</span><span class="cx">     InjectedScript(Deprecated::ScriptObject, InspectorEnvironment*);
</span><span class="cx">     virtual ~InjectedScript();
</span><span class="cx"> 
</span><del>-    void evaluate(ErrorString&amp;, const String&amp; expression, const String&amp; objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, RefPtr&lt;Protocol::Runtime::RemoteObject&gt;* result, Protocol::OptOutput&lt;bool&gt;* wasThrown);
</del><ins>+    void evaluate(ErrorString&amp;, const String&amp; expression, const String&amp; objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, bool saveResult, RefPtr&lt;Protocol::Runtime::RemoteObject&gt;* result, Protocol::OptOutput&lt;bool&gt;* wasThrown, Inspector::Protocol::OptOutput&lt;int&gt;* savedResultIndex);
</ins><span class="cx">     void callFunctionOn(ErrorString&amp;, const String&amp; objectId, const String&amp; expression, const String&amp; arguments, bool returnByValue, bool generatePreview, RefPtr&lt;Protocol::Runtime::RemoteObject&gt;* result, Protocol::OptOutput&lt;bool&gt;* wasThrown);
</span><del>-    void evaluateOnCallFrame(ErrorString&amp;, const Deprecated::ScriptValue&amp; callFrames, const String&amp; callFrameId, const String&amp; expression, const String&amp; objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, RefPtr&lt;Protocol::Runtime::RemoteObject&gt;* result, Protocol::OptOutput&lt;bool&gt;* wasThrown);
</del><ins>+    void evaluateOnCallFrame(ErrorString&amp;, const Deprecated::ScriptValue&amp; callFrames, const String&amp; callFrameId, const String&amp; expression, const String&amp; objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, bool saveResult, RefPtr&lt;Protocol::Runtime::RemoteObject&gt;* result, Protocol::OptOutput&lt;bool&gt;* wasThrown, Inspector::Protocol::OptOutput&lt;int&gt;* savedResultIndex);
</ins><span class="cx">     void getFunctionDetails(ErrorString&amp;, const String&amp; functionId, RefPtr&lt;Protocol::Debugger::FunctionDetails&gt;* result);
</span><span class="cx">     void getProperties(ErrorString&amp;, const String&amp; objectId, bool ownProperties, bool generatePreview, RefPtr&lt;Protocol::Array&lt;Protocol::Runtime::PropertyDescriptor&gt;&gt;* result);
</span><span class="cx">     void getDisplayableProperties(ErrorString&amp;, const String&amp; objectId, bool generatePreview, RefPtr&lt;Protocol::Array&lt;Protocol::Runtime::PropertyDescriptor&gt;&gt;* result);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorInjectedScriptBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/InjectedScriptBase.cpp (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/InjectedScriptBase.cpp        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/Source/JavaScriptCore/inspector/InjectedScriptBase.cpp        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -112,7 +112,7 @@
</span><span class="cx">         *result = InspectorString::create(&quot;Exception while making a call.&quot;);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void InjectedScriptBase::makeEvalCall(ErrorString&amp; errorString, Deprecated::ScriptFunctionCall&amp; function, RefPtr&lt;Protocol::Runtime::RemoteObject&gt;* objectResult, Protocol::OptOutput&lt;bool&gt;* wasThrown)
</del><ins>+void InjectedScriptBase::makeEvalCall(ErrorString&amp; errorString, Deprecated::ScriptFunctionCall&amp; function, RefPtr&lt;Protocol::Runtime::RemoteObject&gt;* objectResult, Protocol::OptOutput&lt;bool&gt;* wasThrown, Protocol::OptOutput&lt;int&gt;* savedResultIndex)
</ins><span class="cx"> {
</span><span class="cx">     RefPtr&lt;InspectorValue&gt; result;
</span><span class="cx">     makeCall(function, &amp;result);
</span><span class="lines">@@ -127,26 +127,32 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    RefPtr&lt;InspectorObject&gt; resultPair;
-    if (!result-&gt;asObject(resultPair)) {
</del><ins>+    RefPtr&lt;InspectorObject&gt; resultTuple;
+    if (!result-&gt;asObject(resultTuple)) {
</ins><span class="cx">         errorString = ASCIILiteral(&quot;Internal error: result is not an Object&quot;);
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;InspectorObject&gt; resultObject;
</span><del>-    if (!resultPair-&gt;getObject(ASCIILiteral(&quot;result&quot;), resultObject)) {
</del><ins>+    if (!resultTuple-&gt;getObject(ASCIILiteral(&quot;result&quot;), resultObject)) {
</ins><span class="cx">         errorString = ASCIILiteral(&quot;Internal error: result is not a pair of value and wasThrown flag&quot;);
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     bool wasThrownValue = false;
</span><del>-    if (!resultPair-&gt;getBoolean(ASCIILiteral(&quot;wasThrown&quot;), wasThrownValue)) {
</del><ins>+    if (!resultTuple-&gt;getBoolean(ASCIILiteral(&quot;wasThrown&quot;), wasThrownValue)) {
</ins><span class="cx">         errorString = ASCIILiteral(&quot;Internal error: result is not a pair of value and wasThrown flag&quot;);
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     *objectResult = BindingTraits&lt;Protocol::Runtime::RemoteObject&gt;::runtimeCast(resultObject);
</span><span class="cx">     *wasThrown = wasThrownValue;
</span><ins>+
+    if (savedResultIndex) {
+        int savedIndex = 0;
+        if (resultTuple-&gt;getInteger(ASCIILiteral(&quot;savedResultIndex&quot;), savedIndex))
+            *savedResultIndex = savedIndex;
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace Inspector
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorInjectedScriptBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/InjectedScriptBase.h (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/InjectedScriptBase.h        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/Source/JavaScriptCore/inspector/InjectedScriptBase.h        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -66,7 +66,7 @@
</span><span class="cx">     const Deprecated::ScriptObject&amp; injectedScriptObject() const;
</span><span class="cx">     Deprecated::ScriptValue callFunctionWithEvalEnabled(Deprecated::ScriptFunctionCall&amp;, bool&amp; hadException) const;
</span><span class="cx">     void makeCall(Deprecated::ScriptFunctionCall&amp;, RefPtr&lt;InspectorValue&gt;* result);
</span><del>-    void makeEvalCall(ErrorString&amp;, Deprecated::ScriptFunctionCall&amp;, RefPtr&lt;Protocol::Runtime::RemoteObject&gt;* result, Protocol::OptOutput&lt;bool&gt;* wasThrown);
</del><ins>+    void makeEvalCall(ErrorString&amp;, Deprecated::ScriptFunctionCall&amp;, RefPtr&lt;Protocol::Runtime::RemoteObject&gt;* result, Protocol::OptOutput&lt;bool&gt;* wasThrown, Protocol::OptOutput&lt;int&gt;* savedResult = nullptr);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     String m_name;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorInjectedScriptSourcejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/InjectedScriptSource.js (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/InjectedScriptSource.js        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/Source/JavaScriptCore/inspector/InjectedScriptSource.js        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -58,6 +58,8 @@
</span><span class="cx">     this._idToObjectGroupName = {};
</span><span class="cx">     this._objectGroups = {};
</span><span class="cx">     this._modules = {};
</span><ins>+    this._nextSavedResultIndex = 1;
+    this._savedResults = [];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> InjectedScript.primitiveTypes = {
</span><span class="lines">@@ -174,13 +176,19 @@
</span><span class="cx"> 
</span><span class="cx">     releaseObjectGroup: function(objectGroupName)
</span><span class="cx">     {
</span><del>-        if (objectGroupName === &quot;console&quot;)
</del><ins>+        if (objectGroupName === &quot;console&quot;) {
</ins><span class="cx">             delete this._lastResult;
</span><ins>+            this._nextSavedResultIndex = 1;
+            this._savedResults = [];
+        }
+
</ins><span class="cx">         var group = this._objectGroups[objectGroupName];
</span><span class="cx">         if (!group)
</span><span class="cx">             return;
</span><ins>+
</ins><span class="cx">         for (var i = 0; i &lt; group.length; i++)
</span><span class="cx">             this._releaseObject(group[i]);
</span><ins>+
</ins><span class="cx">         delete this._objectGroups[objectGroupName];
</span><span class="cx">     },
</span><span class="cx"> 
</span><span class="lines">@@ -320,9 +328,9 @@
</span><span class="cx">         delete this._idToObjectGroupName[id];
</span><span class="cx">     },
</span><span class="cx"> 
</span><del>-    evaluate: function(expression, objectGroup, injectCommandLineAPI, returnByValue, generatePreview)
</del><ins>+    evaluate: function(expression, objectGroup, injectCommandLineAPI, returnByValue, generatePreview, saveResult)
</ins><span class="cx">     {
</span><del>-        return this._evaluateAndWrap(InjectedScriptHost.evaluate, InjectedScriptHost, expression, objectGroup, false, injectCommandLineAPI, returnByValue, generatePreview);
</del><ins>+        return this._evaluateAndWrap(InjectedScriptHost.evaluate, InjectedScriptHost, expression, objectGroup, false, injectCommandLineAPI, returnByValue, generatePreview, saveResult);
</ins><span class="cx">     },
</span><span class="cx"> 
</span><span class="cx">     callFunctionOn: function(objectId, expression, args, returnByValue, generatePreview)
</span><span class="lines">@@ -376,13 +384,20 @@
</span><span class="cx">         return undefined;
</span><span class="cx">     },
</span><span class="cx"> 
</span><del>-    _evaluateAndWrap: function(evalFunction, object, expression, objectGroup, isEvalOnCallFrame, injectCommandLineAPI, returnByValue, generatePreview)
</del><ins>+    _evaluateAndWrap: function(evalFunction, object, expression, objectGroup, isEvalOnCallFrame, injectCommandLineAPI, returnByValue, generatePreview, saveResult)
</ins><span class="cx">     {
</span><span class="cx">         try {
</span><del>-            return {
</del><ins>+            this._savedResultIndex = undefined;
+
+            var returnObject = {
</ins><span class="cx">                 wasThrown: false,
</span><del>-                result: this._wrapObject(this._evaluateOn(evalFunction, object, objectGroup, expression, isEvalOnCallFrame, injectCommandLineAPI), objectGroup, returnByValue, generatePreview)
</del><ins>+                result: this._wrapObject(this._evaluateOn(evalFunction, object, objectGroup, expression, isEvalOnCallFrame, injectCommandLineAPI, saveResult), objectGroup, returnByValue, generatePreview)
</ins><span class="cx">             };
</span><ins>+
+            if (saveResult &amp;&amp; this._savedResultIndex)
+                returnObject.savedResultIndex = this._savedResultIndex;
+
+            return returnObject;
</ins><span class="cx">         } catch (e) {
</span><span class="cx">             return this._createThrownValue(e, objectGroup);
</span><span class="cx">         }
</span><span class="lines">@@ -400,7 +415,7 @@
</span><span class="cx">         };
</span><span class="cx">     },
</span><span class="cx"> 
</span><del>-    _evaluateOn: function(evalFunction, object, objectGroup, expression, isEvalOnCallFrame, injectCommandLineAPI)
</del><ins>+    _evaluateOn: function(evalFunction, object, objectGroup, expression, isEvalOnCallFrame, injectCommandLineAPI, saveResult)
</ins><span class="cx">     {
</span><span class="cx">         var commandLineAPI = null;
</span><span class="cx">         if (injectCommandLineAPI) {
</span><span class="lines">@@ -445,8 +460,8 @@
</span><span class="cx">             var expressionFunction = evalFunction.call(object, boundExpressionFunctionString);
</span><span class="cx">             var result = expressionFunction.apply(null, parameters);
</span><span class="cx"> 
</span><del>-            if (objectGroup === &quot;console&quot;)
-                this._lastResult = result;
</del><ins>+            if (objectGroup === &quot;console&quot; &amp;&amp; saveResult)
+                this._saveResult(result);
</ins><span class="cx"> 
</span><span class="cx">             return result;
</span><span class="cx">         }
</span><span class="lines">@@ -465,8 +480,8 @@
</span><span class="cx"> 
</span><span class="cx">             var result = evalFunction.call(inspectedGlobalObject, expression);
</span><span class="cx"> 
</span><del>-            if (objectGroup === &quot;console&quot;)
-                this._lastResult = result;
</del><ins>+            if (objectGroup === &quot;console&quot; &amp;&amp; saveResult)
+                this._saveResult(result);
</ins><span class="cx"> 
</span><span class="cx">             return result;
</span><span class="cx">         } finally {
</span><span class="lines">@@ -493,12 +508,12 @@
</span><span class="cx">         return result;
</span><span class="cx">     },
</span><span class="cx"> 
</span><del>-    evaluateOnCallFrame: function(topCallFrame, callFrameId, expression, objectGroup, injectCommandLineAPI, returnByValue, generatePreview)
</del><ins>+    evaluateOnCallFrame: function(topCallFrame, callFrameId, expression, objectGroup, injectCommandLineAPI, returnByValue, generatePreview, saveResult)
</ins><span class="cx">     {
</span><span class="cx">         var callFrame = this._callFrameForId(topCallFrame, callFrameId);
</span><span class="cx">         if (!callFrame)
</span><span class="cx">             return &quot;Could not find call frame with given id&quot;;
</span><del>-        return this._evaluateAndWrap(callFrame.evaluate, callFrame, expression, objectGroup, true, injectCommandLineAPI, returnByValue, generatePreview);
</del><ins>+        return this._evaluateAndWrap(callFrame.evaluate, callFrame, expression, objectGroup, true, injectCommandLineAPI, returnByValue, generatePreview, saveResult);
</ins><span class="cx">     },
</span><span class="cx"> 
</span><span class="cx">     _callFrameForId: function(topCallFrame, callFrameId)
</span><span class="lines">@@ -809,6 +824,32 @@
</span><span class="cx">             return this._getWeakMapEntries(object, numberToFetch);
</span><span class="cx"> 
</span><span class="cx">         throw &quot;unexpected type&quot;;
</span><ins>+    },
+
+    _saveResult: function(result)
+    {
+        this._lastResult = result;
+
+        if (result === undefined || result === null)
+            return;
+
+        var existingIndex = this._savedResults.indexOf(result);
+        if (existingIndex !== -1) {
+            this._savedResultIndex = existingIndex;
+            return;
+        }
+
+        this._savedResultIndex = this._nextSavedResultIndex;
+        this._savedResults[this._nextSavedResultIndex++] = result;
+
+        // $n is limited from $1-$99. $0 is special.
+        if (this._nextSavedResultIndex &gt;= 100)
+            this._nextSavedResultIndex = 1;
+    },
+
+    _savedResult: function(index)
+    {
+        return this._savedResults[index];
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1117,10 +1158,35 @@
</span><span class="cx">     };
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+
+function slice(array, index)
+{
+    var result = [];
+    for (var i = index || 0; i &lt; array.length; ++i)
+        result.push(array[i]);
+    return result;
+}
+
+function bind(func, thisObject, var_args)
+{
+    var args = slice(arguments, 2);
+    return function(var_args) {
+        return func.apply(thisObject, args.concat(slice(arguments)));
+    }
+}
+
</ins><span class="cx"> function BasicCommandLineAPI()
</span><span class="cx"> {
</span><span class="cx">     this.$_ = injectedScript._lastResult;
</span><span class="cx">     this.$exception = injectedScript._exceptionValue;
</span><ins>+
+    // $1-$99
+    for (var i = 1; i &lt;= injectedScript._savedResults.length; ++i) {
+        var member = &quot;$&quot; + i;
+        if (member in inspectedGlobalObject)
+            continue;
+        this.__defineGetter__(&quot;$&quot; + i, bind(injectedScript._savedResult, injectedScript, i));
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> return injectedScript;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectoragentsInspectorDebuggerAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -551,7 +551,7 @@
</span><span class="cx">         errorString = ASCIILiteral(&quot;Internal error. Could not change pause on exceptions state&quot;);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString&amp; errorString, const String&amp; callFrameId, const String&amp; expression, const String* const objectGroup, const bool* const includeCommandLineAPI, const bool* const doNotPauseOnExceptionsAndMuteConsole, const bool* const returnByValue, const bool* generatePreview, RefPtr&lt;Inspector::Protocol::Runtime::RemoteObject&gt;&amp; result, Inspector::Protocol::OptOutput&lt;bool&gt;* wasThrown)
</del><ins>+void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString&amp; errorString, const String&amp; callFrameId, const String&amp; expression, const String* const objectGroup, const bool* const includeCommandLineAPI, const bool* const doNotPauseOnExceptionsAndMuteConsole, const bool* const returnByValue, const bool* generatePreview, const bool* saveResult, RefPtr&lt;Inspector::Protocol::Runtime::RemoteObject&gt;&amp; result, Inspector::Protocol::OptOutput&lt;bool&gt;* wasThrown, Inspector::Protocol::OptOutput&lt;int&gt;* savedResultIndex)
</ins><span class="cx"> {
</span><span class="cx">     InjectedScript injectedScript = m_injectedScriptManager-&gt;injectedScriptForObjectId(callFrameId);
</span><span class="cx">     if (injectedScript.hasNoValue()) {
</span><span class="lines">@@ -566,7 +566,7 @@
</span><span class="cx">         muteConsole();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    injectedScript.evaluateOnCallFrame(errorString, m_currentCallStack, callFrameId, expression, objectGroup ? *objectGroup : &quot;&quot;, includeCommandLineAPI ? *includeCommandLineAPI : false, returnByValue ? *returnByValue : false, generatePreview ? *generatePreview : false, &amp;result, wasThrown);
</del><ins>+    injectedScript.evaluateOnCallFrame(errorString, m_currentCallStack, callFrameId, expression, objectGroup ? *objectGroup : &quot;&quot;, includeCommandLineAPI ? *includeCommandLineAPI : false, returnByValue ? *returnByValue : false, generatePreview ? *generatePreview : false, saveResult ? *saveResult : false, &amp;result, wasThrown, savedResultIndex);
</ins><span class="cx"> 
</span><span class="cx">     if (doNotPauseOnExceptionsAndMuteConsole ? *doNotPauseOnExceptionsAndMuteConsole : false) {
</span><span class="cx">         unmuteConsole();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectoragentsInspectorDebuggerAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -84,7 +84,7 @@
</span><span class="cx">     virtual void stepInto(ErrorString&amp;) override;
</span><span class="cx">     virtual void stepOut(ErrorString&amp;) override;
</span><span class="cx">     virtual void setPauseOnExceptions(ErrorString&amp;, const String&amp; pauseState) override;
</span><del>-    virtual void evaluateOnCallFrame(ErrorString&amp;, const String&amp; callFrameId, const String&amp; expression, const String* objectGroup, const bool* includeCommandLineAPI, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, RefPtr&lt;Inspector::Protocol::Runtime::RemoteObject&gt;&amp; result, Inspector::Protocol::OptOutput&lt;bool&gt;* wasThrown) override;
</del><ins>+    virtual void evaluateOnCallFrame(ErrorString&amp;, const String&amp; callFrameId, const String&amp; expression, const String* objectGroup, const bool* includeCommandLineAPI, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, const bool* saveResult, RefPtr&lt;Inspector::Protocol::Runtime::RemoteObject&gt;&amp; result, Inspector::Protocol::OptOutput&lt;bool&gt;* wasThrown, Inspector::Protocol::OptOutput&lt;int&gt;* savedResultIndex) override;
</ins><span class="cx">     virtual void setOverlayMessage(ErrorString&amp;, const String*) override;
</span><span class="cx"> 
</span><span class="cx">     bool isPaused();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectoragentsInspectorRuntimeAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -114,7 +114,7 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void InspectorRuntimeAgent::evaluate(ErrorString&amp; errorString, const String&amp; expression, const String* const objectGroup, const bool* const includeCommandLineAPI, const bool* const doNotPauseOnExceptionsAndMuteConsole, const int* executionContextId, const bool* const returnByValue, const bool* generatePreview, RefPtr&lt;Inspector::Protocol::Runtime::RemoteObject&gt;&amp; result, Inspector::Protocol::OptOutput&lt;bool&gt;* wasThrown)
</del><ins>+void InspectorRuntimeAgent::evaluate(ErrorString&amp; errorString, const String&amp; expression, const String* const objectGroup, const bool* const includeCommandLineAPI, const bool* const doNotPauseOnExceptionsAndMuteConsole, const int* executionContextId, const bool* const returnByValue, const bool* generatePreview, const bool* saveResult, RefPtr&lt;Inspector::Protocol::Runtime::RemoteObject&gt;&amp; result, Inspector::Protocol::OptOutput&lt;bool&gt;* wasThrown, Inspector::Protocol::OptOutput&lt;int&gt;* savedResultIndex)
</ins><span class="cx"> {
</span><span class="cx">     InjectedScript injectedScript = injectedScriptForEval(errorString, executionContextId);
</span><span class="cx">     if (injectedScript.hasNoValue())
</span><span class="lines">@@ -126,7 +126,7 @@
</span><span class="cx">     if (asBool(doNotPauseOnExceptionsAndMuteConsole))
</span><span class="cx">         muteConsole();
</span><span class="cx"> 
</span><del>-    injectedScript.evaluate(errorString, expression, objectGroup ? *objectGroup : String(), asBool(includeCommandLineAPI), asBool(returnByValue), asBool(generatePreview), &amp;result, wasThrown);
</del><ins>+    injectedScript.evaluate(errorString, expression, objectGroup ? *objectGroup : String(), asBool(includeCommandLineAPI), asBool(returnByValue), asBool(generatePreview), asBool(saveResult), &amp;result, wasThrown, savedResultIndex);
</ins><span class="cx"> 
</span><span class="cx">     if (asBool(doNotPauseOnExceptionsAndMuteConsole)) {
</span><span class="cx">         unmuteConsole();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectoragentsInspectorRuntimeAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.h (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.h        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.h        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -60,7 +60,7 @@
</span><span class="cx">     virtual void enable(ErrorString&amp;) override { m_enabled = true; }
</span><span class="cx">     virtual void disable(ErrorString&amp;) override { m_enabled = false; }
</span><span class="cx">     virtual void parse(ErrorString&amp;, const String&amp; expression, Inspector::Protocol::Runtime::SyntaxErrorType* result, Inspector::Protocol::OptOutput&lt;String&gt;* message, RefPtr&lt;Inspector::Protocol::Runtime::ErrorRange&gt;&amp;) override final;
</span><del>-    virtual void evaluate(ErrorString&amp;, const String&amp; expression, const String* objectGroup, const bool* includeCommandLineAPI, const bool* doNotPauseOnExceptionsAndMuteConsole, const int* executionContextId, const bool* returnByValue, const bool* generatePreview, RefPtr&lt;Inspector::Protocol::Runtime::RemoteObject&gt;&amp; result, Inspector::Protocol::OptOutput&lt;bool&gt;* wasThrown) override final;
</del><ins>+    virtual void evaluate(ErrorString&amp;, const String&amp; expression, const String* objectGroup, const bool* includeCommandLineAPI, const bool* doNotPauseOnExceptionsAndMuteConsole, const int* executionContextId, const bool* returnByValue, const bool* generatePreview, const bool* saveResult, RefPtr&lt;Inspector::Protocol::Runtime::RemoteObject&gt;&amp; result, Inspector::Protocol::OptOutput&lt;bool&gt;* wasThrown, Inspector::Protocol::OptOutput&lt;int&gt;* savedResultIndex) override final;
</ins><span class="cx">     virtual void callFunctionOn(ErrorString&amp;, const String&amp; objectId, const String&amp; expression, const RefPtr&lt;Inspector::InspectorArray&gt;&amp;&amp; optionalArguments, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, RefPtr&lt;Inspector::Protocol::Runtime::RemoteObject&gt;&amp; result, Inspector::Protocol::OptOutput&lt;bool&gt;* wasThrown) override final;
</span><span class="cx">     virtual void releaseObject(ErrorString&amp;, const ErrorString&amp; objectId) override final;
</span><span class="cx">     virtual void getProperties(ErrorString&amp;, const String&amp; objectId, const bool* ownProperties, const bool* generatePreview, RefPtr&lt;Inspector::Protocol::Array&lt;Inspector::Protocol::Runtime::PropertyDescriptor&gt;&gt;&amp; result, RefPtr&lt;Inspector::Protocol::Array&lt;Inspector::Protocol::Runtime::InternalPropertyDescriptor&gt;&gt;&amp; internalProperties) override final;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorprotocolDebuggerjson"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/protocol/Debugger.json (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/protocol/Debugger.json        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/Source/JavaScriptCore/inspector/protocol/Debugger.json        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -248,11 +248,13 @@
</span><span class="cx">                 { &quot;name&quot;: &quot;includeCommandLineAPI&quot;, &quot;type&quot;: &quot;boolean&quot;, &quot;optional&quot;: true, &quot;description&quot;: &quot;Specifies whether command line API should be available to the evaluated expression, defaults to false.&quot; },
</span><span class="cx">                 { &quot;name&quot;: &quot;doNotPauseOnExceptionsAndMuteConsole&quot;, &quot;type&quot;: &quot;boolean&quot;, &quot;optional&quot;: true, &quot;description&quot;: &quot;Specifies whether evaluation should stop on exceptions and mute console. Overrides setPauseOnException state.&quot; },
</span><span class="cx">                 { &quot;name&quot;: &quot;returnByValue&quot;, &quot;type&quot;: &quot;boolean&quot;, &quot;optional&quot;: true, &quot;description&quot;: &quot;Whether the result is expected to be a JSON object that should be sent by value.&quot; },
</span><del>-                { &quot;name&quot;: &quot;generatePreview&quot;, &quot;type&quot;: &quot;boolean&quot;, &quot;optional&quot;: true, &quot;description&quot;: &quot;Whether preview should be generated for the result.&quot; }
</del><ins>+                { &quot;name&quot;: &quot;generatePreview&quot;, &quot;type&quot;: &quot;boolean&quot;, &quot;optional&quot;: true, &quot;description&quot;: &quot;Whether preview should be generated for the result.&quot; },
+                { &quot;name&quot;: &quot;saveResult&quot;, &quot;type&quot;: &quot;boolean&quot;, &quot;optional&quot;: true, &quot;description&quot;: &quot;Whether the resulting value should be considered for saving in the $n history.&quot; }
</ins><span class="cx">             ],
</span><span class="cx">             &quot;returns&quot;: [
</span><span class="cx">                 { &quot;name&quot;: &quot;result&quot;, &quot;$ref&quot;: &quot;Runtime.RemoteObject&quot;, &quot;description&quot;: &quot;Object wrapper for the evaluation result.&quot; },
</span><del>-                { &quot;name&quot;: &quot;wasThrown&quot;, &quot;type&quot;: &quot;boolean&quot;, &quot;optional&quot;: true, &quot;description&quot;: &quot;True if the result was thrown during the evaluation.&quot; }
</del><ins>+                { &quot;name&quot;: &quot;wasThrown&quot;, &quot;type&quot;: &quot;boolean&quot;, &quot;optional&quot;: true, &quot;description&quot;: &quot;True if the result was thrown during the evaluation.&quot; },
+                { &quot;name&quot;: &quot;savedResultIndex&quot;, &quot;type&quot;: &quot;integer&quot;, &quot;optional&quot;: true, &quot;description&quot;: &quot;If the result was saved, this is the $n index that can be used to access the value.&quot; }
</ins><span class="cx">             ],
</span><span class="cx">             &quot;description&quot;: &quot;Evaluates expression on a given call frame.&quot;
</span><span class="cx">         },
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorprotocolRuntimejson"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/protocol/Runtime.json (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/protocol/Runtime.json        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/Source/JavaScriptCore/inspector/protocol/Runtime.json        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -209,11 +209,13 @@
</span><span class="cx">                 { &quot;name&quot;: &quot;doNotPauseOnExceptionsAndMuteConsole&quot;, &quot;type&quot;: &quot;boolean&quot;, &quot;optional&quot;: true, &quot;description&quot;: &quot;Specifies whether evaluation should stop on exceptions and mute console. Overrides setPauseOnException state.&quot; },
</span><span class="cx">                 { &quot;name&quot;: &quot;contextId&quot;, &quot;$ref&quot;: &quot;Runtime.ExecutionContextId&quot;, &quot;optional&quot;: true, &quot;description&quot;: &quot;Specifies in which isolated context to perform evaluation. Each content script lives in an isolated context and this parameter may be used to specify one of those contexts. If the parameter is omitted or 0 the evaluation will be performed in the context of the inspected page.&quot; },
</span><span class="cx">                 { &quot;name&quot;: &quot;returnByValue&quot;, &quot;type&quot;: &quot;boolean&quot;, &quot;optional&quot;: true, &quot;description&quot;: &quot;Whether the result is expected to be a JSON object that should be sent by value.&quot; },
</span><del>-                { &quot;name&quot;: &quot;generatePreview&quot;, &quot;type&quot;: &quot;boolean&quot;, &quot;optional&quot;: true, &quot;description&quot;: &quot;Whether preview should be generated for the result.&quot; }
</del><ins>+                { &quot;name&quot;: &quot;generatePreview&quot;, &quot;type&quot;: &quot;boolean&quot;, &quot;optional&quot;: true, &quot;description&quot;: &quot;Whether preview should be generated for the result.&quot; },
+                { &quot;name&quot;: &quot;saveResult&quot;, &quot;type&quot;: &quot;boolean&quot;, &quot;optional&quot;: true, &quot;description&quot;: &quot;Whether the resulting value should be considered for saving in the $n history.&quot; }
</ins><span class="cx">             ],
</span><span class="cx">             &quot;returns&quot;: [
</span><span class="cx">                 { &quot;name&quot;: &quot;result&quot;, &quot;$ref&quot;: &quot;RemoteObject&quot;, &quot;description&quot;: &quot;Evaluation result.&quot; },
</span><del>-                { &quot;name&quot;: &quot;wasThrown&quot;, &quot;type&quot;: &quot;boolean&quot;, &quot;optional&quot;: true, &quot;description&quot;: &quot;True if the result was thrown during the evaluation.&quot; }
</del><ins>+                { &quot;name&quot;: &quot;wasThrown&quot;, &quot;type&quot;: &quot;boolean&quot;, &quot;optional&quot;: true, &quot;description&quot;: &quot;True if the result was thrown during the evaluation.&quot; },
+                { &quot;name&quot;: &quot;savedResultIndex&quot;, &quot;type&quot;: &quot;integer&quot;, &quot;optional&quot;: true, &quot;description&quot;: &quot;If the result was saved, this is the $n index that can be used to access the value.&quot; }
</ins><span class="cx">             ],
</span><span class="cx">             &quot;description&quot;: &quot;Evaluates expression on global object.&quot;
</span><span class="cx">         },
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/Source/WebCore/ChangeLog        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2015-02-26  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: Save Console Evaluations into Command Line variables $1-$99 ($n)
+        https://bugs.webkit.org/show_bug.cgi?id=142061
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/CommandLineAPIModuleSource.js:
+        Replace $1-$4 &quot;inspected objects&quot; with $1-$99 &quot;saved results&quot;.
+
+        * bindings/js/JSCommandLineAPIHostCustom.cpp:
+        (WebCore::JSCommandLineAPIHost::inspectedObject):
+        * inspector/CommandLineAPIHost.cpp:
+        (WebCore::CommandLineAPIHost::CommandLineAPIHost):
+        (WebCore::CommandLineAPIHost::InspectableObject::get):
+        (WebCore::CommandLineAPIHost::addInspectedObject):
+        (WebCore::CommandLineAPIHost::inspectedObject):
+        (WebCore::CommandLineAPIHost::clearInspectedObjects): Deleted.
+        * inspector/CommandLineAPIHost.h:
+        * inspector/CommandLineAPIHost.idl:
+        Since we now just save the single $0 inspected object, eliminate
+        keeping track of a list of 5 values.
+
</ins><span class="cx"> 2015-02-26  Gyuyoung Kim  &lt;gyuyoung.kim@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove unnecessary create() factory functions in CDMFoo, NamedNodeMap
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSCommandLineAPIHostCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSCommandLineAPIHostCustom.cpp (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSCommandLineAPIHostCustom.cpp        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/Source/WebCore/bindings/js/JSCommandLineAPIHostCustom.cpp        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -57,10 +57,7 @@
</span><span class="cx"> 
</span><span class="cx"> JSValue JSCommandLineAPIHost::inspectedObject(ExecState* exec)
</span><span class="cx"> {
</span><del>-    if (exec-&gt;argumentCount() &lt; 1)
-        return jsUndefined();
-
-    CommandLineAPIHost::InspectableObject* object = impl().inspectedObject(exec-&gt;uncheckedArgument(0).toInt32(exec));
</del><ins>+    CommandLineAPIHost::InspectableObject* object = impl().inspectedObject();
</ins><span class="cx">     if (!object)
</span><span class="cx">         return jsUndefined();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorCommandLineAPIHostcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/CommandLineAPIHost.cpp (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/CommandLineAPIHost.cpp        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/Source/WebCore/inspector/CommandLineAPIHost.cpp        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -67,7 +67,7 @@
</span><span class="cx">     , m_domStorageAgent(nullptr)
</span><span class="cx">     , m_databaseAgent(nullptr)
</span><span class="cx"> {
</span><del>-    m_defaultInspectableObject = std::make_unique&lt;InspectableObject&gt;();
</del><ins>+    m_inspectedObject = std::make_unique&lt;InspectableObject&gt;();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> CommandLineAPIHost::~CommandLineAPIHost()
</span><span class="lines">@@ -118,28 +118,18 @@
</span><span class="cx"> Deprecated::ScriptValue CommandLineAPIHost::InspectableObject::get(JSC::ExecState*)
</span><span class="cx"> {
</span><span class="cx">     return Deprecated::ScriptValue();
</span><del>-};
</del><ins>+}
</ins><span class="cx"> 
</span><span class="cx"> void CommandLineAPIHost::addInspectedObject(std::unique_ptr&lt;CommandLineAPIHost::InspectableObject&gt; object)
</span><span class="cx"> {
</span><del>-    m_inspectedObjects.insert(0, WTF::move(object));
-    while (m_inspectedObjects.size() &gt; 5)
-        m_inspectedObjects.removeLast();
</del><ins>+    m_inspectedObject = WTF::move(object);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CommandLineAPIHost::clearInspectedObjects()
</del><ins>+CommandLineAPIHost::InspectableObject* CommandLineAPIHost::inspectedObject()
</ins><span class="cx"> {
</span><del>-    m_inspectedObjects.clear();
</del><ins>+    return m_inspectedObject.get();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-CommandLineAPIHost::InspectableObject* CommandLineAPIHost::inspectedObject(unsigned index)
-{
-    if (index &gt;= m_inspectedObjects.size())
-        return m_defaultInspectableObject.get();
-
-    return m_inspectedObjects[index].get();
-}
-
</del><span class="cx"> String CommandLineAPIHost::databaseIdImpl(Database* database)
</span><span class="cx"> {
</span><span class="cx">     if (m_databaseAgent)
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorCommandLineAPIHosth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/CommandLineAPIHost.h (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/CommandLineAPIHost.h        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/Source/WebCore/inspector/CommandLineAPIHost.h        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -89,8 +89,7 @@
</span><span class="cx">         virtual ~InspectableObject() { }
</span><span class="cx">     };
</span><span class="cx">     void addInspectedObject(std::unique_ptr&lt;InspectableObject&gt;);
</span><del>-    void clearInspectedObjects();
-    InspectableObject* inspectedObject(unsigned index);
</del><ins>+    InspectableObject* inspectedObject();
</ins><span class="cx">     void inspectImpl(RefPtr&lt;Inspector::InspectorValue&gt;&amp;&amp; objectToInspect, RefPtr&lt;Inspector::InspectorValue&gt;&amp;&amp; hints);
</span><span class="cx"> 
</span><span class="cx">     void getEventListenersImpl(Node*, Vector&lt;EventListenerInfo&gt;&amp; listenersArray);
</span><span class="lines">@@ -107,8 +106,7 @@
</span><span class="cx">     InspectorDOMStorageAgent* m_domStorageAgent;
</span><span class="cx">     InspectorDatabaseAgent* m_databaseAgent;
</span><span class="cx"> 
</span><del>-    Vector&lt;std::unique_ptr&lt;InspectableObject&gt;&gt; m_inspectedObjects;
-    std::unique_ptr&lt;InspectableObject&gt; m_defaultInspectableObject;
</del><ins>+    std::unique_ptr&lt;InspectableObject&gt; m_inspectedObject; // $0
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorCommandLineAPIHostidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/CommandLineAPIHost.idl (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/CommandLineAPIHost.idl        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/Source/WebCore/inspector/CommandLineAPIHost.idl        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -37,7 +37,7 @@
</span><span class="cx">     void clearConsoleMessages();
</span><span class="cx">     void copyText(DOMString text);
</span><span class="cx">     [Custom] void inspect(any objectId, any hints);
</span><del>-    [Custom] any inspectedObject(int num);
</del><ins>+    [Custom] any inspectedObject();
</ins><span class="cx">     [Custom] Array getEventListeners(Node node);
</span><span class="cx">     [Custom] DOMString databaseId(any database);
</span><span class="cx">     [Custom] DOMString storageId(any storage);
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorCommandLineAPIModuleSourcejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/CommandLineAPIModuleSource.js (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/CommandLineAPIModuleSource.js        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/Source/WebCore/inspector/CommandLineAPIModuleSource.js        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -115,12 +115,16 @@
</span><span class="cx">         this[member].toString = customToStringMethod(member);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    for (var i = 0; i &lt; 5; ++i) {
</del><ins>+    // $0
+    this.__defineGetter__(&quot;$0&quot;, bind(commandLineAPIImpl._inspectedObject, commandLineAPIImpl));
+
+    // $1-$99
+    for (var i = 1; i &lt;= injectedScript._savedResults.length; ++i) {
</ins><span class="cx">         var member = &quot;$&quot; + i;
</span><span class="cx">         if (member in inspectedWindow || inScopeVariables(member))
</span><span class="cx">             continue;
</span><span class="cx"> 
</span><del>-        this.__defineGetter__(&quot;$&quot; + i, bind(commandLineAPIImpl._inspectedObject, commandLineAPIImpl, i));
</del><ins>+        this.__defineGetter__(&quot;$&quot; + i, bind(injectedScript._savedResult, injectedScript, i));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     this.$_ = injectedScript._lastResult;
</span><span class="lines">@@ -305,12 +309,9 @@
</span><span class="cx">         return CommandLineAPIHost.getEventListeners(node);
</span><span class="cx">     },
</span><span class="cx"> 
</span><del>-    /**
-     * @param {number} num
-     */
-    _inspectedObject: function(num)
</del><ins>+    _inspectedObject: function()
</ins><span class="cx">     {
</span><del>-        return CommandLineAPIHost.inspectedObject(num);
</del><ins>+        return CommandLineAPIHost.inspectedObject();
</ins><span class="cx">     },
</span><span class="cx"> 
</span><span class="cx">     /**
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/Source/WebInspectorUI/ChangeLog        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -1,5 +1,50 @@
</span><span class="cx"> 2015-02-26  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Web Inspector: Save Console Evaluations into Command Line variables $1-$99 ($n)
+        https://bugs.webkit.org/show_bug.cgi?id=142061
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Controllers/RuntimeManager.js:
+        (WebInspector.RuntimeManager.prototype.evalCallback):
+        (WebInspector.RuntimeManager.prototype.evaluateInInspectedWindow):
+        Add a saveResult parameter for the new protocol command in parameter.
+
+        * UserInterface/Views/ConsoleMessageImpl.js:
+        (WebInspector.ConsoleMessageImpl.prototype._formatMessage):
+        (WebInspector.ConsoleMessageImpl.prototype._formatParameterAsObject):
+        (WebInspector.ConsoleMessageImpl.prototype._formatParameterAsArray):
+        (WebInspector.ConsoleMessageImpl.prototype._rootPropertyPathForObject):
+        * UserInterface/Views/ObjectTreeView.js:
+        (WebInspector.ObjectTreeView.prototype.appendTitleSuffix):
+        For console evaluation results, show a &quot;= $n&quot; when the evaluation was
+        given a saved result index.
+
+        * UserInterface/Views/LogContentView.css:
+        (.console-saved-variable):
+        * UserInterface/Views/ObjectPreviewView.css:
+        (.object-preview-name):
+        Make $n and class names in previews always non-italics.
+
+        * UserInterface/Controllers/JavaScriptLogViewController.js:
+        (WebInspector.JavaScriptLogViewController.prototype.printResult):
+        (WebInspector.JavaScriptLogViewController.prototype.consolePromptTextCommitted):
+        * UserInterface/Controllers/JavaScriptRuntimeCompletionProvider.js:
+        (get WebInspector.JavaScriptRuntimeCompletionProvider.prototype.):
+        * UserInterface/Controllers/LogManager.js:
+        (WebInspector.LogManager.prototype.messagesCleared):
+        (WebInspector.LogManager.prototype._mainResourceDidChange):
+        Try to provide better autocompletion for $n, by populating autocompletion menus
+        from $1-$n where n is the maximum saved result index seen. Clear the maximum
+        when we clear the console.
+
+        * UserInterface/Views/ConsoleCommandResult.js:
+        (WebInspector.ConsoleCommandResult):
+        (WebInspector.ConsoleCommandResult.clearMaximumSavedResultIndex):
+        Keep track of the maximum savedResultIndex for console evaluation results.
+
+2015-02-26  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
</ins><span class="cx">         Web Inspector: Set/Map appear as lossless when they have lossy entries
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=142050
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceControllersJavaScriptLogViewControllerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -222,17 +222,17 @@
</span><span class="cx">         var commandMessage = new WebInspector.ConsoleCommand(text);
</span><span class="cx">         this._appendConsoleMessage(commandMessage, true);
</span><span class="cx"> 
</span><del>-        function printResult(result, wasThrown)
</del><ins>+        function printResult(result, wasThrown, savedResultIndex)
</ins><span class="cx">         {
</span><span class="cx">             if (!result || this._cleared)
</span><span class="cx">                 return;
</span><span class="cx"> 
</span><del>-            this._appendConsoleMessage(new WebInspector.ConsoleCommandResult(result, wasThrown, commandMessage), true);
</del><ins>+            this._appendConsoleMessage(new WebInspector.ConsoleCommandResult(result, wasThrown, commandMessage, savedResultIndex), true);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         text += &quot;\n//# sourceURL=__WebInspectorConsole__\n&quot;;
</span><span class="cx"> 
</span><del>-        WebInspector.runtimeManager.evaluateInInspectedWindow(text, &quot;console&quot;, true, false, false, true, printResult.bind(this));
</del><ins>+        WebInspector.runtimeManager.evaluateInInspectedWindow(text, &quot;console&quot;, true, false, false, true, true, printResult.bind(this));
</ins><span class="cx">     },
</span><span class="cx"> 
</span><span class="cx">     // Private
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceControllersJavaScriptRuntimeCompletionProviderjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptRuntimeCompletionProvider.js (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptRuntimeCompletionProvider.js        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptRuntimeCompletionProvider.js        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -104,7 +104,7 @@
</span><span class="cx">         if (!base &amp;&amp; activeCallFrame &amp;&amp; !this._alwaysEvaluateInWindowContext)
</span><span class="cx">             activeCallFrame.collectScopeChainVariableNames(receivedPropertyNames.bind(this));
</span><span class="cx">         else
</span><del>-            WebInspector.runtimeManager.evaluateInInspectedWindow(base, &quot;completion&quot;, true, true, false, false, evaluated.bind(this));
</del><ins>+            WebInspector.runtimeManager.evaluateInInspectedWindow(base, &quot;completion&quot;, true, true, false, false, false, evaluated.bind(this));
</ins><span class="cx"> 
</span><span class="cx">         function updateLastPropertyNames(propertyNames)
</span><span class="cx">         {
</span><span class="lines">@@ -155,7 +155,7 @@
</span><span class="cx">             if (result.type === &quot;object&quot; || result.type === &quot;function&quot;)
</span><span class="cx">                 result.callFunctionJSON(getCompletions, undefined, receivedPropertyNames.bind(this));
</span><span class="cx">             else if (result.type === &quot;string&quot; || result.type === &quot;number&quot; || result.type === &quot;boolean&quot;)
</span><del>-                WebInspector.runtimeManager.evaluateInInspectedWindow(&quot;(&quot; + getCompletions + &quot;)(\&quot;&quot; + result.type + &quot;\&quot;)&quot;, &quot;completion&quot;, false, true, true, false, receivedPropertyNamesFromEvaluate.bind(this));
</del><ins>+                WebInspector.runtimeManager.evaluateInInspectedWindow(&quot;(&quot; + getCompletions + &quot;)(\&quot;&quot; + result.type + &quot;\&quot;)&quot;, &quot;completion&quot;, false, true, true, false, false, receivedPropertyNamesFromEvaluate.bind(this));
</ins><span class="cx">             else
</span><span class="cx">                 console.error(&quot;Unknown result type: &quot; + result.type);
</span><span class="cx">         }
</span><span class="lines">@@ -174,11 +174,15 @@
</span><span class="cx">             RuntimeAgent.releaseObjectGroup(&quot;completion&quot;);
</span><span class="cx"> 
</span><span class="cx">             if (!base) {
</span><del>-                var commandLineAPI = [&quot;$&quot;, &quot;$$&quot;, &quot;$x&quot;, &quot;dir&quot;, &quot;dirxml&quot;, &quot;keys&quot;, &quot;values&quot;, &quot;profile&quot;, &quot;profileEnd&quot;, &quot;monitorEvents&quot;, &quot;unmonitorEvents&quot;, &quot;inspect&quot;, &quot;copy&quot;, &quot;clear&quot;, &quot;getEventListeners&quot;, &quot;$0&quot;, &quot;$1&quot;, &quot;$2&quot;, &quot;$3&quot;, &quot;$4&quot;, &quot;$_&quot;];
</del><ins>+                var commandLineAPI = [&quot;$&quot;, &quot;$$&quot;, &quot;$x&quot;, &quot;dir&quot;, &quot;dirxml&quot;, &quot;keys&quot;, &quot;values&quot;, &quot;profile&quot;, &quot;profileEnd&quot;, &quot;monitorEvents&quot;, &quot;unmonitorEvents&quot;, &quot;inspect&quot;, &quot;copy&quot;, &quot;clear&quot;, &quot;getEventListeners&quot;, &quot;$0&quot;, &quot;$_&quot;];
</ins><span class="cx">                 if (WebInspector.debuggerManager.paused &amp;&amp; WebInspector.debuggerManager.pauseReason === WebInspector.DebuggerManager.PauseReason.Exception)
</span><span class="cx">                     commandLineAPI.push(&quot;$exception&quot;);
</span><span class="cx">                 for (var i = 0; i &lt; commandLineAPI.length; ++i)
</span><span class="cx">                     propertyNames[commandLineAPI[i]] = true;
</span><ins>+
+                // FIXME: Due to caching, sometimes old $n values show up as completion results even though they are not available. We should clear that proactively.
+                for (var i = 1; i &lt;= WebInspector.ConsoleCommandResult.maximumSavedResultIndex; ++i)
+                    propertyNames[&quot;$&quot; + i] = true;
</ins><span class="cx">             }
</span><span class="cx"> 
</span><span class="cx">             propertyNames = Object.keys(propertyNames);
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceControllersLogManagerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/LogManager.js (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Controllers/LogManager.js        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/LogManager.js        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -59,6 +59,8 @@
</span><span class="cx">     {
</span><span class="cx">         // Called from WebInspector.ConsoleObserver.
</span><span class="cx"> 
</span><ins>+        WebInspector.ConsoleCommandResult.clearMaximumSavedResultIndex();
+
</ins><span class="cx">         // We don't want to clear messages on reloads. We can't determine that easily right now.
</span><span class="cx">         // FIXME: &lt;rdar://problem/13767079&gt; Console.messagesCleared should include a reason
</span><span class="cx">         this._shouldClearMessages = true;
</span><span class="lines">@@ -97,6 +99,8 @@
</span><span class="cx">         else
</span><span class="cx">             this.dispatchEventToListeners(WebInspector.LogManager.Event.SessionStarted);
</span><span class="cx"> 
</span><ins>+        WebInspector.ConsoleCommandResult.clearMaximumSavedResultIndex();
+
</ins><span class="cx">         delete this._shouldClearMessages;
</span><span class="cx">     }
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceControllersRuntimeManagerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/RuntimeManager.js (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Controllers/RuntimeManager.js        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/RuntimeManager.js        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -41,14 +41,14 @@
</span><span class="cx"> 
</span><span class="cx">     // Public
</span><span class="cx"> 
</span><del>-    evaluateInInspectedWindow: function(expression, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, generatePreview, callback)
</del><ins>+    evaluateInInspectedWindow: function(expression, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, generatePreview, saveResult, callback)
</ins><span class="cx">     {
</span><span class="cx">         if (!expression) {
</span><span class="cx">             // There is no expression, so the completion should happen against global properties.
</span><span class="cx">             expression = &quot;this&quot;;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        function evalCallback(error, result, wasThrown)
</del><ins>+        function evalCallback(error, result, wasThrown, savedResultIndex)
</ins><span class="cx">         {
</span><span class="cx">             this.dispatchEventToListeners(WebInspector.RuntimeManager.Event.DidEvaluate);
</span><span class="cx"> 
</span><span class="lines">@@ -59,22 +59,24 @@
</span><span class="cx">             }
</span><span class="cx"> 
</span><span class="cx">             if (returnByValue)
</span><del>-                callback(null, wasThrown, wasThrown ? null : result);
</del><ins>+                callback(null, wasThrown, wasThrown ? null : result, savedResultIndex);
</ins><span class="cx">             else
</span><del>-                callback(WebInspector.RemoteObject.fromPayload(result), wasThrown);
</del><ins>+                callback(WebInspector.RemoteObject.fromPayload(result), wasThrown, savedResultIndex);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if (WebInspector.debuggerManager.activeCallFrame) {
</span><span class="cx">             // COMPATIBILITY (iOS 6): &quot;generatePreview&quot; did not exist.
</span><del>-            DebuggerAgent.evaluateOnCallFrame.invoke({callFrameId: WebInspector.debuggerManager.activeCallFrame.id, expression: expression, objectGroup: objectGroup, includeCommandLineAPI: includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole: doNotPauseOnExceptionsAndMuteConsole, returnByValue: returnByValue, generatePreview: generatePreview}, evalCallback.bind(this));
</del><ins>+            // COMPATIBILITY (iOS 8): &quot;saveResult&quot; did not exist.
+            DebuggerAgent.evaluateOnCallFrame.invoke({callFrameId: WebInspector.debuggerManager.activeCallFrame.id, expression: expression, objectGroup: objectGroup, includeCommandLineAPI: includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole: doNotPauseOnExceptionsAndMuteConsole, returnByValue: returnByValue, generatePreview: generatePreview, saveResult: saveResult}, evalCallback.bind(this));
</ins><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // COMPATIBILITY (iOS 6): Execution context identifiers (contextId) did not exist
</span><span class="cx">         // in iOS 6. Fallback to including the frame identifier (frameId).
</span><span class="cx">         // COMPATIBILITY (iOS 6): &quot;generatePreview&quot; did not exist.
</span><ins>+        // COMPATIBILITY (iOS 8): &quot;saveResult&quot; did not exist.
</ins><span class="cx">         var contextId = WebInspector.quickConsole.executionContextIdentifier;
</span><del>-        RuntimeAgent.evaluate.invoke({expression: expression, objectGroup: objectGroup, includeCommandLineAPI: includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole: doNotPauseOnExceptionsAndMuteConsole, contextId: contextId, frameId: contextId, returnByValue: returnByValue, generatePreview: generatePreview}, evalCallback.bind(this));
</del><ins>+        RuntimeAgent.evaluate.invoke({expression: expression, objectGroup: objectGroup, includeCommandLineAPI: includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole: doNotPauseOnExceptionsAndMuteConsole, contextId: contextId, frameId: contextId, returnByValue: returnByValue, generatePreview: generatePreview, saveResult: saveResult}, evalCallback.bind(this));
</ins><span class="cx">     },
</span><span class="cx"> 
</span><span class="cx">     getPropertiesForRemoteObject: function(objectId, callback)
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceTesthtml"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Test.html (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Test.html        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/Source/WebInspectorUI/UserInterface/Test.html        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -27,7 +27,7 @@
</span><span class="cx"> &lt;head&gt;
</span><span class="cx">     &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot;&gt;
</span><span class="cx">     &lt;!--
</span><del>-    These resouces should match the order and groups used in Main.html.
</del><ins>+    These resources should match the order and groups used in Main.html.
</ins><span class="cx">     --&gt;
</span><span class="cx">     &lt;script src=&quot;Base/WebInspector.js&quot;&gt;&lt;/script&gt;
</span><span class="cx">     &lt;script src=&quot;Base/Object.js&quot;&gt;&lt;/script&gt;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsConsoleCommandResultjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleCommandResult.js (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleCommandResult.js        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleCommandResult.js        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -27,14 +27,25 @@
</span><span class="cx">  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-WebInspector.ConsoleCommandResult = function(result, wasThrown, originatingCommand)
</del><ins>+WebInspector.ConsoleCommandResult = function(result, wasThrown, originatingCommand, savedResultIndex)
</ins><span class="cx"> {
</span><span class="cx">     var level = (wasThrown ? WebInspector.ConsoleMessage.MessageLevel.Error : WebInspector.ConsoleMessage.MessageLevel.Log);
</span><span class="cx">     this.originatingCommand = originatingCommand;
</span><ins>+    this.savedResultIndex = savedResultIndex;
</ins><span class="cx"> 
</span><ins>+    if (this.savedResultIndex &amp;&amp; this.savedResultIndex &gt; WebInspector.ConsoleCommandResult.maximumSavedResultIndex)
+        WebInspector.ConsoleCommandResult.maximumSavedResultIndex = this.savedResultIndex;
+
</ins><span class="cx">     WebInspector.ConsoleMessageImpl.call(this, WebInspector.ConsoleMessage.MessageSource.JS, level, &quot;&quot;, null, WebInspector.ConsoleMessage.MessageType.Result, undefined, undefined, undefined, undefined, [result]);
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+WebInspector.ConsoleCommandResult.maximumSavedResultIndex = 0;
+
+WebInspector.ConsoleCommandResult.clearMaximumSavedResultIndex = function()
+{
+    WebInspector.ConsoleCommandResult.maximumSavedResultIndex = 0;
+}
+
</ins><span class="cx"> WebInspector.ConsoleCommandResult.prototype = {
</span><span class="cx">     constructor: WebInspector.ConsoleCommandResult,
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsConsoleMessageImpljs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageImpl.js (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageImpl.js        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageImpl.js        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -125,6 +125,16 @@
</span><span class="cx"> 
</span><span class="cx">         this._formattedMessage.appendChild(messageText);
</span><span class="cx"> 
</span><ins>+        if (this.savedResultIndex) {
+            var savedVariableElement = document.createElement(&quot;span&quot;);
+            savedVariableElement.className = &quot;console-saved-variable&quot;;
+            savedVariableElement.textContent = &quot; = $&quot; + this.savedResultIndex;
+            if (this._objectTree)
+                this._objectTree.appendTitleSuffix(savedVariableElement);
+            else
+                this._formattedMessage.appendChild(savedVariableElement);
+        }
+
</ins><span class="cx">         if (this._shouldDumpStackTrace()) {
</span><span class="cx">             var ol = document.createElement(&quot;ol&quot;);
</span><span class="cx">             ol.className = &quot;outline-disclosure&quot;;
</span><span class="lines">@@ -296,9 +306,8 @@
</span><span class="cx"> 
</span><span class="cx">     _formatParameterAsObject: function(obj, elem, forceExpansion)
</span><span class="cx">     {
</span><del>-        // FIXME: Intialize component with &quot;$n&quot; instead of &quot;obj&quot;. Or, an existing property path.
-        var objectTree = new WebInspector.ObjectTreeView(obj, WebInspector.ObjectTreeView.Mode.Properties, null, forceExpansion);
-        elem.appendChild(objectTree.element);
</del><ins>+        this._objectTree = new WebInspector.ObjectTreeView(obj, WebInspector.ObjectTreeView.Mode.Properties, this._rootPropertyPathForObject(obj), forceExpansion);
+        elem.appendChild(this._objectTree.element);
</ins><span class="cx">     },
</span><span class="cx"> 
</span><span class="cx">     _formatParameterAsString: function(output, elem)
</span><span class="lines">@@ -315,11 +324,18 @@
</span><span class="cx"> 
</span><span class="cx">     _formatParameterAsArray: function(arr, elem)
</span><span class="cx">     {
</span><del>-        // FIXME: Intialize component with &quot;$n&quot; instead of &quot;obj&quot;. Or, an existing property path.
-        var objectTree = new WebInspector.ObjectTreeView(arr, WebInspector.ObjectTreeView.Mode.Properties);
-        elem.appendChild(objectTree.element);
</del><ins>+        this._objectTree = new WebInspector.ObjectTreeView(arr, WebInspector.ObjectTreeView.Mode.Properties, this._rootPropertyPathForObject(arr));
+        elem.appendChild(this._objectTree.element);
</ins><span class="cx">     },
</span><span class="cx"> 
</span><ins>+    _rootPropertyPathForObject: function(object)
+    {
+        if (!this.savedResultIndex)
+            return null;
+
+        return new WebInspector.PropertyPath(object, &quot;$&quot; + this.savedResultIndex);
+    },
+
</ins><span class="cx">     _userProvidedColumnNames: function(columnNamesArgument)
</span><span class="cx">     {
</span><span class="cx">         if (!columnNamesArgument)
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsLogContentViewcss"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.css (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.css        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.css        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -223,6 +223,11 @@
</span><span class="cx">     color: rgb(0, 128, 255);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+.console-saved-variable {
+    font-style: normal;
+    color: hsl(0, 0%, 67%);
+}
+
</ins><span class="cx"> .console-messages a {
</span><span class="cx">     color: rgb(33%, 33%, 33%);
</span><span class="cx">     cursor: pointer;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsObjectPreviewViewcss"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.css (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.css        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.css        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx">     font-size: 11px;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+.object-preview-name,
</ins><span class="cx"> .object-preview.lossless {
</span><span class="cx">     font-style: normal;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsObjectTreeViewjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js (180714 => 180715)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js        2015-02-27 01:15:17 UTC (rev 180714)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js        2015-02-27 01:15:23 UTC (rev 180715)
</span><span class="lines">@@ -32,7 +32,7 @@
</span><span class="cx"> 
</span><span class="cx">     this._object = object;
</span><span class="cx">     this._mode = mode || WebInspector.ObjectTreeView.Mode.Properties;
</span><del>-    this._propertyPath = propertyPath || new WebInspector.PropertyPath(this._object, &quot;obj&quot;);
</del><ins>+    this._propertyPath = propertyPath || new WebInspector.PropertyPath(this._object, &quot;this&quot;);
</ins><span class="cx">     this._expanded = false;
</span><span class="cx">     this._hasLosslessPreview = false;
</span><span class="cx"> 
</span><span class="lines">@@ -186,6 +186,14 @@
</span><span class="cx">         this._untrackWeakEntries();
</span><span class="cx">     },
</span><span class="cx"> 
</span><ins>+    appendTitleSuffix: function(suffixElement)
+    {
+        if (this._previewView)
+            this._previewView.element.appendChild(suffixElement);
+        else
+            this._titleElement.appendChild(suffixElement);
+    },
+
</ins><span class="cx">     // Protected
</span><span class="cx"> 
</span><span class="cx">     update: function()
</span></span></pre>
</div>
</div>

</body>
</html>