Bug 1477343 - Remove PBrowser::IsParentWindowMainWidgetVisible. r=mccr8,bzbarsky
authorBlake Kaplan <mrbkap@gmail.com>
Thu, 26 Jul 2018 19:26:02 +0000
changeset 428629 2b9fac2e27ef6775bdcc49db9144e4cebcff1a69
parent 428628 56590b88c0412e04dd182a9500ba83bea8b86d13
child 428630 eae45845985074d6a9a20766153a9e3d6091d0ed
push id34338
push userdluca@mozilla.com
push dateFri, 27 Jul 2018 09:54:52 +0000
treeherdermozilla-central@e56f7601927e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8, bzbarsky
bugs1477343
milestone63.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 1477343 - Remove PBrowser::IsParentWindowMainWidgetVisible. r=mccr8,bzbarsky Differential Revision: https://phabricator.services.mozilla.com/D2347
dom/base/nsDOMWindowUtils.cpp
dom/ipc/PBrowser.ipdl
dom/ipc/TabParent.cpp
dom/ipc/TabParent.h
ipc/ipdl/sync-messages.ini
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -3546,30 +3546,28 @@ nsDOMWindowUtils::AllowScriptsToClose()
   NS_ENSURE_STATE(window);
   nsGlobalWindowOuter::Cast(window)->AllowScriptsToClose();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMWindowUtils::GetIsParentWindowMainWidgetVisible(bool* aIsVisible)
 {
+  if (!XRE_IsParentProcess()) {
+    MOZ_CRASH("IsParentWindowMainWidgetVisible is only available in the parent process");
+  }
+
   // this should reflect the "is parent window visible" logic in
   // nsWindowWatcher::OpenWindowInternal()
   nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
   NS_ENSURE_STATE(window);
 
   nsCOMPtr<nsIWidget> parentWidget;
   nsIDocShell *docShell = window->GetDocShell();
   if (docShell) {
-    if (TabChild *tabChild = TabChild::GetFrom(docShell)) {
-      if (!tabChild->SendIsParentWindowMainWidgetVisible(aIsVisible))
-        return NS_ERROR_FAILURE;
-      return NS_OK;
-    }
-
     nsCOMPtr<nsIDocShellTreeOwner> parentTreeOwner;
     docShell->GetTreeOwner(getter_AddRefs(parentTreeOwner));
     nsCOMPtr<nsIBaseWindow> parentWindow(do_GetInterface(parentTreeOwner));
     if (parentWindow) {
         parentWindow->GetMainWidget(getter_AddRefs(parentWidget));
     }
   }
   if (!parentWidget) {
--- a/dom/ipc/PBrowser.ipdl
+++ b/dom/ipc/PBrowser.ipdl
@@ -354,18 +354,16 @@ parent:
                                 nsCString[] enabledCommands,
                                 nsCString[] disabledCommands);
 
     nested(inside_cpow) sync GetInputContext() returns (IMEState state);
 
     nested(inside_cpow) async SetInputContext(InputContext context,
                                               InputContextAction action);
 
-    sync IsParentWindowMainWidgetVisible() returns (bool visible);
-
     /**
      * Set the native cursor.
      * @param value
      *   The widget cursor to set.
      * @param force
      *   Invalidate any locally cached cursor settings and force an
      *   update.
      */
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -2486,36 +2486,16 @@ mozilla::ipc::IPCResult
 TabParent::RecvSetInputContext(
   const InputContext& aContext,
   const InputContextAction& aAction)
 {
   IMEStateManager::SetInputContextForChildProcess(this, aContext, aAction);
   return IPC_OK();
 }
 
-mozilla::ipc::IPCResult
-TabParent::RecvIsParentWindowMainWidgetVisible(bool* aIsVisible)
-{
-  // XXXbz This looks unused; can we just remove it?
-  nsCOMPtr<nsIContent> frame = do_QueryInterface(mFrameElement);
-  if (!frame)
-    return IPC_OK();
-  nsGlobalWindowOuter* outer =
-    nsGlobalWindowOuter::Cast(frame->OwnerDoc()->GetWindow());
-  if (!outer)
-    return IPC_OK();
-
-  nsCOMPtr<nsIDOMWindowUtils> windowUtils = outer->WindowUtils();
-  nsresult rv = windowUtils->GetIsParentWindowMainWidgetVisible(aIsVisible);
-  if (NS_FAILED(rv)) {
-    return IPC_FAIL_NO_REASON(this);
-  }
-  return IPC_OK();
-}
-
 already_AddRefed<nsIWidget>
 TabParent::GetTopLevelWidget()
 {
   nsCOMPtr<nsIContent> content = do_QueryInterface(mFrameElement);
   if (content) {
     nsIPresShell* shell = content->OwnerDoc()->GetShell();
     if (shell) {
       nsViewManager* vm = shell->GetViewManager();
--- a/dom/ipc/TabParent.h
+++ b/dom/ipc/TabParent.h
@@ -278,18 +278,16 @@ public:
                                                       const gfx::SurfaceFormat& aFormat,
                                                       const uint32_t& aHotspotX,
                                                       const uint32_t& aHotspotY,
                                                       const bool& aForce) override;
 
   virtual mozilla::ipc::IPCResult RecvSetStatus(const uint32_t& aType,
                                                 const nsString& aStatus) override;
 
-  virtual mozilla::ipc::IPCResult RecvIsParentWindowMainWidgetVisible(bool* aIsVisible) override;
-
   virtual mozilla::ipc::IPCResult RecvShowTooltip(const uint32_t& aX,
                                                   const uint32_t& aY,
                                                   const nsString& aTooltip,
                                                   const nsString& aDirection) override;
 
   virtual mozilla::ipc::IPCResult RecvHideTooltip() override;
 
 
--- a/ipc/ipdl/sync-messages.ini
+++ b/ipc/ipdl/sync-messages.ini
@@ -825,19 +825,16 @@ description =
 [PBrowser::NotifyIMEMouseButtonEvent]
 description =
 [PBrowser::RequestIMEToCommitComposition]
 description =
 [PBrowser::StartPluginIME]
 description =
 [PBrowser::GetInputContext]
 description =
-[PBrowser::IsParentWindowMainWidgetVisible]
-description =
-description =
 [PBrowser::RequestNativeKeyBindings]
 description =
 [PBrowser::DispatchWheelEvent]
 description =
 [PBrowser::DispatchMouseEvent]
 description =
 [PBrowser::DispatchKeyboardEvent]
 description =