From: yurys@chromium.org Date: Wed, 28 Apr 2010 11:59:43 +0000 (+0000) Subject: Ensure v8 is initialized before initializing debug context X-Git-Tag: upstream/4.7.83~21916 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cf63fc5b9ea3aff603b6b1918b1689af294713b3;p=platform%2Fupstream%2Fv8.git Ensure v8 is initialized before initializing debug context Review URL: http://codereview.chromium.org/1756018 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4534 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/api.cc b/src/api.cc index f738a37..85c21fb 100644 --- a/src/api.cc +++ b/src/api.cc @@ -4020,6 +4020,7 @@ void Debug::ProcessDebugMessages() { } Local Debug::GetDebugContext() { + EnsureInitialized("v8::Debug::GetDebugContext()"); ENTER_V8; return Utils::ToLocal(i::Debugger::GetDebugContext()); } diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc index b4376ee..cdc7ac1 100644 --- a/test/cctest/test-debug.cc +++ b/test/cctest/test-debug.cc @@ -6147,3 +6147,12 @@ TEST(CallingContextIsNotDebugContext) { } +TEST(DebugContextIsPreservedBetweenAccesses) { + v8::HandleScope scope; + v8::Local context1 = v8::Debug::GetDebugContext(); + v8::Local context2 = v8::Debug::GetDebugContext(); + CHECK_EQ(*context1, *context2); + // Make sure debugger is unloaded before running other tests. + v8::internal::ForceUnloadDebugger(); + CheckDebuggerUnloaded(); +}