From 578ac09f67274b520071a3ef0052405cde0ef9f0 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Wed, 26 Sep 2018 19:39:44 +1000 Subject: [PATCH] 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. --HG-- extra : rebase_source : 3c44ac20213af97865ad0316e65bfe49b9e5818c --- docshell/base/nsDocShellTreeOwner.cpp | 20 +++++++++++-------- dom/ipc/TabChild.cpp | 16 --------------- .../browser/nsIWebBrowserChrome.idl | 14 ------------- xpfe/appshell/nsAppShellService.cpp | 16 --------------- xpfe/appshell/nsContentTreeOwner.cpp | 12 ----------- 5 files changed, 12 insertions(+), 66 deletions(-) diff --git a/docshell/base/nsDocShellTreeOwner.cpp b/docshell/base/nsDocShellTreeOwner.cpp index 58cefea1650f..4136f4c6672f 100644 --- a/docshell/base/nsDocShellTreeOwner.cpp +++ b/docshell/base/nsDocShellTreeOwner.cpp @@ -402,7 +402,10 @@ nsDocShellTreeOwner::SizeShellTo(nsIDocShellTreeItem* aShellItem, 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); @@ -430,12 +433,10 @@ nsDocShellTreeOwner::SizeShellTo(nsIDocShellTreeItem* aShellItem, 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 @@ -495,7 +496,10 @@ nsDocShellTreeOwner::Destroy() { nsCOMPtr 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; diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index 329f0f0eaab3..d26e98928349 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -734,14 +734,6 @@ TabChild::SetChromeFlags(uint32_t aChromeFlags) 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) @@ -798,14 +790,6 @@ TabChild::RemoteDropLinks(uint32_t aLinksCount, 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() { diff --git a/toolkit/components/browser/nsIWebBrowserChrome.idl b/toolkit/components/browser/nsIWebBrowserChrome.idl index d7b995b4c200..df9a36590c73 100644 --- a/toolkit/components/browser/nsIWebBrowserChrome.idl +++ b/toolkit/components/browser/nsIWebBrowserChrome.idl @@ -97,20 +97,6 @@ interface nsIWebBrowserChrome : nsISupports */ 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. */ diff --git a/xpfe/appshell/nsAppShellService.cpp b/xpfe/appshell/nsAppShellService.cpp index d73c28caaee1..66c4ba1323aa 100644 --- a/xpfe/appshell/nsAppShellService.cpp +++ b/xpfe/appshell/nsAppShellService.cpp @@ -268,22 +268,6 @@ WebBrowserChrome2Stub::SetChromeFlags(uint32_t aChromeFlags) 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() { diff --git a/xpfe/appshell/nsContentTreeOwner.cpp b/xpfe/appshell/nsContentTreeOwner.cpp index a3f37a6322ac..a1ffaf755831 100644 --- a/xpfe/appshell/nsContentTreeOwner.cpp +++ b/xpfe/appshell/nsContentTreeOwner.cpp @@ -483,18 +483,6 @@ NS_IMETHODIMP nsContentTreeOwner::GetChromeFlags(uint32_t* aChromeFlags) 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);