OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 Google Inc. All rights reserved. | 2 * Copyright (c) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 #include "bindings/core/v8/DOMWrapperWorld.h" | 34 #include "bindings/core/v8/DOMWrapperWorld.h" |
35 #include "bindings/core/v8/ScriptController.h" | 35 #include "bindings/core/v8/ScriptController.h" |
36 #include "bindings/core/v8/ScriptSourceCode.h" | 36 #include "bindings/core/v8/ScriptSourceCode.h" |
37 #include "bindings/core/v8/V8Binding.h" | 37 #include "bindings/core/v8/V8Binding.h" |
38 #include "bindings/core/v8/V8ScriptRunner.h" | 38 #include "bindings/core/v8/V8ScriptRunner.h" |
39 #include "bindings/core/v8/V8Window.h" | 39 #include "bindings/core/v8/V8Window.h" |
40 #include "bindings/core/v8/WindowProxy.h" | 40 #include "bindings/core/v8/WindowProxy.h" |
41 #include "core/frame/FrameConsole.h" | 41 #include "core/frame/FrameConsole.h" |
42 #include "core/frame/FrameHost.h" | 42 #include "core/frame/FrameHost.h" |
| 43 #include "core/frame/FrameProtector.h" |
43 #include "core/frame/LocalFrame.h" | 44 #include "core/frame/LocalFrame.h" |
44 #include "core/frame/UseCounter.h" | 45 #include "core/frame/UseCounter.h" |
45 #include "core/inspector/InspectorInstrumentation.h" | 46 #include "core/inspector/InspectorInstrumentation.h" |
46 #include "core/inspector/InspectorTraceEvents.h" | 47 #include "core/inspector/InspectorTraceEvents.h" |
47 #include "core/inspector/ScriptDebugListener.h" | 48 #include "core/inspector/ScriptDebugListener.h" |
48 #include "core/page/Page.h" | 49 #include "core/page/Page.h" |
49 #include "wtf/OwnPtr.h" | 50 #include "wtf/OwnPtr.h" |
50 #include "wtf/PassOwnPtr.h" | 51 #include "wtf/PassOwnPtr.h" |
51 #include "wtf/StdLibExtras.h" | 52 #include "wtf/StdLibExtras.h" |
52 #include "wtf/TemporaryChange.h" | 53 #include "wtf/TemporaryChange.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 } | 165 } |
165 | 166 |
166 void PageScriptDebugServer::setClientMessageLoop(PassOwnPtr<ClientMessageLoop> c
lientMessageLoop) | 167 void PageScriptDebugServer::setClientMessageLoop(PassOwnPtr<ClientMessageLoop> c
lientMessageLoop) |
167 { | 168 { |
168 m_clientMessageLoop = clientMessageLoop; | 169 m_clientMessageLoop = clientMessageLoop; |
169 } | 170 } |
170 | 171 |
171 void PageScriptDebugServer::compileScript(ScriptState* scriptState, const String
& expression, const String& sourceURL, String* scriptId, String* exceptionDetail
sText, int* lineNumber, int* columnNumber, RefPtrWillBeRawPtr<ScriptCallStack>*
stackTrace) | 172 void PageScriptDebugServer::compileScript(ScriptState* scriptState, const String
& expression, const String& sourceURL, String* scriptId, String* exceptionDetail
sText, int* lineNumber, int* columnNumber, RefPtrWillBeRawPtr<ScriptCallStack>*
stackTrace) |
172 { | 173 { |
173 ExecutionContext* executionContext = scriptState->executionContext(); | 174 ExecutionContext* executionContext = scriptState->executionContext(); |
174 RefPtr<LocalFrame> protect = toDocument(executionContext)->frame(); | 175 FrameProtector protect(toDocument(executionContext)->frame()); |
175 ScriptDebugServer::compileScript(scriptState, expression, sourceURL, scriptI
d, exceptionDetailsText, lineNumber, columnNumber, stackTrace); | 176 ScriptDebugServer::compileScript(scriptState, expression, sourceURL, scriptI
d, exceptionDetailsText, lineNumber, columnNumber, stackTrace); |
176 if (!scriptId->isNull()) | 177 if (!scriptId->isNull()) |
177 m_compiledScriptURLs.set(*scriptId, sourceURL); | 178 m_compiledScriptURLs.set(*scriptId, sourceURL); |
178 } | 179 } |
179 | 180 |
180 void PageScriptDebugServer::clearCompiledScripts() | 181 void PageScriptDebugServer::clearCompiledScripts() |
181 { | 182 { |
182 ScriptDebugServer::clearCompiledScripts(); | 183 ScriptDebugServer::clearCompiledScripts(); |
183 m_compiledScriptURLs.clear(); | 184 m_compiledScriptURLs.clear(); |
184 } | 185 } |
185 | 186 |
186 void PageScriptDebugServer::runScript(ScriptState* scriptState, const String& sc
riptId, ScriptValue* result, bool* wasThrown, String* exceptionDetailsText, int*
lineNumber, int* columnNumber, RefPtrWillBeRawPtr<ScriptCallStack>* stackTrace) | 187 void PageScriptDebugServer::runScript(ScriptState* scriptState, const String& sc
riptId, ScriptValue* result, bool* wasThrown, String* exceptionDetailsText, int*
lineNumber, int* columnNumber, RefPtrWillBeRawPtr<ScriptCallStack>* stackTrace) |
187 { | 188 { |
188 String sourceURL = m_compiledScriptURLs.take(scriptId); | 189 String sourceURL = m_compiledScriptURLs.take(scriptId); |
189 | 190 |
190 ExecutionContext* executionContext = scriptState->executionContext(); | 191 ExecutionContext* executionContext = scriptState->executionContext(); |
191 LocalFrame* frame = toDocument(executionContext)->frame(); | 192 LocalFrame* frame = toDocument(executionContext)->frame(); |
192 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "EvaluateScript
", "data", InspectorEvaluateScriptEvent::data(frame, sourceURL, TextPosition::mi
nimumPosition().m_line.oneBasedInt())); | 193 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "EvaluateScript
", "data", InspectorEvaluateScriptEvent::data(frame, sourceURL, TextPosition::mi
nimumPosition().m_line.oneBasedInt())); |
193 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", "stack", InspectorCallStackEvent::currentCallStack()); | 194 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", "stack", InspectorCallStackEvent::currentCallStack()); |
194 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli
ne migrates to tracing. | 195 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli
ne migrates to tracing. |
195 InspectorInstrumentationCookie cookie; | 196 InspectorInstrumentationCookie cookie; |
196 if (frame) | 197 if (frame) |
197 cookie = InspectorInstrumentation::willEvaluateScript(frame, sourceURL,
TextPosition::minimumPosition().m_line.oneBasedInt()); | 198 cookie = InspectorInstrumentation::willEvaluateScript(frame, sourceURL,
TextPosition::minimumPosition().m_line.oneBasedInt()); |
198 | 199 |
199 RefPtr<LocalFrame> protect = frame; | 200 FrameProtector protect(frame); |
200 ScriptDebugServer::runScript(scriptState, scriptId, result, wasThrown, excep
tionDetailsText, lineNumber, columnNumber, stackTrace); | 201 ScriptDebugServer::runScript(scriptState, scriptId, result, wasThrown, excep
tionDetailsText, lineNumber, columnNumber, stackTrace); |
201 | 202 |
202 if (frame) | 203 if (frame) |
203 InspectorInstrumentation::didEvaluateScript(cookie); | 204 InspectorInstrumentation::didEvaluateScript(cookie); |
204 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", "data", InspectorUpdateCountersEvent::data()); | 205 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", "data", InspectorUpdateCountersEvent::data()); |
205 } | 206 } |
206 | 207 |
207 ScriptDebugListener* PageScriptDebugServer::getDebugListenerForContext(v8::Handl
e<v8::Context> context) | 208 ScriptDebugListener* PageScriptDebugServer::getDebugListenerForContext(v8::Handl
e<v8::Context> context) |
208 { | 209 { |
209 v8::HandleScope scope(m_isolate); | 210 v8::HandleScope scope(m_isolate); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 UseCounter::muteForInspector(); | 320 UseCounter::muteForInspector(); |
320 } | 321 } |
321 | 322 |
322 void PageScriptDebugServer::unmuteWarningsAndDeprecations() | 323 void PageScriptDebugServer::unmuteWarningsAndDeprecations() |
323 { | 324 { |
324 FrameConsole::unmute(); | 325 FrameConsole::unmute(); |
325 UseCounter::unmuteForInspector(); | 326 UseCounter::unmuteForInspector(); |
326 } | 327 } |
327 | 328 |
328 } // namespace blink | 329 } // namespace blink |
OLD | NEW |