Changeset 65241 in webkit


Ignore:
Timestamp:
Aug 12, 2010 6:31:30 AM (14 years ago)
Author:
pfeldman@chromium.org
Message:

2010-08-12 Pavel Feldman <pfeldman@chromium.org>

Reviewed by Yury Semikhatsky.

Web Inspector: brush up object proxies, introduce remote object model.
https://bugs.webkit.org/show_bug.cgi?id=43847

  • WebCore.gypi:
  • WebCore.vcproj/WebCore.vcproj:
  • inspector/front-end/AuditRules.js: (WebInspector.AuditRules.CssInHeadRule.prototype.doRun): (WebInspector.AuditRules.StylesScriptsOrderRule.prototype.doRun):
  • inspector/front-end/ConsoleView.js: (WebInspector.ConsoleView.prototype.doEvalInWindow): (WebInspector.ConsoleView.prototype._enterKeyPressed.printResult): (WebInspector.ConsoleView.prototype._enterKeyPressed): (WebInspector.ConsoleView.prototype._format): (WebInspector.ConsoleView.prototype._formatnode): (WebInspector.ConsoleView.prototype._formatarray): (WebInspector.ConsoleView.prototype._formatAsArrayEntry): (WebInspector.ConsoleMessage.prototype._format): (WebInspector.ConsoleCommandResult):
  • inspector/front-end/DOMAgent.js: (WebInspector.DOMNode):
  • inspector/front-end/ElementsTreeOutline.js: (WebInspector.ElementsTreeElement.prototype._createTooltipForNode):
  • inspector/front-end/EventListenersSidebarPane.js:
  • inspector/front-end/InjectedScript.js: (injectedScriptConstructor): (injectedScriptConstructor.):
  • inspector/front-end/ObjectPropertiesSection.js: (WebInspector.ObjectPropertiesSection.prototype.update): (WebInspector.ObjectPropertiesSection.prototype.updateProperties): (WebInspector.ObjectPropertyTreeElement.prototype.onpopulate): (WebInspector.ObjectPropertyTreeElement.prototype.update): (WebInspector.ObjectPropertyTreeElement.prototype.applyExpression):
  • inspector/front-end/ObjectProxy.js: Removed.
  • inspector/front-end/PropertiesSidebarPane.js: (WebInspector.PropertiesSidebarPane.prototype.update.callback):
  • inspector/front-end/RemoteObject.js: Added. (WebInspector.RemoteObjectId): (WebInspector.RemoteObject): (WebInspector.RemoteObject.fromPrimitiveValue): (WebInspector.RemoteObject.fromErrorMessage): (WebInspector.RemoteObject.fromNode): (WebInspector.RemoteObject.fromPayload): (WebInspector.RemoteObject.type): (WebInspector.RemoteObject.prototype.get objectId): (WebInspector.RemoteObject.prototype.get type): (WebInspector.RemoteObject.prototype.get description): (WebInspector.RemoteObject.prototype.get hasChildren): (WebInspector.RemoteObject.prototype.isError): (WebInspector.RemoteObject.prototype.getPropertyValueDescriptions): (WebInspector.RemoteObject.prototype.getOwnProperties): (WebInspector.RemoteObject.prototype.getProperties.remoteObjectBinder): (WebInspector.RemoteObjectProperty):
  • inspector/front-end/ScopeChainSidebarPane.js: (WebInspector.ScopeChainSidebarPane.prototype.update):
  • inspector/front-end/ScriptsPanel.js: (WebInspector.ScriptsPanel.prototype.evaluateInSelectedCallFrame.updatingCallbackWrapper): (WebInspector.ScriptsPanel.prototype.evaluateInSelectedCallFrame): (WebInspector.ScriptsPanel.prototype.doEvalInCallFrame):
  • inspector/front-end/SourceFrame.js: (WebInspector.SourceFrame.prototype._showPopup.evaluateCallback): (WebInspector.SourceFrame.prototype._showPopup): (WebInspector.SourceFrame.prototype._evalSelectionInCallFrame):
  • inspector/front-end/WatchExpressionsSidebarPane.js: (WebInspector.WatchExpressionsSection.prototype.update): (WebInspector.WatchExpressionTreeElement.prototype.update):
  • inspector/front-end/WebKit.qrc:
  • inspector/front-end/inspector.html:
  • inspector/front-end/inspector.js: (WebInspector.log.logMessage): (WebInspector.log):
  • inspector/front-end/utilities.js:

2010-08-12 Pavel Feldman <pfeldman@chromium.org>

Reviewed by Yury Semikhatsky.

Web Inspector: brush up object proxies, introduce remote object model.
https://bugs.webkit.org/show_bug.cgi?id=43847

  • inspector/console-dir-expected.txt:
  • inspector/console-dir-global.html:
  • inspector/console-dir.html:
  • inspector/console-format-collections-expected.txt:
  • inspector/console-format-expected.txt:
