Bug 789732 - Send HTTP header to differentiate addon updates from normal file downloads. r=Unfocused

This commit is contained in:
Onno Ekker 2014-08-25 08:38:55 +02:00
parent 6a6a991c4f
commit a47e351807
2 changed files with 6 additions and 2 deletions

View File

@ -408,6 +408,7 @@ function UpdateParser(aId, aUpdateKey, aUrl, aObserver) {
// Prevent the request from writing to cache.
this.request.channel.loadFlags |= Ci.nsIRequest.INHIBIT_CACHING;
this.request.overrideMimeType("text/xml");
this.request.setRequestHeader("Moz-XPI-Update", "1", true);
this.request.timeout = TIMEOUT;
var self = this;
this.request.addEventListener("load", function loadEventListener(event) { self.onLoad() }, false);

View File

@ -5244,8 +5244,11 @@ AddonInstall.prototype = {
this.channel = NetUtil.newChannel(this.sourceURI);
this.channel.notificationCallbacks = this;
if (this.channel instanceof Ci.nsIHttpChannelInternal)
this.channel.forceAllowThirdPartyCookie = true;
if (this.channel instanceof Ci.nsIHttpChannel) {
this.channel.setRequestHeader("Moz-XPI-Update", "1", true);
if (this.channel instanceof Ci.nsIHttpChannelInternal)
this.channel.forceAllowThirdPartyCookie = true;
}
this.channel.asyncOpen(listener, null);
Services.obs.addObserver(this, "network:offline-about-to-go-offline", false);