<!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>[178768] 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/178768">178768</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-01-20 16:34:57 -0800 (Tue, 20 Jan 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Web Inspector: Expanding event objects in console shows undefined for most values, it should have real values
https://bugs.webkit.org/show_bug.cgi?id=137306
Patch by Joseph Pecoraro <pecoraro@apple.com> on 2015-01-20
Reviewed by Timothy Hatcher.
Source/JavaScriptCore:
Provide another optional parameter to getProperties, to gather a list
of all own and getter properties.
* inspector/InjectedScript.cpp:
(Inspector::InjectedScript::getProperties):
* inspector/InjectedScript.h:
* inspector/InjectedScriptSource.js:
* inspector/agents/InspectorRuntimeAgent.cpp:
(Inspector::InspectorRuntimeAgent::getProperties):
* inspector/agents/InspectorRuntimeAgent.h:
* inspector/protocol/Runtime.json:
Source/WebInspectorUI:
When first expanding an object, show all the object's own properties and any
getter properties that may be on its prototype chain. Now, we only fetch
own properties, for __proto__ properties.
* UserInterface/Protocol/RemoteObject.js:
(WebInspector.RemoteObject.prototype.getOwnProperties):
(WebInspector.RemoteObject.prototype.getOwnAndGetterProperties):
(WebInspector.RemoteObject.prototype.getAllProperties):
(WebInspector.RemoteObject.prototype.get hasChildren): Deleted.
* UserInterface/Views/ObjectPropertiesSection.js:
(WebInspector.ObjectPropertiesSection):
(WebInspector.ObjectPropertiesSection.prototype.update):
(WebInspector.ObjectPropertyTreeElement.prototype.onpopulate):
LayoutTests:
* inspector/model/remote-object-get-properties-expected.txt: Added.
* inspector/model/remote-object-get-properties.html: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</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="#trunkSourceJavaScriptCoreinspectorInjectedScriptSourcejs">trunk/Source/JavaScriptCore/inspector/InjectedScriptSource.js</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="#trunkSourceJavaScriptCoreinspectorprotocolRuntimejson">trunk/Source/JavaScriptCore/inspector/protocol/Runtime.json</a></li>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceProtocolRemoteObjectjs">trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsObjectPropertiesSectionjs">trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPropertiesSection.js</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<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>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (178767 => 178768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-01-21 00:30:36 UTC (rev 178767)
+++ trunk/LayoutTests/ChangeLog        2015-01-21 00:34:57 UTC (rev 178768)
</span><span class="lines">@@ -1,5 +1,15 @@
</span><span class="cx"> 2015-01-20 Joseph Pecoraro <pecoraro@apple.com>
</span><span class="cx">
</span><ins>+ Web Inspector: Expanding event objects in console shows undefined for most values, it should have real values
+ https://bugs.webkit.org/show_bug.cgi?id=137306
+
+ Reviewed by Timothy Hatcher.
+
+ * inspector/model/remote-object-get-properties-expected.txt: Added.
+ * inspector/model/remote-object-get-properties.html: Added.
+
+2015-01-20 Joseph Pecoraro <pecoraro@apple.com>
+
</ins><span class="cx"> Web Inspector: Should show dynamic specificity values
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=140647
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsinspectormodelremoteobjectgetpropertiesexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/model/remote-object-get-properties-expected.txt (0 => 178768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/model/remote-object-get-properties-expected.txt         (rev 0)
+++ trunk/LayoutTests/inspector/model/remote-object-get-properties-expected.txt        2015-01-21 00:34:57 UTC (rev 178768)
</span><span class="lines">@@ -0,0 +1,186 @@
</span><ins>+
+-----------------------------------------------------
+EXPRESSION: window.simpleObject
+objectId: {"injectedScriptId":1,"id":1}
+type: object
+description: Object
+
+OWN PROPERTIES:
+ a
+ b
+ __proto__
+
+OWN AND GETTER PROPERTIES:
+ a
+ b
+ __proto__
+
+ALL PROPERTIES:
+ a
+ b
+ toString
+ toLocaleString
+ valueOf
+ hasOwnProperty
+ propertyIsEnumerable
+ isPrototypeOf
+ __defineGetter__
+ __defineSetter__
+ __lookupGetter__
+ __lookupSetter__
+ constructor
+ __proto__
+-----------------------------------------------------
+
+-----------------------------------------------------
+EXPRESSION: window.loadEvent
+objectId: {"injectedScriptId":1,"id":16}
+type: object
+description: Event
+
+OWN PROPERTIES:
+ clipboardData
+ __proto__
+
+OWN AND GETTER PROPERTIES:
+ clipboardData
+ type
+ target
+ currentTarget
+ eventPhase
+ bubbles
+ cancelable
+ timeStamp
+ defaultPrevented
+ srcElement
+ returnValue
+ cancelBubble
+ __proto__
+
+ALL PROPERTIES:
+ clipboardData
+ constructor
+ type
+ target
+ currentTarget
+ eventPhase
+ bubbles
+ cancelable
+ timeStamp
+ defaultPrevented
+ srcElement
+ returnValue
+ cancelBubble
+ NONE
+ CAPTURING_PHASE
+ AT_TARGET
+ BUBBLING_PHASE
+ MOUSEDOWN
+ MOUSEUP
+ MOUSEOVER
+ MOUSEOUT
+ MOUSEMOVE
+ MOUSEDRAG
+ CLICK
+ DBLCLICK
+ KEYDOWN
+ KEYUP
+ KEYPRESS
+ DRAGDROP
+ FOCUS
+ BLUR
+ SELECT
+ CHANGE
+ stopPropagation
+ preventDefault
+ initEvent
+ stopImmediatePropagation
+ toString
+ toLocaleString
+ valueOf
+ hasOwnProperty
+ propertyIsEnumerable
+ isPrototypeOf
+ __defineGetter__
+ __defineSetter__
+ __lookupGetter__
+ __lookupSetter__
+ __proto__
+-----------------------------------------------------
+
+-----------------------------------------------------
+EXPRESSION: window.complexObject
+objectId: {"injectedScriptId":1,"id":41}
+type: object
+description: SuperFoo
+
+OWN PROPERTIES:
+ _bar
+ _foo
+ __proto__
+
+OWN AND GETTER PROPERTIES:
+ _bar
+ _foo
+ getterProperty
+ foo
+ bar
+ __proto__
+
+ALL PROPERTIES:
+ _bar
+ _foo
+ constructor
+ get getterProperty
+ set getterProperty
+ get foo
+ set foo
+ BAR_CONSTANT
+ get bar
+ set bar
+ get setterOnly
+ set setterOnly
+ toString
+ toLocaleString
+ valueOf
+ hasOwnProperty
+ propertyIsEnumerable
+ isPrototypeOf
+ __defineGetter__
+ __defineSetter__
+ __lookupGetter__
+ __lookupSetter__
+ __proto__
+-----------------------------------------------------
+
+-----------------------------------------------------
+EXPRESSION: window.badGetterObject
+objectId: {"injectedScriptId":1,"id":60}
+type: object
+description: ClassWithBadGetter
+
+OWN PROPERTIES:
+ __proto__
+
+OWN AND GETTER PROPERTIES:
+ badGetter
+ __proto__
+
+ALL PROPERTIES:
+ constructor
+ get badGetter
+ set badGetter
+ toString
+ toLocaleString
+ valueOf
+ hasOwnProperty
+ propertyIsEnumerable
+ isPrototypeOf
+ __defineGetter__
+ __defineSetter__
+ __lookupGetter__
+ __lookupSetter__
+ __proto__
+-----------------------------------------------------
+DONE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectormodelremoteobjectgetpropertieshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/model/remote-object-get-properties.html (0 => 178768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/model/remote-object-get-properties.html         (rev 0)
+++ trunk/LayoutTests/inspector/model/remote-object-get-properties.html        2015-01-21 00:34:57 UTC (rev 178768)
</span><span class="lines">@@ -0,0 +1,114 @@
</span><ins>+<!doctype html>
+<html>
+<head>
+<script type="text/javascript" src="../../http/tests/inspector/inspector-test.js"></script>
+<script>
+// ------------------------------
+// Setup Test Prototype Chain
+// ------------------------------
+
+function SuperBar() { this._bar = 10; }
+SuperBar.prototype = {
+ __proto__: Object.prototype,
+ constructor: SuperBar,
+ BAR_CONSTANT: 99,
+ get getterProperty() { return 20; },
+ get bar() { return this._bar; },
+ set setterOnly(x) {},
+};
+
+function SuperFoo() { SuperBar.call(this); this._foo = 5; }
+SuperFoo.prototype = {
+ __proto__: SuperBar.prototype,
+ constructor: SuperFoo,
+ get getterProperty() { return 10; },
+ get foo() { return this._foo; }
+};
+
+function ClassWithBadGetter() {}
+ClassWithBadGetter.prototype = {
+ __proto__: Object.prototype,
+ constructor: ClassWithBadGetter,
+ get badGetter() { throw "throw in getter"; }
+};
+
+
+// --------------------
+// Objects to Debug
+// --------------------
+
+// window.loadEvent is set inside of <body onload="..."> below.
+var simpleObject = {a:1, b:"string"};
+var complexObject = new SuperFoo;
+var badGetterObject = new ClassWithBadGetter;
+
+
+// --------
+// test
+// --------
+
+function test()
+{
+ var currentStepIndex = 0;
+ var steps = [
+ {expression: "window.simpleObject"},
+ {expression: "window.loadEvent"},
+ {expression: "window.complexObject"},
+ {expression: "window.badGetterObject"},
+ ]
+
+ function runNextStep() {
+ if (currentStepIndex >= steps.length) {
+ InspectorTest.log("DONE");
+ InspectorTest.completeTest();
+ return;
+ }
+
+ var step = steps[currentStepIndex++];
+ InspectorTest.log("");
+ InspectorTest.log("-----------------------------------------------------");
+ InspectorTest.log("EXPRESSION: " + step.expression);
+
+ WebInspector.runtimeManager.evaluateInInspectedWindow(step.expression, "test", false, true, false, function(remoteObject, wasThrown) {
+ InspectorTest.assert(remoteObject instanceof WebInspector.RemoteObject);
+ InspectorTest.log("objectId: " + remoteObject.objectId);
+ InspectorTest.log("type: " + remoteObject.type);
+ if (remoteObject.subtype)
+ InspectorTest.log("subtype: " + remoteObject.subtype);
+ InspectorTest.log("description: " + remoteObject.description);
+ remoteObject.getOwnProperties(function(properties) {
+ InspectorTest.log("\nOWN PROPERTIES:");
+ for (var property of properties) {
+ InspectorTest.assert(property instanceof WebInspector.RemoteObjectProperty);
+ InspectorTest.log(" " + property.name);
+ }
+ });
+
+ remoteObject.getOwnAndGetterProperties(function(properties) {
+ InspectorTest.log("\nOWN AND GETTER PROPERTIES:");
+ for (var property of properties) {
+ InspectorTest.assert(property instanceof WebInspector.RemoteObjectProperty);
+ InspectorTest.log(" " + property.name);
+ }
+ });
+
+ remoteObject.getAllProperties(function(properties) {
+ InspectorTest.log("\nALL PROPERTIES:");
+ for (var property of properties) {
+ InspectorTest.assert(property instanceof WebInspector.RemoteObjectProperty);
+ InspectorTest.log(" " + property.name);
+ }
+
+ InspectorTest.log("-----------------------------------------------------");
+ runNextStep();
+ });
+ });
+ }
+
+ runNextStep();
+}
+</script>
+</head>
+<body onload="window.loadEvent = event; runTest()">
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (178767 => 178768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-01-21 00:30:36 UTC (rev 178767)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-01-21 00:34:57 UTC (rev 178768)
</span><span class="lines">@@ -1,5 +1,24 @@
</span><span class="cx"> 2015-01-20 Joseph Pecoraro <pecoraro@apple.com>
</span><span class="cx">
</span><ins>+ Web Inspector: Expanding event objects in console shows undefined for most values, it should have real values
+ https://bugs.webkit.org/show_bug.cgi?id=137306
+
+ Reviewed by Timothy Hatcher.
+
+ Provide another optional parameter to getProperties, to gather a list
+ of all own and getter properties.
+
+ * inspector/InjectedScript.cpp:
+ (Inspector::InjectedScript::getProperties):
+ * inspector/InjectedScript.h:
+ * inspector/InjectedScriptSource.js:
+ * inspector/agents/InspectorRuntimeAgent.cpp:
+ (Inspector::InspectorRuntimeAgent::getProperties):
+ * inspector/agents/InspectorRuntimeAgent.h:
+ * inspector/protocol/Runtime.json:
+
+2015-01-20 Joseph Pecoraro <pecoraro@apple.com>
+
</ins><span class="cx"> Web Inspector: Should show dynamic specificity values
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=140647
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorInjectedScriptcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/InjectedScript.cpp (178767 => 178768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/InjectedScript.cpp        2015-01-21 00:30:36 UTC (rev 178767)
+++ trunk/Source/JavaScriptCore/inspector/InjectedScript.cpp        2015-01-21 00:34:57 UTC (rev 178768)
</span><span class="lines">@@ -109,11 +109,12 @@
</span><span class="cx"> *result = BindingTraits<Inspector::Protocol::Debugger::FunctionDetails>::runtimeCast(WTF::move(resultValue));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void InjectedScript::getProperties(ErrorString& errorString, const String& objectId, bool ownProperties, RefPtr<Array<Inspector::Protocol::Runtime::PropertyDescriptor>>* properties)
</del><ins>+void InjectedScript::getProperties(ErrorString& errorString, const String& objectId, bool ownProperties, bool ownAndGetterProperties, RefPtr<Array<Inspector::Protocol::Runtime::PropertyDescriptor>>* properties)
</ins><span class="cx"> {
</span><span class="cx"> Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("getProperties"), inspectorEnvironment()->functionCallHandler());
</span><span class="cx"> function.appendArgument(objectId);
</span><span class="cx"> function.appendArgument(ownProperties);
</span><ins>+ function.appendArgument(ownAndGetterProperties);
</ins><span class="cx">
</span><span class="cx"> RefPtr<InspectorValue> result;
</span><span class="cx"> makeCall(function, &result);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorInjectedScripth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/InjectedScript.h (178767 => 178768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/InjectedScript.h        2015-01-21 00:30:36 UTC (rev 178767)
+++ trunk/Source/JavaScriptCore/inspector/InjectedScript.h        2015-01-21 00:34:57 UTC (rev 178768)
</span><span class="lines">@@ -59,7 +59,7 @@
</span><span class="cx"> void callFunctionOn(ErrorString&, const String& objectId, const String& expression, const String& arguments, bool returnByValue, bool generatePreview, RefPtr<Protocol::Runtime::RemoteObject>* result, Protocol::OptOutput<bool>* wasThrown);
</span><span class="cx"> void evaluateOnCallFrame(ErrorString&, const Deprecated::ScriptValue& callFrames, const String& callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, RefPtr<Protocol::Runtime::RemoteObject>* result, Protocol::OptOutput<bool>* wasThrown);
</span><span class="cx"> void getFunctionDetails(ErrorString&, const String& functionId, RefPtr<Protocol::Debugger::FunctionDetails>* result);
</span><del>- void getProperties(ErrorString&, const String& objectId, bool ownProperties, RefPtr<Protocol::Array<Protocol::Runtime::PropertyDescriptor>>* result);
</del><ins>+ void getProperties(ErrorString&, const String& objectId, bool ownProperties, bool ownAndGetterProperties, RefPtr<Protocol::Array<Protocol::Runtime::PropertyDescriptor>>* result);
</ins><span class="cx"> void getInternalProperties(ErrorString&, const String& objectId, RefPtr<Protocol::Array<Protocol::Runtime::InternalPropertyDescriptor>>* result);
</span><span class="cx">
</span><span class="cx"> Ref<Protocol::Array<Protocol::Debugger::CallFrame>> wrapCallFrames(const Deprecated::ScriptValue&);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorInjectedScriptSourcejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/InjectedScriptSource.js (178767 => 178768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/InjectedScriptSource.js        2015-01-21 00:30:36 UTC (rev 178767)
+++ trunk/Source/JavaScriptCore/inspector/InjectedScriptSource.js        2015-01-21 00:34:57 UTC (rev 178768)
</span><span class="lines">@@ -226,12 +226,7 @@
</span><span class="cx"> return result;
</span><span class="cx"> },
</span><span class="cx">
</span><del>- /**
- * @param {string} objectId
- * @param {boolean} ownProperties
- * @return {Array.<RuntimeAgent.PropertyDescriptor>|boolean}
- */
- getProperties: function(objectId, ownProperties)
</del><ins>+ getProperties: function(objectId, ownProperties, ownAndGetterProperties)
</ins><span class="cx"> {
</span><span class="cx"> var parsedObjectId = this._parseObjectId(objectId);
</span><span class="cx"> var object = this._objectForId(parsedObjectId);
</span><span class="lines">@@ -239,8 +234,9 @@
</span><span class="cx">
</span><span class="cx"> if (!this._isDefined(object))
</span><span class="cx"> return false;
</span><del>- var descriptors = this._propertyDescriptors(object, ownProperties);
</del><span class="cx">
</span><ins>+ var descriptors = this._propertyDescriptors(object, ownProperties, ownAndGetterProperties);
+
</ins><span class="cx"> // Go over properties, wrap object values.
</span><span class="cx"> for (var i = 0; i < descriptors.length; ++i) {
</span><span class="cx"> var descriptor = descriptors[i];
</span><span class="lines">@@ -255,6 +251,7 @@
</span><span class="cx"> if (!("enumerable" in descriptor))
</span><span class="cx"> descriptor.enumerable = false;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> return descriptors;
</span><span class="cx"> },
</span><span class="cx">
</span><span class="lines">@@ -328,70 +325,6 @@
</span><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * @param {Object} object
- * @param {boolean} ownProperties
- * @return {Array.<Object>}
- */
- _propertyDescriptors: function(object, ownProperties)
- {
- var descriptors = [];
- var nameProcessed = {};
- nameProcessed["__proto__"] = null;
- for (var o = object; this._isDefined(o); o = o.__proto__) {
- var names = Object.getOwnPropertyNames(/** @type {!Object} */ (o));
- for (var i = 0; i < names.length; ++i) {
- var name = names[i];
- if (nameProcessed[name])
- continue;
-
- try {
- nameProcessed[name] = true;
- var descriptor = Object.getOwnPropertyDescriptor(/** @type {!Object} */ (object), name);
- if (!descriptor) {
- // Not all bindings provide proper descriptors. Fall back to the writable, configurable property.
- try {
- descriptor = { name: name, value: object[name], writable: false, configurable: false, enumerable: false};
- if (o === object)
- descriptor.isOwn = true;
- descriptors.push(descriptor);
- } catch (e) {
- // Silent catch.
- }
- continue;
- }
- if (descriptor.hasOwnProperty("get") && descriptor.hasOwnProperty("set") && !descriptor.get && !descriptor.set) {
- // Not all bindings provide proper descriptors. Fall back to the writable, configurable property.
- try {
- descriptor = { name: name, value: object[name], writable: false, configurable: false, enumerable: false};
- if (o === object)
- descriptor.isOwn = true;
- descriptors.push(descriptor);
- } catch (e) {
- // Silent catch.
- }
- continue;
- }
- } catch (e) {
- var descriptor = {};
- descriptor.value = e;
- descriptor.wasThrown = true;
- }
-
- descriptor.name = name;
- if (o === object)
- descriptor.isOwn = true;
- descriptors.push(descriptor);
- }
- if (ownProperties) {
- if (object.__proto__)
- descriptors.push({ name: "__proto__", value: object.__proto__, writable: true, configurable: true, enumerable: false, isOwn: true});
- break;
- }
- }
- return descriptors;
- },
-
- /**
</del><span class="cx"> * @param {string} expression
</span><span class="cx"> * @param {string} objectGroup
</span><span class="cx"> * @param {boolean} injectCommandLineAPI
</span><span class="lines">@@ -689,6 +622,109 @@
</span><span class="cx"> return module;
</span><span class="cx"> },
</span><span class="cx">
</span><ins>+ _propertyDescriptors: function(object, ownProperties, ownAndGetterProperties)
+ {
+ // Modes:
+ // - ownProperties - only own properties and __proto__
+ // - ownAndGetterProperties - own properties, __proto__, and getters in the prototype chain
+ // - neither - get all properties in the prototype chain, exclude __proto__
+
+ var descriptors = [];
+ var nameProcessed = {};
+ nameProcessed["__proto__"] = null;
+
+ function createFakeValueDescriptor(name, descriptor, isOwnProperty)
+ {
+ try {
+ return {name: name, value: object[name], writable: descriptor.writable, configurable: descriptor.configurable, enumerable: descriptor.enumerable};
+ } catch (e) {
+ var errorDescriptor = {name: name, value: e, wasThrown: true};
+ if (isOwnProperty)
+ errorDescriptor.isOwn = true;
+ return errorDescriptor;
+ }
+ }
+
+ function processDescriptor(descriptor, isOwnProperty)
+ {
+ // Own properties only.
+ if (ownProperties) {
+ if (isOwnProperty)
+ descriptors.push(descriptor);
+ return;
+ }
+
+ // Own and getter properties.
+ if (ownAndGetterProperties) {
+ if (isOwnProperty) {
+ // Own property, include the descriptor as is.
+ descriptors.push(descriptor);
+ } else if (descriptor.hasOwnProperty("get") && descriptor.get) {
+ // Getter property in the prototype chain. Create a fake value descriptor.
+ descriptors.push(createFakeValueDescriptor(descriptor.name, descriptor, isOwnProperty));
+ } else if (descriptor.possibleNativeBindingGetter) {
+ // Possible getter property in the prototype chain.
+ descriptors.push(descriptor);
+ }
+ return;
+ }
+
+ // All properties.
+ descriptors.push(descriptor);
+ }
+
+ function processPropertyNames(o, names, isOwnProperty)
+ {
+ for (var i = 0; i < names.length; ++i) {
+ var name = names[i];
+ if (nameProcessed[name] || name === "__proto__")
+ continue;
+
+ nameProcessed[name] = true;
+
+ var descriptor = Object.getOwnPropertyDescriptor(o, name);
+ if (!descriptor) {
+ // FIXME: Bad descriptor. Can we get here?
+ // Fall back to very restrictive settings.
+ var fakeDescriptor = createFakeValueDescriptor(name, {writable: false, configurable: false, enumerable: false}, isOwnProperty);
+ processDescriptor(fakeDescriptor, isOwnProperty);
+ continue;
+ }
+
+ if (descriptor.hasOwnProperty("get") && descriptor.hasOwnProperty("set") && !descriptor.get && !descriptor.set) {
+ // FIXME: <https://webkit.org/b/140575> Web Inspector: Native Bindings Descriptors are Incomplete
+ // Developers may create such a descriptors, so we should be resilient:
+ // var x = {}; Object.defineProperty(x, "p", {get:undefined}); Object.getOwnPropertyDescriptor(x, "p")
+ var fakeDescriptor = createFakeValueDescriptor(name, descriptor, isOwnProperty);
+ fakeDescriptor.possibleNativeBindingGetter = true; // Native bindings.
+ processDescriptor(fakeDescriptor, isOwnProperty);
+ continue;
+ }
+
+ descriptor.name = name;
+ if (isOwnProperty)
+ descriptor.isOwn = true;
+ processDescriptor(descriptor, isOwnProperty);
+ }
+ }
+
+ // Iterate prototype chain.
+ for (var o = object; this._isDefined(o); o = o.__proto__) {
+ var isOwnProperty = o === object;
+ processPropertyNames(o, Object.getOwnPropertyNames(o), isOwnProperty);
+ if (ownProperties)
+ break;
+ }
+
+ // Include __proto__ at the end.
+ try {
+ if (object.__proto__)
+ descriptors.push({name: "__proto__", value: object.__proto__, writable: true, configurable: true, enumerable: false, isOwn: true});
+ } catch (e) {}
+
+ return descriptors;
+ },
+
</ins><span class="cx"> /**
</span><span class="cx"> * @param {*} object
</span><span class="cx"> * @return {boolean}
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectoragentsInspectorRuntimeAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp (178767 => 178768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp        2015-01-21 00:30:36 UTC (rev 178767)
+++ trunk/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp        2015-01-21 00:34:57 UTC (rev 178768)
</span><span class="lines">@@ -163,7 +163,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void InspectorRuntimeAgent::getProperties(ErrorString& errorString, const String& objectId, const bool* const ownProperties, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties)
</del><ins>+void InspectorRuntimeAgent::getProperties(ErrorString& errorString, const String& objectId, const bool* const ownProperties, const bool* const ownAndGetterProperties, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties)
</ins><span class="cx"> {
</span><span class="cx"> InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId);
</span><span class="cx"> if (injectedScript.hasNoValue()) {
</span><span class="lines">@@ -174,7 +174,7 @@
</span><span class="cx"> ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = setPauseOnExceptionsState(m_scriptDebugServer, ScriptDebugServer::DontPauseOnExceptions);
</span><span class="cx"> muteConsole();
</span><span class="cx">
</span><del>- injectedScript.getProperties(errorString, objectId, ownProperties ? *ownProperties : false, &result);
</del><ins>+ injectedScript.getProperties(errorString, objectId, ownProperties ? *ownProperties : false, ownAndGetterProperties ? *ownAndGetterProperties : false, &result);
</ins><span class="cx"> injectedScript.getInternalProperties(errorString, objectId, &internalProperties);
</span><span class="cx">
</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 (178767 => 178768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.h        2015-01-21 00:30:36 UTC (rev 178767)
+++ trunk/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.h        2015-01-21 00:34:57 UTC (rev 178768)
</span><span class="lines">@@ -65,7 +65,7 @@
</span><span class="cx"> virtual void evaluate(ErrorString&, const String& expression, const String* objectGroup, const bool* includeCommandLineAPI, const bool* doNotPauseOnExceptionsAndMuteConsole, const int* executionContextId, const bool* returnByValue, const bool* generatePreview, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Inspector::Protocol::OptOutput<bool>* wasThrown) override final;
</span><span class="cx"> virtual void callFunctionOn(ErrorString&, const String& objectId, const String& expression, const RefPtr<Inspector::InspectorArray>&& optionalArguments, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Inspector::Protocol::OptOutput<bool>* wasThrown) override final;
</span><span class="cx"> virtual void releaseObject(ErrorString&, const ErrorString& objectId) override final;
</span><del>- virtual void getProperties(ErrorString&, const String& objectId, const bool* ownProperties, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties) override final;
</del><ins>+ virtual void getProperties(ErrorString&, const String& objectId, const bool* ownProperties, const bool* ownAndGetterProperties, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties) override final;
</ins><span class="cx"> virtual void releaseObjectGroup(ErrorString&, const String& objectGroup) override final;
</span><span class="cx"> virtual void run(ErrorString&) override;
</span><span class="cx"> virtual void getRuntimeTypesForVariablesAtOffsets(ErrorString&, const RefPtr<Inspector::InspectorArray>&& locations, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::TypeDescription>>&) override;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorprotocolRuntimejson"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/protocol/Runtime.json (178767 => 178768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/protocol/Runtime.json        2015-01-21 00:30:36 UTC (rev 178767)
+++ trunk/Source/JavaScriptCore/inspector/protocol/Runtime.json        2015-01-21 00:34:57 UTC (rev 178768)
</span><span class="lines">@@ -215,7 +215,8 @@
</span><span class="cx"> "name": "getProperties",
</span><span class="cx"> "parameters": [
</span><span class="cx"> { "name": "objectId", "$ref": "RemoteObjectId", "description": "Identifier of the object to return properties for." },
</span><del>- { "name": "ownProperties", "optional": true, "type": "boolean", "description": "If true, returns properties belonging only to the element itself, not to its prototype chain." }
</del><ins>+ { "name": "ownProperties", "optional": true, "type": "boolean", "description": "If true, returns properties belonging only to the object itself, not to its prototype chain." },
+ { "name": "ownAndGetterProperties", "optional": true, "type": "boolean", "description": "If true, returns properties belonging to the object itself, and getters in its prototype chain." }
</ins><span class="cx"> ],
</span><span class="cx"> "returns": [
</span><span class="cx"> { "name": "result", "type": "array", "items": { "$ref": "PropertyDescriptor"}, "description": "Object properties." },
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (178767 => 178768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2015-01-21 00:30:36 UTC (rev 178767)
+++ trunk/Source/WebInspectorUI/ChangeLog        2015-01-21 00:34:57 UTC (rev 178768)
</span><span class="lines">@@ -1,5 +1,26 @@
</span><span class="cx"> 2015-01-20 Joseph Pecoraro <pecoraro@apple.com>
</span><span class="cx">
</span><ins>+ Web Inspector: Expanding event objects in console shows undefined for most values, it should have real values
+ https://bugs.webkit.org/show_bug.cgi?id=137306
+
+ Reviewed by Timothy Hatcher.
+
+ When first expanding an object, show all the object's own properties and any
+ getter properties that may be on its prototype chain. Now, we only fetch
+ own properties, for __proto__ properties.
+
+ * UserInterface/Protocol/RemoteObject.js:
+ (WebInspector.RemoteObject.prototype.getOwnProperties):
+ (WebInspector.RemoteObject.prototype.getOwnAndGetterProperties):
+ (WebInspector.RemoteObject.prototype.getAllProperties):
+ (WebInspector.RemoteObject.prototype.get hasChildren): Deleted.
+ * UserInterface/Views/ObjectPropertiesSection.js:
+ (WebInspector.ObjectPropertiesSection):
+ (WebInspector.ObjectPropertiesSection.prototype.update):
+ (WebInspector.ObjectPropertyTreeElement.prototype.onpopulate):
+
+2015-01-20 Joseph Pecoraro <pecoraro@apple.com>
+
</ins><span class="cx"> Web Inspector: Should show dynamic specificity values
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=140647
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceProtocolRemoteObjectjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js (178767 => 178768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js        2015-01-21 00:30:36 UTC (rev 178767)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js        2015-01-21 00:34:57 UTC (rev 178768)
</span><span class="lines">@@ -113,15 +113,20 @@
</span><span class="cx">
</span><span class="cx"> getOwnProperties: function(callback)
</span><span class="cx"> {
</span><del>- this._getProperties(true, callback);
</del><ins>+ this._getProperties(true, false, callback);
</ins><span class="cx"> },
</span><span class="cx">
</span><ins>+ getOwnAndGetterProperties: function(callback)
+ {
+ this._getProperties(false, true, callback);
+ },
+
</ins><span class="cx"> getAllProperties: function(callback)
</span><span class="cx"> {
</span><del>- this._getProperties(false, callback);
</del><ins>+ this._getProperties(false, false, callback);
</ins><span class="cx"> },
</span><span class="cx">
</span><del>- _getProperties: function(ownProperties, callback)
</del><ins>+ _getProperties: function(ownProperties, ownAndGetterProperties, callback)
</ins><span class="cx"> {
</span><span class="cx"> if (!this._objectId) {
</span><span class="cx"> callback([]);
</span><span class="lines">@@ -147,7 +152,32 @@
</span><span class="cx"> }
</span><span class="cx"> callback(result);
</span><span class="cx"> }
</span><del>- RuntimeAgent.getProperties(this._objectId, ownProperties, remoteObjectBinder);
</del><ins>+
+ // COMPATIBILITY (iOS 8): RuntimeAgent.getProperties did not support ownerAndGetterProperties.
+ // Here we do our best to reimplement it by getting all properties and reducing them down.
+ if (ownAndGetterProperties && !RuntimeAgent.getProperties.supports("ownAndGetterProperties")) {
+ RuntimeAgent.getProperties(this._objectId, function(error, allProperties) {
+ var ownOrGetterPropertiesList = [];
+ if (allProperties) {
+ for (var property of allProperties) {
+ if (property.isOwn || property.get || property.name === "__proto__") {
+ // Own property or getter property in prototype chain.
+ ownOrGetterPropertiesList.push(property);
+ } else if (property.value && property.name !== property.name.toUpperCase()) {
+ var type = property.value.type;
+ if (type && type !== "function" && property.name !== "constructor") {
+ // Possible native binding getter property converted to a value. Also, no CONSTANT name style and not "constructor".
+ ownOrGetterPropertiesList.push(property);
+ }
+ }
+ }
+ }
+ remoteObjectBinder(error, ownOrGetterPropertiesList);
+ });
+ return;
+ }
+
+ RuntimeAgent.getProperties(this._objectId, ownProperties, ownAndGetterProperties, remoteObjectBinder);
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> setPropertyValue: function(name, value, callback)
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsObjectPropertiesSectionjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPropertiesSection.js (178767 => 178768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPropertiesSection.js        2015-01-21 00:30:36 UTC (rev 178767)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPropertiesSection.js        2015-01-21 00:34:57 UTC (rev 178768)
</span><span class="lines">@@ -23,11 +23,11 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-WebInspector.ObjectPropertiesSection = function(object, title, subtitle, emptyPlaceholder, ignoreHasOwnProperty, extraProperties, treeElementConstructor)
</del><ins>+WebInspector.ObjectPropertiesSection = function(object, title, subtitle, emptyPlaceholder, getAllProperties, extraProperties, treeElementConstructor)
</ins><span class="cx"> {
</span><span class="cx"> this.emptyPlaceholder = (emptyPlaceholder || WebInspector.UIString("No Properties"));
</span><span class="cx"> this.object = object;
</span><del>- this.ignoreHasOwnProperty = ignoreHasOwnProperty;
</del><ins>+ this.getAllProperties = getAllProperties;
</ins><span class="cx"> this.extraProperties = extraProperties;
</span><span class="cx"> this.treeElementConstructor = treeElementConstructor || WebInspector.ObjectPropertyTreeElement;
</span><span class="cx"> this.editable = true;
</span><span class="lines">@@ -50,10 +50,10 @@
</span><span class="cx"> return;
</span><span class="cx"> self.updateProperties(properties);
</span><span class="cx"> }
</span><del>- if (this.ignoreHasOwnProperty)
</del><ins>+ if (this.getAllProperties)
</ins><span class="cx"> this.object.getAllProperties(callback);
</span><span class="cx"> else
</span><del>- this.object.getOwnProperties(callback);
</del><ins>+ this.object.getOwnAndGetterProperties(callback);
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> updateProperties: function(properties, rootTreeElementConstructor, rootPropertyComparer)
</span><span class="lines">@@ -163,7 +163,11 @@
</span><span class="cx"> this.appendChild(new this.treeOutline.section.treeElementConstructor(properties[i]));
</span><span class="cx"> }
</span><span class="cx"> };
</span><del>- this.property.value.getOwnProperties(callback.bind(this));
</del><ins>+
+ if (this.property.name === "__proto__")
+ this.property.value.getOwnProperties(callback.bind(this));
+ else
+ this.property.value.getOwnAndGetterProperties(callback.bind(this));
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> ondblclick: function(event)
</span></span></pre>
</div>
</div>
</body>
</html>