From 283ca1788312b759bab422ef43ca830a0e70adc0 Mon Sep 17 00:00:00 2001
From: Dragana Damjanovic
Date: Tue, 20 Dec 2016 06:45:00 -0500
Subject: [PATCH] Bug 1261585 - Necko does content conversions for
TracableChannel so devtool does not need to do it separately. r=ochameau
--HG--
extra : histedit_source : 636c4eb4f6c0b9e12327adae8745071de62b512d
---
devtools/shared/webconsole/network-monitor.js | 52 ++-----------------
1 file changed, 4 insertions(+), 48 deletions(-)
diff --git a/devtools/shared/webconsole/network-monitor.js b/devtools/shared/webconsole/network-monitor.js
index 76b6aac1d51d..131cc38d44e0 100644
--- a/devtools/shared/webconsole/network-monitor.js
+++ b/devtools/shared/webconsole/network-monitor.js
@@ -427,48 +427,9 @@ 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);
},
@@ -634,7 +595,6 @@ NetworkResponseListener.prototype = {
this.httpActivity = null;
this.sink = null;
this.inputStream = null;
- this.converter = null;
this.request = null;
this.owner = null;
},
@@ -662,15 +622,11 @@ NetworkResponseListener.prototype = {
if (available != -1) {
if (available != 0) {
- if (this.converter) {
- this.converter.onDataAvailable(this.request, null, stream,
- this.offset, available);
- } else {
- this.onDataAvailable(this.request, null, stream, this.offset,
- available);
- }
+ // 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);
}
- this.offset += available;
this.setAsyncListener(stream, this);
} else {
this.onStreamClose();