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

Unified Diff: sky/engine/bindings/core/v8/V8Initializer.cpp

Issue 742583004: Make breakpoints not crash sky (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/engine/bindings/core/v8/V8Binding.cpp ('k') | sky/framework/inspector/inspector.sky » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/bindings/core/v8/V8Initializer.cpp
diff --git a/sky/engine/bindings/core/v8/V8Initializer.cpp b/sky/engine/bindings/core/v8/V8Initializer.cpp
index b45753b72a1323f020fd0dcbfdb12a90282fc637..dd36c02a2d32789e5b8b961bea216a83d1e12ae2 100644
--- a/sky/engine/bindings/core/v8/V8Initializer.cpp
+++ b/sky/engine/bindings/core/v8/V8Initializer.cpp
@@ -83,6 +83,26 @@ static void reportFatalErrorInMainThread(const char* location, const char* messa
CRASH();
}
+static LocalFrame* retrieveFrameWithGlobalObjectCheck(v8::Handle<v8::Context> context)
+{
+ if (context.IsEmpty())
+ return 0;
+
+ // FIXME: This is a temporary hack for crbug.com/345014.
+ // Currently it's possible that V8 can trigger Debugger::ProcessDebugEvent for a context
+ // that is being initialized (i.e., inside Context::New() of the context).
+ // We should fix the V8 side so that it won't trigger the event for a half-baked context
+ // because there is no way in the embedder side to check if the context is half-baked or not.
+ if (isMainThread() && DOMWrapperWorld::windowIsBeingInitialized())
+ return 0;
+
+ v8::Handle<v8::Value> global = V8Window::findInstanceInPrototypeChain(context->Global(), context->GetIsolate());
+ if (global.IsEmpty())
+ return 0;
+
+ return toFrameIfNotDetached(context);
abarth-chromium 2014/11/19 02:05:40 If you're the only client of this function, you ca
+}
+
static void messageHandlerInMainThread(v8::Handle<v8::Message> message, v8::Handle<v8::Value> data)
{
ASSERT(isMainThread());
@@ -93,6 +113,13 @@ static void messageHandlerInMainThread(v8::Handle<v8::Message> message, v8::Hand
return;
v8::Isolate* isolate = v8::Isolate::GetCurrent();
+ // Check if we're in the V8DebugContext which does not have a window object.
+ if (!retrieveFrameWithGlobalObjectCheck(isolate->GetCurrentContext())) {
+ printf("Unhandled: %s %s\n",
+ toCoreString(message->Get()).ascii().data(),
+ toCoreString(message->GetSourceLine()).ascii().data());
+ return;
+ }
// If called during context initialization, there will be no entered window.
LocalDOMWindow* enteredWindow = enteredDOMWindow(isolate);
if (!enteredWindow)
« no previous file with comments | « sky/engine/bindings/core/v8/V8Binding.cpp ('k') | sky/framework/inspector/inspector.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698