summaryrefslogtreecommitdiffstats
path: root/devtools/client/netmonitor/selectors/index.js
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-02-28 16:02:31 +0100
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-02-28 16:02:31 +0100
commitabf60058584772437a317fbc27ea32cbda4a07cb (patch)
tree9cd95e40a1daf21868890190ee4955da24cf98b3 /devtools/client/netmonitor/selectors/index.js
parent9fafdd4546bb51ff2a29a67f369797d19d614350 (diff)
downloadUXP-abf60058584772437a317fbc27ea32cbda4a07cb.tar
UXP-abf60058584772437a317fbc27ea32cbda4a07cb.tar.gz
UXP-abf60058584772437a317fbc27ea32cbda4a07cb.tar.lz
UXP-abf60058584772437a317fbc27ea32cbda4a07cb.tar.xz
UXP-abf60058584772437a317fbc27ea32cbda4a07cb.zip
Bug 1168376: Show transferred size in request summary instead of decompressed size
https://github.com/MoonchildProductions/moebius/pull/93 - without: DOMContentLoaded and load
Diffstat (limited to 'devtools/client/netmonitor/selectors/index.js')
-rw-r--r--devtools/client/netmonitor/selectors/index.js27
1 files changed, 21 insertions, 6 deletions
diff --git a/devtools/client/netmonitor/selectors/index.js b/devtools/client/netmonitor/selectors/index.js
index 8cd6b6ffc..60d6007cd 100644
--- a/devtools/client/netmonitor/selectors/index.js
+++ b/devtools/client/netmonitor/selectors/index.js
@@ -13,7 +13,7 @@ const { createSelector } = require("devtools/client/shared/vendor/reselect");
* @param {array} items - an array of request items
* @return {number} total bytes of requests
*/
-function getTotalBytesOfRequests(items) {
+function getContentSizeOfRequests(items) {
if (!items.length) {
return 0;
}
@@ -27,6 +27,20 @@ function getTotalBytesOfRequests(items) {
return result;
}
+function getTransferredSizeOfRequests(items) {
+ if (!items.length) {
+ return 0;
+ }
+
+ let result = 0;
+ items.forEach((item) => {
+ let size = item.attachment.transferredSize;
+ result += (typeof size == "number") ? size : 0;
+ });
+
+ return result;
+}
+
/**
* Gets the total milliseconds for all requests. Returns null for an
* empty set.
@@ -34,7 +48,7 @@ function getTotalBytesOfRequests(items) {
* @param {array} items - an array of request items
* @return {object} total milliseconds for all requests
*/
-function getTotalMillisOfRequests(items) {
+function getMillisOfRequests(items) {
if (!items.length) {
return null;
}
@@ -49,15 +63,16 @@ function getTotalMillisOfRequests(items) {
return newest.attachment.endedMillis - oldest.attachment.startedMillis;
}
-const getSummary = createSelector(
+const getDisplayedRequestsSummary = createSelector(
(state) => state.requests.items,
(requests) => ({
count: requests.length,
- totalBytes: getTotalBytesOfRequests(requests),
- totalMillis: getTotalMillisOfRequests(requests),
+ contentSize: getContentSizeOfRequests(requests),
+ transferredSize: getTransferredSizeOfRequests(requests),
+ millis: getMillisOfRequests(requests),
})
);
module.exports = {
- getSummary,
+ getDisplayedRequestsSummary,
};