Changeset 65241 in webkit
- Timestamp:
- Aug 12, 2010 6:31:30 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r65239 r65241 1 2010-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 1 14 2010-08-12 Philippe Normand <pnormand@igalia.com> 2 15 -
trunk/LayoutTests/inspector/console-dir-expected.txt
r54769 r65241 4 4 Tests that console logging dumps proper messages. 5 5 6 Array 7 >>>0 = "test1"8 >>>1 = "test2"9 >>>length = 210 >>> __proto__ = Array 11 NodeList 12 >>>0 = HTMLHtmlElement13 >>>constructor = NodeListConstructor14 >>>length = 115 >>>__proto__ = NodeListPrototype6 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 16 16 XPathResult 17 >>>booleanValue = Error: TYPE_ERR: DOM XPath Exception 5218 >>>constructor = XPathResultConstructor19 >>>invalidIteratorState = false20 >>>numberValue = Error: TYPE_ERR: DOM XPath Exception 5221 >>>resultType = 422 >>>singleNodeValue = Error: TYPE_ERR: DOM XPath Exception 5223 >>>snapshotLength = Error: TYPE_ERR: DOM XPath Exception 5224 >>>stringValue = Error: TYPE_ERR: DOM XPath Exception 5225 >>>__proto__ = XPathResultPrototype17 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 26 26 -
trunk/LayoutTests/inspector/console-dir-global.html
r61010 r65241 27 27 function evalCallback(result) 28 28 { 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); 33 33 } 34 34 -
trunk/LayoutTests/inspector/console-dir.html
r58403 r65241 21 21 var properties = result[i].properties; 22 22 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); 24 24 } 25 25 if (!noNotifyDone) -
trunk/LayoutTests/inspector/console-format-collections-expected.txt
r60562 r65241 16 16 console-format-collections.html:31[<select id="sel" name="sel">…</select>, <input type="radio" name="x" value="x1">, <input type="radio" name="x" value="x2">] 17 17 console-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 ]18 console-format-collections.html:41[1, Array[2]] 19 19 -
trunk/LayoutTests/inspector/console-format-expected.txt
r60562 r65241 40 40 console-format.html:20["test", "test2", undefined, undefined, "test4"] 41 41 console-format.html:21["test", "test2", undefined, undefined, "test4"] 42 console-format.html:22Array 42 console-format.html:22Array[5] 43 43 console-format.html:52/^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i 44 44 console-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 1 2010-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 1 77 2010-08-12 Ben Murdoch <benm@google.com> 2 78 -
trunk/WebCore/WebCore.gypi
r65234 r65241 4114 4114 'inspector/front-end/MetricsSidebarPane.js', 4115 4115 'inspector/front-end/Object.js', 4116 'inspector/front-end/ObjectProxy.js',4117 4116 'inspector/front-end/ObjectPropertiesSection.js', 4118 4117 'inspector/front-end/Panel.js', … … 4125 4124 'inspector/front-end/PropertiesSection.js', 4126 4125 'inspector/front-end/PropertiesSidebarPane.js', 4126 'inspector/front-end/RemoteObject.js', 4127 4127 'inspector/front-end/Resource.js', 4128 4128 'inspector/front-end/ResourceCategory.js', -
trunk/WebCore/WebCore.vcproj/WebCore.vcproj
r65234 r65241 51261 51261 </File> 51262 51262 <File 51263 RelativePath="..\inspector\front-end\ObjectProxy.js"51264 >51265 </File>51266 <File51267 51263 RelativePath="..\inspector\front-end\Panel.js" 51268 51264 > … … 51302 51298 <File 51303 51299 RelativePath="..\inspector\front-end\PropertiesSidebarPane.js" 51300 > 51301 </File> 51302 <File 51303 RelativePath="..\inspector\front-end\RemoteObject.js" 51304 51304 > 51305 51305 </File> -
trunk/WebCore/inspector/front-end/AuditRules.js
r59688 r65241 725 725 doRun: function(resources, result, callback) 726 726 { 727 function evalCallback(evalResult , isException)728 { 729 if ( isException ||!evalResult)727 function evalCallback(evalResult) 728 { 729 if (!evalResult) 730 730 return callback(null); 731 731 … … 801 801 doRun: function(resources, result, callback) 802 802 { 803 function evalCallback(resultValue , isException)804 { 805 if ( isException ||!resultValue)803 function evalCallback(resultValue) 804 { 805 if (!resultValue) 806 806 return callback(null); 807 807 -
trunk/WebCore/inspector/front-end/ConsoleView.js
r65052 r65241 512 512 function evalCallback(result) 513 513 { 514 callback( result.value, result.isException);514 callback(WebInspector.RemoteObject.fromPayload(result)); 515 515 }; 516 516 InjectedScriptAccess.getDefault().evaluate(expression, objectGroup, evalCallback); … … 535 535 536 536 var self = this; 537 function printResult(result , exception)537 function printResult(result) 538 538 { 539 539 self.prompt.history.push(str); … … 543 543 WebInspector.applicationSettings.consoleHistory = self.prompt.history.slice(-30); 544 544 545 self.addMessage(new WebInspector.ConsoleCommandResult(result, exception,commandMessage));545 self.addMessage(new WebInspector.ConsoleCommandResult(result, commandMessage)); 546 546 } 547 547 this.evalInInspectedWindow(str, "console", printResult); … … 551 551 { 552 552 var isProxy = (output != null && typeof output === "object"); 553 var type = (forceObjectFormat ? "object" : Object.proxyType(output));553 var type = (forceObjectFormat ? "object" : WebInspector.RemoteObject.type(output)); 554 554 555 555 var formatter = this._customFormatters[type]; … … 590 590 } 591 591 592 InjectedScriptAccess.get(object. injectedScriptId).pushNodeToFrontend(object, printNode);592 InjectedScriptAccess.get(object.objectId.injectedScriptId).pushNodeToFrontend(object.objectId, printNode); 593 593 }, 594 594 595 595 _formatarray: function(arr, elem) 596 596 { 597 InjectedScriptAccess.get(arr.injectedScriptId).getProperties(arr, false,false, this._printArray.bind(this, elem));597 arr.getOwnProperties(false, this._printArray.bind(this, elem)); 598 598 }, 599 599 … … 638 638 _formatAsArrayEntry: function(output) 639 639 { 640 var type = Object.proxyType(output);641 640 // Prevent infinite expansion of cross-referencing arrays. 642 return this._format(output, type=== "array");641 return this._format(output, WebInspector.RemoteObject.type(output) === "array"); 643 642 } 644 643 } … … 729 728 // Formatting code below assumes that parameters are all wrappers whereas frontend console 730 729 // 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 } 734 736 735 737 // 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; 737 739 738 740 // Multiple parameters with the first being a format string. Save unused substitutions. … … 1049 1051 } 1050 1052 1051 WebInspector.ConsoleCommandResult = function(result, exception,originatingCommand)1053 WebInspector.ConsoleCommandResult = function(result, originatingCommand) 1052 1054 { 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); 1063 1056 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]); 1066 1058 } 1067 1059 -
trunk/WebCore/inspector/front-end/DOMAgent.js
r65052 r65241 34 34 35 35 this.id = payload.id; 36 // injectedScriptId is a node is for DOM nodes which should be converted37 // to corresponding InjectedScript by the inspector backend. We indicate38 // this by making injectedScriptId negative.39 this.injectedScriptId = -payload.id;40 36 this.nodeType = payload.nodeType; 41 37 this.nodeName = payload.nodeName; -
trunk/WebCore/inspector/front-end/ElementsPanel.js
r64770 r65241 256 256 this._searchQuery = query; 257 257 258 InspectorBackend.performSearch(whitespaceTrimmedQuery );258 InspectorBackend.performSearch(whitespaceTrimmedQuery, false); 259 259 }, 260 260 -
trunk/WebCore/inspector/front-end/ElementsTreeOutline.js
r64973 r65241 414 414 this.tooltip = WebInspector.UIString("%d × %d pixels (Natural: %d × %d pixels)", properties.offsetWidth, properties.offsetHeight, properties.naturalWidth, properties.naturalHeight); 415 415 } 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)); 418 417 }, 419 418 -
trunk/WebCore/inspector/front-end/EventListenersSidebarPane.js
r61014 r65241 195 195 var value = this.eventListener[propertyName]; 196 196 if (value instanceof WebInspector.DOMNode) 197 value = new WebInspector.ObjectProxy(value.injectedScriptId, value.id, [], appropriateSelectorForNode(value), true);197 value = WebInspector.RemoteObject.fromNode(value); 198 198 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)); 201 201 } 202 202 this.updateProperties(properties); -
trunk/WebCore/inspector/front-end/InjectedScript.js
r65072 r65241 51 51 if (typeof object === "object" || typeof object === "function" || InjectedScript._isHTMLAllCollection(object)) { 52 52 var id = InjectedScript.lastBoundObjectId++; 53 objectId = "object#" +id;54 InjectedScript.idToWrappedObject[ objectId] = object;53 objectId = id; 54 InjectedScript.idToWrappedObject[id] = object; 55 55 56 56 var group = InjectedScript.objectGroups[objectGroupName]; … … 59 59 InjectedScript.objectGroups[objectGroupName] = group; 60 60 } 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); 64 65 } 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 } 68 68 }; 69 69 … … 111 111 } 112 112 113 InjectedScript.getProperties = function(object Proxy, ignoreHasOwnProperty, abbreviate)114 { 115 var object = InjectedScript._ resolveObject(objectProxy);113 InjectedScript.getProperties = function(objectId, ignoreHasOwnProperty, abbreviate) 114 { 115 var object = InjectedScript._objectForId(objectId); 116 116 if (!InjectedScript._isDefined(object)) 117 117 return false; … … 128 128 var property = {}; 129 129 property.name = propertyName + ""; 130 property.parentObjectProxy = objectProxy;131 130 var isGetter = object["__lookupGetter__"] && object.__lookupGetter__(propertyName); 132 131 if (!isGetter) { 133 132 try { 134 133 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); 138 138 property.value = childObjectProxy; 139 139 } catch(e) { 140 property.value = { description: e.toString() }; 141 property.isError = true; 140 property.value = new InjectedScript.RemoteObject.fromException(e); 142 141 } 143 142 } else { 144 143 // FIXME: this should show something like "getter" (bug 16734). 145 property.value = { description: "\u2014" }; // em dash144 property.value = new InjectedScript.RemoteObject.fromObject("\u2014"); // em dash 146 145 property.isGetter = true; 147 146 } … … 151 150 } 152 151 153 InjectedScript.setPropertyValue = function(object Proxy, propertyName, expression)154 { 155 var object = InjectedScript._ resolveObject(objectProxy);152 InjectedScript.setPropertyValue = function(objectId, propertyName, expression) 153 { 154 var object = InjectedScript._objectForId(objectId); 156 155 if (!InjectedScript._isDefined(object)) 157 156 return false; … … 259 258 InjectedScript._evaluateAndWrap = function(evalFunction, object, expression, objectGroup, dontUseCommandLineAPI) 260 259 { 261 var result = {};262 260 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); 270 262 } catch (e) { 271 result.value = e.toString(); 272 result.isException = true; 273 } 274 return result; 263 return InjectedScript.RemoteObject.fromException(e); 264 } 275 265 } 276 266 … … 343 333 } 344 334 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 357 335 InjectedScript._nodeForId = function(nodeId) 358 336 { … … 368 346 // - strings point to console objects cached in InspectorController for lazy evaluation upon them 369 347 // - 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); 376 355 if (objectId.thisObject) 377 returncallFrame.thisObject;356 object = callFrame.thisObject; 378 357 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 371 InjectedScript.pushNodeToFrontend = function(objectId) 372 { 373 var object = InjectedScript._objectForId(objectId); 387 374 if (!object || InjectedScript._type(object) !== "node") 388 375 return false; … … 390 377 } 391 378 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. 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 = ""; 405 407 try { 406 result.description = InjectedScript._describe(object, abbreviate); 408 var description = InjectedScript._describe(object, abbreviate); 409 return new InjectedScript.RemoteObject(objectId, type, description, hasChildren); 407 410 } catch (e) { 408 result.errorText = e.toString(); 409 } 410 return result; 411 return InjectedScript.RemoteObject.fromException(e); 412 } 411 413 } 412 414 … … 443 445 var scopeType = callFrame.scopeType(i); 444 446 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); 446 449 447 450 switch(scopeType) { … … 449 452 foundLocalScope = true; 450 453 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); 452 456 break; 453 457 } … … 535 539 case "node": 536 540 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; 538 545 case "string": 539 546 if (!abbreviated) -
trunk/WebCore/inspector/front-end/ObjectPropertiesSection.js
r54856 r65241 51 51 self.updateProperties(properties); 52 52 }; 53 InjectedScriptAccess.get(this.object.injectedScriptId).getProperties(this.object,this.ignoreHasOwnProperty, true, callback);53 this.object.getProperties(this.ignoreHasOwnProperty, true, callback); 54 54 }, 55 55 … … 70 70 this.propertiesTreeOutline.removeChildren(); 71 71 72 for (var i = 0; i < properties.length; ++i) 72 for (var i = 0; i < properties.length; ++i) { 73 properties[i].parentObject = this.object; 73 74 this.propertiesTreeOutline.appendChild(new rootTreeElementConstructor(properties[i])); 75 } 74 76 75 77 if (!this.propertiesTreeOutline.children.length) { … … 153 155 } 154 156 }; 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)); 156 158 }, 157 159 … … 179 181 this.valueElement.className = "value"; 180 182 this.valueElement.textContent = this.property.value.description; 181 if (typeof this.property.value.propertyLength !== "undefined")182 this.valueElement.textContent += " (" + this.property.value.propertyLength + ")";183 183 if (this.property.isGetter) 184 184 this.valueElement.addStyleClass("dimmed"); 185 if (this.property. isError)185 if (this.property.value.isError()) 186 186 this.valueElement.addStyleClass("error"); 187 187 … … 261 261 } 262 262 }; 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); 264 264 } 265 265 } -
trunk/WebCore/inspector/front-end/PropertiesSidebarPane.js
r54973 r65241 52 52 // Get array of prototype user-friendly names. 53 53 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()); 55 55 var section = new WebInspector.ObjectPropertiesSection(prototype, prototypes[i], WebInspector.UIString("Prototype")); 56 56 self.sections.push(section); … … 59 59 } 60 60 }; 61 InjectedScriptAccess.get( node.injectedScriptId).getPrototypes(node.id, callback);61 InjectedScriptAccess.get(-node.id).getPrototypes(node.id, callback); 62 62 } 63 63 } -
trunk/WebCore/inspector/front-end/ScopeChainSidebarPane.js
r48983 r65241 61 61 subtitle = null; 62 62 if (scopeObjectProxy.thisObject) 63 extraProperties = [ new WebInspector. ObjectPropertyProxy("this", scopeObjectProxy.thisObject) ];63 extraProperties = [ new WebInspector.RemoteObjectProperty("this", WebInspector.RemoteObject.fromPayload(scopeObjectProxy.thisObject)) ]; 64 64 } else if (scopeObjectProxy.isClosure) { 65 65 title = WebInspector.UIString("Closure"); … … 78 78 subtitle = null; 79 79 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); 81 81 section.editInSelectedCallFrameWhenPaused = true; 82 82 section.pane = this; -
trunk/WebCore/inspector/front-end/ScriptsPanel.js
r65052 r65241 388 388 389 389 var self = this; 390 function updatingCallbackWrapper(result , exception)390 function updatingCallbackWrapper(result) 391 391 { 392 callback(result , exception);392 callback(result); 393 393 if (updateInterface) 394 394 self.sidebarPanes.scopechain.update(selectedCallFrame); … … 402 402 { 403 403 if (result) 404 callback( result.value, result.isException);404 callback(WebInspector.RemoteObject.fromPayload(result)); 405 405 } 406 406 InjectedScriptAccess.get(callFrame.injectedScriptId).evaluateInCallFrame(callFrame.id, code, objectGroup, evalCallback); -
trunk/WebCore/inspector/front-end/SourceFrame.js
r62496 r65241 626 626 } 627 627 628 function evaluateCallback(result , exception)628 function evaluateCallback(result) 629 629 { 630 if ( exception)630 if (result.isError()) 631 631 return; 632 632 if (!WebInspector.panels.scripts.paused) … … 700 700 701 701 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) { 703 703 WebInspector.showConsole(); 704 704 var commandMessage = new WebInspector.ConsoleCommand(expression); 705 705 WebInspector.console.addMessage(commandMessage); 706 WebInspector.console.addMessage(new WebInspector.ConsoleCommandResult(result, exception,commandMessage));706 WebInspector.console.addMessage(new WebInspector.ConsoleCommandResult(result, commandMessage)); 707 707 }); 708 708 }, -
trunk/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js
r61014 r65241 91 91 update: function() 92 92 { 93 function appendResult(expression, watchIndex, result , exception)93 function appendResult(expression, watchIndex, result) 94 94 { 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); 104 96 property.watchIndex = watchIndex; 105 property.isException = exception;106 107 // For newly added, empty expressions, set description to "",108 // since otherwise you get DOMWindow109 if (property.name === WebInspector.WatchExpressionsSection.NewWatchExpression)110 property.value.description = "";111 97 112 98 // To clarify what's going on here: … … 223 209 WebInspector.ObjectPropertyTreeElement.prototype.update.call(this); 224 210 225 if (this.property. isException)211 if (this.property.value.isError()) 226 212 this.valueElement.addStyleClass("watch-expressions-error-level"); 227 213 -
trunk/WebCore/inspector/front-end/WebKit.qrc
r64458 r65241 53 53 <file>Object.js</file> 54 54 <file>ObjectPropertiesSection.js</file> 55 <file>ObjectProxy.js</file>56 55 <file>Panel.js</file> 57 56 <file>PanelEnablerView.js</file> … … 63 62 <file>PropertiesSection.js</file> 64 63 <file>PropertiesSidebarPane.js</file> 64 <file>RemoteObject.js</file> 65 65 <file>Resource.js</file> 66 66 <file>ResourceCategory.js</file> -
trunk/WebCore/inspector/front-end/inspector.html
r64458 r65241 74 74 <script type="text/javascript" src="Section.js"></script> 75 75 <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> 77 77 <script type="text/javascript" src="ObjectPropertiesSection.js"></script> 78 78 <script type="text/javascript" src="BreakpointsSidebarPane.js"></script> -
trunk/WebCore/inspector/front-end/inspector.js
r65052 r65241 1468 1468 var self = this; 1469 1469 1470 // return indication if we can actually log a message1471 function isLogAvailable()1472 {1473 return WebInspector.ConsoleMessage && WebInspector.ObjectProxy && self.console;1474 }1475 1476 1470 // flush the queue of pending messages 1477 1471 function flushQueue() … … 1511 1505 1512 1506 // ConsoleMessage expects a proxy object 1513 message = new WebInspector. ObjectProxy(null, null, [], message, false);1507 message = new WebInspector.RemoteObject.fromPrimitiveValue(message); 1514 1508 1515 1509 // post the message -
trunk/WebCore/inspector/front-end/utilities.js
r64952 r65241 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 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 }40 28 41 29 Object.properties = function(obj) … … 848 836 d: function(substitution) 849 837 { 850 if (typeof substitution == "object" && Object.proxyType(substitution) === "number")838 if (typeof substitution == "object" && WebInspector.RemoteObject.type(substitution) === "number") 851 839 substitution = substitution.description; 852 840 substitution = parseInt(substitution); … … 856 844 f: function(substitution, token) 857 845 { 858 if (typeof substitution == "object" && Object.proxyType(substitution) === "number")846 if (typeof substitution == "object" && WebInspector.RemoteObject.type(substitution) === "number") 859 847 substitution = substitution.description; 860 848 substitution = parseFloat(substitution); … … 866 854 s: function(substitution) 867 855 { 868 if (typeof substitution == "object" && Object.proxyType(substitution) !== "null")856 if (typeof substitution == "object" && WebInspector.RemoteObject.type(substitution) !== "null") 869 857 substitution = substitution.description; 870 858 return substitution;
Note: See TracChangeset
for help on using the changeset viewer.