summaryrefslogtreecommitdiff
path: root/netwerk/protocol
diff options
context:
space:
mode:
authorJustOff <Off.Just.Off@gmail.com>2018-05-15 00:32:07 +0300
committerJustOff <Off.Just.Off@gmail.com>2018-05-15 00:32:07 +0300
commit1c9d6206cb04027614d6857786d1d82767664b45 (patch)
treedd64ba865c10972e6e114783dfdfd3a988555e93 /netwerk/protocol
parent1a0462b4587a127d90e36b1f50687a223be8ba0f (diff)
downloaduxp-1c9d6206cb04027614d6857786d1d82767664b45.tar.gz
Revert incorrect UAO optimization that broke SSUAO
Diffstat (limited to 'netwerk/protocol')
-rw-r--r--netwerk/protocol/http/UserAgentOverrides.jsm8
-rw-r--r--netwerk/protocol/http/nsHttpChannel.cpp46
-rw-r--r--netwerk/protocol/http/nsHttpChannel.h2
-rw-r--r--netwerk/protocol/http/nsHttpHandler.h6
-rw-r--r--netwerk/protocol/http/nsIHttpProtocolHandler.idl9
5 files changed, 4 insertions, 67 deletions
diff --git a/netwerk/protocol/http/UserAgentOverrides.jsm b/netwerk/protocol/http/UserAgentOverrides.jsm
index 22c676f068..037aa575b2 100644
--- a/netwerk/protocol/http/UserAgentOverrides.jsm
+++ b/netwerk/protocol/http/UserAgentOverrides.jsm
@@ -46,9 +46,9 @@ this.UserAgentOverrides = {
Services.prefs.addObserver(PREF_OVERRIDES_ENABLED, buildOverrides, false);
try {
- Services.obs.addObserver(HTTP_on_useragent_request, "http-on-useragent-request", false);
+ Services.obs.addObserver(HTTP_on_modify_request, "http-on-modify-request", false);
} catch (x) {
- // The http-on-useragent-request notification is disallowed in content processes.
+ // The http-on-modify-request notification is disallowed in content processes.
}
UserAgentUpdates.init(function(overrides) {
@@ -118,7 +118,7 @@ this.UserAgentOverrides = {
Services.prefs.removeObserver(PREF_OVERRIDES_ENABLED, buildOverrides);
- Services.obs.removeObserver(HTTP_on_useragent_request, "http-on-useragent-request");
+ Services.obs.removeObserver(HTTP_on_modify_request, "http-on-modify-request");
},
receiveMessage: function(aMessage) {
@@ -169,7 +169,7 @@ function buildOverrides() {
}
}
-function HTTP_on_useragent_request(aSubject, aTopic, aData) {
+function HTTP_on_modify_request(aSubject, aTopic, aData) {
let channel = aSubject.QueryInterface(Ci.nsIHttpChannel);
for (let callback of gOverrideFunctions) {
diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp
index 05699df621..9107b16e82 100644
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -6031,8 +6031,6 @@ nsHttpChannel::BeginConnect()
// notify "http-on-modify-request" observers
CallOnModifyRequestObservers();
- SetLoadGroupUserAgentOverride();
-
// Check if request was cancelled during on-modify-request or on-useragent.
if (mCanceled) {
return mStatus;
@@ -8400,50 +8398,6 @@ nsHttpChannel::MaybeWarnAboutAppCache()
}
void
-nsHttpChannel::SetLoadGroupUserAgentOverride()
-{
- nsCOMPtr<nsIURI> uri;
- GetURI(getter_AddRefs(uri));
- nsAutoCString uriScheme;
- if (uri) {
- uri->GetScheme(uriScheme);
- }
-
- // We don't need a UA for file: protocols.
- if (uriScheme.EqualsLiteral("file")) {
- gHttpHandler->OnUserAgentRequest(this);
- return;
- }
-
- nsIRequestContextService* rcsvc = gHttpHandler->GetRequestContextService();
- nsCOMPtr<nsIRequestContext> rc;
- if (rcsvc) {
- rcsvc->GetRequestContext(mRequestContextID,
- getter_AddRefs(rc));
- }
-
- nsAutoCString ua;
- if (nsContentUtils::IsNonSubresourceRequest(this)) {
- gHttpHandler->OnUserAgentRequest(this);
- if (rc) {
- GetRequestHeader(NS_LITERAL_CSTRING("User-Agent"), ua);
- rc->SetUserAgentOverride(ua);
- }
- } else {
- GetRequestHeader(NS_LITERAL_CSTRING("User-Agent"), ua);
- // Don't overwrite the UA if it is already set (eg by an XHR with explicit UA).
- if (ua.IsEmpty()) {
- if (rc) {
- rc->GetUserAgentOverride(ua);
- SetRequestHeader(NS_LITERAL_CSTRING("User-Agent"), ua, false);
- } else {
- gHttpHandler->OnUserAgentRequest(this);
- }
- }
- }
-}
-
-void
nsHttpChannel::SetDoNotTrack()
{
/**
diff --git a/netwerk/protocol/http/nsHttpChannel.h b/netwerk/protocol/http/nsHttpChannel.h
index 7578b1173e..cb8925d04d 100644
--- a/netwerk/protocol/http/nsHttpChannel.h
+++ b/netwerk/protocol/http/nsHttpChannel.h
@@ -460,8 +460,6 @@ private:
void MaybeWarnAboutAppCache();
- void SetLoadGroupUserAgentOverride();
-
void SetDoNotTrack();
private:
diff --git a/netwerk/protocol/http/nsHttpHandler.h b/netwerk/protocol/http/nsHttpHandler.h
index 35b14a511b..0904af8939 100644
--- a/netwerk/protocol/http/nsHttpHandler.h
+++ b/netwerk/protocol/http/nsHttpHandler.h
@@ -280,12 +280,6 @@ public:
NotifyObservers(chan, NS_HTTP_ON_MODIFY_REQUEST_TOPIC);
}
- // Called by the channel and cached in the loadGroup
- void OnUserAgentRequest(nsIHttpChannel *chan)
- {
- NotifyObservers(chan, NS_HTTP_ON_USERAGENT_REQUEST_TOPIC);
- }
-
// Called by the channel once headers are available
void OnExamineResponse(nsIHttpChannel *chan)
{
diff --git a/netwerk/protocol/http/nsIHttpProtocolHandler.idl b/netwerk/protocol/http/nsIHttpProtocolHandler.idl
index f333a557ce..82ac83fe47 100644
--- a/netwerk/protocol/http/nsIHttpProtocolHandler.idl
+++ b/netwerk/protocol/http/nsIHttpProtocolHandler.idl
@@ -113,14 +113,5 @@ interface nsIHttpProtocolHandler : nsIProxiedProtocolHandler
*/
#define NS_HTTP_ON_EXAMINE_CACHED_RESPONSE_TOPIC "http-on-examine-cached-response"
-/**
- * Before an HTTP request corresponding to a channel with the LOAD_DOCUMENT_URI
- * flag is sent to the server, this observer topic is notified. The observer of
- * this topic can then choose to modify the user agent for this request before
- * the request is actually sent to the server. Additionally, the modified user
- * agent will be propagated to sub-resource requests from the same load group.
- */
-#define NS_HTTP_ON_USERAGENT_REQUEST_TOPIC "http-on-useragent-request"
-
%}