Changeset 85319 in webkit
- Timestamp:
- Apr 29, 2011 5:36:51 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r85317 r85319 1 2011-04-28 Yury Semikhatsky <yurys@chromium.org> 2 3 Reviewed by Pavel Feldman. 4 5 Web Inspector: [protocol] Evaluate should expose thrown exception value 6 https://bugs.webkit.org/show_bug.cgi?id=59000 7 8 * inspector/console/console-dir-expected.txt: 9 * inspector/console/console-eval-global-expected.txt: 10 * inspector/console/console-format-expected.txt: 11 * inspector/extensions/extensions-eval-expected.txt: 12 * inspector/protocol/console-agent-expected.txt: 13 * inspector/protocol/runtime-agent-expected.txt: 14 1 15 2011-04-29 Sheriff Bot <webkit.review.bot@gmail.com> 2 16 -
trunk/LayoutTests/http/tests/inspector/inspector-test.js
r85317 r85319 49 49 callback = InspectorTest.safeWrap(callback); 50 50 51 function mycallback(error, result )51 function mycallback(error, result, wasThrown) 52 52 { 53 53 if (!error) 54 callback(WebInspector.RemoteObject.fromPayload(result) );54 callback(WebInspector.RemoteObject.fromPayload(result), wasThrown); 55 55 } 56 56 RuntimeAgent.evaluate(code, "console", false, mycallback); -
trunk/LayoutTests/inspector/console/console-dir-expected.txt
r85063 r85319 19 19 20 20 console-dir.html:11XPathResult 21 booleanValue: XPathException21 booleanValue: [Exception: XPathException] 22 22 constructor: XPathResultConstructor 23 23 invalidIteratorState: false 24 numberValue: XPathException24 numberValue: [Exception: XPathException] 25 25 resultType: 4 26 singleNodeValue: XPathException27 snapshotLength: XPathException28 stringValue: XPathException26 singleNodeValue: [Exception: XPathException] 27 snapshotLength: [Exception: XPathException] 28 stringValue: [Exception: XPathException] 29 29 __proto__: XPathResultPrototype 30 30 -
trunk/LayoutTests/inspector/console/console-eval-global-expected.txt
r78535 r85319 4 4 "fooValue" 5 5 bar1 6 ReferenceError: Can't find variable: bar1 6 Error 7 7 -
trunk/LayoutTests/inspector/console/console-format-expected.txt
r80628 r85319 65 65 globals[3] 66 66 "test named "test"" 67 console-format.html:53Error :68 console-format.html:54[Error :]67 console-format.html:53Error 68 console-format.html:54[Error] 69 69 globals[4] 70 Error :70 Error 71 71 console-format.html:53<body onload="onload()">…</body> 72 72 console-format.html:54[<body onload="onload()">…</body>] -
trunk/LayoutTests/inspector/extensions/extensions-eval-expected.txt
r78535 r85319 8 8 Evaluate: {"func":"function","variable":42} (exception: undefined) 9 9 RUNNING TEST: extension_testEvalFailed 10 Evaluate: " TypeError: JSON.stringify cannot serialize cyclic structures." (exception: true)10 Evaluate: "Error" (exception: true) 11 11 RUNNING TEST: extension_testEvalOk 12 12 Evaluate: {"str":"foo","num":42} (exception: undefined) -
trunk/LayoutTests/platform/chromium/inspector/console/console-dir-expected.txt
r85073 r85319 18 18 19 19 console-dir.html:11XPathResult 20 booleanValue: XPathException20 booleanValue: [Exception: XPathException] 21 21 invalidIteratorState: false 22 numberValue: XPathException22 numberValue: [Exception: XPathException] 23 23 resultType: 4 24 singleNodeValue: XPathException25 snapshotLength: XPathException26 stringValue: XPathException24 singleNodeValue: [Exception: XPathException] 25 snapshotLength: [Exception: XPathException] 26 stringValue: [Exception: XPathException] 27 27 __proto__: XPathResult 28 28 -
trunk/LayoutTests/platform/chromium/inspector/console/console-eval-global-expected.txt
r82713 r85319 4 4 "fooValue" 5 5 bar1 6 ReferenceError : bar1 is not defined6 ReferenceError 7 7 -
trunk/Source/WebCore/ChangeLog
r85317 r85319 1 2011-04-28 Yury Semikhatsky <yurys@chromium.org> 2 3 Reviewed by Pavel Feldman. 4 5 Web Inspector: [protocol] Evaluate should expose thrown exception value 6 https://bugs.webkit.org/show_bug.cgi?id=59000 7 8 Each evaluation command may have either thrown or returned result. This is indicated 9 by wasThrown property in the protocol. 10 11 * inspector/InjectedScript.cpp: 12 (WebCore::InjectedScript::evaluate): 13 (WebCore::InjectedScript::evaluateOn): 14 (WebCore::InjectedScript::evaluateOnCallFrame): 15 (WebCore::InjectedScript::getProperties): 16 (WebCore::InjectedScript::makeEvalCall): 17 * inspector/InjectedScript.h: 18 * inspector/InjectedScriptSource.js: 19 * inspector/Inspector.json: Removed "error" remote object type, added "wasThrown" property to 20 the evaluation results. 21 * inspector/InspectorDebuggerAgent.cpp: 22 (WebCore::InspectorDebuggerAgent::evaluateOnCallFrame): 23 * inspector/InspectorDebuggerAgent.h: 24 * inspector/InspectorRuntimeAgent.cpp: 25 (WebCore::InspectorRuntimeAgent::evaluate): 26 (WebCore::InspectorRuntimeAgent::evaluateOn): 27 (WebCore::InspectorRuntimeAgent::getProperties): 28 * inspector/InspectorRuntimeAgent.h: 29 * inspector/front-end/ConsoleView.js: 30 (WebInspector.ConsoleView.prototype.completions.evaluated): 31 (WebInspector.ConsoleView.prototype.evalInInspectedWindow): 32 (WebInspector.ConsoleView.prototype._enterKeyPressed.printResult): 33 (WebInspector.ConsoleView.prototype._enterKeyPressed): 34 (WebInspector.ConsoleCommandResult): 35 * inspector/front-end/DebuggerPresentationModel.js: 36 (WebInspector.PresenationCallFrame.prototype.evaluate): 37 * inspector/front-end/ElementsTreeOutline.js: 38 (WebInspector.ElementsTreeElement.prototype._createTooltipForNode.setTooltip): 39 * inspector/front-end/ExtensionPanel.js: 40 (WebInspector.ExtensionSidebarPane.prototype._onEvaluate): 41 * inspector/front-end/ExtensionServer.js: 42 (WebInspector.ExtensionServer.prototype._onEvaluateOnInspectedPage): 43 * inspector/front-end/ObjectPropertiesSection.js: 44 (WebInspector.ObjectPropertyTreeElement.prototype.update): 45 * inspector/front-end/PropertiesSidebarPane.js: 46 (WebInspector.PropertiesSidebarPane.prototype.update.nodePrototypesReady): 47 * inspector/front-end/SourceFrame.js: 48 (WebInspector.SourceFrame.prototype._showPopup.showObjectPopup): 49 (WebInspector.SourceFrame.prototype._showPopup): 50 1 51 2011-04-29 Sheriff Bot <webkit.review.bot@gmail.com> 2 52 -
trunk/Source/WebCore/inspector/CodeGeneratorInspector.pm
r84780 r85319 491 491 push(@function, " RefPtr<InspectorObject> responseMessage = InspectorObject::create();"); 492 492 push(@function, " RefPtr<InspectorObject> result = InspectorObject::create();"); 493 push(@function, map(" result->set" . typeTraits($_->type, "JSONType") . "(\"" . $_->name . "\", out_" . $_->name . ");", @outArgs)); 493 foreach my $parameter (@outArgs) { 494 my $offset = " "; 495 # Don't add optional boolean parameter to the result unless it is "true" 496 if ($parameter->extendedAttributes->{"optional"} && $parameter->type eq "boolean") { 497 push(@function, $offset . "if (out_" . $parameter->name . ")"); 498 $offset .= " "; 499 } 500 push(@function, $offset . "result->set" . typeTraits($parameter->type, "JSONType") . "(\"" . $parameter->name . "\", out_" . $parameter->name . ");"); 501 } 494 502 push(@function, " responseMessage->setObject(\"result\", result);"); 495 503 push(@function, ""); -
trunk/Source/WebCore/inspector/InjectedScript.cpp
r85035 r85319 1 1 /* 2 * Copyright (C) 2010 Google Inc. All rights reserved.2 * Copyright (C) 2010, 2011 Google Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 55 55 } 56 56 57 void InjectedScript::evaluate(ErrorString* errorString, const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorObject>* result )57 void InjectedScript::evaluate(ErrorString* errorString, const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorObject>* result, bool* wasThrown) 58 58 { 59 59 ScriptFunctionCall function(m_injectedScriptObject, "evaluate"); … … 61 61 function.appendArgument(objectGroup); 62 62 function.appendArgument(includeCommandLineAPI); 63 make ObjectCall(errorString, function, result);64 } 65 66 void InjectedScript::evaluateOn(ErrorString* errorString, const String& objectId, const String& expression, RefPtr<InspectorObject>* result )63 makeEvalCall(errorString, function, result, wasThrown); 64 } 65 66 void InjectedScript::evaluateOn(ErrorString* errorString, const String& objectId, const String& expression, RefPtr<InspectorObject>* result, bool* wasThrown) 67 67 { 68 68 ScriptFunctionCall function(m_injectedScriptObject, "evaluateOn"); 69 69 function.appendArgument(objectId); 70 70 function.appendArgument(expression); 71 make ObjectCall(errorString, function, result);72 } 73 74 void InjectedScript::evaluateOnCallFrame(ErrorString* errorString, const ScriptValue& callFrames, const String& callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorObject>* result )71 makeEvalCall(errorString, function, result, wasThrown); 72 } 73 74 void InjectedScript::evaluateOnCallFrame(ErrorString* errorString, const ScriptValue& callFrames, const String& callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorObject>* result, bool* wasThrown) 75 75 { 76 76 ScriptFunctionCall function(m_injectedScriptObject, "evaluateOnCallFrame"); … … 80 80 function.appendArgument(objectGroup); 81 81 function.appendArgument(includeCommandLineAPI); 82 make ObjectCall(errorString, function, result);82 makeEvalCall(errorString, function, result, wasThrown); 83 83 } 84 84 … … 89 89 function.appendArgument(ignoreHasOwnProperty); 90 90 91 RefPtr<InspectorValue> result; 91 RefPtr<InspectorValue> result; 92 92 makeCall(function, &result); 93 93 if (!result || result->type() != InspectorValue::TypeArray) { … … 207 207 } 208 208 209 void InjectedScript::makeObjectCall(ErrorString* errorString, ScriptFunctionCall& function, RefPtr<InspectorObject>* objectResult) 210 { 211 RefPtr<InspectorValue> result; 212 makeCall(function, &result); 213 if (result && result->type() == InspectorValue::TypeString) { 209 void InjectedScript::makeEvalCall(ErrorString* errorString, ScriptFunctionCall& function, RefPtr<InspectorObject>* objectResult, bool* wasThrown) 210 { 211 RefPtr<InspectorValue> result; 212 makeCall(function, &result); 213 if (!result) { 214 *errorString = "Internal error: result value is empty"; 215 return; 216 } 217 if (result->type() == InspectorValue::TypeString) { 214 218 result->asString(errorString); 215 219 return; 216 220 } 217 218 if (!result || result->type() != InspectorValue::TypeObject) { 219 *errorString = "Internal error"; 220 return; 221 } 222 *objectResult = result->asObject(); 221 RefPtr<InspectorObject> resultPair = result->asObject(); 222 if (!resultPair) { 223 *errorString = "Internal error: result is not an Object"; 224 return; 225 } 226 RefPtr<InspectorObject> resultObj = resultPair->getObject("result"); 227 bool wasThrownVal = false; 228 if (!resultObj || !resultPair->getBoolean("wasThrown", &wasThrownVal)) { 229 *errorString = "Internal error: result is not a pair of value and wasThrown flag"; 230 return; 231 } 232 *objectResult = resultObj; 233 *wasThrown = wasThrownVal; 223 234 } 224 235 -
trunk/Source/WebCore/inspector/InjectedScript.h
r85035 r85319 1 1 /* 2 * Copyright (C) 2010 Google Inc. All rights reserved.2 * Copyright (C) 2010, 2011 Google Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 56 56 bool hasNoValue() const { return m_injectedScriptObject.hasNoValue(); } 57 57 58 void evaluate(ErrorString*, const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorObject>* result );59 void evaluateOn(ErrorString*, const String& objectId, const String& expression, RefPtr<InspectorObject>* result );60 void evaluateOnCallFrame(ErrorString*, const ScriptValue& callFrames, const String& callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorObject>* result );58 void evaluate(ErrorString*, const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorObject>* result, bool* wasThrown); 59 void evaluateOn(ErrorString*, const String& objectId, const String& expression, RefPtr<InspectorObject>* result, bool* wasThrown); 60 void evaluateOnCallFrame(ErrorString*, const ScriptValue& callFrames, const String& callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorObject>* result, bool* wasThrown); 61 61 void getProperties(ErrorString*, const String& objectId, bool ignoreHasOwnProperty, RefPtr<InspectorArray>* result); 62 62 Node* nodeForObjectId(const String& objectId); … … 81 81 bool canAccessInspectedWindow(); 82 82 void makeCall(ScriptFunctionCall&, RefPtr<InspectorValue>* result); 83 void make ObjectCall(ErrorString*, ScriptFunctionCall&, RefPtr<InspectorObject>* result);83 void makeEvalCall(ErrorString*, ScriptFunctionCall&, RefPtr<InspectorObject>* result, bool* wasThrown); 84 84 ScriptValue nodeAsScriptValue(Node*); 85 85 -
trunk/Source/WebCore/inspector/InjectedScriptSource.js
r85054 r85319 91 91 }, 92 92 93 // This method cannot throw. 93 94 _wrapObject: function(object, objectGroupName) 94 95 { … … 97 98 var id = this._lastBoundObjectId++; 98 99 this._idToWrappedObject[id] = object; 99 var objectId = "{\"injectedScriptId\":" + injectedScriptId + ",\"id\":" + id + "}"; 100 var objectId = "{\"injectedScriptId\":" + injectedScriptId + ",\"id\":" + id + "}"; 100 101 if (objectGroupName) { 101 102 var group = this._objectGroups[objectGroupName]; … … 110 111 return InjectedScript.RemoteObject.fromObject(object, objectId); 111 112 } catch (e) { 112 return InjectedScript.RemoteObject.from Object("[ Exception: " + e.toString() + " ]");113 return InjectedScript.RemoteObject.fromException(e); 113 114 } 114 115 }, … … 153 154 if (!ignoreHasOwnProperty && object.__proto__) 154 155 propertyNames.push("__proto__"); 155 156 156 157 // Go over properties, prepare results. 157 158 for (var i = 0; i < propertyNames.length; ++i) { 158 159 var propertyName = propertyNames[i]; 159 160 160 161 var property = {}; 161 162 property.name = propertyName + ""; … … 163 164 if (!isGetter) { 164 165 try { 165 property.value = this._wrapObject(object[propertyName], objectGroupName);166 var value = object[propertyName]; 166 167 } catch(e) { 167 property.value = new InjectedScript.RemoteObject.fromException(e); 168 var value = e; 169 property.wasThrown = true; 168 170 } 171 property.value = this._wrapObject(value, objectGroupName); 169 172 } else { 170 173 // FIXME: this should show something like "getter" (bug 16734). 171 property.value = newInjectedScript.RemoteObject.fromObject("\u2014"); // em dash174 property.value = InjectedScript.RemoteObject.fromObject("\u2014"); // em dash 172 175 property.isGetter = true; 173 176 } … … 183 186 if (!this._isDefined(object)) 184 187 return "Object with given id not found"; 185 188 186 189 var expressionLength = expression.length; 187 190 if (!expressionLength) { … … 189 192 return propertyName in object ? "Cound not delete property." : undefined; 190 193 } 191 194 192 195 try { 193 196 // Surround the expression in parenthesis so the result of the eval is the result 194 197 // of the whole expression not the last potential sub-expression. 195 198 196 199 // There is a regression introduced here: eval is now happening against global object, 197 200 // not call frame while on a breakpoint. … … 263 266 { 264 267 try { 265 return this._wrapObject(this._evaluateOn(evalFunction, object, expression, isEvalOnCallFrame, injectCommandLineAPI), objectGroup); 268 return { wasThrown: false, 269 result: this._wrapObject(this._evaluateOn(evalFunction, object, expression, isEvalOnCallFrame, injectCommandLineAPI), objectGroup) }; 266 270 } catch (e) { 267 return InjectedScript.RemoteObject.fromException(e); 271 return { wasThrown: true, 272 result: this._wrapObject(e, objectGroup) }; 268 273 } 269 274 }, … … 280 285 expression = "with ((window && window.console && window.console._commandLineAPI) || {}) {\n" + expression + "\n}"; 281 286 } 282 283 var value = evalFunction.call(object, expression); 284 285 // When evaluating on call frame error is not thrown, but returned as a value. 286 if (this._type(value) === "error") 287 throw value.toString(); 288 289 return value; 287 return evalFunction.call(object, expression); 290 288 } finally { 291 289 if (injectCommandLineAPI && inspectedWindow.console) … … 298 296 if (!callFrame) 299 297 return false; 300 298 301 299 var result = []; 302 300 var depth = 0; … … 396 394 if (obj instanceof inspectedWindow.HTMLCollection) 397 395 return "array"; 398 if (obj instanceof inspectedWindow.Error)399 return "error";400 396 return type; 401 397 }, … … 458 454 var description = "<failed to convert exception to string>"; 459 455 } 460 return new InjectedScript.RemoteObject(null, "error", description); 461 } 462 456 return new InjectedScript.RemoteObject(null, "string", "[ Exception: " + description + " ]"); 457 } 458 459 // This method may throw 463 460 InjectedScript.RemoteObject.fromObject = function(object, objectId) 464 461 { … … 467 464 var hasChildren = (rawType === "object" && object !== null && (!!Object.getOwnPropertyNames(object).length || !!object.__proto__)) || rawType === "function"; 468 465 var description = ""; 469 try { 470 var description = injectedScript._describe(object); 471 return new InjectedScript.RemoteObject(objectId, type, description, hasChildren); 472 } catch (e) { 473 return InjectedScript.RemoteObject.fromException(e); 474 } 466 var description = injectedScript._describe(object); 467 return new InjectedScript.RemoteObject(objectId, type, description, hasChildren); 475 468 } 476 469 -
trunk/Source/WebCore/inspector/Inspector.json
r85035 r85319 202 202 { "name": "hasChildren", "type": "boolean", "optional": true, "description": "True when this object can be queried for children." }, 203 203 { "name": "objectId", "type": "string", "optional": true, "description": "Unique object identifier (for non-primitive values)." }, 204 { "name": "type", "type": "string", "enum": ["object", "array", "function", "null", "node", "undefined", "string", "number", "boolean", " error", "regexp", "date"], "description": "Object type." }204 { "name": "type", "type": "string", "enum": ["object", "array", "function", "null", "node", "undefined", "string", "number", "boolean", "regexp", "date"], "description": "Object type." } 205 205 ] 206 206 }, … … 212 212 { "name": "name", "type": "string", "description": "Property name." }, 213 213 { "name": "value", "$ref": "RemoteObject", "description": "Property value." }, 214 { "name": "wasThrown", "type": "boolean", "optional": true, "description": "True if exception was thrown on attempt to get the property value, in that case the value propery will contain thrown value." }, 214 215 { "name": "isGetter", "type": "boolean", "optional": true, "description": "True if this property is getter." } 215 216 ] … … 225 226 ], 226 227 "returns": [ 227 { "name": "result", "$ref": "RemoteObject", "description": "Evaluation result." } 228 { "name": "result", "$ref": "RemoteObject", "description": "Evaluation result." }, 229 { "name": "wasThrown", "type": "boolean", "optional": true, "description": "True iff the result was thrown during the evaluation." } 228 230 ], 229 231 "description": "Evaluate expression on global object." … … 236 238 ], 237 239 "returns": [ 238 { "name": "result", "$ref": "RemoteObject", "description": "Evaluation result." } 240 { "name": "result", "$ref": "RemoteObject", "description": "Evaluation result." }, 241 { "name": "wasThrown", "type": "boolean", "optional": true, "description": "True iff the result was thrown during the evaluation." } 239 242 ], 240 243 "description": "Evaluate expression on given object using it as <code>this</code>." … … 1450 1453 ], 1451 1454 "returns": [ 1452 { "name": "result", "$ref": "Runtime.RemoteObject", "description": "Object wrapper for the evaluation result." } 1455 { "name": "result", "$ref": "Runtime.RemoteObject", "description": "Object wrapper for the evaluation result." }, 1456 { "name": "wasThrown", "type": "boolean", "optional": true, "description": "True iff the result was thrown during the evaluation." } 1453 1457 ], 1454 1458 "description": "Evaluates expression on a given call frame." -
trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp
r85035 r85319 353 353 } 354 354 355 void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString* errorString, const String& callFrameId, const String& expression, const String* const objectGroup, const bool* const includeCommandLineAPI, RefPtr<InspectorObject>* result )355 void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString* errorString, const String& callFrameId, const String& expression, const String* const objectGroup, const bool* const includeCommandLineAPI, RefPtr<InspectorObject>* result, bool* wasThrown) 356 356 { 357 357 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(callFrameId); 358 if (!injectedScript.hasNoValue()) 359 injectedScript.evaluateOnCallFrame(errorString, m_currentCallStack, callFrameId, expression, objectGroup ? *objectGroup : "", includeCommandLineAPI ? *includeCommandLineAPI : false, result); 358 if (injectedScript.hasNoValue()) { 359 *errorString = "Inspected frame has gone"; 360 return; 361 } 362 injectedScript.evaluateOnCallFrame(errorString, m_currentCallStack, callFrameId, expression, objectGroup ? *objectGroup : "", includeCommandLineAPI ? *includeCommandLineAPI : false, result, wasThrown); 360 363 } 361 364 -
trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h
r85035 r85319 98 98 void stepOut(ErrorString*); 99 99 void setPauseOnExceptions(ErrorString*, const String& pauseState); 100 void evaluateOnCallFrame(ErrorString*, const String& callFrameId, const String& expression, const String* const objectGroup, const bool* const includeCommandLineAPI, RefPtr<InspectorObject>* result );100 void evaluateOnCallFrame(ErrorString*, const String& callFrameId, const String& expression, const String* const objectGroup, const bool* const includeCommandLineAPI, RefPtr<InspectorObject>* result, bool* wasThrown); 101 101 102 102 class Listener { -
trunk/Source/WebCore/inspector/InspectorRuntimeAgent.cpp
r83706 r85319 50 50 } 51 51 52 void InspectorRuntimeAgent::evaluate(ErrorString* errorString, const String& expression, const String* const objectGroup, const bool* const includeCommandLineAPI, RefPtr<InspectorObject>* result )52 void InspectorRuntimeAgent::evaluate(ErrorString* errorString, const String& expression, const String* const objectGroup, const bool* const includeCommandLineAPI, RefPtr<InspectorObject>* result, bool* wasThrown) 53 53 { 54 54 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(getDefaultInspectedState()); 55 if (!injectedScript.hasNoValue()) 56 injectedScript.evaluate(errorString, expression, objectGroup ? *objectGroup : "", includeCommandLineAPI ? *includeCommandLineAPI : false, result); 55 if (injectedScript.hasNoValue()) { 56 *errorString = "Inspected frame has gone"; 57 return; 58 } 59 injectedScript.evaluate(errorString, expression, objectGroup ? *objectGroup : "", includeCommandLineAPI ? *includeCommandLineAPI : false, result, wasThrown); 57 60 } 58 61 59 void InspectorRuntimeAgent::evaluateOn(ErrorString* errorString, const String& objectId, const String& expression, RefPtr<InspectorObject>* result )62 void InspectorRuntimeAgent::evaluateOn(ErrorString* errorString, const String& objectId, const String& expression, RefPtr<InspectorObject>* result, bool* wasThrown) 60 63 { 61 64 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId); 62 if (!injectedScript.hasNoValue()) 63 injectedScript.evaluateOn(errorString, objectId, expression, result); 65 if (injectedScript.hasNoValue()) { 66 *errorString = "Inspected frame has gone"; 67 return; 68 } 69 injectedScript.evaluateOn(errorString, objectId, expression, result, wasThrown); 64 70 } 65 71 … … 67 73 { 68 74 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId); 69 if (!injectedScript.hasNoValue()) 70 injectedScript.getProperties(errorString, objectId, ignoreHasOwnProperty, result); 75 if (injectedScript.hasNoValue()) { 76 *errorString = "Inspected frame has gone"; 77 return; 78 } 79 injectedScript.getProperties(errorString, objectId, ignoreHasOwnProperty, result); 71 80 } 72 81 -
trunk/Source/WebCore/inspector/InspectorRuntimeAgent.h
r83706 r85319 53 53 54 54 // Part of the protocol. 55 void evaluate(ErrorString*, const String& expression, const String* const objectGroup, const bool* const includeCommandLineAPI, RefPtr<InspectorObject>* result );56 void evaluateOn(ErrorString*, const String& objectId, const String& expression, RefPtr<InspectorObject>* result );55 void evaluate(ErrorString*, const String& expression, const String* const objectGroup, const bool* const includeCommandLineAPI, RefPtr<InspectorObject>* result, bool* wasThrown); 56 void evaluateOn(ErrorString*, const String& objectId, const String& expression, RefPtr<InspectorObject>* result, bool* wasThrown); 57 57 void releaseObject(ErrorString*, const String& objectId); 58 58 void getProperties(ErrorString*, const String& objectId, bool ignoreHasOwnProperty, RefPtr<InspectorArray>* result); -
trunk/Source/WebCore/inspector/front-end/ConsoleView.js
r85312 r85319 359 359 this.evalInInspectedWindow(expressionString, "completion", true, evaluated.bind(this)); 360 360 361 function evaluated(result )361 function evaluated(result, wasThrown) 362 362 { 363 if ( !result)363 if (wasThrown) 364 364 return; 365 365 result.getAllProperties(evaluatedProperties.bind(this)); … … 535 535 } 536 536 537 function evalCallback(error, result )537 function evalCallback(error, result, wasThrown) 538 538 { 539 539 if (!error) 540 callback(WebInspector.RemoteObject.fromPayload(result) );540 callback(WebInspector.RemoteObject.fromPayload(result), wasThrown); 541 541 } 542 542 RuntimeAgent.evaluate(expression, objectGroup, includeCommandLineAPI, evalCallback); … … 561 561 562 562 var self = this; 563 function printResult(result )563 function printResult(result, wasThrown) 564 564 { 565 565 self.prompt.history.push(str); … … 569 569 WebInspector.settings.consoleHistory = self.prompt.history.slice(-30); 570 570 571 self.addMessage(new WebInspector.ConsoleCommandResult(result, commandMessage));571 self.addMessage(new WebInspector.ConsoleCommandResult(result, wasThrown, commandMessage)); 572 572 } 573 573 this.evalInInspectedWindow(str, "console", true, printResult); … … 1094 1094 } 1095 1095 1096 WebInspector.ConsoleCommandResult = function(result, originatingCommand)1096 WebInspector.ConsoleCommandResult = function(result, wasThrown, originatingCommand) 1097 1097 { 1098 var level = ( result.isError()? WebInspector.ConsoleMessage.MessageLevel.Error : WebInspector.ConsoleMessage.MessageLevel.Log);1098 var level = (wasThrown ? WebInspector.ConsoleMessage.MessageLevel.Error : WebInspector.ConsoleMessage.MessageLevel.Log); 1099 1099 this.originatingCommand = originatingCommand; 1100 1100 WebInspector.ConsoleMessage.call(this, WebInspector.ConsoleMessage.MessageSource.JS, WebInspector.ConsoleMessage.MessageType.Result, level, -1, null, 1, null, [result]); -
trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js
r85317 r85319 685 685 evaluate: function(code, objectGroup, includeCommandLineAPI, callback) 686 686 { 687 function didEvaluateOnCallFrame(error, result )688 { 689 callback(WebInspector.RemoteObject.fromPayload(result) );687 function didEvaluateOnCallFrame(error, result, wasThrown) 688 { 689 callback(WebInspector.RemoteObject.fromPayload(result), wasThrown); 690 690 } 691 691 DebuggerAgent.evaluateOnCallFrame(this._callFrame.id, code, objectGroup, includeCommandLineAPI, didEvaluateOnCallFrame.bind(this)); -
trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js
r85312 r85319 407 407 return; 408 408 409 function setTooltip(error, result )410 { 411 if (error || !result|| result.type !== "string")409 function setTooltip(error, result, wasThrown) 410 { 411 if (error || wasThrown || result.type !== "string") 412 412 return; 413 413 -
trunk/Source/WebCore/inspector/front-end/ExtensionPanel.js
r84624 r85319 107 107 }, 108 108 109 _onEvaluate: function(title, error, result )109 _onEvaluate: function(title, error, result, wasThrown) 110 110 { 111 111 if (!error) -
trunk/Source/WebCore/inspector/front-end/ExtensionServer.js
r84904 r85319 265 265 _onEvaluateOnInspectedPage: function(message, port) 266 266 { 267 function callback(error, resultPayload )267 function callback(error, resultPayload, wasThrown) 268 268 { 269 269 if (error) … … 271 271 var resultObject = WebInspector.RemoteObject.fromPayload(resultPayload); 272 272 var result = {}; 273 if ( resultObject.isError())273 if (wasThrown) 274 274 result.isException = true; 275 275 result.value = resultObject.description; -
trunk/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js
r82609 r85319 188 188 var description = this.property.value.description; 189 189 // Render \n as a nice unicode cr symbol. 190 if (this.property.value.type === "string" && typeof description === "string") { 190 if (this.property.wasThrown) 191 this.valueElement.textContent = "[Exception: " + description + "]"; 192 else if (this.property.value.type === "string" && typeof description === "string") { 191 193 this.valueElement.textContent = "\"" + description.replace(/\n/g, "\u21B5") + "\""; 192 194 this.valueElement._originalTextContent = "\"" + description + "\""; … … 199 201 if (this.property.isGetter) 200 202 this.valueElement.addStyleClass("dimmed"); 201 if (this.property. value.isError())203 if (this.property.wasThrown) 202 204 this.valueElement.addStyleClass("error"); 203 205 if (this.property.value.type) … … 211 213 this.listItemElement.appendChild(separatorElement); 212 214 this.listItemElement.appendChild(this.valueElement); 213 this.hasChildren = this.property.value.hasChildren ;215 this.hasChildren = this.property.value.hasChildren && !this.property.wasThrown; 214 216 }, 215 217 -
trunk/Source/WebCore/inspector/front-end/PropertiesSidebarPane.js
r82609 r85319 53 53 } 54 54 55 function nodePrototypesReady(error, objectPayload )55 function nodePrototypesReady(error, objectPayload, wasThrown) 56 56 { 57 if (error || !objectPayload)57 if (error || wasThrown) 58 58 return; 59 59 var object = WebInspector.RemoteObject.fromPayload(objectPayload); -
trunk/Source/WebCore/inspector/front-end/SourceFrame.js
r85312 r85319 794 794 } 795 795 796 function showObjectPopup(result )796 function showObjectPopup(result, wasThrown) 797 797 { 798 if ( result.isError()|| !this._delegate.debuggerPaused())798 if (wasThrown || !this._delegate.debuggerPaused()) 799 799 return; 800 800 -
trunk/Source/WebCore/inspector/generate-inspector-idl
r84773 r85319 134 134 if ("returns" in command): 135 135 for out_param in command["returns"]: 136 params.append("out %s %s" % (param_type(domain_name, out_param), out_param["name"])) 136 if ("optional" in out_param): 137 optional = " [optional]" 138 else: 139 optional = "" 140 params.append("out%s %s %s" % (optional, param_type(domain_name, out_param), out_param["name"])) 137 141 output_file.write("\n void %s(%s);" % (command["name"], ", ".join(params))) 138 142
Note: See TracChangeset
for help on using the changeset viewer.