Title: [91665] trunk
Revision
91665
Author
[email protected]
Date
2011-07-25 07:24:55 -0700 (Mon, 25 Jul 2011)

Log Message

Web Inspector: refactor remote object structure to contain value for primitive values.
https://bugs.webkit.org/show_bug.cgi?id=65103

Reviewed by Yury Semikhatsky.

Source/WebCore:

* inspector/InjectedScriptSource.js:
* inspector/Inspector.json:
* inspector/front-end/ConsoleView.js:
(WebInspector.ConsoleView.prototype._format):
(WebInspector.ConsoleView.prototype._formatAsArrayEntry):
(WebInspector.ConsoleMessage.prototype._format):
* inspector/front-end/ElementsTreeOutline.js:
(WebInspector.ElementsTreeElement.prototype._createTooltipForNode.setTooltip):
* inspector/front-end/ObjectPropertiesSection.js:
(WebInspector.ObjectPropertyTreeElement.prototype.update):
* inspector/front-end/PropertiesSidebarPane.js:
(WebInspector.PropertiesSidebarPane.prototype.update.nodePrototypesReady):
* inspector/front-end/RemoteObject.js:
(WebInspector.RemoteObject):
(WebInspector.RemoteObject.fromPrimitiveValue):
(WebInspector.RemoteObject.fromPayload):
(WebInspector.RemoteObject.prototype.get subtype):
(WebInspector.RemoteObject.prototype.callFunction):
(WebInspector.LocalJSONObject.prototype.get type):
(WebInspector.LocalJSONObject.prototype.get subtype):
* inspector/front-end/SourceFrame.js:
(WebInspector.SourceFrame.prototype._showPopup.showObjectPopup):
(WebInspector.SourceFrame.prototype._showPopup):
* inspector/front-end/inspector.js:
(WebInspector.log.logMessage):
(WebInspector.log):
(WebInspector.inspect):

LayoutTests:

* inspector/protocol/console-agent-expected.txt:
* inspector/protocol/runtime-agent-expected.txt:
* inspector/runtime/runtime-callFunctionOn.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (91664 => 91665)


--- trunk/LayoutTests/ChangeLog	2011-07-25 14:01:02 UTC (rev 91664)
+++ trunk/LayoutTests/ChangeLog	2011-07-25 14:24:55 UTC (rev 91665)
@@ -1,3 +1,14 @@
+2011-07-25  Pavel Feldman  <[email protected]>
+
+        Web Inspector: refactor remote object structure to contain value for primitive values.
+        https://bugs.webkit.org/show_bug.cgi?id=65103
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/protocol/console-agent-expected.txt:
+        * inspector/protocol/runtime-agent-expected.txt:
+        * inspector/runtime/runtime-callFunctionOn.html:
+
 2011-07-25  Csaba Osztrogonác  <[email protected]>
 
         [Qt] Lot of RenderTree mismatches in fast/multicol

Modified: trunk/LayoutTests/inspector/protocol/console-agent-expected.txt (91664 => 91665)


--- trunk/LayoutTests/inspector/protocol/console-agent-expected.txt	2011-07-25 14:01:02 UTC (rev 91664)
+++ trunk/LayoutTests/inspector/protocol/console-agent-expected.txt	2011-07-25 14:24:55 UTC (rev 91665)
@@ -64,7 +64,7 @@
             parameters : [
                 {
                     type : "string"
-                    description : "test"
+                    value : "test"
                 }
             ]
             stackTrace : <object>
@@ -85,7 +85,6 @@
     result : {
         result : {
             type : "undefined"
-            description : "undefined"
         }
     }
     id : <number>

Modified: trunk/LayoutTests/inspector/protocol/runtime-agent-expected.txt (91664 => 91665)


