| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010-2011 Google Inc. All rights reserved. | 2 * Copyright (c) 2010-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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 return PassRefPtr<JavaScriptCallFrame>(); | 323 return PassRefPtr<JavaScriptCallFrame>(); |
| 324 return JavaScriptCallFrame::create(v8::Debug::GetDebugContext(), v8::Handle<
v8::Object>::Cast(currentCallFrameV8)); | 324 return JavaScriptCallFrame::create(v8::Debug::GetDebugContext(), v8::Handle<
v8::Object>::Cast(currentCallFrameV8)); |
| 325 } | 325 } |
| 326 | 326 |
| 327 ScriptValue ScriptDebugServer::currentCallFrame() | 327 ScriptValue ScriptDebugServer::currentCallFrame() |
| 328 { | 328 { |
| 329 ASSERT(isPaused()); | 329 ASSERT(isPaused()); |
| 330 v8::HandleScope handleScope(m_isolate); | 330 v8::HandleScope handleScope(m_isolate); |
| 331 RefPtr<JavaScriptCallFrame> currentCallFrame = wrapCallFrames(m_executionSta
te.newLocal(m_isolate), -1); | 331 RefPtr<JavaScriptCallFrame> currentCallFrame = wrapCallFrames(m_executionSta
te.newLocal(m_isolate), -1); |
| 332 if (!currentCallFrame) | 332 if (!currentCallFrame) |
| 333 return ScriptValue(v8::Null(m_isolate)); | 333 return ScriptValue(v8::Null(m_isolate), m_isolate); |
| 334 v8::Context::Scope contextScope(m_pausedContext); | 334 v8::Context::Scope contextScope(m_pausedContext); |
| 335 return ScriptValue(toV8(currentCallFrame.release(), v8::Handle<v8::Object>()
, m_pausedContext->GetIsolate())); | 335 return ScriptValue(toV8(currentCallFrame.release(), v8::Handle<v8::Object>()
, m_pausedContext->GetIsolate()), m_pausedContext->GetIsolate()); |
| 336 } | 336 } |
| 337 | 337 |
| 338 void ScriptDebugServer::interruptAndRun(PassOwnPtr<Task> task, v8::Isolate* isol
ate) | 338 void ScriptDebugServer::interruptAndRun(PassOwnPtr<Task> task, v8::Isolate* isol
ate) |
| 339 { | 339 { |
| 340 v8::Debug::DebugBreakForCommand(new ClientDataImpl(task), isolate); | 340 v8::Debug::DebugBreakForCommand(new ClientDataImpl(task), isolate); |
| 341 } | 341 } |
| 342 | 342 |
| 343 void ScriptDebugServer::runPendingTasks() | 343 void ScriptDebugServer::runPendingTasks() |
| 344 { | 344 { |
| 345 v8::Debug::ProcessDebugMessages(); | 345 v8::Debug::ProcessDebugMessages(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 373 | 373 |
| 374 Vector<String> breakpointIds; | 374 Vector<String> breakpointIds; |
| 375 if (!hitBreakpointNumbers.IsEmpty()) { | 375 if (!hitBreakpointNumbers.IsEmpty()) { |
| 376 breakpointIds.resize(hitBreakpointNumbers->Length()); | 376 breakpointIds.resize(hitBreakpointNumbers->Length()); |
| 377 for (size_t i = 0; i < hitBreakpointNumbers->Length(); i++) | 377 for (size_t i = 0; i < hitBreakpointNumbers->Length(); i++) |
| 378 breakpointIds[i] = toWebCoreStringWithUndefinedOrNullCheck(hitBreakp
ointNumbers->Get(i)); | 378 breakpointIds[i] = toWebCoreStringWithUndefinedOrNullCheck(hitBreakp
ointNumbers->Get(i)); |
| 379 } | 379 } |
| 380 | 380 |
| 381 m_executionState.set(m_isolate, executionState); | 381 m_executionState.set(m_isolate, executionState); |
| 382 ScriptState* currentCallFrameState = ScriptState::forContext(m_pausedContext
); | 382 ScriptState* currentCallFrameState = ScriptState::forContext(m_pausedContext
); |
| 383 listener->didPause(currentCallFrameState, currentCallFrame(), ScriptValue(ex
ception), breakpointIds); | 383 listener->didPause(currentCallFrameState, currentCallFrame(), ScriptValue(ex
ception, currentCallFrameState->isolate()), breakpointIds); |
| 384 | 384 |
| 385 m_runningNestedMessageLoop = true; | 385 m_runningNestedMessageLoop = true; |
| 386 runMessageLoopOnPause(m_pausedContext); | 386 runMessageLoopOnPause(m_pausedContext); |
| 387 m_runningNestedMessageLoop = false; | 387 m_runningNestedMessageLoop = false; |
| 388 } | 388 } |
| 389 | 389 |
| 390 void ScriptDebugServer::handleProgramBreak(const v8::Debug::EventDetails& eventD
etails, v8::Handle<v8::Value> exception, v8::Handle<v8::Array> hitBreakpointNumb
ers) | 390 void ScriptDebugServer::handleProgramBreak(const v8::Debug::EventDetails& eventD
etails, v8::Handle<v8::Value> exception, v8::Handle<v8::Array> hitBreakpointNumb
ers) |
| 391 { | 391 { |
| 392 m_pausedContext = eventDetails.GetEventContext(); | 392 m_pausedContext = eventDetails.GetEventContext(); |
| 393 handleProgramBreak(eventDetails.GetExecutionState(), exception, hitBreakpoin
tNumbers); | 393 handleProgramBreak(eventDetails.GetExecutionState(), exception, hitBreakpoin
tNumbers); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 | 595 |
| 596 v8::Handle<v8::Context> context = state->context(); | 596 v8::Handle<v8::Context> context = state->context(); |
| 597 if (context.IsEmpty()) | 597 if (context.IsEmpty()) |
| 598 return; | 598 return; |
| 599 v8::Context::Scope contextScope(context); | 599 v8::Context::Scope contextScope(context); |
| 600 v8::TryCatch tryCatch; | 600 v8::TryCatch tryCatch; |
| 601 v8::Local<v8::Value> value = V8ScriptRunner::runCompiledScript(script, state
->scriptExecutionContext(), m_isolate); | 601 v8::Local<v8::Value> value = V8ScriptRunner::runCompiledScript(script, state
->scriptExecutionContext(), m_isolate); |
| 602 *wasThrown = false; | 602 *wasThrown = false; |
| 603 if (tryCatch.HasCaught()) { | 603 if (tryCatch.HasCaught()) { |
| 604 *wasThrown = true; | 604 *wasThrown = true; |
| 605 *result = ScriptValue(tryCatch.Exception()); | 605 *result = ScriptValue(tryCatch.Exception(), m_isolate); |
| 606 v8::Local<v8::Message> message = tryCatch.Message(); | 606 v8::Local<v8::Message> message = tryCatch.Message(); |
| 607 if (!message.IsEmpty()) | 607 if (!message.IsEmpty()) |
| 608 *exceptionMessage = toWebCoreStringWithUndefinedOrNullCheck(message-
>Get()); | 608 *exceptionMessage = toWebCoreStringWithUndefinedOrNullCheck(message-
>Get()); |
| 609 } else | 609 } else { |
| 610 *result = ScriptValue(value); | 610 *result = ScriptValue(value, m_isolate); |
| 611 } |
| 611 } | 612 } |
| 612 | 613 |
| 613 PassOwnPtr<ScriptSourceCode> ScriptDebugServer::preprocess(Frame*, const ScriptS
ourceCode&) | 614 PassOwnPtr<ScriptSourceCode> ScriptDebugServer::preprocess(Frame*, const ScriptS
ourceCode&) |
| 614 { | 615 { |
| 615 return PassOwnPtr<ScriptSourceCode>(); | 616 return PassOwnPtr<ScriptSourceCode>(); |
| 616 } | 617 } |
| 617 | 618 |
| 618 String ScriptDebugServer::preprocessEventListener(Frame*, const String& source,
const String& url, const String& functionName) | 619 String ScriptDebugServer::preprocessEventListener(Frame*, const String& source,
const String& url, const String& functionName) |
| 619 { | 620 { |
| 620 return source; | 621 return source; |
| 621 } | 622 } |
| 622 | 623 |
| 623 } // namespace WebCore | 624 } // namespace WebCore |
| OLD | NEW |