зеркало из https://github.com/mozilla/pjs.git
Bug 559534: Forward nsIXULWindow.chromeFlags to remote tabs. sr=bsmedberg
This commit is contained in:
Родитель
6bd3515680
Коммит
794b785d59
|
@ -91,6 +91,7 @@
|
|||
#include "nsISHistory.h"
|
||||
#include "nsISHistoryInternal.h"
|
||||
#include "nsIDOMNSHTMLDocument.h"
|
||||
#include "nsIXULWindow.h"
|
||||
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsIView.h"
|
||||
|
@ -1651,9 +1652,23 @@ nsFrameLoader::TryNewProcess()
|
|||
return false;
|
||||
}
|
||||
|
||||
PRUint32 chromeFlags = 0;
|
||||
nsCOMPtr<nsIDocShellTreeOwner> parentOwner;
|
||||
if (NS_FAILED(parentAsItem->GetTreeOwner(getter_AddRefs(parentOwner))) ||
|
||||
!parentOwner) {
|
||||
return false;
|
||||
}
|
||||
nsCOMPtr<nsIXULWindow> window(do_GetInterface(parentOwner));
|
||||
if (!window) {
|
||||
return false;
|
||||
}
|
||||
if (NS_FAILED(window->GetChromeFlags(&chromeFlags))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ContentParent* parent = ContentParent::GetSingleton();
|
||||
NS_ASSERTION(parent->IsAlive(), "Process parent should be alive; something is very wrong!");
|
||||
mRemoteBrowser = parent->CreateTab();
|
||||
mRemoteBrowser = parent->CreateTab(chromeFlags);
|
||||
if (mRemoteBrowser) {
|
||||
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(mOwnerContent);
|
||||
mRemoteBrowser->SetOwnerElement(element);
|
||||
|
|
|
@ -83,9 +83,9 @@ ContentChild::Init(MessageLoop* aIOLoop,
|
|||
}
|
||||
|
||||
PBrowserChild*
|
||||
ContentChild::AllocPBrowser()
|
||||
ContentChild::AllocPBrowser(const PRUint32& aChromeFlags)
|
||||
{
|
||||
nsRefPtr<TabChild> iframe = new TabChild();
|
||||
nsRefPtr<TabChild> iframe = new TabChild(aChromeFlags);
|
||||
return NS_SUCCEEDED(iframe->Init()) ? iframe.forget().get() : NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ public:
|
|||
/* if you remove this, please talk to cjones or dougt */
|
||||
virtual bool RecvDummy(Shmem& foo) { return true; }
|
||||
|
||||
virtual PBrowserChild* AllocPBrowser();
|
||||
virtual PBrowserChild* AllocPBrowser(const PRUint32& aChromeFlags);
|
||||
virtual bool DeallocPBrowser(PBrowserChild*);
|
||||
|
||||
virtual PTestShellChild* AllocPTestShell();
|
||||
|
|
|
@ -119,9 +119,9 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
|
|||
}
|
||||
|
||||
TabParent*
|
||||
ContentParent::CreateTab()
|
||||
ContentParent::CreateTab(PRUint32 aChromeFlags)
|
||||
{
|
||||
return static_cast<TabParent*>(SendPBrowserConstructor());
|
||||
return static_cast<TabParent*>(SendPBrowserConstructor(aChromeFlags));
|
||||
}
|
||||
|
||||
TestShellParent*
|
||||
|
@ -361,7 +361,7 @@ ContentParent::Observe(nsISupports* aSubject,
|
|||
}
|
||||
|
||||
PBrowserParent*
|
||||
ContentParent::AllocPBrowser()
|
||||
ContentParent::AllocPBrowser(const PRUint32& aChromeFlags)
|
||||
{
|
||||
TabParent* parent = new TabParent();
|
||||
if (parent){
|
||||
|
|
|
@ -80,7 +80,7 @@ public:
|
|||
NS_DECL_NSIOBSERVER
|
||||
NS_DECL_NSITHREADOBSERVER
|
||||
|
||||
TabParent* CreateTab();
|
||||
TabParent* CreateTab(PRUint32 aChromeFlags);
|
||||
|
||||
TestShellParent* CreateTestShell();
|
||||
bool DestroyTestShell(TestShellParent* aTestShell);
|
||||
|
@ -104,7 +104,7 @@ private:
|
|||
ContentParent();
|
||||
virtual ~ContentParent();
|
||||
|
||||
virtual PBrowserParent* AllocPBrowser();
|
||||
virtual PBrowserParent* AllocPBrowser(const PRUint32& aChromeFlags);
|
||||
virtual bool DeallocPBrowser(PBrowserParent* frame);
|
||||
|
||||
virtual PTestShellParent* AllocPTestShell();
|
||||
|
|
|
@ -59,7 +59,7 @@ rpc protocol PContent
|
|||
manages PNecko;
|
||||
|
||||
child:
|
||||
PBrowser();
|
||||
PBrowser(PRUint32 chromeFlags);
|
||||
|
||||
PTestShell();
|
||||
|
||||
|
|
|
@ -110,8 +110,10 @@ public:
|
|||
};
|
||||
|
||||
|
||||
TabChild::TabChild()
|
||||
: mCx(nsnull), mTabChildGlobal(nsnull)
|
||||
TabChild::TabChild(PRUint32 aChromeFlags)
|
||||
: mCx(nsnull)
|
||||
, mTabChildGlobal(nsnull)
|
||||
, mChromeFlags(aChromeFlags)
|
||||
{
|
||||
printf("creating %d!\n", NS_IsMainThread());
|
||||
}
|
||||
|
@ -182,12 +184,14 @@ TabChild::SetWebBrowser(nsIWebBrowser* aWebBrowser)
|
|||
NS_IMETHODIMP
|
||||
TabChild::GetChromeFlags(PRUint32* aChromeFlags)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
*aChromeFlags = mChromeFlags;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChild::SetChromeFlags(PRUint32 aChromeFlags)
|
||||
{
|
||||
NS_ERROR("trying to SetChromeFlags from content process?");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ class TabChild : public PBrowserChild,
|
|||
public nsITabChild
|
||||
{
|
||||
public:
|
||||
TabChild();
|
||||
TabChild(PRUint32 aChromeFlags);
|
||||
virtual ~TabChild();
|
||||
bool DestroyWidget();
|
||||
nsresult Init();
|
||||
|
@ -286,6 +286,7 @@ private:
|
|||
nsCOMPtr<nsIChannel> mChannel;
|
||||
TabChildGlobal* mTabChildGlobal;
|
||||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||
PRUint32 mChromeFlags;
|
||||
|
||||
DISALLOW_EVIL_CONSTRUCTORS(TabChild);
|
||||
};
|
||||
|
|
|
@ -51,7 +51,7 @@ interface nsIDocShellTreeItem;
|
|||
interface nsIAppShell;
|
||||
interface nsIXULBrowserWindow;
|
||||
|
||||
[scriptable, uuid(c175a596-ee13-420a-aa74-13ad3a14deb1)]
|
||||
[scriptable, uuid(5869c5e5-743d-473c-bb71-41752146d373)]
|
||||
interface nsIXULWindow : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -132,6 +132,13 @@ interface nsIXULWindow : nsISupports
|
|||
attribute PRUint32 contextFlags;
|
||||
|
||||
attribute PRUint32 chromeFlags;
|
||||
|
||||
/**
|
||||
* Begin assuming |chromeFlags| don't change hereafter, and assert
|
||||
* if they do change. The state change is one-way and idempotent.
|
||||
*/
|
||||
void assumeChromeFlagsAreFrozen();
|
||||
|
||||
/**
|
||||
* Create a new window.
|
||||
* @param aChromeFlags see nsIWebBrowserChrome
|
||||
|
|
|
@ -148,6 +148,7 @@ nsXULWindow::nsXULWindow(PRUint32 aChromeFlags)
|
|||
mLockedUntilChromeLoad(PR_FALSE),
|
||||
mIgnoreXULSize(PR_FALSE),
|
||||
mIgnoreXULPosition(PR_FALSE),
|
||||
mChromeFlagsFrozen(PR_FALSE),
|
||||
mContextFlags(0),
|
||||
mBlurSuppressionLevel(0),
|
||||
mPersistentAttributesDirty(0),
|
||||
|
@ -332,12 +333,21 @@ NS_IMETHODIMP nsXULWindow::GetChromeFlags(PRUint32 *aChromeFlags)
|
|||
|
||||
NS_IMETHODIMP nsXULWindow::SetChromeFlags(PRUint32 aChromeFlags)
|
||||
{
|
||||
NS_ASSERTION(!mChromeFlagsFrozen,
|
||||
"SetChromeFlags() after AssumeChromeFlagsAreFrozen()!");
|
||||
|
||||
mChromeFlags = aChromeFlags;
|
||||
if (mChromeLoaded)
|
||||
NS_ENSURE_SUCCESS(ApplyChromeFlags(), NS_ERROR_FAILURE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULWindow::AssumeChromeFlagsAreFrozen()
|
||||
{
|
||||
mChromeFlagsFrozen = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULWindow::SetIntrinsicallySized(PRBool aIntrinsicallySized)
|
||||
{
|
||||
mIntrinsicallySized = aIntrinsicallySized;
|
||||
|
|
|
@ -171,6 +171,7 @@ protected:
|
|||
PRPackedBool mLockedUntilChromeLoad;
|
||||
PRPackedBool mIgnoreXULSize;
|
||||
PRPackedBool mIgnoreXULPosition;
|
||||
PRPackedBool mChromeFlagsFrozen;
|
||||
PRUint32 mContextFlags;
|
||||
PRUint32 mBlurSuppressionLevel;
|
||||
PRUint32 mPersistentAttributesDirty; // persistentAttributes
|
||||
|
|
Загрузка…
Ссылка в новой задаче