Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Side by Side Diff: Source/bindings/v8/PageScriptDebugServer.cpp

Issue 182903003: Make DOMWrapperWorld::current() callable from workers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/bindings/v8/DOMWrapperWorld.cpp ('k') | Source/bindings/v8/ScriptController.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 if (isMainThread() && DOMWrapperWorld::windowIsBeingInitialized())
61 return 0; 66 return 0;
62 67
63 v8::Handle<v8::Value> global = V8Window::findInstanceInPrototypeChain(contex t->Global(), context->GetIsolate()); 68 v8::Handle<v8::Value> global = V8Window::findInstanceInPrototypeChain(contex t->Global(), context->GetIsolate());
64 if (global.IsEmpty()) 69 if (global.IsEmpty())
65 return 0; 70 return 0;
66 71
67 return toFrameIfNotDetached(context); 72 return toFrameIfNotDetached(context);
68 } 73 }
69 74
70 void PageScriptDebugServer::setPreprocessorSource(const String& preprocessorSour ce) 75 void PageScriptDebugServer::setPreprocessorSource(const String& preprocessorSour ce)
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 276
272 String PageScriptDebugServer::preprocessEventListener(LocalFrame* frame, const S tring& source, const String& url, const String& functionName) 277 String PageScriptDebugServer::preprocessEventListener(LocalFrame* frame, const S tring& source, const String& url, const String& functionName)
273 { 278 {
274 if (!canPreprocess(frame)) 279 if (!canPreprocess(frame))
275 return source; 280 return source;
276 281
277 return m_scriptPreprocessor->preprocessSourceCode(source, url, functionName) ; 282 return m_scriptPreprocessor->preprocessSourceCode(source, url, functionName) ;
278 } 283 }
279 284
280 } // namespace WebCore 285 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/DOMWrapperWorld.cpp ('k') | Source/bindings/v8/ScriptController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698