| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Google Inc. All rights reserved. | 3 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 */ | 28 */ |
| 29 | 29 |
| 30 #include "config.h" | 30 #include "config.h" |
| 31 #include "InspectorFrontend.h" | 31 #include "InspectorFrontend.h" |
| 32 | 32 |
| 33 #if ENABLE(INSPECTOR) | 33 #if ENABLE(INSPECTOR) |
| 34 | 34 |
| 35 #include "ConsoleMessage.h" | 35 #include "ConsoleMessage.h" |
| 36 #include "Frame.h" | 36 #include "Frame.h" |
| 37 #include "InjectedScriptHost.h" |
| 37 #include "InspectorController.h" | 38 #include "InspectorController.h" |
| 38 #include "Node.h" | 39 #include "Node.h" |
| 39 #include "ScriptFunctionCall.h" | 40 #include "ScriptFunctionCall.h" |
| 40 #include "ScriptObject.h" | 41 #include "ScriptObject.h" |
| 41 #include "ScriptState.h" | 42 #include "ScriptState.h" |
| 42 #include "ScriptString.h" | 43 #include "ScriptString.h" |
| 43 #include <wtf/OwnPtr.h> | 44 #include <wtf/OwnPtr.h> |
| 44 | 45 |
| 45 #if ENABLE(JAVASCRIPT_DEBUGGER) | 46 #if ENABLE(JAVASCRIPT_DEBUGGER) |
| 46 #include <parser/SourceCode.h> | 47 #include <parser/SourceCode.h> |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 } | 87 } |
| 87 | 88 |
| 88 void InspectorFrontend::updateConsoleMessageExpiredCount(unsigned count) | 89 void InspectorFrontend::updateConsoleMessageExpiredCount(unsigned count) |
| 89 { | 90 { |
| 90 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); | 91 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); |
| 91 function.appendArgument("updateConsoleMessageExpiredCount"); | 92 function.appendArgument("updateConsoleMessageExpiredCount"); |
| 92 function.appendArgument(count); | 93 function.appendArgument(count); |
| 93 function.call(); | 94 function.call(); |
| 94 } | 95 } |
| 95 | 96 |
| 96 void InspectorFrontend::addConsoleMessage(const ScriptObject& messageObj, const
Vector<ScriptString>& frames, const Vector<ScriptValue> wrappedArguments, const
String& message) | 97 void InspectorFrontend::addConsoleMessage(const ScriptObject& messageObj, const
Vector<ScriptString>& frames, ScriptState* scriptState, const Vector<ScriptValue
> arguments, const String& message) |
| 97 { | 98 { |
| 98 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); | 99 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); |
| 99 function.appendArgument("addConsoleMessage"); | 100 function.appendArgument("addConsoleMessage"); |
| 100 function.appendArgument(messageObj); | 101 function.appendArgument(messageObj); |
| 101 if (!frames.isEmpty()) { | 102 if (!frames.isEmpty()) { |
| 103 function.appendArgument(false); |
| 102 for (unsigned i = 0; i < frames.size(); ++i) | 104 for (unsigned i = 0; i < frames.size(); ++i) |
| 103 function.appendArgument(frames[i]); | 105 function.appendArgument(frames[i]); |
| 104 } else if (!wrappedArguments.isEmpty()) { | 106 } else if (!arguments.isEmpty()) { |
| 105 for (unsigned i = 0; i < wrappedArguments.size(); ++i) | 107 function.appendArgument(true); |
| 106 function.appendArgument(m_inspectorController->wrapObject(wrappedArg
uments[i], "console")); | 108 ScriptObject injectedScript = m_inspectorController->injectedScriptHost(
)->injectedScriptFor(scriptState); |
| 107 } else | 109 for (unsigned i = 0; i < arguments.size(); ++i) { |
| 110 ScriptFunctionCall wrapFunction(scriptState, injectedScript, "wrapAn
dStringifyObject"); |
| 111 wrapFunction.appendArgument(arguments[i]); |
| 112 wrapFunction.appendArgument("console"); |
| 113 ScriptValue r = wrapFunction.call(); |
| 114 if (r.hasNoValue()) |
| 115 return; |
| 116 String s = r.toString(scriptState); |
| 117 function.appendArgument(s); |
| 118 } |
| 119 } else { |
| 120 function.appendArgument(false); |
| 108 function.appendArgument(message); | 121 function.appendArgument(message); |
| 122 } |
| 109 function.call(); | 123 function.call(); |
| 110 } | 124 } |
| 111 | 125 |
| 112 void InspectorFrontend::updateConsoleMessageRepeatCount(unsigned count) | 126 void InspectorFrontend::updateConsoleMessageRepeatCount(unsigned count) |
| 113 { | 127 { |
| 114 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); | 128 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); |
| 115 function.appendArgument("updateConsoleMessageRepeatCount"); | 129 function.appendArgument("updateConsoleMessageRepeatCount"); |
| 116 function.appendArgument(count); | 130 function.appendArgument(count); |
| 117 function.call(); | 131 function.call(); |
| 118 } | 132 } |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 | 319 |
| 306 void InspectorFrontend::didGetProfile(int callId, const ScriptValue& profile) | 320 void InspectorFrontend::didGetProfile(int callId, const ScriptValue& profile) |
| 307 { | 321 { |
| 308 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); | 322 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); |
| 309 function.appendArgument("didGetProfile"); | 323 function.appendArgument("didGetProfile"); |
| 310 function.appendArgument(callId); | 324 function.appendArgument(callId); |
| 311 function.appendArgument(profile); | 325 function.appendArgument(profile); |
| 312 function.call(); | 326 function.call(); |
| 313 } | 327 } |
| 314 | 328 |
| 315 void InspectorFrontend::pausedScript(const ScriptValue& callFrames) | 329 void InspectorFrontend::pausedScript(const String& callFrames) |
| 316 { | 330 { |
| 317 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); | 331 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); |
| 318 function.appendArgument("pausedScript"); | 332 function.appendArgument("pausedScript"); |
| 319 function.appendArgument(callFrames); | 333 function.appendArgument(callFrames); |
| 320 function.call(); | 334 function.call(); |
| 321 } | 335 } |
| 322 | 336 |
| 323 void InspectorFrontend::resumedScript() | 337 void InspectorFrontend::resumedScript() |
| 324 { | 338 { |
| 325 callSimpleFunction("resumedScript"); | 339 callSimpleFunction("resumedScript"); |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 void InspectorFrontend::callSimpleFunction(const String& functionName) | 574 void InspectorFrontend::callSimpleFunction(const String& functionName) |
| 561 { | 575 { |
| 562 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); | 576 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); |
| 563 function.appendArgument(functionName); | 577 function.appendArgument(functionName); |
| 564 function.call(); | 578 function.call(); |
| 565 } | 579 } |
| 566 | 580 |
| 567 } // namespace WebCore | 581 } // namespace WebCore |
| 568 | 582 |
| 569 #endif // ENABLE(INSPECTOR) | 583 #endif // ENABLE(INSPECTOR) |
| OLD | NEW |