Changeset 65245 in webkit


Ignore:
Timestamp:
Aug 12, 2010 8:04:51 AM (14 years ago)
Author:
pfeldman@chromium.org
Message:

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

Not reviewed. Rolling out r65241 and 65243 for breaking inspector tests.

Location:
trunk
Files:
1 added
1 deleted
26 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r65244 r65245  
     12010-08-12  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Not reviewed. Rolling out r65241 and 65243 for breaking inspector tests.
     4
    152010-08-12  Nate Chapin  <japhet@chromium.org>
    26
  • trunk/LayoutTests/inspector/console-dir-expected.txt

    r65241 r65245  
    44Tests that console logging dumps proper messages.
    55
    6 Array[2]
    7     0 = "test1"
    8     1 = "test2"
    9     length = 2
    10     __proto__ = Array[0]
    11 NodeList[1]
    12     0 = HTMLHtmlElement
    13     constructor = NodeListConstructor
    14     length = 1
    15     __proto__ = NodeListPrototype
     6Array
     7>>> 0 = "test1"
     8>>> 1 = "test2"
     9>>> length = 2
     10>>> __proto__ = Array
     11NodeList
     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

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

    r65241 r65245  
    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

    r65241 r65245  
    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[2]]
     18console-format-collections.html:41[1, Array]
    1919
  • trunk/LayoutTests/inspector/console-format-expected.txt

    r65241 r65245  
    4040console-format.html:20["test", "test2", undefined, undefined, "test4"]
    4141console-format.html:21["test", "test2", undefined, undefined, "test4"]
    42 console-format.html:22Array[5]
     42console-format.html:22Array
    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

    r65243 r65245  
     12010-08-12  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Not reviewed. Rolling out r65241 and 65243 for breaking inspector tests.
     4
    152010-08-12  Pavel Feldman  <pfeldman@chromium.org>
    26
  • trunk/WebCore/WebCore.gypi

    r65241 r65245  
    41144114            'inspector/front-end/MetricsSidebarPane.js',
    41154115            'inspector/front-end/Object.js',
     4116            'inspector/front-end/ObjectProxy.js',
    41164117            'inspector/front-end/ObjectPropertiesSection.js',
    41174118            'inspector/front-end/Panel.js',
     
    41244125            'inspector/front-end/PropertiesSection.js',
    41254126            '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

    r65241 r65245  
    5126151261                                </File>
    5126251262                                <File
     51263                                        RelativePath="..\inspector\front-end\ObjectProxy.js"
     51264                                        >
     51265                                </File>
     51266                                <File
    5126351267                                        RelativePath="..\inspector\front-end\Panel.js"
    5126451268                                        >
     
    5129851302                                <File
    5129951303                                        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

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

    r65241 r65245  
    512512        function evalCallback(result)
    513513        {
    514             callback(WebInspector.RemoteObject.fromPayload(result));
     514            callback(result.value, result.isException);
    515515        };
    516516        InjectedScriptAccess.getDefault().evaluate(expression, objectGroup, evalCallback);
     
    535535
    536536        var self = this;
    537         function printResult(result)
     537        function printResult(result, exception)
    538538        {
    539539            self.prompt.history.push(str);
     
    543543            WebInspector.applicationSettings.consoleHistory = self.prompt.history.slice(-30);
    544544
    545             self.addMessage(new WebInspector.ConsoleCommandResult(result, commandMessage));
     545            self.addMessage(new WebInspector.ConsoleCommandResult(result, exception, commandMessage));
    546546        }
    547547        this.evalInInspectedWindow(str, "console", printResult);
     
    551551    {
    552552        var isProxy = (output != null && typeof output === "object");
    553         var type = (forceObjectFormat ? "object" : WebInspector.RemoteObject.type(output));
     553        var type = (forceObjectFormat ? "object" : Object.proxyType(output));
    554554
    555555        var formatter = this._customFormatters[type];
     
    590590        }
    591591
    592         InjectedScriptAccess.get(object.objectId.injectedScriptId).pushNodeToFrontend(object.objectId, printNode);
     592        InjectedScriptAccess.get(object.injectedScriptId).pushNodeToFrontend(object, printNode);
    593593    },
    594594
    595595    _formatarray: function(arr, elem)
    596596    {
    597         arr.getOwnProperties(false, this._printArray.bind(this, elem));
     597        InjectedScriptAccess.get(arr.injectedScriptId).getProperties(arr, false, false, this._printArray.bind(this, elem));
    598598    },
    599599
     
    638638    _formatAsArrayEntry: function(output)
    639639    {
     640        var type = Object.proxyType(output);
    640641        // Prevent infinite expansion of cross-referencing arrays.
    641         return this._format(output, WebInspector.RemoteObject.type(output) === "array");
     642        return this._format(output, type === "array");
    642643    }
    643644}
     
    728729        // Formatting code below assumes that parameters are all wrappers whereas frontend console
    729730        // API allows passing arbitrary values as messages (strings, numbers, etc.). Wrap them here.
    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         }
     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]);
    736734
    737735        // There can be string log and string eval result. We distinguish between them based on message type.
    738         var shouldFormatMessage = WebInspector.RemoteObject.type(parameters[0]) === "string" && this.type !== WebInspector.ConsoleMessage.MessageType.Result;
     736        var shouldFormatMessage = Object.proxyType(parameters[0]) === "string" && this.type !== WebInspector.ConsoleMessage.MessageType.Result;
    739737
    740738        // Multiple parameters with the first being a format string. Save unused substitutions.
     
    10511049}
    10521050
    1053 WebInspector.ConsoleCommandResult = function(result, originatingCommand)
     1051WebInspector.ConsoleCommandResult = function(result, exception, originatingCommand)
    10541052{
    1055     var level = (result.isError() ? WebInspector.ConsoleMessage.MessageLevel.Error : WebInspector.ConsoleMessage.MessageLevel.Log);
     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
    10561063    this.originatingCommand = originatingCommand;
    1057     WebInspector.ConsoleMessage.call(this, WebInspector.ConsoleMessage.MessageSource.JS, WebInspector.ConsoleMessage.MessageType.Result, level, -1, null, null, 1, null, [result]);
     1064
     1065    WebInspector.ConsoleMessage.call(this, WebInspector.ConsoleMessage.MessageSource.JS, WebInspector.ConsoleMessage.MessageType.Result, level, line, url, null, 1, null, [message]);
    10581066}
    10591067
  • trunk/WebCore/inspector/front-end/DOMAgent.js

    r65241 r65245  
    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;
    3640    this.nodeType = payload.nodeType;
    3741    this.nodeName = payload.nodeName;
  • trunk/WebCore/inspector/front-end/ElementsPanel.js

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

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

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

    r65241 r65245  
    5151        if (typeof object === "object" || typeof object === "function" || InjectedScript._isHTMLAllCollection(object)) {
    5252            var id = InjectedScript.lastBoundObjectId++;
    53             objectId = id;
    54             InjectedScript.idToWrappedObject[id] = object;
     53            objectId = "object#" + id;
     54            InjectedScript.idToWrappedObject[objectId] = object;
    5555
    5656            var group = InjectedScript.objectGroups[objectGroupName];
     
    5959                InjectedScript.objectGroups[objectGroupName] = group;
    6060            }
    61             group.push(id);
    62             objectId = new InjectedScript.RemoteObjectId("jsobject", id);
    63         }
    64         return InjectedScript.RemoteObject.fromObject(object, objectId);
     61            group.push(objectId);
     62        }
     63        return InjectedScript.createProxyObject(object, objectId);
    6564    } catch (e) {
    66         return InjectedScript.RemoteObject.fromObject("[ Exception: " + e.toString() + " ]");
    67     }
     65        return InjectedScript.createProxyObject("[ Exception: " + e.toString() + " ]");
     66    }
     67    return InjectedScript.createProxyObject(object, objectId);
    6868};
    6969
     
    111111}
    112112
    113 InjectedScript.getProperties = function(objectId, ignoreHasOwnProperty, abbreviate)
    114 {
    115     var object = InjectedScript._objectForId(objectId);
     113InjectedScript.getProperties = function(objectProxy, ignoreHasOwnProperty, abbreviate)
     114{
     115    var object = InjectedScript._resolveObject(objectProxy);
    116116    if (!InjectedScript._isDefined(object))
    117117        return false;
     
    128128        var property = {};
    129129        property.name = propertyName + "";
     130        property.parentObjectProxy = objectProxy;
    130131        var isGetter = object["__lookupGetter__"] && object.__lookupGetter__(propertyName);
    131132        if (!isGetter) {
    132133            try {
    133134                var childObject = object[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);
     135                var childObjectProxy = new InjectedScript.createProxyObject(childObject, objectProxy.objectId, abbreviate);
     136                childObjectProxy.path = objectProxy.path ? objectProxy.path.slice() : [];
     137                childObjectProxy.path.push(propertyName);
    138138                property.value = childObjectProxy;
    139139            } catch(e) {
    140                 property.value = new InjectedScript.RemoteObject.fromException(e);
     140                property.value = { description: e.toString() };
     141                property.isError = true;
    141142            }
    142143        } else {
    143144            // FIXME: this should show something like "getter" (bug 16734).
    144             property.value = new InjectedScript.RemoteObject.fromObject("\u2014"); // em dash
     145            property.value = { description: "\u2014" }; // em dash
    145146            property.isGetter = true;
    146147        }
     
    150151}
    151152
    152 InjectedScript.setPropertyValue = function(objectId, propertyName, expression)
    153 {
    154     var object = InjectedScript._objectForId(objectId);
     153InjectedScript.setPropertyValue = function(objectProxy, propertyName, expression)
     154{
     155    var object = InjectedScript._resolveObject(objectProxy);
    155156    if (!InjectedScript._isDefined(object))
    156157        return false;
     
    258259InjectedScript._evaluateAndWrap = function(evalFunction, object, expression, objectGroup, dontUseCommandLineAPI)
    259260{
     261    var result = {};
    260262    try {
    261         return InjectedScript.wrapObject(InjectedScript._evaluateOn(evalFunction, object, expression, dontUseCommandLineAPI), objectGroup);
     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        }
    262270    } catch (e) {
    263         return InjectedScript.RemoteObject.fromException(e);
    264     }
     271        result.value = e.toString();
     272        result.isException = true;
     273    }
     274    return result;
    265275}
    266276
     
    333343}
    334344
     345InjectedScript._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
    335357InjectedScript._nodeForId = function(nodeId)
    336358{
     
    346368    // - strings point to console objects cached in InspectorController for lazy evaluation upon them
    347369    // - objects contain complex ids and are currently used for scoped objects
    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);
     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);
    355376        if (objectId.thisObject)
    356             object = callFrame.thisObject;
     377            return callFrame.thisObject;
    357378        else
    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 
    371 InjectedScript.pushNodeToFrontend = function(objectId)
    372 {
    373     var object = InjectedScript._objectForId(objectId);
     379            return callFrame.scopeChain[objectId.chainIndex];
     380    }
     381    return objectId;
     382}
     383
     384InjectedScript.pushNodeToFrontend = function(objectProxy)
     385{
     386    var object = InjectedScript._resolveObject(objectProxy);
    374387    if (!object || InjectedScript._type(object) !== "node")
    375388        return false;
     
    377390}
    378391
    379 // FIXME: RemoteObjectId and RemoteObject structs must match the WebInspector.* ones. Should reuse same file instead.
    380 InjectedScript.RemoteObjectId = function(type, value, path)
    381 {
    382     this.injectedScriptId = injectedScriptId;
    383     this.type = type;
    384     this.value = value;
    385     this.path = path || [];
    386 }
    387 
    388 InjectedScript.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 
    396 InjectedScript.RemoteObject.fromException = function(e)
    397 {
    398     return new InjectedScript.RemoteObject(null, "error", e.toString());
    399 }
    400 
    401 InjectedScript.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 = "";
     392// Called from within InspectorController on the 'inspected page' side.
     393InjectedScript.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";
    407405    try {
    408         var description = InjectedScript._describe(object, abbreviate);
    409         return new InjectedScript.RemoteObject(objectId, type, description, hasChildren);
     406        result.description = InjectedScript._describe(object, abbreviate);
    410407    } catch (e) {
    411         return InjectedScript.RemoteObject.fromException(e);
    412     }
     408        result.errorText = e.toString();
     409    }
     410    return result;
    413411}
    414412
     
    445443            var scopeType = callFrame.scopeType(i);
    446444            var scopeObject = scopeChain[i];
    447             var scopeObjectId = new InjectedScript.RemoteObjectId("scopeObject", { callFrame: this.id, chainIndex: i });
    448             var scopeObjectProxy = InjectedScript.RemoteObject.fromObject(scopeObject, scopeObjectId, true);
     445            var scopeObjectProxy = InjectedScript.createProxyObject(scopeObject, { callFrame: this.id, chainIndex: i }, true);
    449446
    450447            switch(scopeType) {
     
    452449                    foundLocalScope = true;
    453450                    scopeObjectProxy.isLocal = true;
    454                     var thisObjectId = new InjectedScript.RemoteObjectId("scopeObject", { callFrame: this.id, thisObject: true });
    455                     scopeObjectProxy.thisObject = InjectedScript.RemoteObject.fromObject(callFrame.thisObject, thisObjectId, true);
     451                    scopeObjectProxy.thisObject = InjectedScript.createProxyObject(callFrame.thisObject, { callFrame: this.id, thisObject: true }, true);
    456452                    break;
    457453                }
     
    539535    case "node":
    540536    case "array":
    541         var className = InjectedScript._className(obj);
    542         if (typeof obj.length === "number")
    543             className += "[" + obj.length + "]";
    544         return className;
     537        return InjectedScript._className(obj);
    545538    case "string":
    546539        if (!abbreviated)
  • trunk/WebCore/inspector/front-end/ObjectPropertiesSection.js

    r65241 r65245  
    5151            self.updateProperties(properties);
    5252        };
    53         this.object.getProperties(this.ignoreHasOwnProperty, true, callback);
     53        InjectedScriptAccess.get(this.object.injectedScriptId).getProperties(this.object, this.ignoreHasOwnProperty, true, callback);
    5454    },
    5555
     
    7070        this.propertiesTreeOutline.removeChildren();
    7171
    72         for (var i = 0; i < properties.length; ++i) {
    73             properties[i].parentObject = this.object;
     72        for (var i = 0; i < properties.length; ++i)
    7473            this.propertiesTreeOutline.appendChild(new rootTreeElementConstructor(properties[i]));
    75         }
    7674
    7775        if (!this.propertiesTreeOutline.children.length) {
     
    155153            }
    156154        };
    157         this.property.value.getOwnProperties(true, callback.bind(this));
     155        InjectedScriptAccess.get(this.property.value.injectedScriptId).getProperties(this.property.value, false, true, callback.bind(this));
    158156    },
    159157
     
    181179        this.valueElement.className = "value";
    182180        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.value.isError())
     185        if (this.property.isError)
    186186            this.valueElement.addStyleClass("error");
    187187
     
    261261            }
    262262        };
    263         this.property.parentObject.setPropertyValue(this.property.name, expression.trim(), callback);
     263        InjectedScriptAccess.get(this.property.parentObjectProxy.injectedScriptId).setPropertyValue(this.property.parentObjectProxy, this.property.name, expression.trim(), callback);
    264264    }
    265265}
  • trunk/WebCore/inspector/front-end/PropertiesSidebarPane.js

    r65241 r65245  
    5252            // Get array of prototype user-friendly names.
    5353            for (var i = 0; i < prototypes.length; ++i) {
    54                 var prototype = new WebInspector.RemoteObject.fromNode(node, path.slice());
     54                var prototype = new WebInspector.ObjectProxy(node.injectedScriptId, node.id, 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.id).getPrototypes(node.id, callback);
     61        InjectedScriptAccess.get(node.injectedScriptId).getPrototypes(node.id, callback);
    6262    }
    6363}
  • trunk/WebCore/inspector/front-end/ScopeChainSidebarPane.js

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

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

    r65241 r65245  
    626626        }
    627627
    628         function evaluateCallback(result)
     628        function evaluateCallback(result, exception)
    629629        {
    630             if (result.isError())
     630            if (exception)
    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) {
     702        WebInspector.panels.scripts.evaluateInSelectedCallFrame(expression, false, "console", function(result, exception) {
    703703            WebInspector.showConsole();
    704704            var commandMessage = new WebInspector.ConsoleCommand(expression);
    705705            WebInspector.console.addMessage(commandMessage);
    706             WebInspector.console.addMessage(new WebInspector.ConsoleCommandResult(result, commandMessage));
     706            WebInspector.console.addMessage(new WebInspector.ConsoleCommandResult(result, exception, commandMessage));
    707707        });
    708708    },
  • trunk/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js

    r65241 r65245  
    9191    update: function()
    9292    {
    93         function appendResult(expression, watchIndex, result)
     93        function appendResult(expression, watchIndex, result, exception)
    9494        {
    95             var property = new WebInspector.RemoteObjectProperty(expression, result);
     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);
    96104            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 = "";
    97111
    98112            // To clarify what's going on here:
     
    209223        WebInspector.ObjectPropertyTreeElement.prototype.update.call(this);
    210224
    211         if (this.property.value.isError())
     225        if (this.property.isException)
    212226            this.valueElement.addStyleClass("watch-expressions-error-level");
    213227
  • trunk/WebCore/inspector/front-end/WebKit.qrc

    r65241 r65245  
    5353    <file>Object.js</file>
    5454    <file>ObjectPropertiesSection.js</file>
     55    <file>ObjectProxy.js</file>
    5556    <file>Panel.js</file>
    5657    <file>PanelEnablerView.js</file>
     
    6263    <file>PropertiesSection.js</file>
    6364    <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

    r65241 r65245  
    7474    <script type="text/javascript" src="Section.js"></script>
    7575    <script type="text/javascript" src="PropertiesSection.js"></script>
    76     <script type="text/javascript" src="RemoteObject.js"></script>
     76    <script type="text/javascript" src="ObjectProxy.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

    r65241 r65245  
    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
    14701476    // flush the queue of pending messages
    14711477    function flushQueue()
     
    15051511
    15061512        // ConsoleMessage expects a proxy object
    1507         message = new WebInspector.RemoteObject.fromPrimitiveValue(message);
     1513        message = new WebInspector.ObjectProxy(null, null, [], message, false);
    15081514
    15091515        // post the message
  • trunk/WebCore/inspector/front-end/utilities.js

    r65241 r65245  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
     28
     29Object.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}
    2840
    2941Object.properties = function(obj)
     
    836848    d: function(substitution)
    837849    {
    838         if (typeof substitution == "object" && WebInspector.RemoteObject.type(substitution) === "number")
     850        if (typeof substitution == "object" && Object.proxyType(substitution) === "number")
    839851            substitution = substitution.description;
    840852        substitution = parseInt(substitution);
     
    844856    f: function(substitution, token)
    845857    {
    846         if (typeof substitution == "object" && WebInspector.RemoteObject.type(substitution) === "number")
     858        if (typeof substitution == "object" && Object.proxyType(substitution) === "number")
    847859            substitution = substitution.description;
    848860        substitution = parseFloat(substitution);
     
    854866    s: function(substitution)
    855867    {
    856         if (typeof substitution == "object" && WebInspector.RemoteObject.type(substitution) !== "null")
     868        if (typeof substitution == "object" && Object.proxyType(substitution) !== "null")
    857869            substitution = substitution.description;
    858870        return substitution;
Note: See TracChangeset for help on using the changeset viewer.