Bug 1633459 - Marshal customUserAgent setting via nsDocShell. r=geckoview-reviewers,esawin,nika

Reinstate customUserAgent interface for nsIDocShell. This is so it can be used
as a choke-point to catch setting values on docshells which are in the process
of changing process. We don't want to send changes which will be rejected on the
parent side.

This code should be removed once callers setting customUserAgent are refactored
to only occur from parent process.

Differential Revision: https://phabricator.services.mozilla.com/D75006
This commit is contained in:
Dan Glastonbury
2020-05-20 00:19:59 +00:00
parent 9f2b4ffac9
commit 5b6558b130
5 changed files with 32 additions and 4 deletions

View File

@@ -2267,6 +2267,23 @@ nsDocShell::NameEquals(const nsAString& aName, bool* aResult) {
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetCustomUserAgent(nsAString& aCustomUserAgent) {
mBrowsingContext->GetCustomUserAgent(aCustomUserAgent);
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::SetCustomUserAgent(const nsAString& aCustomUserAgent) {
if (mWillChangeProcess) {
NS_WARNING("SetCustomUserAgent: Process is changing. Ignoring set");
return NS_ERROR_FAILURE;
}
mBrowsingContext->SetCustomUserAgent(aCustomUserAgent);
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::ClearCachedUserAgent() {
RefPtr<nsGlobalWindowInner> win =