Bug 1494175 - Remove unimplemented nsIWebBrowserChrome methods. r=qdot
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 26 Sep 2018 19:39:44 +1000
changeset 487364 00de0dfa82f2fe4ddcd2f9cddde39862d8ee2763
parent 487363 7a064423a1ad691c6ab8344fd81b469e0114480c
child 487365 11df51f97f138ade3124881b9a72a3d5e65fabba
child 487450 56b988a937689d5599400afa59b72c390b40abf2
push id246
push userfmarier@mozilla.com
push dateSat, 13 Oct 2018 00:15:40 +0000
reviewersqdot
bugs1494175
milestone64.0a1
Bug 1494175 - Remove unimplemented nsIWebBrowserChrome methods. r=qdot All implementations of these methods fail immediately. This patch removes them, and replaces their call sites with failures. Code coverage indicates these locations aren't hit by any of our tests.
docshell/base/nsDocShellTreeOwner.cpp
dom/ipc/TabChild.cpp
toolkit/components/browser/nsIWebBrowserChrome.idl
xpfe/appshell/nsAppShellService.cpp
xpfe/appshell/nsContentTreeOwner.cpp
--- a/docshell/base/nsDocShellTreeOwner.cpp
+++ b/docshell/base/nsDocShellTreeOwner.cpp
@@ -397,17 +397,20 @@ nsDocShellTreeOwner::SizeShellTo(nsIDocS
       nsCOMPtr<nsIBaseWindow> shellAsWin(do_QueryInterface(aShellItem));
       NS_ENSURE_TRUE(shellAsWin, NS_ERROR_FAILURE);
 
       int32_t width = 0;
       int32_t height = 0;
       shellAsWin->GetSize(&width, &height);
       return tabChild->RemoteSizeShellTo(aCX, aCY, width, height);
     }
-    return webBrowserChrome->SizeBrowserTo(aCX, aCY);
+    // XXX: this is weird, but we used to call a method here
+    // (webBrowserChrome->SizeBrowserTo()) whose implementations all failed
+    // like this, so...
+    return NS_ERROR_NOT_IMPLEMENTED;
   }
 
   NS_ENSURE_TRUE(aShellItem, NS_ERROR_FAILURE);
 
   nsCOMPtr<nsIDocument> document = aShellItem->GetDocument();
   NS_ENSURE_TRUE(document, NS_ERROR_FAILURE);
 
   NS_ENSURE_TRUE(document->GetDocumentElement(), NS_ERROR_FAILURE);
