<!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>[180236] 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/180236">180236</a></dd>
<dt>Author</dt> <dd>joepeck@webkit.org</dd>
<dt>Date</dt> <dd>2015-02-17 12:17:28 -0800 (Tue, 17 Feb 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: Improved Console Support for Bound Functions
https://bugs.webkit.org/show_bug.cgi?id=141635

Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

* inspector/JSInjectedScriptHost.cpp:
(Inspector::JSInjectedScriptHost::getInternalProperties):
Expose internal properties of a JSBoundFunction.

LayoutTests:

* inspector/model/remote-object-get-properties-expected.txt:
* inspector/model/remote-object-get-properties.html:
Show that boundFunction has extra properties (targetFunction, boundThis, boundArgs).

* inspector/model/remote-object-expected.txt:
* inspector/model/remote-object.html:
Include a bound function. Much different from a function now though.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsinspectormodelremoteobjectexpectedtxt">trunk/LayoutTests/inspector/model/remote-object-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectormodelremoteobjectgetpropertiesexpectedtxt">trunk/LayoutTests/inspector/model/remote-object-get-properties-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectormodelremoteobjectgetpropertieshtml">trunk/LayoutTests/inspector/model/remote-object-get-properties.html</a></li>
<li><a href="#trunkLayoutTestsinspectormodelremoteobjecthtml">trunk/LayoutTests/inspector/model/remote-object.html</a></li>
<li><a href="#trunkLayoutTestsinspectorprotocolruntimegetPropertiesexpectedtxt">trunk/LayoutTests/inspector-protocol/runtime/getProperties-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorprotocolruntimegetPropertieshtml">trunk/LayoutTests/inspector-protocol/runtime/getProperties.html</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorJSInjectedScriptHostcpp">trunk/Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (180235 => 180236)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-02-17 20:17:16 UTC (rev 180235)
+++ trunk/LayoutTests/ChangeLog        2015-02-17 20:17:28 UTC (rev 180236)
</span><span class="lines">@@ -1,5 +1,20 @@
</span><span class="cx"> 2015-02-16  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Web Inspector: Improved Console Support for Bound Functions
+        https://bugs.webkit.org/show_bug.cgi?id=141635
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/model/remote-object-get-properties-expected.txt:
+        * inspector/model/remote-object-get-properties.html:
+        Show that boundFunction has extra properties (targetFunction, boundThis, boundArgs).
+
+        * inspector/model/remote-object-expected.txt:
+        * inspector/model/remote-object.html:
+        Include a bound function. Much different from a function now though.
+
+2015-02-16  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
</ins><span class="cx">         Web Inspector: ES6: Improved Console Support for Promise Objects
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=141634
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsinspectormodelremoteobjectexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/model/remote-object-expected.txt (180235 => 180236)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/model/remote-object-expected.txt        2015-02-17 20:17:16 UTC (rev 180235)
+++ trunk/LayoutTests/inspector/model/remote-object-expected.txt        2015-02-17 20:17:28 UTC (rev 180236)
</span><span class="lines">@@ -208,6 +208,14 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> -----------------------------------------------------
</span><ins>+EXPRESSION: function myTarget(a, b) { console.log(a, b); }; myTarget.bind(null)
+{
+  &quot;_type&quot;: &quot;function&quot;,
+  &quot;_objectId&quot;: &quot;&lt;filtered&gt;&quot;,
+  &quot;_description&quot;: &quot;function myTarget() {\n    [native code]\n}&quot;
+}
+
+-----------------------------------------------------
</ins><span class="cx"> EXPRESSION: Array.prototype.push
</span><span class="cx"> {
</span><span class="cx">   &quot;_type&quot;: &quot;function&quot;,
</span></span></pre></div>
<a id="trunkLayoutTestsinspectormodelremoteobjectgetpropertiesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/model/remote-object-get-properties-expected.txt (180235 => 180236)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/model/remote-object-get-properties-expected.txt        2015-02-17 20:17:16 UTC (rev 180235)
+++ trunk/LayoutTests/inspector/model/remote-object-get-properties-expected.txt        2015-02-17 20:17:28 UTC (rev 180236)
</span><span class="lines">@@ -178,5 +178,107 @@
</span><span class="cx">     __lookupSetter__
</span><span class="cx">     __proto__
</span><span class="cx"> -----------------------------------------------------
</span><ins>+
+-----------------------------------------------------
+EXPRESSION: window.unboundFunction
+type: function
+description: function () { console.log(arguments); }
+
+OWN PROPERTIES:
+    arguments
+    caller
+    length
+    name
+    prototype
+    __proto__
+
+OWN AND GETTER PROPERTIES:
+    arguments
+    caller
+    length
+    name
+    prototype
+    __proto__
+
+ALL PROPERTIES:
+    arguments
+    caller
+    length
+    name
+    prototype
+    toString
+    apply
+    call
+    bind
+    constructor
+    toLocaleString
+    valueOf
+    hasOwnProperty
+    propertyIsEnumerable
+    isPrototypeOf
+    __defineGetter__
+    __defineSetter__
+    __lookupGetter__
+    __lookupSetter__
+    __proto__
+-----------------------------------------------------
+
+-----------------------------------------------------
+EXPRESSION: window.boundFunction
+type: function
+description: function () {
+    [native code]
+}
+
+OWN PROPERTIES:
+    name
+    length
+    get arguments
+    set arguments
+    get caller
+    set caller
+    __proto__
+    targetFunction
+    boundThis
+    boundArgs
+
+OWN AND GETTER PROPERTIES:
+    name
+    length
+    get arguments
+    set arguments
+    get caller
+    set caller
+    __proto__
+    targetFunction
+    boundThis
+    boundArgs
+
+ALL PROPERTIES:
+    name
+    length
+    get arguments
+    set arguments
+    get caller
+    set caller
+    toString
+    apply
+    call
+    bind
+    constructor
+    toLocaleString
+    valueOf
+    hasOwnProperty
+    propertyIsEnumerable
+    isPrototypeOf
+    __defineGetter__
+    __defineSetter__
+    __lookupGetter__
+    __lookupSetter__
+    __proto__
+    targetFunction
+    boundThis
+    boundArgs
+-----------------------------------------------------
</ins><span class="cx"> DONE
</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 (180235 => 180236)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/model/remote-object-get-properties.html        2015-02-17 20:17:16 UTC (rev 180235)
+++ trunk/LayoutTests/inspector/model/remote-object-get-properties.html        2015-02-17 20:17:28 UTC (rev 180236)
</span><span class="lines">@@ -41,6 +41,8 @@
</span><span class="cx"> var simpleObject = {a:1, b:&quot;string&quot;};
</span><span class="cx"> var complexObject = new SuperFoo;
</span><span class="cx"> var badGetterObject = new ClassWithBadGetter;
</span><ins>+var unboundFunction = function() { console.log(arguments); }
+var boundFunction = unboundFunction.bind(document.body, 1, 2, 3);
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> // --------
</span><span class="lines">@@ -55,6 +57,8 @@
</span><span class="cx">         {expression: &quot;window.loadEvent&quot;},
</span><span class="cx">         {expression: &quot;window.complexObject&quot;},
</span><span class="cx">         {expression: &quot;window.badGetterObject&quot;},
</span><ins>+        {expression: &quot;window.unboundFunction&quot;},
+        {expression: &quot;window.boundFunction&quot;},
</ins><span class="cx">     ]
</span><span class="cx"> 
</span><span class="cx">     function runNextStep() {
</span></span></pre></div>
<a id="trunkLayoutTestsinspectormodelremoteobjecthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/model/remote-object.html (180235 => 180236)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/model/remote-object.html        2015-02-17 20:17:16 UTC (rev 180235)
+++ trunk/LayoutTests/inspector/model/remote-object.html        2015-02-17 20:17:28 UTC (rev 180236)
</span><span class="lines">@@ -49,6 +49,7 @@
</span><span class="cx">         {expression: &quot;(function(){})&quot;},
</span><span class="cx">         {expression: &quot;function foo(){}; foo&quot;},
</span><span class="cx">         {expression: &quot;function myFunction(a, b) { console.log(a, b); }; myFunction&quot;},
</span><ins>+        {expression: &quot;function myTarget(a, b) { console.log(a, b); }; myTarget.bind(null)&quot;}, // bound function
</ins><span class="cx">         {expression: &quot;Array.prototype.push&quot;}, // native (ECMAScript)
</span><span class="cx">         {expression: &quot;window.setTimeout&quot;}, // native (DOM)
</span><span class="cx">         {expression: &quot;Object.getOwnPropertyDescriptor({ get getter() { return 1 } }, 'getter').get&quot;}, // getter
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorprotocolruntimegetPropertiesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector-protocol/runtime/getProperties-expected.txt (180235 => 180236)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-protocol/runtime/getProperties-expected.txt        2015-02-17 20:17:16 UTC (rev 180235)
+++ trunk/LayoutTests/inspector-protocol/runtime/getProperties-expected.txt        2015-02-17 20:17:28 UTC (rev 180236)
</span><span class="lines">@@ -1,16 +1,24 @@
</span><span class="cx"> Properties of Object(5)
</span><del>-  __proto__ object undefined
</del><ins>+  __proto__ object Number
</ins><span class="cx">   foo string cat
</span><span class="cx"> Properties of array
</span><del>-  __proto__ object undefined
</del><ins>+  __proto__ object Array[0]
</ins><span class="cx">   0 string red
</span><span class="cx">   1 string green
</span><span class="cx">   2 string blue
</span><span class="cx">   length number 3
</span><span class="cx"> Properties of Bound function
</span><del>-  __proto__ function undefined
</del><ins>+  __proto__ function function () {
+    [native code]
+}
</ins><span class="cx">   arguments
</span><span class="cx">   caller
</span><span class="cx">   length number 0
</span><span class="cx">   name string Number
</span><ins>+Internal properties
+  boundArgs object Array[1]
+  boundThis object Object
+  targetFunction function function Number() {
+    [native code]
+}
</ins><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorprotocolruntimegetPropertieshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector-protocol/runtime/getProperties.html (180235 => 180236)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-protocol/runtime/getProperties.html        2015-02-17 20:17:16 UTC (rev 180235)
+++ trunk/LayoutTests/inspector-protocol/runtime/getProperties.html        2015-02-17 20:17:28 UTC (rev 180236)
</span><span class="lines">@@ -127,7 +127,7 @@
</span><span class="cx">             var p = propertyArray[i];
</span><span class="cx">             var v = p.value;
</span><span class="cx">             if (v)
</span><del>-                InspectorTest.log(&quot;  &quot; + p.name + &quot; &quot; + v.type + &quot; &quot; + v.value);
</del><ins>+                InspectorTest.log(&quot;  &quot; + p.name + &quot; &quot; + v.type + &quot; &quot; + (v.value || v.description));
</ins><span class="cx">             else
</span><span class="cx">                 InspectorTest.log(&quot;  &quot; + p.name);
</span><span class="cx">         }
</span><span class="lines">@@ -138,7 +138,7 @@
</span><span class="cx">             for (var i = 0; i &lt; internalPropertyArray.length; i++) {
</span><span class="cx">                 var p = internalPropertyArray[i];
</span><span class="cx">                 var v = p.value;
</span><del>-                InspectorTest.log(&quot;  &quot; + p.name + &quot; &quot; + v.type + &quot; &quot; + v.value);
</del><ins>+                InspectorTest.log(&quot;  &quot; + p.name + &quot; &quot; + v.type + &quot; &quot; + (v.value || v.description));
</ins><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (180235 => 180236)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-02-17 20:17:16 UTC (rev 180235)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-02-17 20:17:28 UTC (rev 180236)
</span><span class="lines">@@ -1,5 +1,16 @@
</span><span class="cx"> 2015-02-16  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Web Inspector: Improved Console Support for Bound Functions
+        https://bugs.webkit.org/show_bug.cgi?id=141635
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/JSInjectedScriptHost.cpp:
+        (Inspector::JSInjectedScriptHost::getInternalProperties):
+        Expose internal properties of a JSBoundFunction.
+
+2015-02-16  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
</ins><span class="cx">         Web Inspector: ES6: Improved Console Support for Promise Objects
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=141634
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorJSInjectedScriptHostcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp (180235 => 180236)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp        2015-02-17 20:17:16 UTC (rev 180235)
+++ trunk/Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp        2015-02-17 20:17:28 UTC (rev 180236)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #include &quot;Error.h&quot;
</span><span class="cx"> #include &quot;InjectedScriptHost.h&quot;
</span><span class="cx"> #include &quot;JSArray.h&quot;
</span><ins>+#include &quot;JSBoundFunction.h&quot;
</ins><span class="cx"> #include &quot;JSCInlines.h&quot;
</span><span class="cx"> #include &quot;JSFunction.h&quot;
</span><span class="cx"> #include &quot;JSInjectedScriptHostPrototype.h&quot;
</span><span class="lines">@@ -208,8 +209,7 @@
</span><span class="cx"> 
</span><span class="cx">     JSValue value = exec-&gt;uncheckedArgument(0);
</span><span class="cx"> 
</span><del>-    JSPromise* promise = jsDynamicCast&lt;JSPromise*&gt;(value);
-    if (promise) {
</del><ins>+    if (JSPromise* promise = jsDynamicCast&lt;JSPromise*&gt;(value)) {
</ins><span class="cx">         unsigned index = 0;
</span><span class="cx">         JSArray* array = constructEmptyArray(exec, nullptr);
</span><span class="cx">         switch (promise-&gt;status()) {
</span><span class="lines">@@ -229,6 +229,15 @@
</span><span class="cx">         return array;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    if (JSBoundFunction* boundFunction = jsDynamicCast&lt;JSBoundFunction*&gt;(value)) {
+        unsigned index = 0;
+        JSArray* array = constructEmptyArray(exec, nullptr, 3);
+        array-&gt;putDirectIndex(exec, index++, constructInternalProperty(exec, &quot;targetFunction&quot;, boundFunction-&gt;targetFunction()));
+        array-&gt;putDirectIndex(exec, index++, constructInternalProperty(exec, &quot;boundThis&quot;, boundFunction-&gt;boundThis()));
+        array-&gt;putDirectIndex(exec, index++, constructInternalProperty(exec, &quot;boundArgs&quot;, boundFunction-&gt;boundArgs()));
+        return array;
+    }
+
</ins><span class="cx">     return jsUndefined();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>