Bug 1499828 Part 4 - Handle input events in the middleman when the active child is replaying, r=mccr8.
authorBrian Hackett <bhackett1024@gmail.com>
Wed, 17 Oct 2018 13:32:34 -0600
changeset 490600 925e342d29d805f96f06ebd99a4679cd2fd72ecd
parent 490599 97475fb566eaefc467b4068a0579e779bd5e19d1
child 490601 18f2ea8c2a1978a36ed6b3124f9ce213da7726dc
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersmccr8
bugs1499828
milestone64.0a1
Bug 1499828 Part 4 - Handle input events in the middleman when the active child is replaying, r=mccr8.
toolkit/recordreplay/ipc/ParentForwarding.cpp
toolkit/recordreplay/ipc/ParentIPC.cpp
--- a/toolkit/recordreplay/ipc/ParentForwarding.cpp
+++ b/toolkit/recordreplay/ipc/ParentForwarding.cpp
@@ -87,16 +87,24 @@ HandleMessageInMiddleman(ipc::Side aSide
       type == dom::PContent::Msg_SaveRecording__ID ||
       // Teardown that should only happen in the middleman.
       type == dom::PContent::Msg_Shutdown__ID) {
     ipc::IProtocol::Result r = dom::ContentChild::GetSingleton()->PContentChild::OnMessageReceived(aMessage);
     MOZ_RELEASE_ASSERT(r == ipc::IProtocol::MsgProcessed);
     return true;
   }
 
+  // Send input events to the middleman when the active child is replaying,
+  // so that UI elements such as the replay overlay can be interacted with.
+  if (!ActiveChildIsRecording() && nsContentUtils::IsMessageInputEvent(aMessage)) {
+    ipc::IProtocol::Result r = dom::ContentChild::GetSingleton()->PContentChild::OnMessageReceived(aMessage);
+    MOZ_RELEASE_ASSERT(r == ipc::IProtocol::MsgProcessed);
+    return true;
+  }
+
   // The content process has its own compositor, so compositor messages from
   // the UI process should only be handled in the middleman.
   if (type >= layers::PCompositorBridge::PCompositorBridgeStart &&
       type <= layers::PCompositorBridge::PCompositorBridgeEnd) {
     layers::CompositorBridgeChild* compositorChild = layers::CompositorBridgeChild::Get();
     ipc::IProtocol::Result r = compositorChild->OnMessageReceived(aMessage);
     MOZ_RELEASE_ASSERT(r == ipc::IProtocol::MsgProcessed);
     return true;
--- a/toolkit/recordreplay/ipc/ParentIPC.cpp
+++ b/toolkit/recordreplay/ipc/ParentIPC.cpp
@@ -278,17 +278,17 @@ public:
       MOZ_CRASH("Unexpected message");
     }
   }
 };
 
 bool
 ActiveChildIsRecording()
 {
-  return gActiveChild->IsRecording();
+  return gActiveChild && gActiveChild->IsRecording();
 }
 
 ChildProcessInfo*
 ActiveRecordingChild()
 {
   MOZ_RELEASE_ASSERT(ActiveChildIsRecording());
   return gActiveChild;
 }