@@ -425,22 +428,20 @@ nsDocShellTreeOwner::SizeShellTo(nsIDocS
 
   nsIPresShell* presShell = presContext->GetPresShell();
   NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
 
   NS_ENSURE_SUCCESS(
     presShell->ResizeReflow(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE),
     NS_ERROR_FAILURE);
 
-  nsRect shellArea = presContext->GetVisibleArea();
-
-  int32_t browserCX = presContext->AppUnitsToDevPixels(shellArea.Width());
-  int32_t browserCY = presContext->AppUnitsToDevPixels(shellArea.Height());
-
-  return webBrowserChrome->SizeBrowserTo(browserCX, browserCY);
+  // XXX: this is weird, but we used to call a method here
+  // (webBrowserChrome->SizeBrowserTo()) whose implementations all failed like
+  // this, so...
+  return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::SetPersistence(bool aPersistPosition,
                                     bool aPersistSize,
                                     bool aPersistSizeMode)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
@@ -490,17 +491,20 @@ nsDocShellTreeOwner::Create()
   return NS_ERROR_NULL_POINTER;
 }
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::Destroy()
 {
   nsCOMPtr<nsIWebBrowserChrome> webBrowserChrome = GetWebBrowserChrome();
   if (webBrowserChrome) {
-    return webBrowserChrome->DestroyBrowserWindow();
+    // XXX: this is weird, but we used to call a method here
+    // (webBrowserChrome->DestroyBrowserWindow()) whose implementations all
+    // failed like this, so...
+    return NS_ERROR_NOT_IMPLEMENTED;
   }
 
   return NS_ERROR_NULL_POINTER;
 }
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::GetUnscaledDevicePixelsPerCSSPixel(double* aScale)
 {
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -730,24 +730,16 @@ NS_IMETHODIMP
 TabChild::SetChromeFlags(uint32_t aChromeFlags)
 {
   NS_WARNING("trying to SetChromeFlags from content process?");
 
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
-TabChild::DestroyBrowserWindow()
-{
-  NS_WARNING("TabChild::DestroyBrowserWindow not supported in TabChild");
-
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
 TabChild::RemoteSizeShellTo(int32_t aWidth, int32_t aHeight,
                             int32_t aShellItemWidth, int32_t aShellItemHeight)
 {
   nsCOMPtr<nsIDocShell> ourDocShell = do_GetInterface(WebNavigation());
   nsCOMPtr<nsIBaseWindow> docShellAsWin(do_QueryInterface(ourDocShell));
   NS_ENSURE_STATE(docShellAsWin);
 
   int32_t width, height;
@@ -794,24 +786,16 @@ TabChild::RemoteDropLinks(uint32_t aLink
     linksArray.AppendElement(tmp);
   }
   bool sent = SendDropLinks(linksArray);
 
   return sent ? NS_OK : NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
-TabChild::SizeBrowserTo(int32_t aWidth, int32_t aHeight)
-{
-  NS_WARNING("TabChild::SizeBrowserTo not supported in TabChild");
-
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
 TabChild::ShowAsModal()
 {
   NS_WARNING("TabChild::ShowAsModal not supported in TabChild");
 
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
--- a/toolkit/components/browser/nsIWebBrowserChrome.idl
+++ b/toolkit/components/browser/nsIWebBrowserChrome.idl
@@ -93,30 +93,16 @@ interface nsIWebBrowserChrome : nsISuppo
     /**
      * The chrome flags for this browser chrome. The implementation should
      * reflect the value of this attribute by hiding or showing its chrome
      * appropriately.
      */
     attribute unsigned long chromeFlags;
 
     /**
-     * Asks the implementer to destroy the window associated with this
-     * WebBrowser object.
-     */
-    void destroyBrowserWindow();
-
-    /**
-     * Tells the chrome to size itself such that the browser will be the
-     * specified size.
-     * @param aCX new width of the browser
-     * @param aCY new height of the browser
-     */
-    void sizeBrowserTo(in long aCX, in long aCY);
-
-    /**
      * Shows the window as a modal window.
      */
     void showAsModal();
 
     /**
      * Is the window modal (that is, currently executing a modal loop)?
      * @return true if it's a modal window
      */
--- a/xpfe/appshell/nsAppShellService.cpp
+++ b/xpfe/appshell/nsAppShellService.cpp
@@ -264,32 +264,16 @@ NS_IMETHODIMP
 WebBrowserChrome2Stub::SetChromeFlags(uint32_t aChromeFlags)
 {
   MOZ_ASSERT_UNREACHABLE("WebBrowserChrome2Stub::SetChromeFlags is "
                          "not supported");
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
-WebBrowserChrome2Stub::DestroyBrowserWindow()
-{
-  MOZ_ASSERT_UNREACHABLE("WebBrowserChrome2Stub::DestroyBrowserWindow is "
-                         "not supported");
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-WebBrowserChrome2Stub::SizeBrowserTo(int32_t aCX, int32_t aCY)
-{
-  MOZ_ASSERT_UNREACHABLE("WebBrowserChrome2Stub::SizeBrowserTo is "
-                         "not supported");
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
 WebBrowserChrome2Stub::ShowAsModal()
 {
   MOZ_ASSERT_UNREACHABLE("WebBrowserChrome2Stub::ShowAsModal is not supported");
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 WebBrowserChrome2Stub::IsWindowModal(bool* aResult)
--- a/xpfe/appshell/nsContentTreeOwner.cpp
+++ b/xpfe/appshell/nsContentTreeOwner.cpp
@@ -478,28 +478,16 @@ NS_IMETHODIMP nsContentTreeOwner::SetChr
 }
 
 NS_IMETHODIMP nsContentTreeOwner::GetChromeFlags(uint32_t* aChromeFlags)
 {
   NS_ENSURE_STATE(mXULWindow);
   return mXULWindow->GetChromeFlags(aChromeFlags);
 }
 
-NS_IMETHODIMP nsContentTreeOwner::DestroyBrowserWindow()
-{
-   NS_ERROR("Haven't Implemented this yet");
-   return NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP nsContentTreeOwner::SizeBrowserTo(int32_t aCX, int32_t aCY)
-{
-   NS_ERROR("Haven't Implemented this yet");
-   return NS_ERROR_FAILURE;
-}
-
 NS_IMETHODIMP nsContentTreeOwner::ShowAsModal()
 {
    NS_ENSURE_STATE(mXULWindow);
    return mXULWindow->ShowModal();
 }
 
 NS_IMETHODIMP nsContentTreeOwner::IsWindowModal(bool *_retval)
 {