Bug 968334 Allow disabling content retargeting on child docshells only r=smaug

This commit is contained in:
Neil Rashbrook 2015-03-21 10:48:48 +00:00
parent 008fdfcf89
commit bd9d1512b5
3 changed files with 27 additions and 2 deletions

View File

@ -859,6 +859,7 @@ nsDocShell::nsDocShell()
, mAllowDNSPrefetch(true)
, mAllowWindowControl(true)
, mAllowContentRetargeting(true)
, mAllowContentRetargetingOnChildren(true)
, mCreatingDocument(false)
, mUseErrorPages(false)
, mObserveErrorPages(true)
@ -2587,10 +2588,25 @@ nsDocShell::GetAllowContentRetargeting(bool* aAllowContentRetargeting)
NS_IMETHODIMP
nsDocShell::SetAllowContentRetargeting(bool aAllowContentRetargeting)
{
mAllowContentRetargetingOnChildren = aAllowContentRetargeting;
mAllowContentRetargeting = aAllowContentRetargeting;
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetAllowContentRetargetingOnChildren(bool* aAllowContentRetargetingOnChildren)
{
*aAllowContentRetargetingOnChildren = mAllowContentRetargetingOnChildren;
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::SetAllowContentRetargetingOnChildren(bool aAllowContentRetargetingOnChildren)
{
mAllowContentRetargetingOnChildren = aAllowContentRetargetingOnChildren;
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetFullscreenAllowed(bool* aFullscreenAllowed)
{
@ -3461,7 +3477,7 @@ nsDocShell::SetDocLoaderParent(nsDocLoader* aParent)
if (NS_SUCCEEDED(parentAsDocShell->GetAllowWindowControl(&value))) {
SetAllowWindowControl(value);
}
SetAllowContentRetargeting(parentAsDocShell->GetAllowContentRetargeting());
SetAllowContentRetargeting(parentAsDocShell->GetAllowContentRetargetingOnChildren());
if (NS_SUCCEEDED(parentAsDocShell->GetIsActive(&value))) {
SetIsActive(value);
}
@ -8738,6 +8754,7 @@ nsDocShell::RestoreFromHistory()
childShell->GetAllowDNSPrefetch(&allowDNSPrefetch);
bool allowContentRetargeting = childShell->GetAllowContentRetargeting();
bool allowContentRetargetingOnChildren = childShell->GetAllowContentRetargetingOnChildren();
uint32_t defaultLoadFlags;
childShell->GetDefaultLoadFlags(&defaultLoadFlags);
@ -8756,6 +8773,7 @@ nsDocShell::RestoreFromHistory()
childShell->SetAllowMedia(allowMedia);
childShell->SetAllowDNSPrefetch(allowDNSPrefetch);
childShell->SetAllowContentRetargeting(allowContentRetargeting);
childShell->SetAllowContentRetargetingOnChildren(allowContentRetargetingOnChildren);
childShell->SetDefaultLoadFlags(defaultLoadFlags);
rv = childShell->BeginRestore(nullptr, false);

View File

@ -883,6 +883,7 @@ protected:
bool mAllowDNSPrefetch;
bool mAllowWindowControl;
bool mAllowContentRetargeting;
bool mAllowContentRetargetingOnChildren;
bool mCreatingDocument; // (should be) debugging only
bool mUseErrorPages;
bool mObserveErrorPages;

View File

@ -54,7 +54,7 @@ interface nsITabParent;
typedef unsigned long nsLoadFlags;
[scriptable, builtinclass, uuid(f84b1ae4-2f78-4bad-b36a-6a8516ee6e40)]
[scriptable, builtinclass, uuid(68ba7610-e33d-47ce-8fa2-af07af2422bc)]
interface nsIDocShell : nsIDocShellTreeItem
{
/**
@ -289,6 +289,12 @@ interface nsIDocShell : nsIDocShellTreeItem
*/
[infallible] attribute boolean allowContentRetargeting;
/**
* True if new child docshells should allow content retargeting.
* Setting allowContentRetargeting also overwrites this value.
*/
[infallible] attribute boolean allowContentRetargetingOnChildren;
/**
* Get an enumerator over this docShell and its children.
*