Location:
trunk
Files:
1 deleted
26 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r65239 r65241  
     12010-08-12  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: brush up object proxies, introduce remote object model.
     6        https://bugs.webkit.org/show_bug.cgi?id=43847
     7
     8        * inspector/console-dir-expected.txt:
     9        * inspector/console-dir-global.html:
     10        * inspector/console-dir.html:
     11        * inspector/console-format-collections-expected.txt:
     12        * inspector/console-format-expected.txt:
     13
    1142010-08-12  Philippe Normand  <pnormand@igalia.com>
    215
  • trunk/LayoutTests/inspector/console-dir-expected.txt

    r54769 r65241  
    44Tests that console logging dumps proper messages.
    55
    6 Array
    7 >>> 0 = "test1"
    8 >>> 1 = "test2"
    9 >>> length = 2
    10 >>> __proto__ = Array
    11 NodeList
    12 >>> 0 = HTMLHtmlElement
    13 >>> constructor = NodeListConstructor
    14 >>> length = 1
    15 >>> __proto__ = NodeListPrototype
     6Array[2]
     7    0 = "test1"
     8    1 = "test2"
     9    length = 2
     10    __proto__ = Array[0]
     11NodeList[1]
     12    0 = HTMLHtmlElement
     13    constructor = NodeListConstructor
     14    length = 1
     15    __proto__ = NodeListPrototype
    1616XPathResult
    17 >>> booleanValue = Error: TYPE_ERR: DOM XPath Exception 52
    18 >>> constructor = XPathResultConstructor
    19 >>> invalidIteratorState = false
    20 >>> numberValue = Error: TYPE_ERR: DOM XPath Exception 52
    21 >>> resultType = 4
    22 >>> singleNodeValue = Error: TYPE_ERR: DOM XPath Exception 52
    23 >>> snapshotLength = Error: TYPE_ERR: DOM XPath Exception 52
    24 >>> stringValue = Error: TYPE_ERR: DOM XPath Exception 52
    25 >>> __proto__ = XPathResultPrototype
     17    booleanValue = Error: TYPE_ERR: DOM XPath Exception 52
     18    constructor = XPathResultConstructor
     19    invalidIteratorState = false
     20    numberValue = Error: TYPE_ERR: DOM XPath Exception 52
     21    resultType = 4
     22    singleNodeValue = Error: TYPE_ERR: DOM XPath Exception 52
     23    snapshotLength = Error: TYPE_ERR: DOM XPath Exception 52
     24    stringValue = Error: TYPE_ERR: DOM XPath Exception 52
     25    __proto__ = XPathResultPrototype
    2626
  • trunk/LayoutTests/inspector/console-dir-global.html

    r61010 r65241  
    2727    function evalCallback(result)
    2828    {
    29         if (result.isException)
    30             testController.notifyDone("Exception:" + result.value);
    31         var objectProxy = result.value;
    32         InjectedScriptAccess.getDefault().getProperties(objectProxy, false, true, getPropertiesCallback);
     29        if (result.type === "error")
     30            testController.notifyDone("Exception:" + result);
     31        var objectProxy = WebInspector.RemoteObject.fromPayload(result);
     32        objectProxy.getProperties(false, true, getPropertiesCallback);
    3333    }
    3434
  • trunk/LayoutTests/inspector/console-dir.html

    r58403 r65241  
    2121            var properties = result[i].properties;
    2222            for (var j = 0; properties && j < properties.length; ++j)
    23                 output(">>> " + properties[j].name + " = " + properties[j].value.description);
     23                output("    " + properties[j].name + " = " + properties[j].value._description);
    2424        }
    2525        if (!noNotifyDone)
  • trunk/LayoutTests/inspector/console-format-collections-expected.txt

    r60562 r65241  
    1616console-format-collections.html:31[<select id="sel" name="sel">…</select>, <input type="radio" name="x" value="x1">, <input type="radio" name="x" value="x2">]
    1717console-format-collections.html:35[<input type="radio" name="x" value="x1">, <input type="radio" name="x" value="x2">]
    18 console-format-collections.html:41[1, Array]
     18console-format-collections.html:41[1, Array[2]]
    1919
  • trunk/LayoutTests/inspector/console-format-expected.txt

    r60562 r65241  
    4040console-format.html:20["test", "test2", undefined, undefined, "test4"]
    4141console-format.html:21["test", "test2", undefined, undefined, "test4"]
    42 console-format.html:22Array
     42console-format.html:22Array[5]
    4343console-format.html:52/^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i
    4444console-format.html:53[/^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i]
  • trunk/WebCore/ChangeLog

    r65240 r65241  
     12010-08-12  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: brush up object proxies, introduce remote object model.
     6        https://bugs.webkit.org/show_bug.cgi?id=43847
     7
     8        * WebCore.gypi:
     9        * WebCore.vcproj/WebCore.vcproj:
     10        * inspector/front-end/AuditRules.js:
     11        (WebInspector.AuditRules.CssInHeadRule.prototype.doRun):
     12        (WebInspector.AuditRules.StylesScriptsOrderRule.prototype.doRun):
     13        * inspector/front-end/ConsoleView.js:
     14        (WebInspector.ConsoleView.prototype.doEvalInWindow):
     15        (WebInspector.ConsoleView.prototype._enterKeyPressed.printResult):
     16        (WebInspector.ConsoleView.prototype._enterKeyPressed):
     17        (WebInspector.ConsoleView.prototype._format):
     18        (WebInspector.ConsoleView.prototype._formatnode):
     19        (WebInspector.ConsoleView.prototype._formatarray):
     20        (WebInspector.ConsoleView.prototype._formatAsArrayEntry):
     21        (WebInspector.ConsoleMessage.prototype._format):
     22        (WebInspector.ConsoleCommandResult):
     23        * inspector/front-end/DOMAgent.js:
     24        (WebInspector.DOMNode):
     25        * inspector/front-end/ElementsTreeOutline.js:
     26        (WebInspector.ElementsTreeElement.prototype._createTooltipForNode):
     27        * inspector/front-end/EventListenersSidebarPane.js:
     28        * inspector/front-end/InjectedScript.js:
     29        (injectedScriptConstructor):
     30        (injectedScriptConstructor.):
     31        * inspector/front-end/ObjectPropertiesSection.js:
     32        (WebInspector.ObjectPropertiesSection.prototype.update):
     33        (WebInspector.ObjectPropertiesSection.prototype.updateProperties):
     34        (WebInspector.ObjectPropertyTreeElement.prototype.onpopulate):
     35        (WebInspector.ObjectPropertyTreeElement.prototype.update):
     36        (WebInspector.ObjectPropertyTreeElement.prototype.applyExpression):
     37        * inspector/front-end/ObjectProxy.js: Removed.
     38        * inspector/front-end/PropertiesSidebarPane.js:
     39        (WebInspector.PropertiesSidebarPane.prototype.update.callback):
     40        * inspector/front-end/RemoteObject.js: Added.
     41        (WebInspector.RemoteObjectId):
     42        (WebInspector.RemoteObject):
     43        (WebInspector.RemoteObject.fromPrimitiveValue):
     44        (WebInspector.RemoteObject.fromErrorMessage):
     45        (WebInspector.RemoteObject.fromNode):
     46        (WebInspector.RemoteObject.fromPayload):
     47        (WebInspector.RemoteObject.type):
     48        (WebInspector.RemoteObject.prototype.get objectId):
     49        (WebInspector.RemoteObject.prototype.get type):
     50        (WebInspector.RemoteObject.prototype.get description):
     51        (WebInspector.RemoteObject.prototype.get hasChildren):
     52        (WebInspector.RemoteObject.prototype.isError):
     53        (WebInspector.RemoteObject.prototype.getPropertyValueDescriptions):
     54        (WebInspector.RemoteObject.prototype.getOwnProperties):
     55        (WebInspector.RemoteObject.prototype.getProperties.remoteObjectBinder):
     56        (WebInspector.RemoteObjectProperty):
     57        * inspector/front-end/ScopeChainSidebarPane.js:
     58        (WebInspector.ScopeChainSidebarPane.prototype.update):
     59        * inspector/front-end/ScriptsPanel.js:
     60        (WebInspector.ScriptsPanel.prototype.evaluateInSelectedCallFrame.updatingCallbackWrapper):
     61        (WebInspector.ScriptsPanel.prototype.evaluateInSelectedCallFrame):
     62        (WebInspector.ScriptsPanel.prototype.doEvalInCallFrame):
     63        * inspector/front-end/SourceFrame.js:
     64        (WebInspector.SourceFrame.prototype._showPopup.evaluateCallback):
     65        (WebInspector.SourceFrame.prototype._showPopup):
     66        (WebInspector.SourceFrame.prototype._evalSelectionInCallFrame):
     67        * inspector/front-end/WatchExpressionsSidebarPane.js:
     68        (WebInspector.WatchExpressionsSection.prototype.update):
     69        (WebInspector.WatchExpressionTreeElement.prototype.update):
     70        * inspector/front-end/WebKit.qrc:
     71        * inspector/front-end/inspector.html:
     72        * inspector/front-end/inspector.js:
     73        (WebInspector.log.logMessage):
     74        (WebInspector.log):
     75        * inspector/front-end/utilities.js:
     76
    1772010-08-12  Ben Murdoch  <benm@google.com>
    278
  • trunk/WebCore/WebCore.gypi

    r65234 r65241  
    41144114            'inspector/front-end/MetricsSidebarPane.js',
    41154115            'inspector/front-end/Object.js',
    4116             'inspector/front-end/ObjectProxy.js',
    41174116            'inspector/front-end/ObjectPropertiesSection.js',
    41184117            'inspector/front-end/Panel.js',
     
    41254124            'inspector/front-end/PropertiesSection.js',
    41264125            'inspector/front-end/PropertiesSidebarPane.js',
     4126            'inspector/front-end/RemoteObject.js',
    41274127            'inspector/front-end/Resource.js',
    41284128            'inspector/front-end/ResourceCategory.js',
  • trunk/WebCore/WebCore.vcproj/WebCore.vcproj

    r65234 r65241  
    5126151261                                </File>
    5126251262                                <File
    51263                                         RelativePath="..\inspector\front-end\ObjectProxy.js"
    51264                                         >
    51265                                 </File>
    51266                                 <File
    5126751263                                        RelativePath="..\inspector\front-end\Panel.js"
    5126851264                                        >
     
    5130251298                                <File
    5130351299                                        RelativePath="..\inspector\front-end\PropertiesSidebarPane.js"
     51300                                        >
     51301                                </File>
     51302                                <File
     51303                                        RelativePath="..\inspector\front-end\RemoteObject.js"
    5130451304                                        >
    5130551305                                </File>
  • trunk/WebCore/inspector/front-end/AuditRules.js

    r59688 r65241  
    725725    doRun: function(resources, result, callback)
    726726    {
    727         function evalCallback(evalResult, isException)
    728         {
    729             if (isException || !evalResult)
     727        function evalCallback(evalResult)
     728        {
     729            if (!evalResult)
    730730                return callback(null);
    731731
     
    801801    doRun: function(resources, result, callback)
    802802    {
    803         function evalCallback(resultValue, isException)
    804         {
    805             if (isException || !resultValue)
     803        function evalCallback(resultValue)
     804        {
     805            if (!resultValue)
    806806                return callback(null);
    807807
  • trunk/WebCore/inspector/front-end/ConsoleView.js

    r65052 r65241  
    512512        function evalCallback(result)
    513513        {
    514             callback(result.value, result.isException);
     514            callback(WebInspector.RemoteObject.fromPayload(result));
    515515        };
    516516        InjectedScriptAccess.getDefault().evaluate(expression, objectGroup, evalCallback);
     
    535535
    536536        var self = this;
    537         function printResult(result, exception)
     537        function printResult(result)
    538538        {
    539539            self.prompt.history.push(str);
     
    543543            WebInspector.applicationSettings.consoleHistory = self.prompt.history.slice(-30);
    544544
    545             self.addMessage(new WebInspector.ConsoleCommandResult(result, exception, commandMessage));
     545            self.addMessage(new WebInspector.ConsoleCommandResult(result, commandMessage));
    546546        }
    547547        this.evalInInspectedWindow(str, "console", printResult);
     
    551551    {
    552552        var isProxy = (output != null && typeof output === "object");
    553         var type = (forceObjectFormat ? "object" : Object.proxyType(output));
     553        var type = (forceObjectFormat ? "object" : WebInspector.RemoteObject.type(output));
    554554
    555555        var formatter = this._customFormatters[type];
     
    590590        }
    591591
    592         InjectedScriptAccess.get(object.injectedScriptId).pushNodeToFrontend(object, printNode);
     592        InjectedScriptAccess.get(object.objectId.injectedScriptId).pushNodeToFrontend(object.objectId, printNode);
    593593    },
    594594
    595595    _formatarray: function(arr, elem)
    596596    {
    597         InjectedScriptAccess.get(arr.injectedScriptId).getProperties(arr, false, false, this._printArray.bind(this, elem));
     597        arr.getOwnProperties(false, this._printArray.bind(this, elem));
    598598    },
    599599
     
    638638    _formatAsArrayEntry: function(output)
    639639    {
    640         var type = Object.proxyType(output);
    641640        // Prevent infinite expansion of cross-referencing arrays.
    642         return this._format(output, type === "array");
     641        return this._format(output, WebInspector.RemoteObject.type(output) === "array");
    643642    }
    644643}
     
    729728        // Formatting code below assumes that parameters are all wrappers whereas frontend console
    730729        // API allows passing arbitrary values as messages (strings, numbers, etc.). Wrap them here.
    731         for (var i = 0; i < parameters.length; ++i)
    732             if (typeof parameters[i] !== "object" && typeof parameters[i] !== "function")
    733                 parameters[i] = WebInspector.ObjectProxy.wrapPrimitiveValue(parameters[i]);
     730        for (var i = 0; i < parameters.length; ++i) {
     731            if (typeof parameters[i] === "object")
     732                parameters[i] = WebInspector.RemoteObject.fromPayload(parameters[i]);
     733            else
     734                parameters[i] = WebInspector.RemoteObject.fromPrimitiveValue(parameters[i]);
     735        }
    734736
    735737        // There can be string log and string eval result. We distinguish between them based on message type.
    736         var shouldFormatMessage = Object.proxyType(parameters[0]) === "string" && this.type !== WebInspector.ConsoleMessage.MessageType.Result;
     738        var shouldFormatMessage = WebInspector.RemoteObject.type(parameters[0]) === "string" && this.type !== WebInspector.ConsoleMessage.MessageType.Result;
    737739
    738740        // Multiple parameters with the first being a format string. Save unused substitutions.
     
    10491051}
    10501052
    1051 WebInspector.ConsoleCommandResult = function(result, exception, originatingCommand)
     1053WebInspector.ConsoleCommandResult = function(result, originatingCommand)
    10521054{
    1053     var level = (exception ? WebInspector.ConsoleMessage.MessageLevel.Error : WebInspector.ConsoleMessage.MessageLevel.Log);
    1054     var message = result;
    1055     if (exception) {
    1056         // Distinguish between strings and errors (no need to quote latter).
    1057         message = WebInspector.ObjectProxy.wrapPrimitiveValue(result);
    1058         message.type = "error";
    1059     }
    1060     var line = (exception ? result.line : -1);
    1061     var url = (exception ? result.sourceURL : null);
    1062 
     1055    var level = (result.isError() ? WebInspector.ConsoleMessage.MessageLevel.Error : WebInspector.ConsoleMessage.MessageLevel.Log);
    10631056    this.originatingCommand = originatingCommand;
    1064 
    1065     WebInspector.ConsoleMessage.call(this, WebInspector.ConsoleMessage.MessageSource.JS, WebInspector.ConsoleMessage.MessageType.Result, level, line, url, null, 1, null, [message]);
     1057    WebInspector.ConsoleMessage.call(this, WebInspector.ConsoleMessage.MessageSource.JS, WebInspector.ConsoleMessage.MessageType.Result, level, -1, null, null, 1, null, [result]);
    10661058}
    10671059
  • trunk/WebCore/inspector/front-end/DOMAgent.js

    r65052 r65241  
    3434
    3535    this.id = payload.id;
    36     // injectedScriptId is a node is for DOM nodes which should be converted
    37     // to corresponding InjectedScript by the inspector backend. We indicate
    38     // this by making injectedScriptId negative.
    39     this.injectedScriptId = -payload.id;
    4036    this.nodeType = payload.nodeType;
    4137    this.nodeName = payload.nodeName;
  • trunk/WebCore/inspector/front-end/ElementsPanel.js

    r64770 r65241  
    256256        this._searchQuery = query;
    257257
    258         InspectorBackend.performSearch(whitespaceTrimmedQuery);
     258        InspectorBackend.performSearch(whitespaceTrimmedQuery, false);
    259259    },
    260260
  • trunk/WebCore/inspector/front-end/ElementsTreeOutline.js

    r64973 r65241  
    414414                this.tooltip = WebInspector.UIString("%d × %d pixels (Natural: %d × %d pixels)", properties.offsetWidth, properties.offsetHeight, properties.naturalWidth, properties.naturalHeight);
    415415        }
    416         var objectProxy = new WebInspector.ObjectProxy(node.injectedScriptId, node.id);
    417         WebInspector.ObjectProxy.getPropertiesAsync(objectProxy, ["naturalHeight", "naturalWidth", "offsetHeight", "offsetWidth"], setTooltip.bind(this));
     416        WebInspector.RemoteObject.fromNode(node).getPropertyValueDescriptions(["naturalHeight", "naturalWidth", "offsetHeight", "offsetWidth"], setTooltip.bind(this));
    418417    },
    419418
  • trunk/WebCore/inspector/front-end/EventListenersSidebarPane.js

    r61014 r65241  
    195195            var value = this.eventListener[propertyName];
    196196            if (value instanceof WebInspector.DOMNode)
    197                 value = new WebInspector.ObjectProxy(value.injectedScriptId, value.id, [], appropriateSelectorForNode(value), true);
     197                value = WebInspector.RemoteObject.fromNode(value);
    198198            else
    199                 value = WebInspector.ObjectProxy.wrapPrimitiveValue(value);
    200             properties.push(new WebInspector.ObjectPropertyProxy(propertyName, value));
     199                value = WebInspector.RemoteObject.fromPrimitiveValue(value);
     200            properties.push(new WebInspector.RemoteObjectProperty(propertyName, value));
    201201        }
    202202        this.updateProperties(properties);
  • trunk/WebCore/inspector/front-end/InjectedScript.js

    r65072 r65241  
    5151        if (typeof object === "object" || typeof object === "function" || InjectedScript._isHTMLAllCollection(object)) {
    5252            var id = InjectedScript.lastBoundObjectId++;
    53             objectId = "object#" + id;
    54             InjectedScript.idToWrappedObject[objectId] = object;
     53            objectId = id;
     54            InjectedScript.idToWrappedObject[id] = object;
    5555
    5656            var group = InjectedScript.objectGroups[objectGroupName];
     
    5959                InjectedScript.objectGroups[objectGroupName] = group;
    6060            }
    61             group.push(objectId);
    62         }
    63         return InjectedScript.createProxyObject(object, objectId);
     61            group.push(id);
     62            objectId = new InjectedScript.RemoteObjectId("jsobject", id);
     63        }
     64        return InjectedScript.RemoteObject.fromObject(object, objectId);
    6465    } catch (e) {
    65         return InjectedScript.createProxyObject("[ Exception: " + e.toString() + " ]");
    66     }
    67     return InjectedScript.createProxyObject(object, objectId);
     66        return InjectedScript.RemoteObject.fromObject("[ Exception: " + e.toString() + " ]");
     67    }
    6868};
    6969
     
    111111}
    112112
    113 InjectedScript.getProperties = function(objectProxy, ignoreHasOwnProperty, abbreviate)
    114 {
    115     var object = InjectedScript._resolveObject(objectProxy);
     113InjectedScript.getProperties = function(objectId, ignoreHasOwnProperty, abbreviate)
     114{
     115    var object = InjectedScript._objectForId(objectId);
    116116    if (!InjectedScript._isDefined(object))
    117117        return false;
     
    128128        var property = {};
    129129        property.name = propertyName + "";
    130         property.parentObjectProxy = objectProxy;
    131130        var isGetter = object["__lookupGetter__"] && object.__lookupGetter__(propertyName);
    132131        if (!isGetter) {
    133132            try {
    134133                var childObject = object[propertyName];
    135                 var childObjectProxy = new InjectedScript.createProxyObject(childObject, objectProxy.objectId, abbreviate);
    136                 childObjectProxy.path = objectProxy.path ? objectProxy.path.slice() : [];
    137                 childObjectProxy.path.push(propertyName);
     134                var path = objectId.path ? objectId.path.slice() : [];
     135                path.push(propertyName);
     136                var childObjectId = new InjectedScript.RemoteObjectId(objectId.type, objectId.value, path);
     137                var childObjectProxy = new InjectedScript.RemoteObject.fromObject(childObject, childObjectId, abbreviate);
    138138                property.value = childObjectProxy;
    139139            } catch(e) {
    140                 property.value = { description: e.toString() };
    141                 property.isError = true;
     140                property.value = new InjectedScript.RemoteObject.fromException(e);
    142141            }
    143142        } else {
    144143            // FIXME: this should show something like "getter" (bug 16734).
    145             property.value = { description: "\u2014" }; // em dash
     144            property.value = new InjectedScript.RemoteObject.fromObject("\u2014"); // em dash
    146145            property.isGetter = true;
    147146        }
     
    151150}
    152151
    153 InjectedScript.setPropertyValue = function(objectProxy, propertyName, expression)
    154 {
    155     var object = InjectedScript._resolveObject(objectProxy);
     152InjectedScript.setPropertyValue = function(objectId, propertyName, expression)
     153{
     154    var object = InjectedScript._objectForId(objectId);
    156155    if (!InjectedScript._isDefined(object))
    157156        return false;
     
    259258InjectedScript._evaluateAndWrap = function(evalFunction, object, expression, objectGroup, dontUseCommandLineAPI)
    260259{
    261     var result = {};
    262260    try {
    263         result.value = InjectedScript.wrapObject(InjectedScript._evaluateOn(evalFunction, object, expression, dontUseCommandLineAPI), objectGroup);
    264 
    265         // Handle error that might have happened while describing result.
    266         if (result.value.errorText) {
    267             result.value = result.value.errorText;
    268             result.isException = true;
    269         }
     261        return InjectedScript.wrapObject(InjectedScript._evaluateOn(evalFunction, object, expression, dontUseCommandLineAPI), objectGroup);
    270262    } catch (e) {
    271         result.value = e.toString();
    272         result.isException = true;
    273     }
    274     return result;
     263        return InjectedScript.RemoteObject.fromException(e);
     264    }
    275265}
    276266
     
    343333}
    344334
    345 InjectedScript._resolveObject = function(objectProxy)
    346 {
    347     var object = InjectedScript._objectForId(objectProxy.objectId);
    348     var path = objectProxy.path;
    349 
    350     // Follow the property path.
    351     for (var i = 0; InjectedScript._isDefined(object) && path && i < path.length; ++i)
    352         object = object[path[i]];
    353 
    354     return object;
    355 }
    356 
    357335InjectedScript._nodeForId = function(nodeId)
    358336{
     
    368346    // - strings point to console objects cached in InspectorController for lazy evaluation upon them
    369347    // - objects contain complex ids and are currently used for scoped objects
    370     if (typeof objectId === "number")
    371         return InjectedScript._nodeForId(objectId);
    372     else if (typeof objectId === "string")
    373         return InjectedScript.unwrapObject(objectId);
    374     else if (typeof objectId === "object") {
    375         var callFrame = InjectedScript._callFrameForId(objectId.callFrame);
     348    var object;
     349    if (objectId.type === "node")
     350        object = InjectedScript._nodeForId(objectId.value);
     351    else if (objectId.type === "jsobject")
     352        object = InjectedScript.unwrapObject(objectId.value);
     353    else if (objectId.type === "scopeObject") {
     354        var callFrame = InjectedScript._callFrameForId(objectId.value.callFrame);
    376355        if (objectId.thisObject)
    377             return callFrame.thisObject;
     356            object = callFrame.thisObject;
    378357        else
    379             return callFrame.scopeChain[objectId.chainIndex];
    380     }
    381     return objectId;
    382 }
    383 
    384 InjectedScript.pushNodeToFrontend = function(objectProxy)
    385 {
    386     var object = InjectedScript._resolveObject(objectProxy);
     358            object = callFrame.scopeChain[objectId.value.chainIndex];
     359    } else
     360        return objectId;
     361
     362    var path = objectId.path;
     363
     364    // Follow the property path.
     365    for (var i = 0; InjectedScript._isDefined(object) && path && i < path.length; ++i)
     366        object = object[path[i]];
     367
     368    return object;
     369}
     370
     371InjectedScript.pushNodeToFrontend = function(objectId)
     372{
     373    var object = InjectedScript._objectForId(objectId);
    387374    if (!object || InjectedScript._type(object) !== "node")
    388375        return false;
     
    390377}
    391378
    392 // Called from within InspectorController on the 'inspected page' side.
    393 InjectedScript.createProxyObject = function(object, objectId, abbreviate)
    394 {
    395     var result = {};
    396     result.injectedScriptId = injectedScriptId;
    397     result.objectId = objectId;
    398     result.type = InjectedScript._type(object);
    399     if (result.type === "array")
    400         result.propertyLength = object.length;
    401 
    402     var type = typeof object;
    403    
    404     result.hasChildren = (type === "object" && object !== null && (Object.getOwnPropertyNames(object).length || !!object.__proto__)) || type === "function";
     379// FIXME: RemoteObjectId and RemoteObject structs must match the WebInspector.* ones. Should reuse same file instead.
     380InjectedScript.RemoteObjectId = function(type, value, path)
     381{
     382    this.injectedScriptId = injectedScriptId;
     383    this.type = type;
     384    this.value = value;
     385    this.path = path || [];
     386}
     387
     388InjectedScript.RemoteObject = function(objectId, type, description, hasChildren)
     389{
     390    this.objectId = objectId;
     391    this.type = type;
     392    this.description = description;
     393    this.hasChildren = hasChildren;
     394}
     395
     396InjectedScript.RemoteObject.fromException = function(e)
     397{
     398    return new InjectedScript.RemoteObject(null, "error", e.toString());
     399}
     400
     401InjectedScript.RemoteObject.fromObject = function(object, objectId, abbreviate)
     402{
     403    var type = InjectedScript._type(object);
     404    var rawType = typeof object;
     405    var hasChildren = (rawType === "object" && object !== null && (Object.getOwnPropertyNames(object).length || !!object.__proto__)) || rawType === "function";
     406    var description = "";
    405407    try {
    406         result.description = InjectedScript._describe(object, abbreviate);
     408        var description = InjectedScript._describe(object, abbreviate);
     409        return new InjectedScript.RemoteObject(objectId, type, description, hasChildren);
    407410    } catch (e) {
    408         result.errorText = e.toString();
    409     }
    410     return result;
     411        return InjectedScript.RemoteObject.fromException(e);
     412    }
    411413}
    412414
     
    443445            var scopeType = callFrame.scopeType(i);
    444446            var scopeObject = scopeChain[i];
    445             var scopeObjectProxy = InjectedScript.createProxyObject(scopeObject, { callFrame: this.id, chainIndex: i }, true);
     447            var scopeObjectId = new InjectedScript.RemoteObjectId("scopeObject", { callFrame: this.id, chainIndex: i });
     448            var scopeObjectProxy = InjectedScript.RemoteObject.fromObject(scopeObject, scopeObjectId, true);
    446449
    447450            switch(scopeType) {
     
    449452                    foundLocalScope = true;
    450453                    scopeObjectProxy.isLocal = true;
    451                     scopeObjectProxy.thisObject = InjectedScript.createProxyObject(callFrame.thisObject, { callFrame: this.id, thisObject: true }, true);
     454                    var thisObjectId = new InjectedScript.RemoteObjectId("scopeObject", { callFrame: this.id, thisObject: true });
     455                    scopeObjectProxy.thisObject = InjectedScript.RemoteObject.fromObject(callFrame.thisObject, thisObjectId, true);
    452456                    break;
    453457                }
     
    535539    case "node":
    536540    case "array":
    537         return InjectedScript._className(obj);
     541        var className = InjectedScript._className(obj);
     542        if (typeof obj.length === "number")
     543            className += "[" + obj.length + "]";
     544        return className;
    538545    case "string":
    539546        if (!abbreviated)
  • trunk/WebCore/inspector/front-end/ObjectPropertiesSection.js

    r54856 r65241  
    5151            self.updateProperties(properties);
    5252        };
    53         InjectedScriptAccess.get(this.object.injectedScriptId).getProperties(this.object, this.ignoreHasOwnProperty, true, callback);
     53        this.object.getProperties(this.ignoreHasOwnProperty, true, callback);
    5454    },
    5555
     
    7070        this.propertiesTreeOutline.removeChildren();
    7171
    72         for (var i = 0; i < properties.length; ++i)
     72        for (var i = 0; i < properties.length; ++i) {
     73            properties[i].parentObject = this.object;
    7374            this.propertiesTreeOutline.appendChild(new rootTreeElementConstructor(properties[i]));
     75        }
    7476
    7577        if (!this.propertiesTreeOutline.children.length) {
     
    153155            }
    154156        };
    155         InjectedScriptAccess.get(this.property.value.injectedScriptId).getProperties(this.property.value, false, true, callback.bind(this));
     157        this.property.value.getOwnProperties(true, callback.bind(this));
    156158    },
    157159
     
    179181        this.valueElement.className = "value";
    180182        this.valueElement.textContent = this.property.value.description;
    181         if (typeof this.property.value.propertyLength !== "undefined")
    182             this.valueElement.textContent += " (" + this.property.value.propertyLength + ")";
    183183        if (this.property.isGetter)
    184184            this.valueElement.addStyleClass("dimmed");
    185         if (this.property.isError)
     185        if (this.property.value.isError())
    186186            this.valueElement.addStyleClass("error");
    187187
     
    261261            }
    262262        };
    263         InjectedScriptAccess.get(this.property.parentObjectProxy.injectedScriptId).setPropertyValue(this.property.parentObjectProxy, this.property.name, expression.trim(), callback);
     263        this.property.parentObject.setPropertyValue(this.property.name, expression.trim(), callback);
    264264    }
    265265}
  • trunk/WebCore/inspector/front-end/PropertiesSidebarPane.js

    r54973 r65241  
    5252            // Get array of prototype user-friendly names.
    5353            for (var i = 0; i < prototypes.length; ++i) {
    54                 var prototype = new WebInspector.ObjectProxy(node.injectedScriptId, node.id, path.slice());
     54                var prototype = new WebInspector.RemoteObject.fromNode(node, path.slice());
    5555                var section = new WebInspector.ObjectPropertiesSection(prototype, prototypes[i], WebInspector.UIString("Prototype"));
    5656                self.sections.push(section);
     
    5959            }
    6060        };
    61         InjectedScriptAccess.get(node.injectedScriptId).getPrototypes(node.id, callback);
     61        InjectedScriptAccess.get(-node.id).getPrototypes(node.id, callback);
    6262    }
    6363}
  • trunk/WebCore/inspector/front-end/ScopeChainSidebarPane.js

    r48983 r65241  
    6161                subtitle = null;
    6262                if (scopeObjectProxy.thisObject)
    63                     extraProperties = [ new WebInspector.ObjectPropertyProxy("this", scopeObjectProxy.thisObject) ];
     63                    extraProperties = [ new WebInspector.RemoteObjectProperty("this", WebInspector.RemoteObject.fromPayload(scopeObjectProxy.thisObject)) ];
    6464            } else if (scopeObjectProxy.isClosure) {
    6565                title = WebInspector.UIString("Closure");
     
    7878                subtitle = null;
    7979
    80             var section = new WebInspector.ObjectPropertiesSection(scopeObjectProxy, title, subtitle, emptyPlaceholder, true, extraProperties, WebInspector.ScopeVariableTreeElement);
     80            var section = new WebInspector.ObjectPropertiesSection(WebInspector.RemoteObject.fromPayload(scopeObjectProxy), title, subtitle, emptyPlaceholder, true, extraProperties, WebInspector.ScopeVariableTreeElement);
    8181            section.editInSelectedCallFrameWhenPaused = true;
    8282            section.pane = this;
  • trunk/WebCore/inspector/front-end/ScriptsPanel.js

    r65052 r65241  
    388388
    389389        var self = this;
    390         function updatingCallbackWrapper(result, exception)
     390        function updatingCallbackWrapper(result)
    391391        {
    392             callback(result, exception);
     392            callback(result);
    393393            if (updateInterface)
    394394                self.sidebarPanes.scopechain.update(selectedCallFrame);
     
    402402        {
    403403            if (result)
    404                 callback(result.value, result.isException);
     404                callback(WebInspector.RemoteObject.fromPayload(result));
    405405        }
    406406        InjectedScriptAccess.get(callFrame.injectedScriptId).evaluateInCallFrame(callFrame.id, code, objectGroup, evalCallback);
  • trunk/WebCore/inspector/front-end/SourceFrame.js

    r62496 r65241  
    626626        }
    627627
    628         function evaluateCallback(result, exception)
     628        function evaluateCallback(result)
    629629        {
    630             if (exception)
     630            if (result.isError())
    631631                return;
    632632            if (!WebInspector.panels.scripts.paused)
     
    700700
    701701        var expression = selection.getRangeAt(0).toString().trim();
    702         WebInspector.panels.scripts.evaluateInSelectedCallFrame(expression, false, "console", function(result, exception) {
     702        WebInspector.panels.scripts.evaluateInSelectedCallFrame(expression, false, "console", function(result) {
    703703            WebInspector.showConsole();
    704704            var commandMessage = new WebInspector.ConsoleCommand(expression);
    705705            WebInspector.console.addMessage(commandMessage);
    706             WebInspector.console.addMessage(new WebInspector.ConsoleCommandResult(result, exception, commandMessage));
     706            WebInspector.console.addMessage(new WebInspector.ConsoleCommandResult(result, commandMessage));
    707707        });
    708708    },
  • trunk/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js

    r61014 r65241  
    9191    update: function()
    9292    {
    93         function appendResult(expression, watchIndex, result, exception)
     93        function appendResult(expression, watchIndex, result)
    9494        {
    95             if (exception) {
    96                 // Exception results are not wrappers, but text messages.
    97                 result = WebInspector.ObjectProxy.wrapPrimitiveValue(result);
    98             } else if (result.type === "string") {
    99                 // Evaluation result is intentionally not abbreviated. However, we'd like to distinguish between null and "null"
    100                 result.description = "\"" + result.description + "\"";
    101             }
    102 
    103             var property = new WebInspector.ObjectPropertyProxy(expression, result);
     95            var property = new WebInspector.RemoteObjectProperty(expression, result);
    10496            property.watchIndex = watchIndex;
    105             property.isException = exception;
    106 
    107             // For newly added, empty expressions, set description to "",
    108             // since otherwise you get DOMWindow
    109             if (property.name === WebInspector.WatchExpressionsSection.NewWatchExpression)
    110                 property.value.description = "";
    11197
    11298            // To clarify what's going on here:
     
    223209        WebInspector.ObjectPropertyTreeElement.prototype.update.call(this);
    224210
    225         if (this.property.isException)
     211        if (this.property.value.isError())
    226212            this.valueElement.addStyleClass("watch-expressions-error-level");
    227213
  • trunk/WebCore/inspector/front-end/WebKit.qrc

    r64458 r65241  
    5353    <file>Object.js</file>
    5454    <file>ObjectPropertiesSection.js</file>
    55     <file>ObjectProxy.js</file>
    5655    <file>Panel.js</file>
    5756    <file>PanelEnablerView.js</file>
     
    6362    <file>PropertiesSection.js</file>
    6463    <file>PropertiesSidebarPane.js</file>
     64    <file>RemoteObject.js</file>
    6565    <file>Resource.js</file>
    6666    <file>ResourceCategory.js</file>
  • trunk/WebCore/inspector/front-end/inspector.html

    r64458 r65241  
    7474    <script type="text/javascript" src="Section.js"></script>
    7575    <script type="text/javascript" src="PropertiesSection.js"></script>
    76     <script type="text/javascript" src="ObjectProxy.js"></script>
     76    <script type="text/javascript" src="RemoteObject.js"></script>
    7777    <script type="text/javascript" src="ObjectPropertiesSection.js"></script>
    7878    <script type="text/javascript" src="BreakpointsSidebarPane.js"></script>
  • trunk/WebCore/inspector/front-end/inspector.js

    r65052 r65241  
    14681468    var self = this;
    14691469
    1470     // return indication if we can actually log a message
    1471     function isLogAvailable()
    1472     {
    1473         return WebInspector.ConsoleMessage && WebInspector.ObjectProxy && self.console;
    1474     }
    1475 
    14761470    // flush the queue of pending messages
    14771471    function flushQueue()
     
    15111505
    15121506        // ConsoleMessage expects a proxy object
    1513         message = new WebInspector.ObjectProxy(null, null, [], message, false);
     1507        message = new WebInspector.RemoteObject.fromPrimitiveValue(message);
    15141508
    15151509        // post the message
  • trunk/WebCore/inspector/front-end/utilities.js

    r64952 r65241  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28 
    29 Object.proxyType = function(objectProxy)
    30 {
    31     if (objectProxy === null)
    32         return "null";
    33 
    34     var type = typeof objectProxy;
    35     if (type !== "object" && type !== "function")
    36         return type;
    37 
    38     return objectProxy.type;
    39 }
    4028
    4129Object.properties = function(obj)
     
    848836    d: function(substitution)
    849837    {
    850         if (typeof substitution == "object" && Object.proxyType(substitution) === "number")
     838        if (typeof substitution == "object" && WebInspector.RemoteObject.type(substitution) === "number")
    851839            substitution = substitution.description;
    852840        substitution = parseInt(substitution);
     
    856844    f: function(substitution, token)
    857845    {
    858         if (typeof substitution == "object" && Object.proxyType(substitution) === "number")
     846        if (typeof substitution == "object" && WebInspector.RemoteObject.type(substitution) === "number")
    859847            substitution = substitution.description;
    860848        substitution = parseFloat(substitution);
     
    866854    s: function(substitution)
    867855    {
    868         if (typeof substitution == "object" && Object.proxyType(substitution) !== "null")
     856        if (typeof substitution == "object" && WebInspector.RemoteObject.type(substitution) !== "null")
    869857            substitution = substitution.description;
    870858        return substitution;
Note: See TracChangeset for help on using the changeset viewer.