| 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 15 matching lines...) Expand all Loading... |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "bindings/v8/PageScriptDebugServer.h" | 32 #include "bindings/v8/PageScriptDebugServer.h" |
| 33 | 33 |
| 34 | 34 |
| 35 #include "V8Window.h" | 35 #include "V8Window.h" |
| 36 #include "bindings/v8/DOMWrapperWorld.h" |
| 36 #include "bindings/v8/ScriptController.h" | 37 #include "bindings/v8/ScriptController.h" |
| 37 #include "bindings/v8/ScriptSourceCode.h" | 38 #include "bindings/v8/ScriptSourceCode.h" |
| 38 #include "bindings/v8/V8Binding.h" | 39 #include "bindings/v8/V8Binding.h" |
| 39 #include "bindings/v8/V8ScriptRunner.h" | 40 #include "bindings/v8/V8ScriptRunner.h" |
| 40 #include "bindings/v8/V8WindowShell.h" | 41 #include "bindings/v8/V8WindowShell.h" |
| 41 #include "core/frame/FrameHost.h" | 42 #include "core/frame/FrameHost.h" |
| 42 #include "core/frame/LocalFrame.h" | 43 #include "core/frame/LocalFrame.h" |
| 43 #include "core/inspector/InspectorInstrumentation.h" | 44 #include "core/inspector/InspectorInstrumentation.h" |
| 44 #include "core/inspector/ScriptDebugListener.h" | 45 #include "core/inspector/ScriptDebugListener.h" |
| 45 #include "core/page/Page.h" | 46 #include "core/page/Page.h" |
| 46 #include "wtf/OwnPtr.h" | 47 #include "wtf/OwnPtr.h" |
| 47 #include "wtf/PassOwnPtr.h" | 48 #include "wtf/PassOwnPtr.h" |
| 48 #include "wtf/StdLibExtras.h" | 49 #include "wtf/StdLibExtras.h" |
| 49 #include "wtf/TemporaryChange.h" | 50 #include "wtf/TemporaryChange.h" |
| 50 #include "wtf/text/StringBuilder.h" | 51 #include "wtf/text/StringBuilder.h" |
| 51 | 52 |
| 52 namespace WebCore { | 53 namespace WebCore { |
| 53 | 54 |
| 54 static LocalFrame* retrieveFrameWithGlobalObjectCheck(v8::Handle<v8::Context> co
ntext) | 55 static LocalFrame* retrieveFrameWithGlobalObjectCheck(v8::Handle<v8::Context> co
ntext) |
| 55 { | 56 { |
| 56 if (context.IsEmpty()) | 57 if (context.IsEmpty()) |
| 57 return 0; | 58 return 0; |
| 58 | 59 |
| 59 // Test that context has associated global dom window object. | 60 // FIXME: This is a temporary hack for crbug.com/345014. |
| 60 if (!V8WindowShell::contextHasCorrectPrototype(context)) | 61 // Currently it's possible that V8 can trigger Debugger::ProcessDebugEvent f
or a context |
| 62 // that is being initialized (i.e., inside Context::New() of the context). |
| 63 // We should fix the V8 side so that it won't trigger the event for a half-b
aked context |
| 64 // because there is no way in the embedder side to check if the context is h
alf-baked or not. |
| 65 ASSERT(isMainThread()); |
| 66 if (DOMWrapperWorld::windowIsBeingInitialized()) |
| 61 return 0; | 67 return 0; |
| 62 | 68 |
| 63 v8::Handle<v8::Value> global = V8Window::findInstanceInPrototypeChain(contex
t->Global(), context->GetIsolate()); | 69 v8::Handle<v8::Value> global = V8Window::findInstanceInPrototypeChain(contex
t->Global(), context->GetIsolate()); |
| 64 if (global.IsEmpty()) | 70 if (global.IsEmpty()) |
| 65 return 0; | 71 return 0; |
| 66 | 72 |
| 67 return toFrameIfNotDetached(context); | 73 return toFrameIfNotDetached(context); |
| 68 } | 74 } |
| 69 | 75 |
| 70 void PageScriptDebugServer::setPreprocessorSource(const String& preprocessorSour
ce) | 76 void PageScriptDebugServer::setPreprocessorSource(const String& preprocessorSour
ce) |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 277 |
| 272 String PageScriptDebugServer::preprocessEventListener(LocalFrame* frame, const S
tring& source, const String& url, const String& functionName) | 278 String PageScriptDebugServer::preprocessEventListener(LocalFrame* frame, const S
tring& source, const String& url, const String& functionName) |
| 273 { | 279 { |
| 274 if (!canPreprocess(frame)) | 280 if (!canPreprocess(frame)) |
| 275 return source; | 281 return source; |
| 276 | 282 |
| 277 return m_scriptPreprocessor->preprocessSourceCode(source, url, functionName)
; | 283 return m_scriptPreprocessor->preprocessSourceCode(source, url, functionName)
; |
| 278 } | 284 } |
| 279 | 285 |
| 280 } // namespace WebCore | 286 } // namespace WebCore |
| OLD | NEW |