<!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>[182047] 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/182047">182047</a></dd>
<dt>Author</dt> <dd>joepeck@webkit.org</dd>
<dt>Date</dt> <dd>2015-03-26 18:42:37 -0700 (Thu, 26 Mar 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Web Inspector: ES6: Provide a better view for Classes in the console
https://bugs.webkit.org/show_bug.cgi?id=142999
Reviewed by Timothy Hatcher.
Source/JavaScriptCore:
* inspector/protocol/Runtime.json:
Provide a new `subtype` enum "class". This is a subtype of `type`
"function", all other subtypes are subtypes of `object` types.
For a class, the frontend will immediately want to get the prototype
to enumerate its methods, so include the `classPrototype`.
* inspector/JSInjectedScriptHost.cpp:
(Inspector::JSInjectedScriptHost::subtype):
Denote class construction functions as "class" subtypes.
* inspector/InjectedScriptSource.js:
Handling for the new "class" type.
* bytecode/UnlinkedCodeBlock.h:
(JSC::UnlinkedFunctionExecutable::isClassConstructorFunction):
* runtime/Executable.h:
(JSC::FunctionExecutable::isClassConstructorFunction):
* runtime/JSFunction.h:
* runtime/JSFunctionInlines.h:
(JSC::JSFunction::isClassConstructorFunction):
Check if this function is a class constructor function. That information
is on the UnlinkedFunctionExecutable, so plumb it through to JSFunction.
Source/WebInspectorUI:
* UserInterface/Protocol/RemoteObject.js:
(WebInspector.RemoteObject):
(WebInspector.RemoteObject.fromPrimitiveValue):
(WebInspector.RemoteObject.fromPayload):
(WebInspector.RemoteObject.prototype.get classPrototype):
(WebInspector.RemoteObject.prototype.isClass):
Update our RemoteObject model object for the new subtype
and its unique properties.
* UserInterface/Views/FormattedValue.js:
(WebInspector.FormattedValue.createElementForTypesAndValue):
(WebInspector.FormattedValue.createObjectTreeOrFormattedValueForRemoteObject):
Better handle "class", as it is a new function subtype.
* UserInterface/Views/LegacyConsoleMessageImpl.js:
(WebInspector.LegacyConsoleMessageImpl):
(WebInspector.LegacyConsoleMessageImpl.prototype._formatParameterAsObject):
Format a "class" with ObjectTreeView.
* UserInterface/Views/ObjectTreeArrayIndexTreeElement.js:
* UserInterface/Views/ObjectTreeBaseTreeElement.js:
* UserInterface/Views/ObjectTreePropertyTreeElement.css:
(.object-tree-property .getter.disabled):
(.object-tree-property .getter:not(.disabled):hover):
(.object-tree-property .getter:hover): Deleted.
* UserInterface/Views/ObjectTreePropertyTreeElement.js:
In ClassAPI mode, you cannot invoke a getter since we don't have
an instance to invoke it on. So disable interactivity with getters.
* UserInterface/Views/ObjectTreeView.js:
(WebInspector.ObjectTreeView):
Update the modes to include an API mode for instances and classes.
(WebInspector.ObjectTreeView.defaultModeForObject):
* UserInterface/Views/SourceCodeTextEditor.js:
(WebInspector.SourceCodeTextEditor.prototype._showPopoverForObject):
Simplify ObjectTree construction to automatically determine mode based
on the RemoteObject that was provided.
* Localizations/en.lproj/localizedStrings.js:
"Getter" tooltip.
LayoutTests:
* inspector/model/remote-object-expected.txt:
* inspector/model/remote-object.html:
Update the test to include coverage of the new "class" subtype of "function".</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="#trunkLayoutTestsinspectormodelremoteobjecthtml">trunk/LayoutTests/inspector/model/remote-object.html</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeUnlinkedCodeBlockh">trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorInjectedScriptSourcejs">trunk/Source/JavaScriptCore/inspector/InjectedScriptSource.js</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorJSInjectedScriptHostcpp">trunk/Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorprotocolRuntimejson">trunk/Source/JavaScriptCore/inspector/protocol/Runtime.json</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeExecutableh">trunk/Source/JavaScriptCore/runtime/Executable.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSFunctionh">trunk/Source/JavaScriptCore/runtime/JSFunction.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSFunctionInlinesh">trunk/Source/JavaScriptCore/runtime/JSFunctionInlines.h</a></li>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUILocalizationsenlprojlocalizedStringsjs">trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceProtocolRemoteObjectjs">trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsFormattedValuejs">trunk/Source/WebInspectorUI/UserInterface/Views/FormattedValue.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsLegacyConsoleMessageImpljs">trunk/Source/WebInspectorUI/UserInterface/Views/LegacyConsoleMessageImpl.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsObjectTreeArrayIndexTreeElementjs">trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeArrayIndexTreeElement.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsObjectTreeBaseTreeElementjs">trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeBaseTreeElement.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsObjectTreePropertyTreeElementcss">trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.css</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsObjectTreePropertyTreeElementjs">trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsObjectTreeViewjs">trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsSourceCodeTextEditorjs">trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (182046 => 182047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-03-27 01:02:38 UTC (rev 182046)
+++ trunk/LayoutTests/ChangeLog        2015-03-27 01:42:37 UTC (rev 182047)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2015-03-26 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: ES6: Provide a better view for Classes in the console
+ https://bugs.webkit.org/show_bug.cgi?id=142999
+
+ Reviewed by Timothy Hatcher.
+
+ * inspector/model/remote-object-expected.txt:
+ * inspector/model/remote-object.html:
+ Update the test to include coverage of the new "class" subtype of "function".
+
</ins><span class="cx"> 2015-03-26 Tim Horton <timothy_horton@apple.com>
</span><span class="cx">
</span><span class="cx"> REGRESSION (r181358 and r181507): Lots of sites think that we support touch events on OS X
</span></span></pre></div>
<a id="trunkLayoutTestsinspectormodelremoteobjectexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/model/remote-object-expected.txt (182046 => 182047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/model/remote-object-expected.txt        2015-03-27 01:02:38 UTC (rev 182046)
+++ trunk/LayoutTests/inspector/model/remote-object-expected.txt        2015-03-27 01:42:37 UTC (rev 182047)
</span><span class="lines">@@ -196,7 +196,7 @@
</span><span class="cx"> {
</span><span class="cx"> "_type": "function",
</span><span class="cx"> "_objectId": "<filtered>",
</span><del>- "_description": "function () {}"
</del><ins>+ "_description": "function (){}"
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> -----------------------------------------------------
</span><span class="lines">@@ -204,7 +204,7 @@
</span><span class="cx"> {
</span><span class="cx"> "_type": "function",
</span><span class="cx"> "_objectId": "<filtered>",
</span><del>- "_description": "function foo() {}"
</del><ins>+ "_description": "function foo(){}"
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> -----------------------------------------------------
</span><span class="lines">@@ -244,7 +244,7 @@
</span><span class="cx"> {
</span><span class="cx"> "_type": "function",
</span><span class="cx"> "_objectId": "<filtered>",
</span><del>- "_description": "function () { return 1; }"
</del><ins>+ "_description": "function () { return 1 }"
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> -----------------------------------------------------
</span><span class="lines">@@ -4092,6 +4092,69 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> -----------------------------------------------------
</span><ins>+EXPRESSION: Person = class Person { constructor(){} get fullName(){} methodName(p1, p2){} }; Person
+{
+ "_type": "function",
+ "_subtype": "class",
+ "_objectId": "<filtered>",
+ "_description": "class Person",
+ "_classPrototype": {
+ "_type": "object",
+ "_objectId": "<filtered>",
+ "_description": "Person"
+ }
+}
+
+-----------------------------------------------------
+EXPRESSION: Person.prototype.methodName
+{
+ "_type": "function",
+ "_objectId": "<filtered>",
+ "_description": "function methodName(p1, p2){}"
+}
+
+-----------------------------------------------------
+EXPRESSION: Alpha = class A { methodA(){} }; Beta = class B extends Alpha { methodB(){} }; Beta
+{
+ "_type": "function",
+ "_subtype": "class",
+ "_objectId": "<filtered>",
+ "_description": "class B",
+ "_classPrototype": {
+ "_type": "object",
+ "_objectId": "<filtered>",
+ "_description": "B"
+ }
+}
+
+-----------------------------------------------------
+EXPRESSION: [Beta]
+{
+ "_type": "object",
+ "_subtype": "array",
+ "_objectId": "<filtered>",
+ "_description": "Array",
+ "_size": 1,
+ "_preview": {
+ "_type": "object",
+ "_subtype": "array",
+ "_description": "Array",
+ "_lossless": false,
+ "_overflow": false,
+ "_size": 1,
+ "_properties": [
+ {
+ "_name": "0",
+ "_type": "function",
+ "_subtype": "class",
+ "_value": "B"
+ }
+ ],
+ "_entries": null
+ }
+}
+
+-----------------------------------------------------
</ins><span class="cx"> EXPRESSION: Object.seal({})
</span><span class="cx"> {
</span><span class="cx"> "_type": "object",
</span></span></pre></div>
<a id="trunkLayoutTestsinspectormodelremoteobjecthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/model/remote-object.html (182046 => 182047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/model/remote-object.html        2015-03-27 01:02:38 UTC (rev 182046)
+++ trunk/LayoutTests/inspector/model/remote-object.html        2015-03-27 01:42:37 UTC (rev 182047)
</span><span class="lines">@@ -154,6 +154,13 @@
</span><span class="cx"> {expression: "Promise.resolve()"},
</span><span class="cx"> {expression: "Promise.resolve({result:1})"},
</span><span class="cx">
</span><ins>+ // Classes
+
+ {expression: "Person = class Person { constructor(){} get fullName(){} methodName(p1, p2){} }; Person"}, // Constructor => class type
+ {expression: "Person.prototype.methodName"}, // Method => just a function type
+ {expression: "Alpha = class A { methodA(){} }; Beta = class B extends Alpha { methodB(){} }; Beta"},
+ {expression: "[Beta]"},
+
</ins><span class="cx"> // Improveable:
</span><span class="cx">
</span><span class="cx"> // Sealed / Frozen objects.
</span><span class="lines">@@ -216,7 +223,11 @@
</span><span class="cx">
</span><span class="cx"> for (var step of steps) {
</span><span class="cx"> console.info("EXPRESSION", step.expression);
</span><del>- console.log(eval(step.expression));
</del><ins>+ try {
+ console.log(eval(step.expression));
+ } catch (e) {
+ console.log("EXCEPTION: " + e);
+ }
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> </script>
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (182046 => 182047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-03-27 01:02:38 UTC (rev 182046)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-03-27 01:42:37 UTC (rev 182047)
</span><span class="lines">@@ -1,3 +1,33 @@
</span><ins>+2015-03-26 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: ES6: Provide a better view for Classes in the console
+ https://bugs.webkit.org/show_bug.cgi?id=142999
+
+ Reviewed by Timothy Hatcher.
+
+ * inspector/protocol/Runtime.json:
+ Provide a new `subtype` enum "class". This is a subtype of `type`
+ "function", all other subtypes are subtypes of `object` types.
+ For a class, the frontend will immediately want to get the prototype
+ to enumerate its methods, so include the `classPrototype`.
+
+ * inspector/JSInjectedScriptHost.cpp:
+ (Inspector::JSInjectedScriptHost::subtype):
+ Denote class construction functions as "class" subtypes.
+
+ * inspector/InjectedScriptSource.js:
+ Handling for the new "class" type.
+
+ * bytecode/UnlinkedCodeBlock.h:
+ (JSC::UnlinkedFunctionExecutable::isClassConstructorFunction):
+ * runtime/Executable.h:
+ (JSC::FunctionExecutable::isClassConstructorFunction):
+ * runtime/JSFunction.h:
+ * runtime/JSFunctionInlines.h:
+ (JSC::JSFunction::isClassConstructorFunction):
+ Check if this function is a class constructor function. That information
+ is on the UnlinkedFunctionExecutable, so plumb it through to JSFunction.
+
</ins><span class="cx"> 2015-03-26 Geoffrey Garen <ggaren@apple.com>
</span><span class="cx">
</span><span class="cx"> Function.prototype.toString should not decompile the AST
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeUnlinkedCodeBlockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h (182046 => 182047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h        2015-03-27 01:02:38 UTC (rev 182046)
+++ trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h        2015-03-27 01:42:37 UTC (rev 182047)
</span><span class="lines">@@ -166,6 +166,7 @@
</span><span class="cx"> static void destroy(JSCell*);
</span><span class="cx">
</span><span class="cx"> bool isBuiltinFunction() const { return m_isBuiltinFunction; }
</span><ins>+ bool isClassConstructorFunction() const { return constructorKind() != ConstructorKind::None; }
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> UnlinkedFunctionExecutable(VM*, Structure*, const SourceCode&, RefPtr<SourceProvider>&& sourceOverride, FunctionBodyNode*, UnlinkedFunctionKind);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorInjectedScriptSourcejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/InjectedScriptSource.js (182046 => 182047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/InjectedScriptSource.js        2015-03-27 01:02:38 UTC (rev 182046)
+++ trunk/Source/JavaScriptCore/inspector/InjectedScriptSource.js        2015-03-27 01:42:37 UTC (rev 182047)
</span><span class="lines">@@ -779,6 +779,9 @@
</span><span class="cx"> if (subtype === "array")
</span><span class="cx"> return className;
</span><span class="cx">
</span><ins>+ if (subtype === "class")
+ return obj.name;
+
</ins><span class="cx"> // NodeList in JSC is a function, check for array prior to this.
</span><span class="cx"> if (typeof obj === "function")
</span><span class="cx"> return toString(obj);
</span><span class="lines">@@ -922,6 +925,8 @@
</span><span class="cx"> this.size = object.size;
</span><span class="cx"> else if (subtype === "weakmap")
</span><span class="cx"> this.size = InjectedScriptHost.weakMapSize(object);
</span><ins>+ else if (subtype === "class")
+ this.classPrototype = injectedScript._wrapObject(object.prototype, objectGroupName);
</ins><span class="cx">
</span><span class="cx"> if (generatePreview && this.type === "object")
</span><span class="cx"> this.preview = this._generatePreview(object, undefined, columnNames);
</span><span class="lines">@@ -955,6 +960,8 @@
</span><span class="cx"> var remoteObject = new InjectedScript.RemoteObject(value, undefined, false, true, undefined);
</span><span class="cx"> if (remoteObject.objectId)
</span><span class="cx"> injectedScript.releaseObject(remoteObject.objectId);
</span><ins>+ if (remoteObject.classPrototype && remoteObject.classPrototype.objectId)
+ injectedScript.releaseObject(remoteObject.classPrototype.objectId);
</ins><span class="cx">
</span><span class="cx"> return remoteObject.preview || remoteObject._emptyPreview();
</span><span class="cx"> },
</span><span class="lines">@@ -1103,7 +1110,7 @@
</span><span class="cx"> preview.overflow = true;
</span><span class="cx"> } else {
</span><span class="cx"> var description = "";
</span><del>- if (type !== "function")
</del><ins>+ if (type !== "function" || subtype === "class")
</ins><span class="cx"> description = this._abbreviateString(injectedScript._describe(value), maxLength, subtype === "regexp");
</span><span class="cx"> property.value = description;
</span><span class="cx"> preview.lossless = false;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorJSInjectedScriptHostcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp (182046 => 182047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp        2015-03-27 01:02:38 UTC (rev 182046)
+++ trunk/Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp        2015-03-27 01:42:37 UTC (rev 182047)
</span><span class="lines">@@ -136,9 +136,16 @@
</span><span class="cx"> return exec->vm().smallStrings.symbolString();
</span><span class="cx">
</span><span class="cx"> JSObject* object = asObject(value);
</span><del>- if (object && object->isErrorInstance())
- return jsNontrivialString(exec, ASCIILiteral("error"));
</del><ins>+ if (object) {
+ if (object->isErrorInstance())
+ return jsNontrivialString(exec, ASCIILiteral("error"));
</ins><span class="cx">
</span><ins>+ // Consider class constructor functions class objects.
+ JSFunction* function = jsDynamicCast<JSFunction*>(value);
+ if (function && function->isClassConstructorFunction())
+ return jsNontrivialString(exec, ASCIILiteral("class"));
+ }
+
</ins><span class="cx"> if (value.inherits(JSArray::info()))
</span><span class="cx"> return jsNontrivialString(exec, ASCIILiteral("array"));
</span><span class="cx"> if (value.inherits(DateInstance::info()))
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorprotocolRuntimejson"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/protocol/Runtime.json (182046 => 182047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/protocol/Runtime.json        2015-03-27 01:02:38 UTC (rev 182046)
+++ trunk/Source/JavaScriptCore/inspector/protocol/Runtime.json        2015-03-27 01:42:37 UTC (rev 182047)
</span><span class="lines">@@ -13,12 +13,13 @@
</span><span class="cx"> "description": "Mirror object referencing original JavaScript object.",
</span><span class="cx"> "properties": [
</span><span class="cx"> { "name": "type", "type": "string", "enum": ["object", "function", "undefined", "string", "number", "boolean", "symbol"], "description": "Object type." },
</span><del>- { "name": "subtype", "type": "string", "optional": true, "enum": ["array", "null", "node", "regexp", "date", "error", "map", "set", "weakmap", "iterator"], "description": "Object subtype hint. Specified for <code>object</code> type values only." },
</del><ins>+ { "name": "subtype", "type": "string", "optional": true, "enum": ["array", "null", "node", "regexp", "date", "error", "map", "set", "weakmap", "iterator", "class"], "description": "Object subtype hint. Specified for <code>object</code> <code>function</code> (for class) type values only." },
</ins><span class="cx"> { "name": "className", "type": "string", "optional": true, "description": "Object class (constructor) name. Specified for <code>object</code> type values only." },
</span><span class="cx"> { "name": "value", "type": "any", "optional": true, "description": "Remote object value (in case of primitive values or JSON values if it was requested)." },
</span><span class="cx"> { "name": "description", "type": "string", "optional": true, "description": "String representation of the object." },
</span><span class="cx"> { "name": "objectId", "$ref": "RemoteObjectId", "optional": true, "description": "Unique object identifier (for non-primitive values)." },
</span><span class="cx"> { "name": "size", "type": "integer", "optional": true, "description": "Size of the array/collection. Specified for array/map/set/weakmap object type values only." },
</span><ins>+ { "name": "classPrototype", "$ref": "RemoteObject", "optional": true, "description": "Remote object for the class prototype. Specified for class object type values only." },
</ins><span class="cx"> { "name": "preview", "$ref": "ObjectPreview", "optional": true, "description": "Preview containing abbreviated property values. Specified for <code>object</code> type values only." }
</span><span class="cx"> ]
</span><span class="cx"> },
</span><span class="lines">@@ -28,7 +29,7 @@
</span><span class="cx"> "description": "Object containing abbreviated remote object value.",
</span><span class="cx"> "properties": [
</span><span class="cx"> { "name": "type", "type": "string", "enum": ["object", "function", "undefined", "string", "number", "boolean", "symbol"], "description": "Object type." },
</span><del>- { "name": "subtype", "type": "string", "optional": true, "enum": ["array", "null", "node", "regexp", "date", "error", "map", "set", "weakmap", "iterator"], "description": "Object subtype hint. Specified for <code>object</code> type values only." },
</del><ins>+ { "name": "subtype", "type": "string", "optional": true, "enum": ["array", "null", "node", "regexp", "date", "error", "map", "set", "weakmap", "iterator", "class"], "description": "Object subtype hint. Specified for <code>object</code> type values only." },
</ins><span class="cx"> { "name": "description", "type": "string", "optional": true, "description": "String representation of the object." },
</span><span class="cx"> { "name": "lossless", "type": "boolean", "description": "Determines whether preview is lossless (contains all information of the original object)." },
</span><span class="cx"> { "name": "overflow", "type": "boolean", "optional": true, "description": "True iff some of the properties of the original did not fit." },
</span><span class="lines">@@ -43,7 +44,7 @@
</span><span class="cx"> "properties": [
</span><span class="cx"> { "name": "name", "type": "string", "description": "Property name." },
</span><span class="cx"> { "name": "type", "type": "string", "enum": ["object", "function", "undefined", "string", "number", "boolean", "symbol", "accessor"], "description": "Object type." },
</span><del>- { "name": "subtype", "type": "string", "optional": true, "enum": ["array", "null", "node", "regexp", "date", "error", "map", "set", "weakmap", "iterator"], "description": "Object subtype hint. Specified for <code>object</code> type values only." },
</del><ins>+ { "name": "subtype", "type": "string", "optional": true, "enum": ["array", "null", "node", "regexp", "date", "error", "map", "set", "weakmap", "iterator", "class"], "description": "Object subtype hint. Specified for <code>object</code> type values only." },
</ins><span class="cx"> { "name": "value", "type": "string", "optional": true, "description": "User-friendly property value string." },
</span><span class="cx"> { "name": "valuePreview", "$ref": "ObjectPreview", "optional": true, "description": "Nested value preview." },
</span><span class="cx"> { "name": "internal", "type": "boolean", "optional": true, "description": "True if this is an internal property." }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeExecutableh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/Executable.h (182046 => 182047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/Executable.h        2015-03-27 01:02:38 UTC (rev 182046)
+++ trunk/Source/JavaScriptCore/runtime/Executable.h        2015-03-27 01:42:37 UTC (rev 182047)
</span><span class="lines">@@ -627,6 +627,7 @@
</span><span class="cx">
</span><span class="cx"> FunctionMode functionMode() { return m_unlinkedExecutable->functionMode(); }
</span><span class="cx"> bool isBuiltinFunction() const { return m_unlinkedExecutable->isBuiltinFunction(); }
</span><ins>+ bool isClassConstructorFunction() const { return m_unlinkedExecutable->isClassConstructorFunction(); }
</ins><span class="cx"> const Identifier& name() { return m_unlinkedExecutable->name(); }
</span><span class="cx"> const Identifier& inferredName() { return m_unlinkedExecutable->inferredName(); }
</span><span class="cx"> JSString* nameValue() const { return m_unlinkedExecutable->nameValue(); }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSFunctionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSFunction.h (182046 => 182047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSFunction.h        2015-03-27 01:02:38 UTC (rev 182046)
+++ trunk/Source/JavaScriptCore/runtime/JSFunction.h        2015-03-27 01:42:37 UTC (rev 182047)
</span><span class="lines">@@ -125,6 +125,7 @@
</span><span class="cx"> bool isHostOrBuiltinFunction() const;
</span><span class="cx"> bool isBuiltinFunction() const;
</span><span class="cx"> JS_EXPORT_PRIVATE bool isHostFunctionNonInline() const;
</span><ins>+ bool isClassConstructorFunction() const;
</ins><span class="cx">
</span><span class="cx"> protected:
</span><span class="cx"> const static unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | OverridesGetPropertyNames | JSObject::StructureFlags;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSFunctionInlinesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSFunctionInlines.h (182046 => 182047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSFunctionInlines.h        2015-03-27 01:02:38 UTC (rev 182046)
+++ trunk/Source/JavaScriptCore/runtime/JSFunctionInlines.h        2015-03-27 01:42:37 UTC (rev 182047)
</span><span class="lines">@@ -60,6 +60,11 @@
</span><span class="cx"> return isHostFunction() || isBuiltinFunction();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+inline bool JSFunction::isClassConstructorFunction() const
+{
+ return !isHostFunction() && jsExecutable()->isClassConstructorFunction();
+}
+
</ins><span class="cx"> inline NativeFunction JSFunction::nativeFunction()
</span><span class="cx"> {
</span><span class="cx"> ASSERT(isHostFunctionNonInline());
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (182046 => 182047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2015-03-27 01:02:38 UTC (rev 182046)
+++ trunk/Source/WebInspectorUI/ChangeLog        2015-03-27 01:42:37 UTC (rev 182047)
</span><span class="lines">@@ -1,3 +1,52 @@
</span><ins>+2015-03-26 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: ES6: Provide a better view for Classes in the console
+ https://bugs.webkit.org/show_bug.cgi?id=142999
+
+ Reviewed by Timothy Hatcher.
+
+ * UserInterface/Protocol/RemoteObject.js:
+ (WebInspector.RemoteObject):
+ (WebInspector.RemoteObject.fromPrimitiveValue):
+ (WebInspector.RemoteObject.fromPayload):
+ (WebInspector.RemoteObject.prototype.get classPrototype):
+ (WebInspector.RemoteObject.prototype.isClass):
+ Update our RemoteObject model object for the new subtype
+ and its unique properties.
+
+ * UserInterface/Views/FormattedValue.js:
+ (WebInspector.FormattedValue.createElementForTypesAndValue):
+ (WebInspector.FormattedValue.createObjectTreeOrFormattedValueForRemoteObject):
+ Better handle "class", as it is a new function subtype.
+
+ * UserInterface/Views/LegacyConsoleMessageImpl.js:
+ (WebInspector.LegacyConsoleMessageImpl):
+ (WebInspector.LegacyConsoleMessageImpl.prototype._formatParameterAsObject):
+ Format a "class" with ObjectTreeView.
+
+ * UserInterface/Views/ObjectTreeArrayIndexTreeElement.js:
+ * UserInterface/Views/ObjectTreeBaseTreeElement.js:
+ * UserInterface/Views/ObjectTreePropertyTreeElement.css:
+ (.object-tree-property .getter.disabled):
+ (.object-tree-property .getter:not(.disabled):hover):
+ (.object-tree-property .getter:hover): Deleted.
+ * UserInterface/Views/ObjectTreePropertyTreeElement.js:
+ In ClassAPI mode, you cannot invoke a getter since we don't have
+ an instance to invoke it on. So disable interactivity with getters.
+
+ * UserInterface/Views/ObjectTreeView.js:
+ (WebInspector.ObjectTreeView):
+ Update the modes to include an API mode for instances and classes.
+
+ (WebInspector.ObjectTreeView.defaultModeForObject):
+ * UserInterface/Views/SourceCodeTextEditor.js:
+ (WebInspector.SourceCodeTextEditor.prototype._showPopoverForObject):
+ Simplify ObjectTree construction to automatically determine mode based
+ on the RemoteObject that was provided.
+
+ * Localizations/en.lproj/localizedStrings.js:
+ "Getter" tooltip.
+
</ins><span class="cx"> 2015-03-26 Timothy Hatcher <timothy@apple.com>
</span><span class="cx">
</span><span class="cx"> Web Inspector: Convert TreeElement classes to ES6
</span></span></pre></div>
<a id="trunkSourceWebInspectorUILocalizationsenlprojlocalizedStringsjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (182046 => 182047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js        2015-03-27 01:02:38 UTC (rev 182046)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js        2015-03-27 01:42:37 UTC (rev 182047)
</span><span class="lines">@@ -231,6 +231,7 @@
</span><span class="cx"> localizedStrings["Full URL"] = "Full URL";
</span><span class="cx"> localizedStrings["Function"] = "Function";
</span><span class="cx"> localizedStrings["Function Name Variable"] = "Function Name Variable";
</span><ins>+localizedStrings["Getter"] = "Getter";
</ins><span class="cx"> localizedStrings["Global Breakpoints"] = "Global Breakpoints";
</span><span class="cx"> localizedStrings["Global Variables"] = "Global Variables";
</span><span class="cx"> localizedStrings["Grammar"] = "Grammar";
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceProtocolRemoteObjectjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js (182046 => 182047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js        2015-03-27 01:02:38 UTC (rev 182046)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js        2015-03-27 01:42:37 UTC (rev 182047)
</span><span class="lines">@@ -31,7 +31,7 @@
</span><span class="cx">
</span><span class="cx"> WebInspector.RemoteObject = class RemoteObject
</span><span class="cx"> {
</span><del>- constructor(objectId, type, subtype, value, description, size, preview)
</del><ins>+ constructor(objectId, type, subtype, value, description, size, classPrototype, preview)
</ins><span class="cx"> {
</span><span class="cx"> console.assert(type);
</span><span class="cx"> console.assert(!preview || preview instanceof WebInspector.ObjectPreview);
</span><span class="lines">@@ -40,7 +40,7 @@
</span><span class="cx"> this._subtype = subtype;
</span><span class="cx">
</span><span class="cx"> if (objectId) {
</span><del>- // Object or Symbol.
</del><ins>+ // Object, Function, or Symbol.
</ins><span class="cx"> console.assert(!subtype || typeof subtype === "string");
</span><span class="cx"> console.assert(!description || typeof description === "string");
</span><span class="cx"> console.assert(!value);
</span><span class="lines">@@ -49,7 +49,11 @@
</span><span class="cx"> this._description = description;
</span><span class="cx"> this._hasChildren = type !== "symbol";
</span><span class="cx"> this._size = size;
</span><ins>+ this._classPrototype = classPrototype;
</ins><span class="cx"> this._preview = preview;
</span><ins>+
+ if (subtype === "class")
+ this._description = "class " + this._description;
</ins><span class="cx"> } else {
</span><span class="cx"> // Primitive or null.
</span><span class="cx"> console.assert(type !== "object" || value === null);
</span><span class="lines">@@ -65,7 +69,7 @@
</span><span class="cx">
</span><span class="cx"> static fromPrimitiveValue(value)
</span><span class="cx"> {
</span><del>- return new WebInspector.RemoteObject(undefined, typeof value, undefined, undefined, value);
</del><ins>+ return new WebInspector.RemoteObject(undefined, typeof value, undefined, value, undefined, undefined, undefined);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static fromPayload(payload)
</span><span class="lines">@@ -82,6 +86,9 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ if (payload.classPrototype)
+ payload.classPrototype = WebInspector.RemoteObject.fromPayload(payload.classPrototype);
+
</ins><span class="cx"> if (payload.preview) {
</span><span class="cx"> // COMPATIBILITY (iOS 8): iOS 7 and 8 did not have type/subtype/description on
</span><span class="cx"> // Runtime.ObjectPreview. Copy them over from the RemoteObject.
</span><span class="lines">@@ -95,7 +102,7 @@
</span><span class="cx"> payload.preview = WebInspector.ObjectPreview.fromPayload(payload.preview);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- return new WebInspector.RemoteObject(payload.objectId, payload.type, payload.subtype, payload.value, payload.description, payload.size, payload.preview);
</del><ins>+ return new WebInspector.RemoteObject(payload.objectId, payload.type, payload.subtype, payload.value, payload.description, payload.size, payload.classPrototype, payload.preview);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static createCallArgument(valueOrObject)
</span><span class="lines">@@ -171,6 +178,11 @@
</span><span class="cx"> return this._size || 0;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ get classPrototype()
+ {
+ return this._classPrototype;
+ }
+
</ins><span class="cx"> get preview()
</span><span class="cx"> {
</span><span class="cx"> return this._preview;
</span><span class="lines">@@ -323,6 +335,11 @@
</span><span class="cx"> return this._subtype === "array";
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ isClass()
+ {
+ return this._subtype === "class";
+ }
+
</ins><span class="cx"> isCollectionType()
</span><span class="cx"> {
</span><span class="cx"> return this._subtype === "map" || this._subtype === "set" || this._subtype === "weakmap";
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsFormattedValuejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/FormattedValue.js (182046 => 182047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/FormattedValue.js        2015-03-27 01:02:38 UTC (rev 182046)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/FormattedValue.js        2015-03-27 01:42:37 UTC (rev 182047)
</span><span class="lines">@@ -86,9 +86,12 @@
</span><span class="cx"> return span;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- // Function: ellided in previews.
</del><ins>+ // Function: if class, show the description, otherwise ellide in previews.
</ins><span class="cx"> if (type === "function") {
</span><del>- span.textContent = isPreview ? "function" : displayString;
</del><ins>+ if (subtype === "class")
+ span.textContent = displayString;
+ else
+ span.textContent = isPreview ? "function" : displayString;
</ins><span class="cx"> return span;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -125,8 +128,8 @@
</span><span class="cx"> if (object.subtype === "node")
</span><span class="cx"> return WebInspector.FormattedValue.createElementForNode(object);
</span><span class="cx">
</span><del>- if (object.type === "object") {
- var objectTree = new WebInspector.ObjectTreeView(object, WebInspector.ObjectTreeView.Mode.Properties, propertyPath, forceExpanding);
</del><ins>+ if (object.type === "object" || object.subtype === "class") {
+ var objectTree = new WebInspector.ObjectTreeView(object, null, propertyPath, forceExpanding);
</ins><span class="cx"> return objectTree.element;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsLegacyConsoleMessageImpljs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/LegacyConsoleMessageImpl.js (182046 => 182047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/LegacyConsoleMessageImpl.js        2015-03-27 01:02:38 UTC (rev 182046)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/LegacyConsoleMessageImpl.js        2015-03-27 01:42:37 UTC (rev 182047)
</span><span class="lines">@@ -46,6 +46,7 @@
</span><span class="cx"> "set": this._formatParameterAsObject,
</span><span class="cx"> "weakmap": this._formatParameterAsObject,
</span><span class="cx"> "iterator": this._formatParameterAsObject,
</span><ins>+ "class": this._formatParameterAsObject,
</ins><span class="cx"> "array": this._formatParameterAsArray,
</span><span class="cx"> "node": this._formatParameterAsNode,
</span><span class="cx"> "string": this._formatParameterAsString
</span><span class="lines">@@ -308,7 +309,8 @@
</span><span class="cx">
</span><span class="cx"> _formatParameterAsObject: function(obj, elem, forceExpansion)
</span><span class="cx"> {
</span><del>- this._objectTree = new WebInspector.ObjectTreeView(obj, WebInspector.ObjectTreeView.Mode.Properties, this._rootPropertyPathForObject(obj), forceExpansion);
</del><ins>+ // FIXME: Should have a better ObjectTreeView mode for classes (static methods and methods).
+ this._objectTree = new WebInspector.ObjectTreeView(obj, null, this._rootPropertyPathForObject(obj), forceExpansion);
</ins><span class="cx"> elem.appendChild(this._objectTree.element);
</span><span class="cx"> },
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsObjectTreeArrayIndexTreeElementjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeArrayIndexTreeElement.js (182046 => 182047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeArrayIndexTreeElement.js        2015-03-27 01:02:38 UTC (rev 182046)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeArrayIndexTreeElement.js        2015-03-27 01:42:37 UTC (rev 182047)
</span><span class="lines">@@ -69,7 +69,7 @@
</span><span class="cx"> valueElement.appendChild(WebInspector.FormattedValue.createObjectTreeOrFormattedValueForRemoteObject(resolvedValue, this.resolvedValuePropertyPath()));
</span><span class="cx"> else {
</span><span class="cx"> if (this.property.hasGetter())
</span><del>- container.appendChild(this.createInteractiveGetterElement());
</del><ins>+ container.appendChild(this.createInteractiveGetterElement(true));
</ins><span class="cx"> if (!this.property.hasSetter())
</span><span class="cx"> container.appendChild(this.createReadOnlyIconElement());
</span><span class="cx"> // FIXME: What if just a setter?
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsObjectTreeBaseTreeElementjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeBaseTreeElement.js (182046 => 182047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeBaseTreeElement.js        2015-03-27 01:02:38 UTC (rev 182046)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeBaseTreeElement.js        2015-03-27 01:42:37 UTC (rev 182047)
</span><span class="lines">@@ -113,12 +113,18 @@
</span><span class="cx"> return propertyPath.displayPath(this.propertyPathType());
</span><span class="cx"> }
</span><span class="cx">
</span><del>- createInteractiveGetterElement()
</del><ins>+ createInteractiveGetterElement(enabled)
</ins><span class="cx"> {
</span><span class="cx"> var getterElement = document.createElement("img");
</span><span class="cx"> getterElement.className = "getter";
</span><ins>+
+ if (!enabled) {
+ getterElement.classList.add("disabled");
+ getterElement.title = WebInspector.UIString("Getter");
+ return getterElement;
+ }
+
</ins><span class="cx"> getterElement.title = WebInspector.UIString("Invoke getter");
</span><del>-
</del><span class="cx"> getterElement.addEventListener("click", function(event) {
</span><span class="cx"> event.stopPropagation();
</span><span class="cx"> var lastNonPrototypeObject = this._propertyPath.lastNonPrototypeObject;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsObjectTreePropertyTreeElementcss"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.css (182046 => 182047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.css        2015-03-27 01:02:38 UTC (rev 182046)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.css        2015-03-27 01:42:37 UTC (rev 182047)
</span><span class="lines">@@ -157,7 +157,11 @@
</span><span class="cx"> margin-left: 3px;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-.object-tree-property .getter:hover {
</del><ins>+.object-tree-property .getter.disabled {
+ opacity: 0.35;
+}
+
+.object-tree-property .getter:not(.disabled):hover {
</ins><span class="cx"> opacity: 1;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsObjectTreePropertyTreeElementjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.js (182046 => 182047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.js        2015-03-27 01:02:38 UTC (rev 182046)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.js        2015-03-27 01:42:37 UTC (rev 182047)
</span><span class="lines">@@ -169,7 +169,7 @@
</span><span class="cx"> } else {
</span><span class="cx"> valueOrGetterElement = document.createElement("span");
</span><span class="cx"> if (this.property.hasGetter())
</span><del>- valueOrGetterElement.appendChild(this.createInteractiveGetterElement());
</del><ins>+ valueOrGetterElement.appendChild(this.createInteractiveGetterElement(this._mode !== WebInspector.ObjectTreeView.Mode.ClassAPI));
</ins><span class="cx"> if (!this.property.hasSetter())
</span><span class="cx"> valueOrGetterElement.appendChild(this.createReadOnlyIconElement());
</span><span class="cx"> // FIXME: What if just a setter?
</span><span class="lines">@@ -211,7 +211,7 @@
</span><span class="cx"> container.appendChild(paramElement);
</span><span class="cx"> } else {
</span><span class="cx"> if (this.property.hasGetter())
</span><del>- container.appendChild(this.createInteractiveGetterElement());
</del><ins>+ container.appendChild(this.createInteractiveGetterElement(this._mode !== WebInspector.ObjectTreeView.Mode.ClassAPI));
</ins><span class="cx"> if (!this.property.hasSetter())
</span><span class="cx"> container.appendChild(this.createReadOnlyIconElement());
</span><span class="cx"> // FIXME: What if just a setter?
</span><span class="lines">@@ -304,8 +304,10 @@
</span><span class="cx"> var resolvedValue = this.resolvedValue();
</span><span class="cx"> if (resolvedValue.isCollectionType() && this._mode === WebInspector.ObjectTreeView.Mode.Properties)
</span><span class="cx"> resolvedValue.getCollectionEntries(0, 100, this._updateChildrenInternal.bind(this, this._updateEntries, this._mode));
</span><ins>+ else if (this._mode === WebInspector.ObjectTreeView.Mode.ClassAPI)
+ resolvedValue.getOwnPropertyDescriptors(this._updateChildrenInternal.bind(this, this._updateProperties, WebInspector.ObjectTreeView.Mode.ClassAPI));
</ins><span class="cx"> else if (this.property.name === "__proto__")
</span><del>- resolvedValue.getOwnPropertyDescriptors(this._updateChildrenInternal.bind(this, this._updateProperties, WebInspector.ObjectTreeView.Mode.API));
</del><ins>+ resolvedValue.getOwnPropertyDescriptors(this._updateChildrenInternal.bind(this, this._updateProperties, WebInspector.ObjectTreeView.Mode.PrototypeAPI));
</ins><span class="cx"> else
</span><span class="cx"> resolvedValue.getDisplayablePropertyDescriptors(this._updateChildrenInternal.bind(this, this._updateProperties, this._mode));
</span><span class="cx"> }
</span><span class="lines">@@ -353,7 +355,7 @@
</span><span class="cx"> var resolvedValue = this.resolvedValue();
</span><span class="cx"> var isArray = resolvedValue.isArray();
</span><span class="cx"> var isPropertyMode = mode === WebInspector.ObjectTreeView.Mode.Properties || this._getterValue;
</span><del>- var isAPI = mode === WebInspector.ObjectTreeView.Mode.API;
</del><ins>+ var isAPI = mode !== WebInspector.ObjectTreeView.Mode.Prototype;
</ins><span class="cx">
</span><span class="cx"> var prototypeName = undefined;
</span><span class="cx"> if (this.property.name === "__proto__") {
</span><span class="lines">@@ -367,7 +369,7 @@
</span><span class="cx"> // already showed them in the Properties section.
</span><span class="cx"> if (isAPI && propertyDescriptor.nativeGetter)
</span><span class="cx"> continue;
</span><del>-
</del><ins>+
</ins><span class="cx"> if (isArray && isPropertyMode) {
</span><span class="cx"> if (propertyDescriptor.isIndexProperty())
</span><span class="cx"> this.appendChild(new WebInspector.ObjectTreeArrayIndexTreeElement(propertyDescriptor, propertyPath));
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsObjectTreeViewjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js (182046 => 182047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js        2015-03-27 01:02:38 UTC (rev 182046)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js        2015-03-27 01:42:37 UTC (rev 182047)
</span><span class="lines">@@ -32,7 +32,7 @@
</span><span class="cx"> console.assert(!propertyPath || propertyPath instanceof WebInspector.PropertyPath);
</span><span class="cx">
</span><span class="cx"> this._object = object;
</span><del>- this._mode = mode || WebInspector.ObjectTreeView.Mode.Properties;
</del><ins>+ this._mode = mode || WebInspector.ObjectTreeView.defaultModeForObject(object);
</ins><span class="cx"> this._propertyPath = propertyPath || new WebInspector.PropertyPath(this._object, "this");
</span><span class="cx"> this._expanded = false;
</span><span class="cx"> this._hasLosslessPreview = false;
</span><span class="lines">@@ -42,6 +42,10 @@
</span><span class="cx"> // listen for console clear events. Currently all ObjectTrees are in the console.
</span><span class="cx"> this._inConsole = true;
</span><span class="cx">
</span><ins>+ // Always force expanding for classes.
+ if (this._object.isClass())
+ forceExpanding = true;
+
</ins><span class="cx"> this._element = document.createElement("div");
</span><span class="cx"> this._element.className = "object-tree";
</span><span class="cx">
</span><span class="lines">@@ -70,6 +74,14 @@
</span><span class="cx"> // FIXME: Support editable ObjectTrees.
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+WebInspector.ObjectTreeView.defaultModeForObject = function(object)
+{
+ if (object.subtype === "class")
+ return WebInspector.ObjectTreeView.Mode.ClassAPI;
+
+ return WebInspector.ObjectTreeView.Mode.Properties;
+}
+
</ins><span class="cx"> WebInspector.ObjectTreeView.emptyMessageElement = function(message)
</span><span class="cx"> {
</span><span class="cx"> var emptyMessageElement = document.createElement("div");
</span><span class="lines">@@ -79,8 +91,9 @@
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> WebInspector.ObjectTreeView.Mode = {
</span><del>- Properties: Symbol("object-tree-properties"),
- API: Symbol("object-tree-api"),
</del><ins>+ Properties: Symbol("object-tree-properties"), // Properties
+ PrototypeAPI: Symbol("object-tree-prototype-api"), // API view on a live object instance, so getters can be invoked.
+ ClassAPI: Symbol("object-tree-class-api"), // API view without an object instance, can not invoke getters.
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> WebInspector.ObjectTreeView.ComparePropertyDescriptors = function(propertyA, propertyB)
</span><span class="lines">@@ -221,6 +234,8 @@
</span><span class="cx"> {
</span><span class="cx"> if (this._object.isCollectionType() && this._mode === WebInspector.ObjectTreeView.Mode.Properties)
</span><span class="cx"> this._object.getCollectionEntries(0, 100, this._updateChildren.bind(this, this._updateEntries));
</span><ins>+ else if (this._object.isClass())
+ this._object.classPrototype.getDisplayablePropertyDescriptors(this._updateChildren.bind(this, this._updateProperties));
</ins><span class="cx"> else
</span><span class="cx"> this._object.getDisplayablePropertyDescriptors(this._updateChildren.bind(this, this._updateProperties));
</span><span class="cx"> },
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsSourceCodeTextEditorjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js (182046 => 182047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js        2015-03-27 01:02:38 UTC (rev 182046)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js        2015-03-27 01:42:37 UTC (rev 182047)
</span><span class="lines">@@ -1525,7 +1525,7 @@
</span><span class="cx"> content.appendChild(titleElement);
</span><span class="cx">
</span><span class="cx"> // FIXME: If this is a variable, it would be nice to put the variable name in the PropertyPath.
</span><del>- var objectTree = new WebInspector.ObjectTreeView(data, WebInspector.ObjectTreeView.Mode.Properties, null);
</del><ins>+ var objectTree = new WebInspector.ObjectTreeView(data);
</ins><span class="cx"> objectTree.showOnlyProperties();
</span><span class="cx"> objectTree.expand();
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>