Bug 635673 - Content inside xul:iframe with type=content is always able to resize top chrome window. r=bz

This commit is contained in:
Jan Varga 2011-06-25 13:42:41 +02:00
parent 5fe0614d99
commit 9ed93f386e
4 changed files with 31 additions and 1 deletions

View File

@ -737,6 +737,7 @@ nsDocShell::nsDocShell():
mAllowMetaRedirects(PR_TRUE),
mAllowImages(PR_TRUE),
mAllowDNSPrefetch(PR_TRUE),
mAllowWindowControl(PR_TRUE),
mCreatingDocument(PR_FALSE),
mUseErrorPages(PR_FALSE),
mObserveErrorPages(PR_TRUE),
@ -2036,6 +2037,18 @@ NS_IMETHODIMP nsDocShell::SetAllowDNSPrefetch(PRBool aAllowDNSPrefetch)
return NS_OK;
}
NS_IMETHODIMP nsDocShell::GetAllowWindowControl(PRBool * aAllowWindowControl)
{
*aAllowWindowControl = mAllowWindowControl;
return NS_OK;
}
NS_IMETHODIMP nsDocShell::SetAllowWindowControl(PRBool aAllowWindowControl)
{
mAllowWindowControl = aAllowWindowControl;
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetDocShellEnumerator(PRInt32 aItemType, PRInt32 aDirection, nsISimpleEnumerator **outEnum)
{
@ -2612,6 +2625,10 @@ nsDocShell::SetDocLoaderParent(nsDocLoader * aParent)
{
SetAllowImages(value);
}
if (NS_SUCCEEDED(parentAsDocShell->GetAllowWindowControl(&value)))
{
SetAllowWindowControl(value);
}
if (NS_SUCCEEDED(parentAsDocShell->GetIsActive(&value)))
{
SetIsActive(value);

View File

@ -796,6 +796,7 @@ protected:
PRPackedBool mAllowMetaRedirects;
PRPackedBool mAllowImages;
PRPackedBool mAllowDNSPrefetch;
PRPackedBool mAllowWindowControl;
PRPackedBool mCreatingDocument; // (should be) debugging only
PRPackedBool mUseErrorPages;
PRPackedBool mObserveErrorPages;

View File

@ -72,7 +72,7 @@ interface nsIPrincipal;
interface nsIWebBrowserPrint;
interface nsIVariant;
[scriptable, uuid(f77271a1-0b22-4581-af6d-529125f1901d)]
[scriptable, uuid(0666adf8-8738-4ca7-a917-0348f47d2f40)]
interface nsIDocShell : nsISupports
{
/**
@ -274,6 +274,11 @@ interface nsIDocShell : nsISupports
*/
attribute boolean allowDNSPrefetch;
/**
* Attribute that determines whether window control (move/resize) is allowed.
*/
attribute boolean allowWindowControl;
/**
* Get an enumerator over this docShell and its children.
*

View File

@ -4648,6 +4648,13 @@ nsGlobalWindow::CanMoveResizeWindows()
}
}
if (mDocShell) {
PRBool allow;
nsresult rv = mDocShell->GetAllowWindowControl(&allow);
if (NS_SUCCEEDED(rv) && !allow)
return PR_FALSE;
}
if (gMouseDown && !gDragServiceDisabled) {
nsCOMPtr<nsIDragService> ds =
do_GetService("@mozilla.org/widget/dragservice;1");