| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 } | 57 } |
| 58 | 58 |
| 59 static bool inLiveEditScope = false; | 59 static bool inLiveEditScope = false; |
| 60 | 60 |
| 61 v8::MaybeLocal<v8::Value> V8DebuggerImpl::callDebuggerMethod(const char* functio
nName, int argc, v8::Local<v8::Value> argv[]) | 61 v8::MaybeLocal<v8::Value> V8DebuggerImpl::callDebuggerMethod(const char* functio
nName, int argc, v8::Local<v8::Value> argv[]) |
| 62 { | 62 { |
| 63 v8::Local<v8::Object> debuggerScript = m_debuggerScript.Get(m_isolate); | 63 v8::Local<v8::Object> debuggerScript = m_debuggerScript.Get(m_isolate); |
| 64 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(debuggerScr
ipt->Get(v8InternalizedString(functionName))); | 64 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(debuggerScr
ipt->Get(v8InternalizedString(functionName))); |
| 65 ASSERT(m_isolate->InContext()); | 65 ASSERT(m_isolate->InContext()); |
| 66 return function->Call(m_isolate->GetCurrentContext(), debuggerScript, argc,
argv); | 66 return m_client->callInternalFunction(function, debuggerScript, argc, argv); |
| 67 } | 67 } |
| 68 | 68 |
| 69 PassOwnPtr<V8Debugger> V8Debugger::create(v8::Isolate* isolate, V8DebuggerClient
* client) | 69 PassOwnPtr<V8Debugger> V8Debugger::create(v8::Isolate* isolate, V8DebuggerClient
* client) |
| 70 { | 70 { |
| 71 return adoptPtr(new V8DebuggerImpl(isolate, client)); | 71 return adoptPtr(new V8DebuggerImpl(isolate, client)); |
| 72 } | 72 } |
| 73 | 73 |
| 74 V8DebuggerImpl::V8DebuggerImpl(v8::Isolate* isolate, V8DebuggerClient* client) | 74 V8DebuggerImpl::V8DebuggerImpl(v8::Isolate* isolate, V8DebuggerClient* client) |
| 75 : m_isolate(isolate) | 75 : m_isolate(isolate) |
| 76 , m_client(client) | 76 , m_client(client) |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 { | 203 { |
| 204 int groupId = getGroupId(context); | 204 int groupId = getGroupId(context); |
| 205 if (!groupId) | 205 if (!groupId) |
| 206 return nullptr; | 206 return nullptr; |
| 207 return m_runtimeAgentsMap.get(groupId); | 207 return m_runtimeAgentsMap.get(groupId); |
| 208 } | 208 } |
| 209 | 209 |
| 210 void V8DebuggerImpl::getCompiledScripts(int contextGroupId, protocol::Vector<V8D
ebuggerParsedScript>& result) | 210 void V8DebuggerImpl::getCompiledScripts(int contextGroupId, protocol::Vector<V8D
ebuggerParsedScript>& result) |
| 211 { | 211 { |
| 212 v8::HandleScope scope(m_isolate); | 212 v8::HandleScope scope(m_isolate); |
| 213 v8::Context::Scope contextScope(debuggerContext()); |
| 214 |
| 213 v8::Local<v8::Object> debuggerScript = m_debuggerScript.Get(m_isolate); | 215 v8::Local<v8::Object> debuggerScript = m_debuggerScript.Get(m_isolate); |
| 214 ASSERT(!debuggerScript->IsUndefined()); | 216 ASSERT(!debuggerScript->IsUndefined()); |
| 215 v8::Local<v8::Function> getScriptsFunction = v8::Local<v8::Function>::Cast(d
ebuggerScript->Get(v8InternalizedString("getScripts"))); | 217 v8::Local<v8::Function> getScriptsFunction = v8::Local<v8::Function>::Cast(d
ebuggerScript->Get(v8InternalizedString("getScripts"))); |
| 216 v8::Local<v8::Value> argv[] = { v8::Integer::New(m_isolate, contextGroupId)
}; | 218 v8::Local<v8::Value> argv[] = { v8::Integer::New(m_isolate, contextGroupId)
}; |
| 217 v8::Local<v8::Value> value; | 219 v8::Local<v8::Value> value; |
| 218 if (!getScriptsFunction->Call(debuggerContext(), debuggerScript, WTF_ARRAY_L
ENGTH(argv), argv).ToLocal(&value)) | 220 if (!m_client->callInternalFunction(getScriptsFunction, debuggerScript, WTF_
ARRAY_LENGTH(argv), argv).ToLocal(&value)) |
| 219 return; | 221 return; |
| 220 ASSERT(value->IsArray()); | 222 ASSERT(value->IsArray()); |
| 221 v8::Local<v8::Array> scriptsArray = v8::Local<v8::Array>::Cast(value); | 223 v8::Local<v8::Array> scriptsArray = v8::Local<v8::Array>::Cast(value); |
| 222 result.resize(scriptsArray->Length()); | 224 result.resize(scriptsArray->Length()); |
| 223 for (unsigned i = 0; i < scriptsArray->Length(); ++i) | 225 for (unsigned i = 0; i < scriptsArray->Length(); ++i) |
| 224 result[i] = createParsedScript(v8::Local<v8::Object>::Cast(scriptsArray-
>Get(v8::Integer::New(m_isolate, i))), true); | 226 result[i] = createParsedScript(v8::Local<v8::Object>::Cast(scriptsArray-
>Get(v8::Integer::New(m_isolate, i))), true); |
| 225 } | 227 } |
| 226 | 228 |
| 227 String16 V8DebuggerImpl::setBreakpoint(const String16& sourceID, const ScriptBre
akpoint& scriptBreakpoint, int* actualLineNumber, int* actualColumnNumber, bool
interstatementLocation) | 229 String16 V8DebuggerImpl::setBreakpoint(const String16& sourceID, const ScriptBre
akpoint& scriptBreakpoint, int* actualLineNumber, int* actualColumnNumber, bool
interstatementLocation) |
| 228 { | 230 { |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 if (m_executionState.IsEmpty()) { | 485 if (m_executionState.IsEmpty()) { |
| 484 v8::Local<v8::Function> currentCallFrameFunction = v8::Local<v8::Functio
n>::Cast(m_debuggerScript.Get(m_isolate)->Get(v8InternalizedString("currentCallF
rame"))); | 486 v8::Local<v8::Function> currentCallFrameFunction = v8::Local<v8::Functio
n>::Cast(m_debuggerScript.Get(m_isolate)->Get(v8InternalizedString("currentCallF
rame"))); |
| 485 currentCallFrameV8 = v8::Debug::Call(debuggerContext(), currentCallFrame
Function).ToLocalChecked(); | 487 currentCallFrameV8 = v8::Debug::Call(debuggerContext(), currentCallFrame
Function).ToLocalChecked(); |
| 486 } else { | 488 } else { |
| 487 v8::Local<v8::Value> argv[] = { m_executionState }; | 489 v8::Local<v8::Value> argv[] = { m_executionState }; |
| 488 currentCallFrameV8 = callDebuggerMethod("currentCallFrame", WTF_ARRAY_LE
NGTH(argv), argv).ToLocalChecked(); | 490 currentCallFrameV8 = callDebuggerMethod("currentCallFrame", WTF_ARRAY_LE
NGTH(argv), argv).ToLocalChecked(); |
| 489 } | 491 } |
| 490 ASSERT(!currentCallFrameV8.IsEmpty()); | 492 ASSERT(!currentCallFrameV8.IsEmpty()); |
| 491 if (!currentCallFrameV8->IsObject()) | 493 if (!currentCallFrameV8->IsObject()) |
| 492 return nullptr; | 494 return nullptr; |
| 493 return JavaScriptCallFrame::create(debuggerContext(), v8::Local<v8::Object>:
:Cast(currentCallFrameV8)); | 495 return JavaScriptCallFrame::create(m_client, debuggerContext(), v8::Local<v8
::Object>::Cast(currentCallFrameV8)); |
| 494 } | 496 } |
| 495 | 497 |
| 496 v8::Local<v8::Object> V8DebuggerImpl::currentCallFrames() | 498 v8::Local<v8::Object> V8DebuggerImpl::currentCallFrames() |
| 497 { | 499 { |
| 498 if (!m_isolate->InContext()) | 500 if (!m_isolate->InContext()) |
| 499 return v8::Local<v8::Object>(); | 501 return v8::Local<v8::Object>(); |
| 500 | 502 |
| 501 // Filter out stack traces entirely consisting of V8's internal scripts. | 503 // Filter out stack traces entirely consisting of V8's internal scripts. |
| 502 v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(m_i
solate, 1); | 504 v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(m_i
solate, 1); |
| 503 if (!stackTrace->GetFrameCount()) | 505 if (!stackTrace->GetFrameCount()) |
| 504 return v8::Local<v8::Object>(); | 506 return v8::Local<v8::Object>(); |
| 505 | 507 |
| 506 OwnPtr<JavaScriptCallFrame> currentCallFrame = wrapCallFrames(); | 508 OwnPtr<JavaScriptCallFrame> currentCallFrame = wrapCallFrames(); |
| 507 if (!currentCallFrame) | 509 if (!currentCallFrame) |
| 508 return v8::Local<v8::Object>(); | 510 return v8::Local<v8::Object>(); |
| 509 | 511 |
| 510 v8::Local<v8::FunctionTemplate> wrapperTemplate = v8::Local<v8::FunctionTemp
late>::New(m_isolate, m_callFrameWrapperTemplate); | 512 v8::Local<v8::FunctionTemplate> wrapperTemplate = v8::Local<v8::FunctionTemp
late>::New(m_isolate, m_callFrameWrapperTemplate); |
| 511 v8::Local<v8::Context> context = m_pausedContext.IsEmpty() ? m_isolate->GetC
urrentContext() : m_pausedContext; | 513 v8::Local<v8::Context> context = m_pausedContext.IsEmpty() ? m_isolate->GetC
urrentContext() : m_pausedContext; |
| 512 v8::Context::Scope scope(context); | 514 v8::Context::Scope scope(context); |
| 513 v8::Local<v8::Object> wrapper = V8JavaScriptCallFrame::wrap(wrapperTemplate,
context, currentCallFrame.release()); | 515 v8::Local<v8::Object> wrapper = V8JavaScriptCallFrame::wrap(m_client, wrappe
rTemplate, context, currentCallFrame.release()); |
| 514 return wrapper; | 516 return wrapper; |
| 515 } | 517 } |
| 516 | 518 |
| 517 PassOwnPtr<JavaScriptCallFrame> V8DebuggerImpl::callFrameNoScopes(int index) | 519 PassOwnPtr<JavaScriptCallFrame> V8DebuggerImpl::callFrameNoScopes(int index) |
| 518 { | 520 { |
| 519 if (!m_isolate->InContext()) | 521 if (!m_isolate->InContext()) |
| 520 return nullptr; | 522 return nullptr; |
| 521 v8::HandleScope handleScope(m_isolate); | 523 v8::HandleScope handleScope(m_isolate); |
| 522 | 524 |
| 523 v8::Local<v8::Value> currentCallFrameV8; | 525 v8::Local<v8::Value> currentCallFrameV8; |
| 524 if (m_executionState.IsEmpty()) { | 526 if (m_executionState.IsEmpty()) { |
| 525 v8::Local<v8::Function> currentCallFrameFunction = v8::Local<v8::Functio
n>::Cast(m_debuggerScript.Get(m_isolate)->Get(v8InternalizedString("currentCallF
rameByIndex"))); | 527 v8::Local<v8::Function> currentCallFrameFunction = v8::Local<v8::Functio
n>::Cast(m_debuggerScript.Get(m_isolate)->Get(v8InternalizedString("currentCallF
rameByIndex"))); |
| 526 currentCallFrameV8 = v8::Debug::Call(debuggerContext(), currentCallFrame
Function, v8::Integer::New(m_isolate, index)).ToLocalChecked(); | 528 currentCallFrameV8 = v8::Debug::Call(debuggerContext(), currentCallFrame
Function, v8::Integer::New(m_isolate, index)).ToLocalChecked(); |
| 527 } else { | 529 } else { |
| 528 v8::Local<v8::Value> argv[] = { m_executionState, v8::Integer::New(m_iso
late, index) }; | 530 v8::Local<v8::Value> argv[] = { m_executionState, v8::Integer::New(m_iso
late, index) }; |
| 529 currentCallFrameV8 = callDebuggerMethod("currentCallFrameByIndex", WTF_A
RRAY_LENGTH(argv), argv).ToLocalChecked(); | 531 currentCallFrameV8 = callDebuggerMethod("currentCallFrameByIndex", WTF_A
RRAY_LENGTH(argv), argv).ToLocalChecked(); |
| 530 } | 532 } |
| 531 ASSERT(!currentCallFrameV8.IsEmpty()); | 533 ASSERT(!currentCallFrameV8.IsEmpty()); |
| 532 if (!currentCallFrameV8->IsObject()) | 534 if (!currentCallFrameV8->IsObject()) |
| 533 return nullptr; | 535 return nullptr; |
| 534 return JavaScriptCallFrame::create(debuggerContext(), v8::Local<v8::Object>:
:Cast(currentCallFrameV8)); | 536 return JavaScriptCallFrame::create(m_client, debuggerContext(), v8::Local<v8
::Object>::Cast(currentCallFrameV8)); |
| 535 } | 537 } |
| 536 | 538 |
| 537 static V8DebuggerImpl* toV8DebuggerImpl(v8::Local<v8::Value> data) | 539 static V8DebuggerImpl* toV8DebuggerImpl(v8::Local<v8::Value> data) |
| 538 { | 540 { |
| 539 void* p = v8::Local<v8::External>::Cast(data)->Value(); | 541 void* p = v8::Local<v8::External>::Cast(data)->Value(); |
| 540 return static_cast<V8DebuggerImpl*>(p); | 542 return static_cast<V8DebuggerImpl*>(p); |
| 541 } | 543 } |
| 542 | 544 |
| 543 void V8DebuggerImpl::breakProgramCallback(const v8::FunctionCallbackInfo<v8::Val
ue>& info) | 545 void V8DebuggerImpl::breakProgramCallback(const v8::FunctionCallbackInfo<v8::Val
ue>& info) |
| 544 { | 546 { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 void V8DebuggerImpl::v8DebugEventCallback(const v8::Debug::EventDetails& eventDe
tails) | 604 void V8DebuggerImpl::v8DebugEventCallback(const v8::Debug::EventDetails& eventDe
tails) |
| 603 { | 605 { |
| 604 V8DebuggerImpl* thisPtr = toV8DebuggerImpl(eventDetails.GetCallbackData()); | 606 V8DebuggerImpl* thisPtr = toV8DebuggerImpl(eventDetails.GetCallbackData()); |
| 605 thisPtr->handleV8DebugEvent(eventDetails); | 607 thisPtr->handleV8DebugEvent(eventDetails); |
| 606 } | 608 } |
| 607 | 609 |
| 608 v8::Local<v8::Value> V8DebuggerImpl::callInternalGetterFunction(v8::Local<v8::Ob
ject> object, const char* functionName) | 610 v8::Local<v8::Value> V8DebuggerImpl::callInternalGetterFunction(v8::Local<v8::Ob
ject> object, const char* functionName) |
| 609 { | 611 { |
| 610 v8::Local<v8::Value> getterValue = object->Get(v8InternalizedString(function
Name)); | 612 v8::Local<v8::Value> getterValue = object->Get(v8InternalizedString(function
Name)); |
| 611 ASSERT(!getterValue.IsEmpty() && getterValue->IsFunction()); | 613 ASSERT(!getterValue.IsEmpty() && getterValue->IsFunction()); |
| 612 return v8::Local<v8::Function>::Cast(getterValue)->Call(m_isolate->GetCurren
tContext(), object, 0, 0).ToLocalChecked(); | 614 return m_client->callInternalFunction(v8::Local<v8::Function>::Cast(getterVa
lue), object, 0, 0).ToLocalChecked(); |
| 613 } | 615 } |
| 614 | 616 |
| 615 void V8DebuggerImpl::handleV8DebugEvent(const v8::Debug::EventDetails& eventDeta
ils) | 617 void V8DebuggerImpl::handleV8DebugEvent(const v8::Debug::EventDetails& eventDeta
ils) |
| 616 { | 618 { |
| 617 if (!enabled()) | 619 if (!enabled()) |
| 618 return; | 620 return; |
| 619 v8::DebugEvent event = eventDetails.GetEvent(); | 621 v8::DebugEvent event = eventDetails.GetEvent(); |
| 620 if (event != v8::AsyncTaskEvent && event != v8::Break && event != v8::Except
ion && event != v8::AfterCompile && event != v8::BeforeCompile && event != v8::C
ompileError && event != v8::PromiseEvent) | 622 if (event != v8::AsyncTaskEvent && event != v8::Break && event != v8::Except
ion && event != v8::AfterCompile && event != v8::BeforeCompile && event != v8::C
ompileError && event != v8::PromiseEvent) |
| 621 return; | 623 return; |
| 622 | 624 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 if (!m_debuggerScript.IsEmpty()) { | 714 if (!m_debuggerScript.IsEmpty()) { |
| 713 ASSERT_NOT_REACHED(); | 715 ASSERT_NOT_REACHED(); |
| 714 return; | 716 return; |
| 715 } | 717 } |
| 716 | 718 |
| 717 v8::HandleScope scope(m_isolate); | 719 v8::HandleScope scope(m_isolate); |
| 718 v8::Context::Scope contextScope(debuggerContext()); | 720 v8::Context::Scope contextScope(debuggerContext()); |
| 719 | 721 |
| 720 v8::Local<v8::String> scriptValue = v8::String::NewFromUtf8(m_isolate, Debug
gerScript_js, v8::NewStringType::kInternalized, sizeof(DebuggerScript_js)).ToLoc
alChecked(); | 722 v8::Local<v8::String> scriptValue = v8::String::NewFromUtf8(m_isolate, Debug
gerScript_js, v8::NewStringType::kInternalized, sizeof(DebuggerScript_js)).ToLoc
alChecked(); |
| 721 v8::Local<v8::Value> value; | 723 v8::Local<v8::Value> value; |
| 722 if (!compileAndRunInternalScript(debuggerContext(), scriptValue).ToLocal(&va
lue)) | 724 if (!m_client->compileAndRunInternalScript(scriptValue).ToLocal(&value)) |
| 723 return; | 725 return; |
| 724 ASSERT(value->IsObject()); | 726 ASSERT(value->IsObject()); |
| 725 m_debuggerScript.Reset(m_isolate, value.As<v8::Object>()); | 727 m_debuggerScript.Reset(m_isolate, value.As<v8::Object>()); |
| 726 } | 728 } |
| 727 | 729 |
| 728 v8::Local<v8::Context> V8DebuggerImpl::debuggerContext() const | 730 v8::Local<v8::Context> V8DebuggerImpl::debuggerContext() const |
| 729 { | 731 { |
| 730 ASSERT(!m_debuggerContext.IsEmpty()); | 732 ASSERT(!m_debuggerContext.IsEmpty()); |
| 731 return m_debuggerContext.Get(m_isolate); | 733 return m_debuggerContext.Get(m_isolate); |
| 732 } | 734 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 }; | 783 }; |
| 782 return callDebuggerMethod("setFunctionVariableValue", 4, argv); | 784 return callDebuggerMethod("setFunctionVariableValue", 4, argv); |
| 783 } | 785 } |
| 784 | 786 |
| 785 | 787 |
| 786 bool V8DebuggerImpl::isPaused() | 788 bool V8DebuggerImpl::isPaused() |
| 787 { | 789 { |
| 788 return !m_pausedContext.IsEmpty(); | 790 return !m_pausedContext.IsEmpty(); |
| 789 } | 791 } |
| 790 | 792 |
| 791 v8::MaybeLocal<v8::Value> V8DebuggerImpl::runCompiledScript(v8::Local<v8::Contex
t> context, v8::Local<v8::Script> script) | 793 v8::Local<v8::Script> V8DebuggerImpl::compileInternalScript(v8::Local<v8::Contex
t>, v8::Local<v8::String> code, const String16& fileName) |
| 792 { | |
| 793 // TODO(dgozman): get rid of this check. | |
| 794 if (!m_client->isExecutionAllowed()) | |
| 795 return v8::MaybeLocal<v8::Value>(); | |
| 796 | |
| 797 v8::MicrotasksScope microtasksScope(m_isolate, v8::MicrotasksScope::kRunMicr
otasks); | |
| 798 int groupId = getGroupId(context); | |
| 799 V8DebuggerAgentImpl* agent = groupId ? m_debuggerAgentsMap.get(groupId) : nu
llptr; | |
| 800 if (agent) | |
| 801 agent->willExecuteScript(script->GetUnboundScript()->GetId()); | |
| 802 v8::MaybeLocal<v8::Value> result = script->Run(context); | |
| 803 // Get agent from the map again, since it could have detached during script
execution. | |
| 804 agent = groupId ? m_debuggerAgentsMap.get(groupId) : nullptr; | |
| 805 if (agent) | |
| 806 agent->didExecuteScript(); | |
| 807 return result; | |
| 808 } | |
| 809 | |
| 810 v8::MaybeLocal<v8::Value> V8DebuggerImpl::callFunction(v8::Local<v8::Function> f
unction, v8::Local<v8::Context> context, v8::Local<v8::Value> receiver, int argc
, v8::Local<v8::Value> info[]) | |
| 811 { | |
| 812 // TODO(dgozman): get rid of this check. | |
| 813 if (!m_client->isExecutionAllowed()) | |
| 814 return v8::MaybeLocal<v8::Value>(); | |
| 815 | |
| 816 v8::MicrotasksScope microtasksScope(m_isolate, v8::MicrotasksScope::kRunMicr
otasks); | |
| 817 int groupId = getGroupId(context); | |
| 818 V8DebuggerAgentImpl* agent = groupId ? m_debuggerAgentsMap.get(groupId) : nu
llptr; | |
| 819 if (agent) | |
| 820 agent->willExecuteScript(function->ScriptId()); | |
| 821 v8::MaybeLocal<v8::Value> result = function->Call(context, receiver, argc, i
nfo); | |
| 822 // Get agent from the map again, since it could have detached during script
execution. | |
| 823 agent = groupId ? m_debuggerAgentsMap.get(groupId) : nullptr; | |
| 824 if (agent) | |
| 825 agent->didExecuteScript(); | |
| 826 return result; | |
| 827 } | |
| 828 | |
| 829 v8::MaybeLocal<v8::Value> V8DebuggerImpl::compileAndRunInternalScript(v8::Local<
v8::Context> context, v8::Local<v8::String> source) | |
| 830 { | |
| 831 v8::Local<v8::Script> script = compileInternalScript(context, source, String
()); | |
| 832 if (script.IsEmpty()) | |
| 833 return v8::MaybeLocal<v8::Value>(); | |
| 834 v8::MicrotasksScope microtasksScope(m_isolate, v8::MicrotasksScope::kDoNotRu
nMicrotasks); | |
| 835 return script->Run(context); | |
| 836 } | |
| 837 | |
| 838 v8::Local<v8::Script> V8DebuggerImpl::compileInternalScript(v8::Local<v8::Contex
t> context, v8::Local<v8::String> code, const String16& fileName) | |
| 839 { | 794 { |
| 840 // NOTE: For compatibility with WebCore, ScriptSourceCode's line starts at | 795 // NOTE: For compatibility with WebCore, ScriptSourceCode's line starts at |
| 841 // 1, whereas v8 starts at 0. | 796 // 1, whereas v8 starts at 0. |
| 842 v8::ScriptOrigin origin( | 797 v8::ScriptOrigin origin( |
| 843 toV8String(m_isolate, fileName), | 798 toV8String(m_isolate, fileName), |
| 844 v8::Integer::New(m_isolate, 0), | 799 v8::Integer::New(m_isolate, 0), |
| 845 v8::Integer::New(m_isolate, 0), | 800 v8::Integer::New(m_isolate, 0), |
| 846 v8::False(m_isolate), // sharable | 801 v8::False(m_isolate), // sharable |
| 847 v8::Local<v8::Integer>(), | 802 v8::Local<v8::Integer>(), |
| 848 v8::True(m_isolate), // internal | 803 v8::True(m_isolate), // internal |
| 849 toV8String(m_isolate, String16()), // sourceMap | 804 toV8String(m_isolate, String16()), // sourceMap |
| 850 v8::True(m_isolate)); // opaqueresource | 805 v8::True(m_isolate)); // opaqueresource |
| 851 v8::ScriptCompiler::Source source(code, origin); | 806 v8::ScriptCompiler::Source source(code, origin); |
| 852 v8::Local<v8::Script> script; | 807 v8::Local<v8::Script> script; |
| 853 if (!v8::ScriptCompiler::Compile(context, &source, v8::ScriptCompiler::kNoCo
mpileOptions).ToLocal(&script)) | 808 if (!v8::ScriptCompiler::Compile(m_isolate->GetCurrentContext(), &source, v8
::ScriptCompiler::kNoCompileOptions).ToLocal(&script)) |
| 854 return v8::Local<v8::Script>(); | 809 return v8::Local<v8::Script>(); |
| 855 return script; | 810 return script; |
| 856 } | 811 } |
| 857 | 812 |
| 858 PassOwnPtr<V8StackTrace> V8DebuggerImpl::createStackTrace(v8::Local<v8::StackTra
ce> stackTrace, size_t maxStackSize) | 813 PassOwnPtr<V8StackTrace> V8DebuggerImpl::createStackTrace(v8::Local<v8::StackTra
ce> stackTrace, size_t maxStackSize) |
| 859 { | 814 { |
| 860 V8DebuggerAgentImpl* agent = getDebuggerAgentForContext(m_isolate->GetCurren
tContext()); | 815 V8DebuggerAgentImpl* agent = getDebuggerAgentForContext(m_isolate->GetCurren
tContext()); |
| 861 return V8StackTraceImpl::create(agent, stackTrace, maxStackSize); | 816 return V8StackTraceImpl::create(agent, stackTrace, maxStackSize); |
| 862 } | 817 } |
| 863 | 818 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 882 } | 837 } |
| 883 | 838 |
| 884 v8::Local<v8::Context> V8DebuggerImpl::regexContext() | 839 v8::Local<v8::Context> V8DebuggerImpl::regexContext() |
| 885 { | 840 { |
| 886 if (m_regexContext.IsEmpty()) | 841 if (m_regexContext.IsEmpty()) |
| 887 m_regexContext.Reset(m_isolate, v8::Context::New(m_isolate)); | 842 m_regexContext.Reset(m_isolate, v8::Context::New(m_isolate)); |
| 888 return m_regexContext.Get(m_isolate); | 843 return m_regexContext.Get(m_isolate); |
| 889 } | 844 } |
| 890 | 845 |
| 891 } // namespace blink | 846 } // namespace blink |
| OLD | NEW |