OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2010-2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2010-2011 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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 m_breakProgramDetails = 0; | 343 m_breakProgramDetails = 0; |
344 scriptDebugServer().setPauseOnNextStatement(false); | 344 scriptDebugServer().setPauseOnNextStatement(false); |
345 } | 345 } |
346 | 346 |
347 void InspectorDebuggerAgent::pause(ErrorString*) | 347 void InspectorDebuggerAgent::pause(ErrorString*) |
348 { | 348 { |
349 schedulePauseOnNextStatement(JavaScriptPauseEventType, InspectorObject::crea
te()); | 349 schedulePauseOnNextStatement(JavaScriptPauseEventType, InspectorObject::crea
te()); |
350 m_javaScriptPauseScheduled = true; | 350 m_javaScriptPauseScheduled = true; |
351 } | 351 } |
352 | 352 |
353 void InspectorDebuggerAgent::resume(ErrorString*) | 353 void InspectorDebuggerAgent::resume(ErrorString* errorString) |
354 { | 354 { |
| 355 if (!assertPaused(errorString)) |
| 356 return; |
355 m_injectedScriptManager->releaseObjectGroup(InspectorDebuggerAgent::backtrac
eObjectGroup); | 357 m_injectedScriptManager->releaseObjectGroup(InspectorDebuggerAgent::backtrac
eObjectGroup); |
356 scriptDebugServer().continueProgram(); | 358 scriptDebugServer().continueProgram(); |
357 } | 359 } |
358 | 360 |
359 void InspectorDebuggerAgent::stepOver(ErrorString*) | 361 void InspectorDebuggerAgent::stepOver(ErrorString* errorString) |
360 { | 362 { |
| 363 if (!assertPaused(errorString)) |
| 364 return; |
361 scriptDebugServer().stepOverStatement(); | 365 scriptDebugServer().stepOverStatement(); |
362 } | 366 } |
363 | 367 |
364 void InspectorDebuggerAgent::stepInto(ErrorString*) | 368 void InspectorDebuggerAgent::stepInto(ErrorString* errorString) |
365 { | 369 { |
| 370 if (!assertPaused(errorString)) |
| 371 return; |
366 scriptDebugServer().stepIntoStatement(); | 372 scriptDebugServer().stepIntoStatement(); |
367 } | 373 } |
368 | 374 |
369 void InspectorDebuggerAgent::stepOut(ErrorString*) | 375 void InspectorDebuggerAgent::stepOut(ErrorString* errorString) |
370 { | 376 { |
| 377 if (!assertPaused(errorString)) |
| 378 return; |
371 scriptDebugServer().stepOutOfFunction(); | 379 scriptDebugServer().stepOutOfFunction(); |
372 } | 380 } |
373 | 381 |
374 void InspectorDebuggerAgent::setPauseOnExceptions(ErrorString* errorString, cons
t String& stringPauseState) | 382 void InspectorDebuggerAgent::setPauseOnExceptions(ErrorString* errorString, cons
t String& stringPauseState) |
375 { | 383 { |
376 ScriptDebugServer::PauseOnExceptionsState pauseState; | 384 ScriptDebugServer::PauseOnExceptionsState pauseState; |
377 if (stringPauseState == "none") | 385 if (stringPauseState == "none") |
378 pauseState = ScriptDebugServer::DontPauseOnExceptions; | 386 pauseState = ScriptDebugServer::DontPauseOnExceptions; |
379 else if (stringPauseState == "all") | 387 else if (stringPauseState == "all") |
380 pauseState = ScriptDebugServer::PauseOnAllExceptions; | 388 pauseState = ScriptDebugServer::PauseOnAllExceptions; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 { | 500 { |
493 m_pausedScriptState = 0; | 501 m_pausedScriptState = 0; |
494 m_currentCallStack = ScriptValue(); | 502 m_currentCallStack = ScriptValue(); |
495 m_scripts.clear(); | 503 m_scripts.clear(); |
496 m_breakpointIdToDebugServerBreakpointIds.clear(); | 504 m_breakpointIdToDebugServerBreakpointIds.clear(); |
497 m_continueToLocationBreakpointId = String(); | 505 m_continueToLocationBreakpointId = String(); |
498 m_breakProgramDetails.clear(); | 506 m_breakProgramDetails.clear(); |
499 m_javaScriptPauseScheduled = false; | 507 m_javaScriptPauseScheduled = false; |
500 } | 508 } |
501 | 509 |
| 510 bool InspectorDebuggerAgent::assertPaused(ErrorString* errorString) |
| 511 { |
| 512 if (!m_pausedScriptState) { |
| 513 *errorString = "Can only perform operation while paused."; |
| 514 return false; |
| 515 } |
| 516 return true; |
| 517 } |
| 518 |
502 } // namespace WebCore | 519 } // namespace WebCore |
503 | 520 |
504 #endif // ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR) | 521 #endif // ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR) |
OLD | NEW |