Bug 1240959 - properly calculate total size; r=vporof
☠☠ backed out by 53864eca4327 ☠ ☠
authorJan Odvarko <odvarko@gmail.com>
Tue, 23 Feb 2016 12:47:15 +0100
changeset 285514 e0cc363043ade8f69a600bfd68edaf88b35b7c96
parent 285513 9cc28ef28c0f8995726615e3a150881821e9bde5
child 285515 e38a16b7d37e848ace544aa45c8ccebb3d0411c5
push id72403
push usercbook@mozilla.com
push dateThu, 25 Feb 2016 10:59:17 +0000
treeherdermozilla-inbound@3b913f81cb98 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvporof
bugs1240959
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1240959 - properly calculate total size; r=vporof
devtools/client/netmonitor/netmonitor-view.js
devtools/shared/webconsole/network-monitor.js
--- a/devtools/client/netmonitor/netmonitor-view.js
+++ b/devtools/client/netmonitor/netmonitor-view.js
@@ -2218,17 +2218,24 @@ RequestsMenuView.prototype = Heritage.ex
    *
    * @param array aItemsArray
    * @return number
    */
   _getTotalBytesOfRequests: function(aItemsArray) {
     if (!aItemsArray.length) {
       return 0;
     }
-    return aItemsArray.reduce((prev, curr) => prev + curr.attachment.contentSize || 0, 0);
+
+    let result = 0;
+    aItemsArray.forEach(item => {
+      let size = item.attachment.contentSize;
+      result += (typeof size == "number") ? size : 0;
+    });
+
+    return result;
   },
 
   /**
    * Gets the oldest (first performed) request in a set. Returns null for an
    * empty set.
    *
    * @param array aItemsArray
    * @return object
--- a/devtools/shared/webconsole/network-monitor.js
+++ b/devtools/shared/webconsole/network-monitor.js
@@ -383,17 +383,23 @@ NetworkResponseListener.prototype = {
 
     try {
       response.mimeType = this.request.contentType;
     }
     catch (ex) { }
 
     if (!response.mimeType || !NetworkHelper.isTextMimeType(response.mimeType)) {
       response.encoding = "base64";
-      response.text = btoa(response.text);
+
+      try {
+        response.text = unescape(encodeURIComponent(response.text));
+      } catch (err) {
+        console.error(err);
+      }
+
     }
 
     if (response.mimeType && this.request.contentCharset) {
       response.mimeType += "; charset=" + this.request.contentCharset;
     }
 
     this.receivedData = "";