Backed out changeset 92de31554a9f (bug 1261585) for failing browser_dbg_post-page.js on Linux x64 opt with e10s. r=backout

This commit is contained in:
Sebastian Hengst 2017-02-20 22:45:13 +01:00
Родитель 68369bde83
Коммит 6908dbb0a6
1 изменённых файлов: 48 добавлений и 4 удалений

Просмотреть файл

@ -427,9 +427,48 @@ NetworkResponseListener.prototype = {
* @param nsISupports context
*/
onStartRequest: function (request) {
// Converter will call this again, we should just ignore that.
if (this.request) {
return;
}
this.request = request;
this._getSecurityInfo();
this._findOpenResponse();
// We need to track the offset for the onDataAvailable calls where
// we pass the data from our pipe to the converter.
this.offset = 0;
// In the multi-process mode, the conversion happens on the child
// side while we can only monitor the channel on the parent
// side. If the content is gzipped, we have to unzip it
// ourself. For that we use the stream converter services. Do not
// do that for Service workers as they are run in the child
// process.
let channel = this.request;
if (!this.httpActivity.fromServiceWorker &&
channel instanceof Ci.nsIEncodedChannel &&
channel.contentEncodings &&
!channel.applyConversion) {
let encodingHeader = channel.getResponseHeader("Content-Encoding");
let scs = Cc["@mozilla.org/streamConverters;1"]
.getService(Ci.nsIStreamConverterService);
let encodings = encodingHeader.split(/\s*\t*,\s*\t*/);
let nextListener = this;
let acceptedEncodings = ["gzip", "deflate", "br", "x-gzip", "x-deflate"];
for (let i in encodings) {
// There can be multiple conversions applied
let enc = encodings[i].toLowerCase();
if (acceptedEncodings.indexOf(enc) > -1) {
this.converter = scs.asyncConvertData(enc, "uncompressed",
nextListener, null);
nextListener = this.converter;
}
}
if (this.converter) {
this.converter.onStartRequest(this.request, null);
}
}
// Asynchronously wait for the data coming from the request.
this.setAsyncListener(this.sink.inputStream, this);
},
@ -595,6 +634,7 @@ NetworkResponseListener.prototype = {
this.httpActivity = null;
this.sink = null;
this.inputStream = null;
this.converter = null;
this.request = null;
this.owner = null;
},
@ -622,11 +662,15 @@ NetworkResponseListener.prototype = {
if (available != -1) {
if (available != 0) {
// Note that passing 0 as the offset here is wrong, but the
// onDataAvailable() method does not use the offset, so it does not
// matter.
this.onDataAvailable(this.request, null, stream, 0, available);
if (this.converter) {
this.converter.onDataAvailable(this.request, null, stream,
this.offset, available);
} else {
this.onDataAvailable(this.request, null, stream, this.offset,
available);
}
}
this.offset += available;
this.setAsyncListener(stream, this);
} else {
this.onStreamClose();