Bug 492196. Make it possible to disable dns prefetch on a per-docshell-tree level; disable it by default in embedding contexts, for api compat. r+sr=jst
This commit is contained in:
@@ -687,6 +687,7 @@ nsDocShell::nsDocShell():
|
||||
mAllowJavascript(PR_TRUE),
|
||||
mAllowMetaRedirects(PR_TRUE),
|
||||
mAllowImages(PR_TRUE),
|
||||
mAllowDNSPrefetch(PR_TRUE),
|
||||
mFocusDocFirst(PR_FALSE),
|
||||
mHasFocus(PR_FALSE),
|
||||
mCreatingDocument(PR_FALSE),
|
||||
@@ -1923,6 +1924,18 @@ NS_IMETHODIMP nsDocShell::SetAllowImages(PRBool aAllowImages)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShell::GetAllowDNSPrefetch(PRBool * aAllowDNSPrefetch)
|
||||
{
|
||||
*aAllowDNSPrefetch = mAllowDNSPrefetch;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShell::SetAllowDNSPrefetch(PRBool aAllowDNSPrefetch)
|
||||
{
|
||||
mAllowDNSPrefetch = aAllowDNSPrefetch;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetDocShellEnumerator(PRInt32 aItemType, PRInt32 aDirection, nsISimpleEnumerator **outEnum)
|
||||
{
|
||||
@@ -1962,6 +1975,9 @@ NS_IMETHODIMP
|
||||
nsDocShell::SetAppType(PRUint32 aAppType)
|
||||
{
|
||||
mAppType = aAppType;
|
||||
if (mAppType == APP_TYPE_MAIL || mAppType == APP_TYPE_EDITOR) {
|
||||
SetAllowDNSPrefetch(PR_FALSE);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -2383,6 +2399,10 @@ nsDocShell::SetDocLoaderParent(nsDocLoader * aParent)
|
||||
{
|
||||
SetAllowImages(value);
|
||||
}
|
||||
if (NS_FAILED(parentAsDocShell->GetAllowDNSPrefetch(&value))) {
|
||||
value = PR_FALSE;
|
||||
}
|
||||
SetAllowDNSPrefetch(value);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURIContentListener> parentURIListener(do_GetInterface(parent));
|
||||
@@ -6843,6 +6863,9 @@ nsDocShell::RestoreFromHistory()
|
||||
|
||||
PRBool allowImages;
|
||||
childShell->GetAllowImages(&allowImages);
|
||||
|
||||
PRBool allowDNSPrefetch;
|
||||
childShell->GetAllowDNSPrefetch(&allowDNSPrefetch);
|
||||
|
||||
AddChild(childItem);
|
||||
|
||||
@@ -6851,6 +6874,7 @@ nsDocShell::RestoreFromHistory()
|
||||
childShell->SetAllowMetaRedirects(allowRedirects);
|
||||
childShell->SetAllowSubframes(allowSubframes);
|
||||
childShell->SetAllowImages(allowImages);
|
||||
childShell->SetAllowDNSPrefetch(allowDNSPrefetch);
|
||||
|
||||
rv = childShell->BeginRestore(nsnull, PR_FALSE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
Reference in New Issue
Block a user