| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 Google Inc. All rights reserved. | 2 * Copyright (c) 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 RefPtr<Frame> protect = frame; | 159 RefPtr<Frame> protect = frame; |
| 160 ScriptDebugServer::runScript(state, scriptId, result, wasThrown, exceptionMe
ssage); | 160 ScriptDebugServer::runScript(state, scriptId, result, wasThrown, exceptionMe
ssage); |
| 161 | 161 |
| 162 if (frame) | 162 if (frame) |
| 163 InspectorInstrumentation::didEvaluateScript(cookie); | 163 InspectorInstrumentation::didEvaluateScript(cookie); |
| 164 } | 164 } |
| 165 | 165 |
| 166 ScriptDebugListener* PageScriptDebugServer::getDebugListenerForContext(v8::Handl
e<v8::Context> context) | 166 ScriptDebugListener* PageScriptDebugServer::getDebugListenerForContext(v8::Handl
e<v8::Context> context) |
| 167 { | 167 { |
| 168 v8::HandleScope scope; | 168 v8::HandleScope scope; |
| 169 |
| 170 // System-created contexts will crash retrieveFrameWithGlobalCheck |
| 171 if (V8PerContextDebugData::contextDebugId(context) < 0) |
| 172 return 0; |
| 173 |
| 169 Frame* frame = retrieveFrameWithGlobalObjectCheck(context); | 174 Frame* frame = retrieveFrameWithGlobalObjectCheck(context); |
| 170 if (!frame) | 175 if (!frame) |
| 171 return 0; | 176 return 0; |
| 172 return m_listenersMap.get(frame->page()); | 177 return m_listenersMap.get(frame->page()); |
| 173 } | 178 } |
| 174 | 179 |
| 175 void PageScriptDebugServer::runMessageLoopOnPause(v8::Handle<v8::Context> contex
t) | 180 void PageScriptDebugServer::runMessageLoopOnPause(v8::Handle<v8::Context> contex
t) |
| 176 { | 181 { |
| 177 v8::HandleScope scope; | 182 v8::HandleScope scope; |
| 178 Frame* frame = retrieveFrameWithGlobalObjectCheck(context); | 183 Frame* frame = retrieveFrameWithGlobalObjectCheck(context); |
| 179 m_pausedPage = frame->page(); | 184 m_pausedPage = frame->page(); |
| 180 | 185 |
| 181 // Wait for continue or step command. | 186 // Wait for continue or step command. |
| 182 m_clientMessageLoop->run(m_pausedPage); | 187 m_clientMessageLoop->run(m_pausedPage); |
| 183 | 188 |
| 184 // The listener may have been removed in the nested loop. | 189 // The listener may have been removed in the nested loop. |
| 185 if (ScriptDebugListener* listener = m_listenersMap.get(m_pausedPage)) | 190 if (ScriptDebugListener* listener = m_listenersMap.get(m_pausedPage)) |
| 186 listener->didContinue(); | 191 listener->didContinue(); |
| 187 | 192 |
| 188 m_pausedPage = 0; | 193 m_pausedPage = 0; |
| 189 } | 194 } |
| 190 | 195 |
| 191 void PageScriptDebugServer::quitMessageLoopOnPause() | 196 void PageScriptDebugServer::quitMessageLoopOnPause() |
| 192 { | 197 { |
| 193 m_clientMessageLoop->quitNow(); | 198 m_clientMessageLoop->quitNow(); |
| 194 } | 199 } |
| 195 | 200 |
| 196 } // namespace WebCore | 201 } // namespace WebCore |
| 197 | 202 |
| OLD | NEW |