OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 v8::Local<v8::Context> debuggerContext = v8::Debug::GetDebugContext(); | 106 v8::Local<v8::Context> debuggerContext = v8::Debug::GetDebugContext(); |
107 v8::Context::Scope contextScope(debuggerContext); | 107 v8::Context::Scope contextScope(debuggerContext); |
108 | 108 |
109 if (!m_listenersMap.size()) { | 109 if (!m_listenersMap.size()) { |
110 ensureDebuggerScriptCompiled(); | 110 ensureDebuggerScriptCompiled(); |
111 ASSERT(!m_debuggerScript.get()->IsUndefined()); | 111 ASSERT(!m_debuggerScript.get()->IsUndefined()); |
112 v8::Debug::SetDebugEventListener2(&ScriptDebugServer::v8DebugEventCallba
ck); | 112 v8::Debug::SetDebugEventListener2(&ScriptDebugServer::v8DebugEventCallba
ck); |
113 } | 113 } |
114 m_listenersMap.set(page, listener); | 114 m_listenersMap.set(page, listener); |
115 | 115 |
116 v8::Local<v8::Context> context = proxy->mainWorldContext(); | 116 V8DOMWindowShell* shell = proxy->windowShell(); |
117 | 117 if (!shell->isContextInitialized()) |
| 118 return; |
| 119 v8::Handle<v8::Context> context = shell->context(); |
118 v8::Handle<v8::Function> getScriptsFunction = v8::Local<v8::Function>::Cast(
m_debuggerScript.get()->Get(v8::String::New("getScripts"))); | 120 v8::Handle<v8::Function> getScriptsFunction = v8::Local<v8::Function>::Cast(
m_debuggerScript.get()->Get(v8::String::New("getScripts"))); |
119 v8::Handle<v8::Value> argv[] = { context->GetData() }; | 121 v8::Handle<v8::Value> argv[] = { context->GetData() }; |
120 v8::Handle<v8::Value> value = getScriptsFunction->Call(m_debuggerScript.get(
), 1, argv); | 122 v8::Handle<v8::Value> value = getScriptsFunction->Call(m_debuggerScript.get(
), 1, argv); |
121 if (value.IsEmpty()) | 123 if (value.IsEmpty()) |
122 return; | 124 return; |
123 ASSERT(!value->IsUndefined() && value->IsArray()); | 125 ASSERT(!value->IsUndefined() && value->IsArray()); |
124 v8::Handle<v8::Array> scriptsArray = v8::Handle<v8::Array>::Cast(value); | 126 v8::Handle<v8::Array> scriptsArray = v8::Handle<v8::Array>::Cast(value); |
125 for (unsigned i = 0; i < scriptsArray->Length(); ++i) | 127 for (unsigned i = 0; i < scriptsArray->Length(); ++i) |
126 dispatchDidParseSource(listener, v8::Handle<v8::Object>::Cast(scriptsArr
ay->Get(v8::Integer::New(i)))); | 128 dispatchDidParseSource(listener, v8::Handle<v8::Object>::Cast(scriptsArr
ay->Get(v8::Integer::New(i)))); |
127 } | 129 } |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 void ScriptDebugServer::didResume() | 465 void ScriptDebugServer::didResume() |
464 { | 466 { |
465 m_currentCallFrame.clear(); | 467 m_currentCallFrame.clear(); |
466 m_executionState.clear(); | 468 m_executionState.clear(); |
467 m_pausedPage = 0; | 469 m_pausedPage = 0; |
468 } | 470 } |
469 | 471 |
470 } // namespace WebCore | 472 } // namespace WebCore |
471 | 473 |
472 #endif // ENABLE(JAVASCRIPT_DEBUGGER) | 474 #endif // ENABLE(JAVASCRIPT_DEBUGGER) |
OLD | NEW |