Monkey can trigger a situation such that script can execute while
the frame is detached. Not clear if this can be triggered in
normal usage, but the fix is simple enough.
Bug:
5201341
Change-Id: Id5701cc0947e30103f9168cf43fcb164c0fe8356
void V8AbstractEventListener::handleEvent(ScriptExecutionContext* context, Event* event)
{
+#ifdef ANDROID
+ // Monkey data shows that we can crash here, due to script executing while the
+ // page's frame has been detached (in the middle of a navigation).
+ // See b/5201341
+ if (!context)
+ return;
+#endif
+
// Don't reenter V8 if execution was terminated in this instance of V8.
if (context->isJSExecutionForbidden())
return;