зеркало из https://github.com/mozilla/gecko-dev.git
Bug 842015 - Avoid modifying the root docshell's privacy status when we aren't opening a new toplevel window. r=bz
This commit is contained in:
Родитель
cc629bf54e
Коммит
6e2d06ad52
|
@ -899,33 +899,38 @@ nsWindowWatcher::OpenWindowInternal(nsIDOMWindow *aParent,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (windowIsNew) {
|
// If all windows should be private, make sure the new window is also
|
||||||
// If all windows should be private, make sure the new window is also
|
// private. Otherwise, see if the caller has explicitly requested a
|
||||||
// private. Otherwise, see if the caller has explicitly requested a
|
// private or non-private window.
|
||||||
// private or non-private window.
|
bool isPrivateBrowsingWindow =
|
||||||
bool isPrivateBrowsingWindow =
|
|
||||||
Preferences::GetBool("browser.privatebrowsing.autostart") ||
|
Preferences::GetBool("browser.privatebrowsing.autostart") ||
|
||||||
(!!(chromeFlags & nsIWebBrowserChrome::CHROME_PRIVATE_WINDOW) &&
|
(!!(chromeFlags & nsIWebBrowserChrome::CHROME_PRIVATE_WINDOW) &&
|
||||||
!(chromeFlags & nsIWebBrowserChrome::CHROME_NON_PRIVATE_WINDOW));
|
!(chromeFlags & nsIWebBrowserChrome::CHROME_NON_PRIVATE_WINDOW));
|
||||||
|
|
||||||
// Otherwise, propagate the privacy status of the parent window, if
|
// Otherwise, propagate the privacy status of the parent window, if
|
||||||
// available, to the child.
|
// available, to the child.
|
||||||
if (!isPrivateBrowsingWindow &&
|
if (!isPrivateBrowsingWindow &&
|
||||||
!(chromeFlags & nsIWebBrowserChrome::CHROME_NON_PRIVATE_WINDOW)) {
|
!(chromeFlags & nsIWebBrowserChrome::CHROME_NON_PRIVATE_WINDOW)) {
|
||||||
nsCOMPtr<nsIDocShellTreeItem> parentItem;
|
nsCOMPtr<nsIDocShellTreeItem> parentItem;
|
||||||
GetWindowTreeItem(aParent, getter_AddRefs(parentItem));
|
GetWindowTreeItem(aParent, getter_AddRefs(parentItem));
|
||||||
nsCOMPtr<nsILoadContext> parentContext = do_QueryInterface(parentItem);
|
nsCOMPtr<nsILoadContext> parentContext = do_QueryInterface(parentItem);
|
||||||
if (parentContext) {
|
if (parentContext) {
|
||||||
isPrivateBrowsingWindow = parentContext->UsePrivateBrowsing();
|
isPrivateBrowsingWindow = parentContext->UsePrivateBrowsing();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isNewToplevelWindow) {
|
||||||
nsCOMPtr<nsIDocShellTreeItem> childRoot;
|
nsCOMPtr<nsIDocShellTreeItem> childRoot;
|
||||||
newDocShellItem->GetRootTreeItem(getter_AddRefs(childRoot));
|
newDocShellItem->GetRootTreeItem(getter_AddRefs(childRoot));
|
||||||
nsCOMPtr<nsILoadContext> childContext = do_QueryInterface(childRoot);
|
nsCOMPtr<nsILoadContext> childContext = do_QueryInterface(childRoot);
|
||||||
if (childContext) {
|
if (childContext) {
|
||||||
childContext->SetPrivateBrowsing(isPrivateBrowsingWindow);
|
childContext->SetPrivateBrowsing(isPrivateBrowsingWindow);
|
||||||
}
|
}
|
||||||
|
} else if (windowIsNew) {
|
||||||
|
nsCOMPtr<nsILoadContext> childContext = do_QueryInterface(newDocShellItem);
|
||||||
|
if (childContext) {
|
||||||
|
childContext->SetPrivateBrowsing(isPrivateBrowsingWindow);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uriToLoad && aNavigate) { // get the script principal and pass it to docshell
|
if (uriToLoad && aNavigate) { // get the script principal and pass it to docshell
|
||||||
|
|
Загрузка…
Ссылка в новой задаче