Bug 1021466 - Part 1: Make it possible to stash opener and newly created TabParent's inside DocShell. r=smaug.

This commit is contained in:
Mike Conley 2014-06-05 22:49:43 -04:00
parent c0967f3a38
commit 1da1d37e14
5 changed files with 55 additions and 3 deletions

View File

@ -13053,3 +13053,29 @@ nsDocShell::SetInvisible(bool aInvisible)
{
mInvisible = aInvisible;
}
void
nsDocShell::SetOpener(nsITabParent* aOpener)
{
mOpener = do_GetWeakReference(aOpener);
}
nsITabParent*
nsDocShell::GetOpener()
{
nsCOMPtr<nsITabParent> opener(do_QueryReferent(mOpener));
return opener;
}
void
nsDocShell::SetOpenedRemote(nsITabParent* aOpenedRemote)
{
mOpenedRemote = do_GetWeakReference(aOpenedRemote);
}
nsITabParent*
nsDocShell::GetOpenedRemote()
{
nsCOMPtr<nsITabParent> openedRemote(do_QueryReferent(mOpenedRemote));
return openedRemote;
}

View File

@ -42,6 +42,7 @@
#include "nsIWebShellServices.h"
#include "nsILinkHandler.h"
#include "nsIClipboardCommands.h"
#include "nsITabParent.h"
#include "nsCRT.h"
#include "prtime.h"
#include "nsRect.h"
@ -902,6 +903,8 @@ private:
nsTObserverArray<nsWeakPtr> mReflowObservers;
nsTObserverArray<nsWeakPtr> mScrollObservers;
nsCString mOriginalUriString;
nsWeakPtr mOpener;
nsWeakPtr mOpenedRemote;
// Separate function to do the actual name (i.e. not _top, _self etc.)
// searching for FindItemWithName.

View File

@ -42,10 +42,11 @@ interface nsIVariant;
interface nsIPrivacyTransitionObserver;
interface nsIReflowObserver;
interface nsIScrollObserver;
interface nsITabParent;
typedef unsigned long nsLoadFlags;
[scriptable, builtinclass, uuid(3ca96c12-b69d-4b54-83c5-25a18d32a22b)]
[scriptable, builtinclass, uuid(9c65a466-9814-48f8-a4ca-c4600b03b15d)]
interface nsIDocShell : nsIDocShellTreeItem
{
/**
@ -958,4 +959,20 @@ interface nsIDocShell : nsIDocShellTreeItem
* docshell.device_size_is_page_size pref.
*/
[infallible] attribute boolean deviceSizeIsPageSize;
/**
* Regarding setOpener / getOpener - We can't use XPIDL's "attribute"
* for notxpcom, so we're relegated to using explicit gets / sets. This
* should be fine, considering that these methods should only ever be
* called from native code.
*/
[noscript,notxpcom,nostdcall] void setOpener(in nsITabParent aOpener);
[noscript,notxpcom,nostdcall] nsITabParent getOpener();
/**
* See the documentation for setOpener and getOpener about why we
* don't use attribute here instead.
*/
[noscript,notxpcom,nostdcall] void setOpenedRemote(in nsITabParent aOpenedRemote);
[noscript,notxpcom,nostdcall] nsITabParent getOpenedRemote();
};

View File

@ -200,7 +200,11 @@ TabParent* sEventCapturer;
TabParent *TabParent::mIMETabParent = nullptr;
NS_IMPL_ISUPPORTS(TabParent, nsITabParent, nsIAuthPromptProvider, nsISecureBrowserUI)
NS_IMPL_ISUPPORTS(TabParent,
nsITabParent,
nsIAuthPromptProvider,
nsISecureBrowserUI,
nsISupportsWeakReference)
TabParent::TabParent(ContentParent* aManager, const TabContext& aContext, uint32_t aChromeFlags)
: TabContext(aContext)

View File

@ -17,6 +17,7 @@
#include "nsISecureBrowserUI.h"
#include "nsITabParent.h"
#include "nsIXULBrowserWindow.h"
#include "nsWeakReference.h"
#include "Units.h"
#include "js/TypeDecls.h"
@ -50,6 +51,7 @@ class TabParent : public PBrowserParent
, public nsITabParent
, public nsIAuthPromptProvider
, public nsISecureBrowserUI
, public nsSupportsWeakReference
, public TabContext
{
typedef mozilla::dom::ClonedMessageData ClonedMessageData;