Bug 1534258 - Send Deactivate() messages to out-of-process iframes. r=NeilDeakin
authorHenri Sivonen <hsivonen@hsivonen.fi>
Thu, 14 Mar 2019 16:00:32 +0000
changeset 521896 b7184b1a3d78
parent 521895 72c8227148dd
child 521897 0ffd90627891
push id10870
push usernbeleuzu@mozilla.com
push dateFri, 15 Mar 2019 20:00:07 +0000
treeherdermozilla-beta@c594aee5b7a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersNeilDeakin
bugs1534258
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1534258 - Send Deactivate() messages to out-of-process iframes. r=NeilDeakin Differential Revision: https://phabricator.services.mozilla.com/D22969
dom/base/nsFocusManager.cpp
dom/ipc/BrowserBridgeChild.cpp
dom/ipc/BrowserBridgeChild.h
dom/ipc/BrowserBridgeParent.cpp
dom/ipc/BrowserBridgeParent.h
dom/ipc/PBrowserBridge.ipdl
--- a/dom/base/nsFocusManager.cpp
+++ b/dom/base/nsFocusManager.cpp
@@ -1632,16 +1632,22 @@ bool nsFocusManager::Blur(nsPIDOMWindowO
     }
 
     // if the object being blurred is a remote browser, deactivate remote
     // content
     if (TabParent* remote = TabParent::GetFrom(element)) {
       remote->Deactivate();
       LOGFOCUS(("Remote browser deactivated"));
     }
+
+    // Same as above but for out-of-process iframes
+    if (BrowserBridgeChild* bbc = BrowserBridgeChild::GetFrom(element)) {
+      bbc->Deactivate();
+      LOGFOCUS(("Out-of-process iframe deactivated"));
+    }
   }
 
   bool result = true;
   if (sendBlurEvent) {
     // if there is an active window, update commands. If there isn't an active
     // window, then this was a blur caused by the active window being lowered,
     // so there is no need to update the commands
     if (mActiveWindow)
--- a/dom/ipc/BrowserBridgeChild.cpp
+++ b/dom/ipc/BrowserBridgeChild.cpp
@@ -79,16 +79,18 @@ void BrowserBridgeChild::UpdateDimension
 
 void BrowserBridgeChild::NavigateByKey(bool aForward,
                                        bool aForDocumentNavigation) {
   Unused << SendNavigateByKey(aForward, aForDocumentNavigation);
 }
 
 void BrowserBridgeChild::Activate() { Unused << SendActivate(); }
 
+void BrowserBridgeChild::Deactivate() { Unused << SendDeactivate(); }
+
 /*static*/
 BrowserBridgeChild* BrowserBridgeChild::GetFrom(nsFrameLoader* aFrameLoader) {
   if (!aFrameLoader) {
     return nullptr;
   }
   return aFrameLoader->GetBrowserBridgeChild();
 }
 
--- a/dom/ipc/BrowserBridgeChild.h
+++ b/dom/ipc/BrowserBridgeChild.h
@@ -33,16 +33,18 @@ class BrowserBridgeChild : public PBrows
 
   void UpdateDimensions(const nsIntRect& aRect,
                         const mozilla::ScreenIntSize& aSize);
 
   void NavigateByKey(bool aForward, bool aForDocumentNavigation);
 
   void Activate();
 
+  void Deactivate();
+
   static BrowserBridgeChild* GetFrom(nsFrameLoader* aFrameLoader);
 
   static BrowserBridgeChild* GetFrom(nsIContent* aContent);
 
  protected:
   friend class PBrowserBridgeChild;
 
   mozilla::ipc::IPCResult RecvSetLayersId(
--- a/dom/ipc/BrowserBridgeParent.cpp
+++ b/dom/ipc/BrowserBridgeParent.cpp
@@ -122,14 +122,19 @@ IPCResult BrowserBridgeParent::RecvNavig
   return IPC_OK();
 }
 
 IPCResult BrowserBridgeParent::RecvActivate() {
   mTabParent->Activate();
   return IPC_OK();
 }
 
+IPCResult BrowserBridgeParent::RecvDeactivate() {
+  mTabParent->Deactivate();
+  return IPC_OK();
+}
+
 void BrowserBridgeParent::ActorDestroy(ActorDestroyReason aWhy) {
   mIPCOpen = false;
 }
 
 }  // namespace dom
 }  // namespace mozilla
--- a/dom/ipc/BrowserBridgeParent.h
+++ b/dom/ipc/BrowserBridgeParent.h
@@ -43,16 +43,18 @@ class BrowserBridgeParent : public PBrow
                                            const bool& aForceRepaint,
                                            const LayersObserverEpoch& aEpoch);
 
   mozilla::ipc::IPCResult RecvNavigateByKey(const bool& aForward,
                                             const bool& aForDocumentNavigation);
 
   mozilla::ipc::IPCResult RecvActivate();
 
+  mozilla::ipc::IPCResult RecvDeactivate();
+
   void ActorDestroy(ActorDestroyReason aWhy) override;
 
  private:
   ~BrowserBridgeParent();
 
   RefPtr<TabParent> mTabParent;
   bool mIPCOpen;
 };
--- a/dom/ipc/PBrowserBridge.ipdl
+++ b/dom/ipc/PBrowserBridge.ipdl
@@ -42,12 +42,14 @@ parent:
    */
   async NavigateByKey(bool aForward, bool aForDocumentNavigation);
 
   /**
    * Sending an activate message moves focus to the iframe.
    */
   async Activate();
 
+  async Deactivate();
+
 };
 
 }  // namespace dom
 }  // namespace mozilla