Bug 1615967 - Move customUserAgent to BrowsingContext. r=nika,remote-protocol-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D63040
This commit is contained in:
Matt Woodrow
2020-02-24 02:15:03 +00:00
parent 40d4aa3769
commit 08b49cc241
18 changed files with 88 additions and 81 deletions

View File

@@ -2343,14 +2343,7 @@ nsDocShell::NameEquals(const nsAString& aName, bool* aResult) {
}
NS_IMETHODIMP
nsDocShell::GetCustomUserAgent(nsAString& aCustomUserAgent) {
aCustomUserAgent = mCustomUserAgent;
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::SetCustomUserAgent(const nsAString& aCustomUserAgent) {
mCustomUserAgent = aCustomUserAgent;
nsDocShell::ClearCachedUserAgent() {
RefPtr<nsGlobalWindowInner> win =
mScriptGlobal ? mScriptGlobal->GetCurrentInnerWindowInternal() : nullptr;
if (win) {
@@ -2360,13 +2353,6 @@ nsDocShell::SetCustomUserAgent(const nsAString& aCustomUserAgent) {
}
}
uint32_t childCount = mChildList.Length();
for (uint32_t i = 0; i < childCount; ++i) {
nsCOMPtr<nsIDocShell> childShell = do_QueryInterface(ChildAt(i));
if (childShell) {
childShell->SetCustomUserAgent(aCustomUserAgent);
}
}
return NS_OK;
}
@@ -2628,7 +2614,6 @@ nsresult nsDocShell::SetDocLoaderParent(nsDocLoader* aParent) {
// If parent is another docshell, we inherit all their flags for
// allowing plugins, scripting etc.
bool value;
nsString customUserAgent;
nsCOMPtr<nsIDocShell> parentAsDocShell(do_QueryInterface(parent));
if (parentAsDocShell) {
@@ -2663,10 +2648,6 @@ nsresult nsDocShell::SetDocLoaderParent(nsDocLoader* aParent) {
if (NS_SUCCEEDED(parentAsDocShell->GetIsActive(&value))) {
SetIsActive(value);
}
if (NS_SUCCEEDED(parentAsDocShell->GetCustomUserAgent(customUserAgent)) &&
!customUserAgent.IsEmpty()) {
SetCustomUserAgent(customUserAgent);
}
if (NS_FAILED(parentAsDocShell->GetAllowDNSPrefetch(&value))) {
value = false;
}