--- trunk/LayoutTests/inspector/protocol/runtime-agent-expected.txt	2011-07-25 14:01:02 UTC (rev 91664)
+++ trunk/LayoutTests/inspector/protocol/runtime-agent-expected.txt	2011-07-25 14:24:55 UTC (rev 91665)
@@ -18,9 +18,8 @@
 {
     result : {
         result : {
-            objectId : <string>
-            hasChildren : true
             type : "object"
+            objectId : <string>
             className : <string>
             description : "TestObject"
         }
@@ -45,9 +44,8 @@
 {
     result : {
         result : {
-            objectId : <string>
-            hasChildren : true
             type : "object"
+            objectId : <string>
             className : <string>
             description : "TestObject"
         }
@@ -73,7 +71,7 @@
     result : {
         result : {
             type : "string"
-            description : "callFunctionOn function works fine"
+            value : "callFunctionOn function works fine"
         }
     }
     id : <number>
@@ -142,22 +140,21 @@
                 name : "assignedByCallFunctionOn"
                 value : {
                     type : "string"
-                    description : "callFunctionOn function works fine"
+                    value : "callFunctionOn function works fine"
                 }
             }
             {
                 name : "assignedBySetPropertyValue"
                 value : {
                     type : "boolean"
-                    description : "true"
+                    value : true
                 }
             }
             {
                 name : "__proto__"
                 value : {
-                    objectId : <string>
-                    hasChildren : true
                     type : "object"
+                    objectId : <string>
                     className : <string>
                     description : "TestObject"
                 }

Modified: trunk/LayoutTests/inspector/runtime/runtime-callFunctionOn.html (91664 => 91665)


--- trunk/LayoutTests/inspector/runtime/runtime-callFunctionOn.html	2011-07-25 14:01:02 UTC (rev 91664)
+++ trunk/LayoutTests/inspector/runtime/runtime-callFunctionOn.html	2011-07-25 14:24:55 UTC (rev 91665)
@@ -26,7 +26,7 @@
 
             function step2(error, result, wasThrown)
             {
-                InspectorTest.addResult(result.description);
+                InspectorTest.addResult(result.value);
                 next();
             }
         },
@@ -48,7 +48,7 @@
 
             function step2(error, result, wasThrown)
             {
-                InspectorTest.addResult(result.description);
+                InspectorTest.addResult(result.value);
                 next();
             }
         }

Modified: trunk/Source/WebCore/ChangeLog (91664 => 91665)


--- trunk/Source/WebCore/ChangeLog	2011-07-25 14:01:02 UTC (rev 91664)
+++ trunk/Source/WebCore/ChangeLog	2011-07-25 14:24:55 UTC (rev 91665)
@@ -1,3 +1,38 @@
+2011-07-25  Pavel Feldman  <[email protected]>
+
+        Web Inspector: refactor remote object structure to contain value for primitive values.
+        https://bugs.webkit.org/show_bug.cgi?id=65103
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/InjectedScriptSource.js:
+        * inspector/Inspector.json:
+        * inspector/front-end/ConsoleView.js:
+        (WebInspector.ConsoleView.prototype._format):
+        (WebInspector.ConsoleView.prototype._formatAsArrayEntry):
+        (WebInspector.ConsoleMessage.prototype._format):
+        * inspector/front-end/ElementsTreeOutline.js:
+        (WebInspector.ElementsTreeElement.prototype._createTooltipForNode.setTooltip):
+        * inspector/front-end/ObjectPropertiesSection.js:
+        (WebInspector.ObjectPropertyTreeElement.prototype.update):
+        * inspector/front-end/PropertiesSidebarPane.js:
+        (WebInspector.PropertiesSidebarPane.prototype.update.nodePrototypesReady):
+        * inspector/front-end/RemoteObject.js:
+        (WebInspector.RemoteObject):
+        (WebInspector.RemoteObject.fromPrimitiveValue):
+        (WebInspector.RemoteObject.fromPayload):
+        (WebInspector.RemoteObject.prototype.get subtype):
+        (WebInspector.RemoteObject.prototype.callFunction):
+        (WebInspector.LocalJSONObject.prototype.get type):
+        (WebInspector.LocalJSONObject.prototype.get subtype):
+        * inspector/front-end/SourceFrame.js:
+        (WebInspector.SourceFrame.prototype._showPopup.showObjectPopup):
+        (WebInspector.SourceFrame.prototype._showPopup):
+        * inspector/front-end/inspector.js:
+        (WebInspector.log.logMessage):
+        (WebInspector.log):
+        (WebInspector.inspect):
+
 2011-07-25  Mikhail Naganov  <[email protected]>
 
         Web Inspector: [Chromium] Fix mixing of retaining path in heap profiler.

Modified: trunk/Source/WebCore/inspector/InjectedScriptSource.js (91664 => 91665)


--- trunk/Source/WebCore/inspector/InjectedScriptSource.js	2011-07-25 14:01:02 UTC (rev 91664)
+++ trunk/Source/WebCore/inspector/InjectedScriptSource.js	2011-07-25 14:24:55 UTC (rev 91665)
@@ -50,14 +50,31 @@
     this._objectGroups = {};
 }
 
+InjectedScript.primitiveTypes = {
+    undefined: true,
+    boolean: true,
+    number: true,
+    string: true
+}
+
 InjectedScript.prototype = {
+    isPrimitiveValue: function(object)
+    {
+        // FIXME(33716): typeof document.all is always 'undefined'.
+        return InjectedScript.primitiveTypes[typeof object] && !this._isHTMLAllCollection(object);
+    },
+
     wrapObject: function(object, groupName, canAccessInspectedWindow)
     {
         if (canAccessInspectedWindow)
             return this._wrapObject(object, groupName);
+
         var result = {};
         result.type = typeof object;
-        result.description = this._toString(object);
+        if (this._isPrimitiveValue(object))
+            result.value = object;
+        else
+            result.description = this._toString(object);
         return result;
     },
 
@@ -94,26 +111,34 @@
     _wrapObject: function(object, objectGroupName)
     {
         try {
-            if (typeof object === "object" || typeof object === "function" || this._isHTMLAllCollection(object)) {
-                var id = this._lastBoundObjectId++;
-                this._idToWrappedObject[id] = object;
-                var objectId = "{\"injectedScriptId\":" + injectedScriptId + ",\"id\":" + id + "}";
-                if (objectGroupName) {
-                    var group = this._objectGroups[objectGroupName];
-                    if (!group) {
-                        group = [];
-                        this._objectGroups[objectGroupName] = group;
-                    }
-                    group.push(id);
-                    this._idToObjectGroupName[id] = objectGroupName;
-                }
+            return new InjectedScript.RemoteObject(object, objectGroupName);
+        } catch (e) {
+            try {
+                var description = injectedScript._describe(e);
+            } catch (ex) {
+                var description = "<failed to convert exception to string>";
             }
-            return InjectedScript.RemoteObject.fromObject(object, objectId);
-        } catch (e) {
-            return InjectedScript.RemoteObject.fromException(e);
+            return new InjectedScript.RemoteObject(description);
         }
     },
 
+    _bind: function(object, objectGroupName)
+    {
+        var id = this._lastBoundObjectId++;
+        this._idToWrappedObject[id] = object;
+        var objectId = "{\"injectedScriptId\":" + injectedScriptId + ",\"id\":" + id + "}";
+        if (objectGroupName) {
+            var group = this._objectGroups[objectGroupName];
+            if (!group) {
+                group = [];
+                this._objectGroups[objectGroupName] = group;
+            }
+            group.push(id);
+            this._idToObjectGroupName[id] = objectGroupName;
+        }
+        return objectId;
+    },
+
     _parseObjectId: function(objectId)
     {
         return InjectedScriptHost.evaluate("(" + objectId + ")");
@@ -356,7 +381,7 @@
     {
         var parsedObjectId = this._parseObjectId(objectId);
         var object = this._objectForId(parsedObjectId);
-        if (!object || this._type(object) !== "node")
+        if (!object || this._subtype(object) !== "node")
             return null;
         return object;
     },
@@ -372,19 +397,18 @@
         return (typeof object === "undefined") && InjectedScriptHost.isHTMLAllCollection(object);
     },
 
-    _type: function(obj)
+    _subtype: function(obj)
     {
         if (obj === null)
             return "null";
 
         var type = typeof obj;
-        if (type !== "object" && type !== "function") {
-            // FIXME(33716): typeof document.all is always 'undefined'.
-            if (this._isHTMLAllCollection(obj))
-                return "array";
-            return type;
-        }
+        if (this.isPrimitiveValue(obj))
+            return null;
 
+        if (this._isHTMLAllCollection(obj))
+            return "array";
+
         var preciseType = InjectedScriptHost.type(obj);
         if (preciseType)
             return preciseType;
@@ -399,39 +423,39 @@
         }
 
         // If owning frame has navigated to somewhere else window properties will be undefined.
-        // In this case just return result of the typeof.
-        return type;
+        return null;
     },
 
     _describe: function(obj)
     {
-        var type = this._type(obj);
+        if (this.isPrimitiveValue(obj))
+            return null;
 
-        switch (type) {
-        case "object":
-            // Fall through.
-        case "node":
-            var result = InjectedScriptHost.internalConstructorName(obj);
-            if (result === "Object") {
-                // In Chromium DOM wrapper prototypes will have Object as their constructor name,
-                // get the real DOM wrapper name from the constructor property.
-                var constructorName = obj.constructor && obj.constructor.name;
-                if (constructorName)
-                    return constructorName;
-            }
-            return result;
-        case "array":
-            var className = InjectedScriptHost.internalConstructorName(obj);
+        var type = typeof obj;
+        if (type === "function")
+            return this._toString(obj);
+
+        // Type is object, get subtype.
+        var subtype = this._subtype(obj);
+
+        if (subtype === "regexp")
+            return this._toString(obj);
+
+        var className = InjectedScriptHost.internalConstructorName(obj);
+        if (subtype === "array") {
             if (typeof obj.length === "number")
                 className += "[" + obj.length + "]";
             return className;
-        case "string":
-            return obj;
-        case "function":
-            // Fall through.
-        default:
-            return this._toString(obj);
         }
+
+        if (className === "Object") {
+            // In Chromium DOM wrapper prototypes will have Object as their constructor name,
+            // get the real DOM wrapper name from the constructor property.
+            var constructorName = obj.constructor && obj.constructor.name;
+            if (constructorName)
+                return constructorName;
+        }
+        return className;
     },
 
     _toString: function(obj)
@@ -443,42 +467,26 @@
 
 var injectedScript = new InjectedScript();
 
-InjectedScript.RemoteObject = function(objectId, type, className, description, hasChildren)
+InjectedScript.RemoteObject = function(object, objectGroupName)
 {
-    if (objectId) {
-        this.objectId = objectId;
-        this.hasChildren = hasChildren;
+    this.type = typeof object;
+    if (injectedScript.isPrimitiveValue(object) || object === null) {
+        // We don't send undefined values over JSON.
+        if (typeof object !== "undefined")
+            this.value = object;
+        if (object === null)
+            this.subtype = "null";
+        return;
     }
-    this.type = type;
-    if (className)
-        this.className = className;
-    this.description = description;
-}
 
-InjectedScript.RemoteObject.fromException = function(e)
-{
-    try {
-        var description = injectedScript._describe(e);
-    } catch (ex) {
-        var description = "<failed to convert exception to string>";
-    }
-    return new InjectedScript.RemoteObject(null, "string", null, "[ Exception: " + description + " ]");
+    this.objectId = injectedScript._bind(object, objectGroupName);
+    var subtype = injectedScript._subtype(object)
+    if (subtype)
+        this.subtype = subtype;
+    this.className = InjectedScriptHost.internalConstructorName(object);
+    this.description = injectedScript._describe(object);
 }
 
-// This method may throw
-InjectedScript.RemoteObject.fromObject = function(object, objectId)
-{
-    var type = injectedScript._type(object);
-    var rawType = typeof object;
-    var hasChildren = (rawType === "object" && object !== null && (!!Object.getOwnPropertyNames(object).length || !!object.__proto__)) || rawType === "function";
-    var className;
-    // Avoid explicit assignment to undefined as its value can be overriden (see crbug.com/88414).
-    if (typeof object === "object" || typeof object === "function")
-        className = InjectedScriptHost.internalConstructorName(object);
-    var description = injectedScript._describe(object);
-    return new InjectedScript.RemoteObject(objectId, type, className, description, hasChildren);
-}
-
 InjectedScript.CallFrameProxy = function(ordinal, callFrame)
 {
     this.id = "{\"ordinal\":" + ordinal + ",\"injectedScriptId\":" + injectedScriptId + "}";
@@ -645,7 +653,7 @@
 
     copy: function(object)
     {
-        if (injectedScript._type(object) === "node")
+        if (injectedScript._subtype(object) === "node")
             object = object.outerHTML;
         InjectedScriptHost.copyText(object);
     },

Modified: trunk/Source/WebCore/inspector/Inspector.json (91664 => 91665)


--- trunk/Source/WebCore/inspector/Inspector.json	2011-07-25 14:01:02 UTC (rev 91664)
+++ trunk/Source/WebCore/inspector/Inspector.json	2011-07-25 14:24:55 UTC (rev 91665)
@@ -222,11 +222,12 @@
                 "type": "object",
                 "description": "Mirror object referencing original _javascript_ object.",
                 "properties": [
-                    { "name": "description", "type": "string", "description": "String representation of the object." },
-                    { "name": "hasChildren", "type": "boolean", "optional": true, "description": "True when this object can be queried for children." },
-                    { "name": "objectId", "type": "string", "optional": true, "description": "Unique object identifier (for non-primitive values)." },
-                    { "name": "type", "type": "string", "enum": ["object", "array", "function", "null", "node", "undefined", "string", "number", "boolean", "regexp", "date"], "description": "Object type." },
-                    { "name": "className", "type": "string", "optional": true, "description": "Object class name." }
+                    { "name": "type", "type": "string", "enum": ["object", "function", "undefined", "string", "number", "boolean"], "description": "Object type." },
+                    { "name": "subtype", "type": "string", "optional": true, "enum": ["array", "null", "node", "regexp", "date"], "description": "Object subtype hint. Specified for <code>object</code> type values only." },
+                    { "name": "className", "type": "string", "optional": true, "description": "Object class (constructor) name. Specified for <code>object</code> type values only." },
+                    { "name": "value", "type": "any", "optional": true, "description": "Remote object value (in case of primitive values)." },
+                    { "name": "description", "type": "string", "optional": true, "description": "String representation of the object." },
+                    { "name": "objectId", "type": "string", "optional": true, "description": "Unique object identifier (for non-primitive values)." }
                 ]
             },
             {

Modified: trunk/Source/WebCore/inspector/front-end/ConsoleView.js (91664 => 91665)


--- trunk/Source/WebCore/inspector/front-end/ConsoleView.js	2011-07-25 14:01:02 UTC (rev 91664)
+++ trunk/Source/WebCore/inspector/front-end/ConsoleView.js	2011-07-25 14:24:55 UTC (rev 91665)
@@ -615,11 +615,16 @@
 
     _format: function(output, forceObjectFormat)
     {
-        var isProxy = (output != null && typeof output === "object");
-        var type = (forceObjectFormat ? "object" : WebInspector.RemoteObject.type(output));
+        var type;
+        if (forceObjectFormat)
+            type = "object";
+        else if (output instanceof WebInspector.RemoteObject)
+            type = output.subtype || output.type;
+        else
+            type = typeof output;
 
         var formatter = this._customFormatters[type];
-        if (!formatter || !isProxy) {
+        if (!formatter) {
             formatter = this._formatvalue;
             output = output.description;
         }
@@ -707,7 +712,7 @@
     _formatAsArrayEntry: function(output)
     {
         // Prevent infinite expansion of cross-referencing arrays.
-        return this._format(output, WebInspector.RemoteObject.type(output) === "array");
+        return this._format(output, output.subtype && output.subtype === "array");
     }
 }
 
@@ -844,6 +849,10 @@
         // Formatting code below assumes that parameters are all wrappers whereas frontend console
         // API allows passing arbitrary values as messages (strings, numbers, etc.). Wrap them here.
         for (var i = 0; i < parameters.length; ++i) {
+            // FIXME: Only pass runtime wrappers here.
+            if (parameters[i] instanceof WebInspector.RemoteObject)
+                continue;
+
             if (typeof parameters[i] === "object")
                 parameters[i] = WebInspector.RemoteObject.fromPayload(parameters[i]);
             else

Modified: trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js (91664 => 91665)


--- trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js	2011-07-25 14:01:02 UTC (rev 91664)
+++ trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js	2011-07-25 14:24:55 UTC (rev 91665)
@@ -579,9 +579,9 @@
         if (!node.nodeName() || node.nodeName().toLowerCase() !== "img")
             return;
 
-        function setTooltip(error, result, wasThrown)
+        function setTooltip(result)
         {
-            if (error || wasThrown || result.type !== "string")
+            if (!result || result.type !== "string")
                 return;
 
             try {

Modified: trunk/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js (91664 => 91665)


--- trunk/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js	2011-07-25 14:01:02 UTC (rev 91664)
+++ trunk/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js	2011-07-25 14:24:55 UTC (rev 91665)
@@ -204,7 +204,7 @@
             this.valueElement.addStyleClass("error");
         if (this.property.value.type)
             this.valueElement.addStyleClass("console-formatted-" + this.property.value.type);
-        if (this.property.value.type === "node")
+        if (this.property.value.subtype === "node")
             this.valueElement.addEventListener("contextmenu", this._contextMenuEventFired.bind(this), false);
 
         this.listItemElement.removeChildren();

Modified: trunk/Source/WebCore/inspector/front-end/PropertiesSidebarPane.js (91664 => 91665)


--- trunk/Source/WebCore/inspector/front-end/PropertiesSidebarPane.js	2011-07-25 14:01:02 UTC (rev 91664)
+++ trunk/Source/WebCore/inspector/front-end/PropertiesSidebarPane.js	2011-07-25 14:24:55 UTC (rev 91665)
@@ -65,11 +65,10 @@
             object.release();
         }
 
-        function nodePrototypesReady(error, objectPayload, wasThrown)
+        function nodePrototypesReady(object)
         {
-            if (error || wasThrown)
+            if (!object)
                 return;
-            var object = WebInspector.RemoteObject.fromPayload(objectPayload);
             object.getOwnProperties(fillSection.bind(this));
         }
 

Modified: trunk/Source/WebCore/inspector/front-end/RemoteObject.js (91664 => 91665)


--- trunk/Source/WebCore/inspector/front-end/RemoteObject.js	2011-07-25 14:01:02 UTC (rev 91664)
+++ trunk/Source/WebCore/inspector/front-end/RemoteObject.js	2011-07-25 14:24:55 UTC (rev 91665)
@@ -28,17 +28,25 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.RemoteObject = function(objectId, type, description, hasChildren)
+WebInspector.RemoteObject = function(objectId, type, subtype, value, description)
 {
-    this._objectId = objectId;
     this._type = type;
-    this._description = description;
-    this._hasChildren = hasChildren;
+    if (objectId) {
+        // handle
+        this._objectId = objectId;
+        this._subtype = subtype;
+        this._description = description;
+        this._hasChildren = true;
+    } else {
+        // Primitive
+        this._description = value + "";
+        this._hasChildren = false;
+    }
 }
 
 WebInspector.RemoteObject.fromPrimitiveValue = function(value)
 {
-    return new WebInspector.RemoteObject(null, typeof value, value);
+    return new WebInspector.RemoteObject(null, typeof value, null, value);
 }
 
 WebInspector.RemoteObject.fromLocalObject = function(value)
@@ -63,10 +71,9 @@
 
 WebInspector.RemoteObject.fromPayload = function(payload)
 {
-    if (typeof payload === "object")
-        return new WebInspector.RemoteObject(payload.objectId, payload.type, payload.description, payload.hasChildren);
-    // FIXME: make sure we only get here with real payloads in the new DebuggerAgent.js.
-    return payload;
+    console.assert(typeof payload === "object", "Remote object payload should only be an object");
+
+    return new WebInspector.RemoteObject(payload.objectId, payload.type, payload.subtype, payload.value, payload.description);
 }
 
 WebInspector.RemoteObject.type = function(remoteObject)
@@ -92,6 +99,11 @@
         return this._type;
     },
 
+    get subtype()
+    {
+        return this._subtype;
+    },
+
     get description()
     {
         return this._description;
@@ -150,7 +162,12 @@
 
     callFunction: function(functionDeclaration, callback)
     {
-        RuntimeAgent.callFunctionOn(this._objectId, functionDeclaration.toString(), undefined, callback);
+        function mycallback(error, result, wasThrown)
+        {
+            callback((error || wasThrown) ? null : WebInspector.RemoteObject.fromPayload(result));
+        }
+
+        RuntimeAgent.callFunctionOn(this._objectId, functionDeclaration.toString(), undefined, mycallback);
     },
 
     release: function()
@@ -232,11 +249,18 @@
 
     get type()
     {
+        return typeof this._value;
+    },
+
+    get subtype()
+    {
         if (this._value === null)
             return "null";
+
         if (this._value instanceof Array)
             return "array";
-        return typeof this._value;
+
+        return undefined;
     },
 
     get hasChildren()

Modified: trunk/Source/WebCore/inspector/front-end/SourceFrame.js (91664 => 91665)


--- trunk/Source/WebCore/inspector/front-end/SourceFrame.js	2011-07-25 14:01:02 UTC (rev 91664)
+++ trunk/Source/WebCore/inspector/front-end/SourceFrame.js	2011-07-25 14:24:55 UTC (rev 91665)
@@ -788,7 +788,7 @@
                 return;
 
             var popupContentElement = null;
-            if (result.type !== "object" && result.type !== "node" && result.type !== "array") {
+            if (result.type !== "object") {
                 popupContentElement = document.createElement("span");
                 popupContentElement.className = "monospace console-formatted-" + result.type;
                 popupContentElement.style.whiteSpace = "pre";

Modified: trunk/Source/WebCore/inspector/front-end/inspector.js (91664 => 91665)


--- trunk/Source/WebCore/inspector/front-end/inspector.js	2011-07-25 14:01:02 UTC (rev 91664)
+++ trunk/Source/WebCore/inspector/front-end/inspector.js	2011-07-25 14:24:55 UTC (rev 91665)
@@ -1128,7 +1128,7 @@
         WebInspector.log.repeatCount = repeatCount;
 
         // ConsoleMessage expects a proxy object
-        message = new WebInspector.RemoteObject.fromPrimitiveValue(message);
+        message = WebInspector.RemoteObject.fromPrimitiveValue(message);
 
         // post the message
         var msg = new WebInspector.ConsoleMessage(
@@ -1168,7 +1168,7 @@
 WebInspector.inspect = function(payload, hints)
 {
     var object = WebInspector.RemoteObject.fromPayload(payload);
-    if (object.type === "node") {
+    if (object.subtype === "node") {
         // Request node from backend and focus it.
         object.pushNodeToFrontend(WebInspector.updateFocusedNode.bind(WebInspector), object.release.bind(object));
         return;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to