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