Bug 516747 part 1; make TabChild hand things out via nsIInterfaceRequestor. r=bsmedberg
authorBoris Zbarsky <bzbarsky@mit.edu>
Thu, 31 Dec 2009 20:34:06 -0500
changeset 46489 5d75d1ef28c1647e8b43950a5136ac2020c22866
parent 46488 179bad6335811b764f6671149d0fc5dbacd51bcd
child 46490 15b58ed34cb0ae72f57dedfb6104fc2ed171a167
push id14210
push userdougt@mozilla.com
push dateThu, 01 Jul 2010 06:28:42 +0000
treeherdermozilla-central@3aff97777291 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs516747
milestone1.9.3a1pre
Bug 516747 part 1; make TabChild hand things out via nsIInterfaceRequestor. r=bsmedberg
dom/ipc/TabChild.cpp
dom/ipc/TabChild.h
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -97,19 +97,19 @@ TabChild::Init()
   mWebNav = do_QueryInterface(webBrowser);
   NS_ASSERTION(mWebNav, "nsWebBrowser doesn't implement nsIWebNavigation?");
 
   nsCOMPtr<nsIDocShellTreeItem> docShellItem(do_QueryInterface(mWebNav));
   docShellItem->SetItemType(nsIDocShellTreeItem::typeContentWrapper);
   return NS_OK;
 }
 
-NS_IMPL_ISUPPORTS5(TabChild, nsIWebBrowserChrome, nsIWebBrowserChrome2,
+NS_IMPL_ISUPPORTS6(TabChild, nsIWebBrowserChrome, nsIWebBrowserChrome2,
                    nsIEmbeddingSiteWindow, nsIEmbeddingSiteWindow2,
-                   nsIWebBrowserChromeFocus)
+                   nsIWebBrowserChromeFocus, nsIInterfaceRequestor)
 
 NS_IMETHODIMP
 TabChild::SetStatus(PRUint32 aStatusType, const PRUnichar* aStatus)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
@@ -241,16 +241,24 @@ TabChild::FocusNextElement()
 
 NS_IMETHODIMP
 TabChild::FocusPrevElement()
 {
   SendmoveFocus(PR_FALSE);
   return NS_OK;
 }
 
+NS_IMETHODIMP
+TabChild::GetInterface(const nsIID & aIID, void **aSink)
+{
+    // XXXbz should we restrict the set of interfaces we hand out here?
+    // See bug 537429
+    return QueryInterface(aIID, aSink);
+}
+
 bool
 TabChild::RecvcreateWidget(const MagicWindowHandle& parentWidget)
 {
     nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(mWebNav);
     if (!baseWindow) {
         NS_ERROR("mWebNav doesn't QI to nsIBaseWindow");
         return true;
     }
--- a/dom/ipc/TabChild.h
+++ b/dom/ipc/TabChild.h
@@ -43,16 +43,17 @@
 #include "nsIWebNavigation.h"
 #include "nsCOMPtr.h"
 #include "nsAutoPtr.h"
 #include "nsIWebBrowserChrome2.h"
 #include "nsIEmbeddingSiteWindow2.h"
 #include "nsIWebBrowserChromeFocus.h"
 #include "nsIDOMEventListener.h"
 #include "nsIDOMEventTarget.h"
+#include "nsIInterfaceRequestor.h"
 
 namespace mozilla {
 namespace dom {
 
 class TabChild;
 
 class ContentListener : public nsIDOMEventListener
 {
@@ -62,30 +63,32 @@ public:
   NS_DECL_NSIDOMEVENTLISTENER
 protected:
   TabChild* mTabChild;
 };
 
 class TabChild : public PIFrameEmbeddingChild,
                  public nsIWebBrowserChrome2,
                  public nsIEmbeddingSiteWindow2,
-                 public nsIWebBrowserChromeFocus
+                 public nsIWebBrowserChromeFocus,
+                 public nsIInterfaceRequestor
 {
 public:
     TabChild();
     virtual ~TabChild();
     bool destroyWidget();
     nsresult Init();
 
     NS_DECL_ISUPPORTS
     NS_DECL_NSIWEBBROWSERCHROME
     NS_DECL_NSIWEBBROWSERCHROME2
     NS_DECL_NSIEMBEDDINGSITEWINDOW
     NS_DECL_NSIEMBEDDINGSITEWINDOW2
     NS_DECL_NSIWEBBROWSERCHROMEFOCUS
+    NS_DECL_NSIINTERFACEREQUESTOR
 
     virtual bool RecvcreateWidget(const MagicWindowHandle& parentWidget);
     virtual bool RecvloadURL(const nsCString& uri);
     virtual bool Recvmove(const PRUint32& x,
                           const PRUint32& y,
                           const PRUint32& width,
                           const PRUint32& height);
     virtual bool Recvactivate();