Changeset 48491 in webkit
- Timestamp:
- Sep 17, 2009 1:54:57 PM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r48490 r48491 1 2009-09-17 Yury Semikhatsky <yurys@chromium.org> 2 3 Reviewed by Timothy Hatcher. 4 5 Wrap primitive values (as objects) in InspectorController::wrap. 6 7 https://bugs.webkit.org/show_bug.cgi?id=28983 8 9 * inspector/InspectorController.cpp: 10 (WebCore::InspectorController::wrapObject): objects of any type will be wrapped into proxies, 11 only object proxies will have objectId. 12 * inspector/front-end/ConsoleView.js: 13 (WebInspector.ConsoleView.prototype.completions): there is InjectedScript.getCompletionsi 14 that accepts an expression and returns possible completions. This way we don't need to wrap 15 and unwrap the completions result into a proxy object. 16 * inspector/front-end/InjectedScript.js: 17 (InjectedScript.getCompletions): 18 (InjectedScript.evaluate): 19 (InjectedScript._evaluateOn): 20 (InjectedScript.createProxyObject): 21 * inspector/front-end/InjectedScriptAccess.js: 22 1 23 2009-09-17 Nate Chapin <japhet@chromium.org> 2 24 -
trunk/WebCore/inspector/InspectorController.cpp
r48430 r48491 1532 1532 ScriptValue InspectorController::wrapObject(const ScriptValue& quarantinedObject) 1533 1533 { 1534 ScriptFunctionCall function(m_scriptState, m_injectedScriptObj, "createProxyObject"); 1535 function.appendArgument(quarantinedObject); 1534 1536 if (quarantinedObject.isObject()) { 1535 1537 long id = m_lastBoundObjectId++; … … 1537 1539 m_idToConsoleObject.set(objectId, quarantinedObject); 1538 1540 1539 ScriptFunctionCall function(m_scriptState, m_injectedScriptObj, "createProxyObject");1540 function.appendArgument(quarantinedObject);1541 1541 function.appendArgument(objectId); 1542 ScriptValue wrapper = function.call(); 1543 return wrapper; 1544 } 1545 return quarantinedObject; 1542 } 1543 ScriptValue wrapper = function.call(); 1544 return wrapper; 1546 1545 } 1547 1546 -
trunk/WebCore/inspector/front-end/ConsoleView.js
r48431 r48491 292 292 } 293 293 294 function parsingCallback(result, isException) 295 { 296 if (!isException) 297 result = JSON.parse(result); 298 reportCompletions(result, isException); 299 } 300 301 this.evalInInspectedWindow( 302 "(function() {" + 303 "var props = {};" + 304 "for (var prop in (" + expressionString + ")) props[prop] = true;" + 305 ((!dotNotation && !bracketNotation) ? 306 "for (var prop in window._inspectorCommandLineAPI)" + 307 "if (prop.charAt(0) !== '_') props[prop] = true;" 308 : "") + 309 "return JSON.stringify(props);" + 310 "})()", 311 parsingCallback); 294 var includeInspectorCommandLineAPI = (!dotNotation && !bracketNotation); 295 InjectedScriptAccess.getCompletions(expressionString, includeInspectorCommandLineAPI, reportCompletions); 312 296 }, 313 297 -
trunk/WebCore/inspector/front-end/InjectedScript.js
r48437 r48491 499 499 } 500 500 501 502 InjectedScript.getCompletions = function(expression, includeInspectorCommandLineAPI) 503 { 504 var props = {}; 505 try { 506 var expressionResult = InjectedScript._evaluateOn(InjectedScript._window().eval, InjectedScript._window(), expression); 507 for (var prop in expressionResult) 508 props[prop] = true; 509 if (includeInspectorCommandLineAPI) 510 for (var prop in InjectedScript._window()._inspectorCommandLineAPI) 511 if (prop.charAt(0) !== '_') 512 props[prop] = true; 513 } catch(e) { 514 } 515 return props; 516 } 517 518 501 519 InjectedScript.evaluate = function(expression) 502 520 { 503 return InjectedScript._evaluateOn(InjectedScript._window().eval, InjectedScript._window(), expression);504 }505 506 InjectedScript._evaluateOn = function(evalFunction, object, expression)507 {508 InjectedScript._ensureCommandLineAPIInstalled();509 // Surround the expression in with statements to inject our command line API so that510 // the window object properties still take more precedent than our API functions.511 expression = "with (window._inspectorCommandLineAPI) { with (window) { " + expression + " } }";512 513 521 var result = {}; 514 522 try { 515 var value = evalFunction.call(object, expression);523 var value = InjectedScript._evaluateOn(InjectedScript._window().eval, InjectedScript._window(), expression); 516 524 if (value === null) 517 525 return { value: null }; … … 534 542 } 535 543 return result; 544 } 545 546 InjectedScript._evaluateOn = function(evalFunction, object, expression) 547 { 548 InjectedScript._ensureCommandLineAPIInstalled(); 549 // Surround the expression in with statements to inject our command line API so that 550 // the window object properties still take more precedent than our API functions. 551 expression = "with (window._inspectorCommandLineAPI) { with (window) { " + expression + " } }"; 552 return evalFunction.call(object, expression); 536 553 } 537 554 … … 951 968 952 969 var type = typeof object; 953 if ( type === "object"|| type === "function") {970 if ((type === "object" && object !== null) || type === "function") { 954 971 for (var subPropertyName in object) { 955 972 result.hasChildren = true; -
trunk/WebCore/inspector/front-end/InjectedScriptAccess.js
r48046 r48491 64 64 InjectedScriptAccess._installHandler("getProperties"); 65 65 InjectedScriptAccess._installHandler("setPropertyValue"); 66 InjectedScriptAccess._installHandler("getCompletions"); 66 67 InjectedScriptAccess._installHandler("evaluate"); 67 68 InjectedScriptAccess._installHandler("addInspectedNode");
Note: See TracChangeset
for help on using the changeset viewer.