mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-20 22:27:31 +09:00
Bug 1168376: Show transferred size in request summary instead of decompressed size
https://github.com/MoonchildProductions/moebius/pull/93 - without: DOMContentLoaded and load
This commit is contained in:
parent
8d210f18c8
commit
173d356acd
11 changed files with 177 additions and 70 deletions
|
|
@ -143,12 +143,12 @@ networkMenu.sortedDesc=Sorted descending
|
||||||
# in the network table footer when there are no requests available.
|
# in the network table footer when there are no requests available.
|
||||||
networkMenu.empty=No requests
|
networkMenu.empty=No requests
|
||||||
|
|
||||||
# LOCALIZATION NOTE (networkMenu.summary): Semi-colon list of plural forms.
|
# LOCALIZATION NOTE (networkMenu.summary2): Semi-colon list of plural forms.
|
||||||
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
|
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
|
||||||
# This label is displayed in the network table footer providing concise
|
# This label is displayed in the network table footer providing concise
|
||||||
# information about all requests. Parameters: #1 is the number of requests,
|
# information about all requests. Parameters: #1 is the number of requests,
|
||||||
# #2 is the size, #3 is the number of seconds.
|
# #2 is the size, #3 is the transferred size, #4 is the number of seconds.
|
||||||
networkMenu.summary=One request, #2 KB, #3 s;#1 requests, #2 KB, #3 s
|
networkMenu.summary2=One request, #2 KB (transferred: #3 KB), #4 s;#1 requests, #2 KB (transferred: #3 KB), #4 s
|
||||||
|
|
||||||
# LOCALIZATION NOTE (networkMenu.sizeB): This is the label displayed
|
# LOCALIZATION NOTE (networkMenu.sizeB): This is the label displayed
|
||||||
# in the network menu specifying the size of a request (in bytes).
|
# in the network menu specifying the size of a request (in bytes).
|
||||||
|
|
@ -221,10 +221,22 @@ tableChart.unavailable=No data available
|
||||||
# in pie or table charts specifying the size of a request (in kilobytes).
|
# in pie or table charts specifying the size of a request (in kilobytes).
|
||||||
charts.sizeKB=%S KB
|
charts.sizeKB=%S KB
|
||||||
|
|
||||||
|
# LOCALIZATION NOTE (charts.transferredSizeKB): This is the label displayed
|
||||||
|
# in pie or table charts specifying the size of a transferred request (in kilobytes).
|
||||||
|
charts.transferredSizeKB=%S KB
|
||||||
|
|
||||||
# LOCALIZATION NOTE (charts.totalS): This is the label displayed
|
# LOCALIZATION NOTE (charts.totalS): This is the label displayed
|
||||||
# in pie or table charts specifying the time for a request to finish (in seconds).
|
# in pie or table charts specifying the time for a request to finish (in seconds).
|
||||||
charts.totalS=%S s
|
charts.totalS=%S s
|
||||||
|
|
||||||
|
# LOCALIZATION NOTE (charts.totalSize): This is the label displayed
|
||||||
|
# in the performance analysis view for total requests size, in kilobytes.
|
||||||
|
charts.totalSize=Size: %S KB
|
||||||
|
|
||||||
|
# LOCALIZATION NOTE (charts.totalTranferredSize): This is the label displayed
|
||||||
|
# in the performance analysis view for total transferred size, in kilobytes.
|
||||||
|
charts.totalTransferredSize=Transferred Size: %S KB
|
||||||
|
|
||||||
# LOCALIZATION NOTE (charts.cacheEnabled): This is the label displayed
|
# LOCALIZATION NOTE (charts.cacheEnabled): This is the label displayed
|
||||||
# in the performance analysis view for "cache enabled" charts.
|
# in the performance analysis view for "cache enabled" charts.
|
||||||
charts.cacheEnabled=Primed cache
|
charts.cacheEnabled=Primed cache
|
||||||
|
|
@ -233,10 +245,6 @@ charts.cacheEnabled=Primed cache
|
||||||
# in the performance analysis view for "cache disabled" charts.
|
# in the performance analysis view for "cache disabled" charts.
|
||||||
charts.cacheDisabled=Empty cache
|
charts.cacheDisabled=Empty cache
|
||||||
|
|
||||||
# LOCALIZATION NOTE (charts.totalSize): This is the label displayed
|
|
||||||
# in the performance analysis view for total requests size, in kilobytes.
|
|
||||||
charts.totalSize=Size: %S KB
|
|
||||||
|
|
||||||
# LOCALIZATION NOTE (charts.totalSeconds): Semi-colon list of plural forms.
|
# LOCALIZATION NOTE (charts.totalSeconds): Semi-colon list of plural forms.
|
||||||
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
|
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
|
||||||
# This is the label displayed in the performance analysis view for the
|
# This is the label displayed in the performance analysis view for the
|
||||||
|
|
@ -251,6 +259,23 @@ charts.totalCached=Cached responses: %S
|
||||||
# in the performance analysis view for total requests.
|
# in the performance analysis view for total requests.
|
||||||
charts.totalCount=Total requests: %S
|
charts.totalCount=Total requests: %S
|
||||||
|
|
||||||
|
# LOCALIZATION NOTE (charts.size): This is the label displayed
|
||||||
|
# in the header column in the performance analysis view for size of the request.
|
||||||
|
charts.size=Size
|
||||||
|
|
||||||
|
# LOCALIZATION NOTE (charts.type): This is the label displayed
|
||||||
|
# in the header column in the performance analysis view for type of request.
|
||||||
|
charts.type=Type
|
||||||
|
|
||||||
|
# LOCALIZATION NOTE (charts.transferred): This is the label displayed
|
||||||
|
# in the header column in the performance analysis view for transferred
|
||||||
|
# size of the request.
|
||||||
|
charts.transferred=Transferred
|
||||||
|
|
||||||
|
# LOCALIZATION NOTE (charts.time): This is the label displayed
|
||||||
|
# in the header column in the performance analysis view for time of request.
|
||||||
|
charts.time=Time
|
||||||
|
|
||||||
# LOCALIZATION NOTE (netRequest.headers): A label used for Headers tab
|
# LOCALIZATION NOTE (netRequest.headers): A label used for Headers tab
|
||||||
# This tab displays list of HTTP headers
|
# This tab displays list of HTTP headers
|
||||||
netRequest.headers=Headers
|
netRequest.headers=Headers
|
||||||
|
|
|
||||||
|
|
@ -14,21 +14,25 @@ const { DOM, PropTypes } = require("devtools/client/shared/vendor/react");
|
||||||
const { connect } = require("devtools/client/shared/vendor/react-redux");
|
const { connect } = require("devtools/client/shared/vendor/react-redux");
|
||||||
const { PluralForm } = require("devtools/shared/plural-form");
|
const { PluralForm } = require("devtools/shared/plural-form");
|
||||||
const { L10N } = require("../l10n");
|
const { L10N } = require("../l10n");
|
||||||
const { getSummary } = require("../selectors/index");
|
const {
|
||||||
|
getDisplayedRequestsSummary
|
||||||
|
} = require("../selectors/index");
|
||||||
|
|
||||||
const { button, span } = DOM;
|
const { button, span } = DOM;
|
||||||
|
|
||||||
function SummaryButton({
|
function SummaryButton({
|
||||||
summary,
|
summary,
|
||||||
triggerSummary,
|
triggerSummary
|
||||||
}) {
|
}) {
|
||||||
let { count, totalBytes, totalMillis } = summary;
|
let { count, contentSize, transferredSize, millis } = summary;
|
||||||
const text = (count === 0) ? L10N.getStr("networkMenu.empty") :
|
const text = (count === 0) ? L10N.getStr("networkMenu.empty") :
|
||||||
PluralForm.get(count, L10N.getStr("networkMenu.summary"))
|
PluralForm.get(count, L10N.getStr("networkMenu.summary2"))
|
||||||
.replace("#1", count)
|
.replace("#1", count)
|
||||||
.replace("#2", L10N.numberWithDecimals(totalBytes / 1024,
|
.replace("#2", L10N.numberWithDecimals(contentSize / 1024,
|
||||||
CONTENT_SIZE_DECIMALS))
|
CONTENT_SIZE_DECIMALS))
|
||||||
.replace("#3", L10N.numberWithDecimals(totalMillis / 1000,
|
.replace("#3", L10N.numberWithDecimals(transferredSize / 1024,
|
||||||
|
CONTENT_SIZE_DECIMALS))
|
||||||
|
.replace("#4", L10N.numberWithDecimals(millis / 1000,
|
||||||
REQUEST_TIME_DECIMALS));
|
REQUEST_TIME_DECIMALS));
|
||||||
|
|
||||||
return button({
|
return button({
|
||||||
|
|
@ -47,7 +51,7 @@ SummaryButton.propTypes = {
|
||||||
|
|
||||||
module.exports = connect(
|
module.exports = connect(
|
||||||
(state) => ({
|
(state) => ({
|
||||||
summary: getSummary(state),
|
summary: getDisplayedRequestsSummary(state),
|
||||||
}),
|
}),
|
||||||
(dispatch) => ({
|
(dispatch) => ({
|
||||||
triggerSummary: () => {
|
triggerSummary: () => {
|
||||||
|
|
|
||||||
|
|
@ -233,7 +233,7 @@ var NetMonitorView = {
|
||||||
// populating the statistics view.
|
// populating the statistics view.
|
||||||
// • The response mime type is used for categorization.
|
// • The response mime type is used for categorization.
|
||||||
yield whenDataAvailable(requestsView, [
|
yield whenDataAvailable(requestsView, [
|
||||||
"responseHeaders", "status", "contentSize", "mimeType", "totalTime"
|
"responseHeaders", "status", "contentSize", "transferredSize", "mimeType", "totalTime"
|
||||||
]);
|
]);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
// Timed out while waiting for data. Continue with what we have.
|
// Timed out while waiting for data. Continue with what we have.
|
||||||
|
|
|
||||||
|
|
@ -92,27 +92,35 @@ PerformanceStatisticsView.prototype = {
|
||||||
let string = L10N.numberWithDecimals(value / 1024, CONTENT_SIZE_DECIMALS);
|
let string = L10N.numberWithDecimals(value / 1024, CONTENT_SIZE_DECIMALS);
|
||||||
return L10N.getFormatStr("charts.sizeKB", string);
|
return L10N.getFormatStr("charts.sizeKB", string);
|
||||||
},
|
},
|
||||||
|
transferredSize: value => {
|
||||||
|
let string = L10N.numberWithDecimals(value / 1024, CONTENT_SIZE_DECIMALS);
|
||||||
|
return L10N.getFormatStr("charts.transferredSizeKB", string);
|
||||||
|
},
|
||||||
time: value => {
|
time: value => {
|
||||||
let string = L10N.numberWithDecimals(value / 1000, REQUEST_TIME_DECIMALS);
|
let string = L10N.numberWithDecimals(value / 1000, REQUEST_TIME_DECIMALS);
|
||||||
return L10N.getFormatStr("charts.totalS", string);
|
return L10N.getFormatStr("charts.totalS", string);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_commonChartTotals: {
|
_commonChartTotals: {
|
||||||
|
cached: total => {
|
||||||
|
return L10N.getFormatStr("charts.totalCached", total);
|
||||||
|
},
|
||||||
|
count: total => {
|
||||||
|
return L10N.getFormatStr("charts.totalCount", total);
|
||||||
|
},
|
||||||
size: total => {
|
size: total => {
|
||||||
let string = L10N.numberWithDecimals(total / 1024, CONTENT_SIZE_DECIMALS);
|
let string = L10N.numberWithDecimals(total / 1024, CONTENT_SIZE_DECIMALS);
|
||||||
return L10N.getFormatStr("charts.totalSize", string);
|
return L10N.getFormatStr("charts.totalSize", string);
|
||||||
},
|
},
|
||||||
|
transferredSize: total => {
|
||||||
|
let string = L10N.numberWithDecimals(total / 1024, CONTENT_SIZE_DECIMALS);
|
||||||
|
return L10N.getFormatStr("charts.totalTransferredSize", string);
|
||||||
|
},
|
||||||
time: total => {
|
time: total => {
|
||||||
let seconds = total / 1000;
|
let seconds = total / 1000;
|
||||||
let string = L10N.numberWithDecimals(seconds, REQUEST_TIME_DECIMALS);
|
let string = L10N.numberWithDecimals(seconds, REQUEST_TIME_DECIMALS);
|
||||||
return PluralForm.get(seconds,
|
return PluralForm.get(seconds,
|
||||||
L10N.getStr("charts.totalSeconds")).replace("#1", string);
|
L10N.getStr("charts.totalSeconds")).replace("#1", string);
|
||||||
},
|
|
||||||
cached: total => {
|
|
||||||
return L10N.getFormatStr("charts.totalCached", total);
|
|
||||||
},
|
|
||||||
count: total => {
|
|
||||||
return L10N.getFormatStr("charts.totalCount", total);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -136,6 +144,14 @@ PerformanceStatisticsView.prototype = {
|
||||||
let chart = Chart.PieTable(document, {
|
let chart = Chart.PieTable(document, {
|
||||||
diameter: NETWORK_ANALYSIS_PIE_CHART_DIAMETER,
|
diameter: NETWORK_ANALYSIS_PIE_CHART_DIAMETER,
|
||||||
title: L10N.getStr(title),
|
title: L10N.getStr(title),
|
||||||
|
header: {
|
||||||
|
cached: "",
|
||||||
|
count: "",
|
||||||
|
label: L10N.getStr("charts.type"),
|
||||||
|
size: L10N.getStr("charts.size"),
|
||||||
|
transferredSize: L10N.getStr("charts.transferred"),
|
||||||
|
time: L10N.getStr("charts.time")
|
||||||
|
},
|
||||||
data: data,
|
data: data,
|
||||||
strings: strings,
|
strings: strings,
|
||||||
totals: totals,
|
totals: totals,
|
||||||
|
|
@ -161,13 +177,14 @@ PerformanceStatisticsView.prototype = {
|
||||||
* True if the cache is considered enabled, false for disabled.
|
* True if the cache is considered enabled, false for disabled.
|
||||||
*/
|
*/
|
||||||
_sanitizeChartDataSource: function (items, emptyCache) {
|
_sanitizeChartDataSource: function (items, emptyCache) {
|
||||||
let data = [
|
const data = [
|
||||||
"html", "css", "js", "xhr", "fonts", "images", "media", "flash", "ws", "other"
|
"html", "css", "js", "xhr", "fonts", "images", "media", "flash", "ws", "other"
|
||||||
].map(e => ({
|
].map((type) => ({
|
||||||
cached: 0,
|
cached: 0,
|
||||||
count: 0,
|
count: 0,
|
||||||
label: e,
|
label: type,
|
||||||
size: 0,
|
size: 0,
|
||||||
|
transferredSize: 0,
|
||||||
time: 0
|
time: 0
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
@ -211,6 +228,7 @@ PerformanceStatisticsView.prototype = {
|
||||||
if (emptyCache || !responseIsFresh(details)) {
|
if (emptyCache || !responseIsFresh(details)) {
|
||||||
data[type].time += details.totalTime || 0;
|
data[type].time += details.totalTime || 0;
|
||||||
data[type].size += details.contentSize || 0;
|
data[type].size += details.contentSize || 0;
|
||||||
|
data[type].transferredSize += details.transferredSize || 0;
|
||||||
} else {
|
} else {
|
||||||
data[type].cached++;
|
data[type].cached++;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ const { createSelector } = require("devtools/client/shared/vendor/reselect");
|
||||||
* @param {array} items - an array of request items
|
* @param {array} items - an array of request items
|
||||||
* @return {number} total bytes of requests
|
* @return {number} total bytes of requests
|
||||||
*/
|
*/
|
||||||
function getTotalBytesOfRequests(items) {
|
function getContentSizeOfRequests(items) {
|
||||||
if (!items.length) {
|
if (!items.length) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -27,6 +27,20 @@ function getTotalBytesOfRequests(items) {
|
||||||
return result;
|
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
|
* Gets the total milliseconds for all requests. Returns null for an
|
||||||
* empty set.
|
* empty set.
|
||||||
|
|
@ -34,7 +48,7 @@ function getTotalBytesOfRequests(items) {
|
||||||
* @param {array} items - an array of request items
|
* @param {array} items - an array of request items
|
||||||
* @return {object} total milliseconds for all requests
|
* @return {object} total milliseconds for all requests
|
||||||
*/
|
*/
|
||||||
function getTotalMillisOfRequests(items) {
|
function getMillisOfRequests(items) {
|
||||||
if (!items.length) {
|
if (!items.length) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -49,15 +63,16 @@ function getTotalMillisOfRequests(items) {
|
||||||
return newest.attachment.endedMillis - oldest.attachment.startedMillis;
|
return newest.attachment.endedMillis - oldest.attachment.startedMillis;
|
||||||
}
|
}
|
||||||
|
|
||||||
const getSummary = createSelector(
|
const getDisplayedRequestsSummary = createSelector(
|
||||||
(state) => state.requests.items,
|
(state) => state.requests.items,
|
||||||
(requests) => ({
|
(requests) => ({
|
||||||
count: requests.length,
|
count: requests.length,
|
||||||
totalBytes: getTotalBytesOfRequests(requests),
|
contentSize: getContentSizeOfRequests(requests),
|
||||||
totalMillis: getTotalMillisOfRequests(requests),
|
transferredSize: getTransferredSizeOfRequests(requests),
|
||||||
|
millis: getMillisOfRequests(requests),
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
getSummary,
|
getDisplayedRequestsSummary,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,10 @@ add_task(function* () {
|
||||||
totals: {
|
totals: {
|
||||||
label1: value => "Hello " + L10N.numberWithDecimals(value, 2),
|
label1: value => "Hello " + L10N.numberWithDecimals(value, 2),
|
||||||
label2: value => "World " + L10N.numberWithDecimals(value, 2)
|
label2: value => "World " + L10N.numberWithDecimals(value, 2)
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
label1: "label1header",
|
||||||
|
label2: "label2header",
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -51,39 +55,48 @@ add_task(function* () {
|
||||||
is(title.getAttribute("value"), "Table title",
|
is(title.getAttribute("value"), "Table title",
|
||||||
"The title node displays the correct text.");
|
"The title node displays the correct text.");
|
||||||
|
|
||||||
is(rows.length, 3, "There should be 3 table chart rows created.");
|
is(rows.length, 4, "There should be 3 table chart rows and a header created.");
|
||||||
|
|
||||||
ok(rows[0].querySelector(".table-chart-row-box.chart-colored-blob"),
|
|
||||||
"A colored blob exists for the firt row.");
|
|
||||||
is(rows[0].querySelectorAll("label")[0].getAttribute("name"), "label1",
|
is(rows[0].querySelectorAll("label")[0].getAttribute("name"), "label1",
|
||||||
"The first column of the first row exists.");
|
"The first column of the header exists.");
|
||||||
is(rows[0].querySelectorAll("label")[1].getAttribute("name"), "label2",
|
is(rows[0].querySelectorAll("label")[1].getAttribute("name"), "label2",
|
||||||
"The second column of the first row exists.");
|
"The second column of the header exists.");
|
||||||
is(rows[0].querySelectorAll("label")[0].getAttribute("value"), "1",
|
is(rows[0].querySelectorAll("span")[0].textContent, "label1header",
|
||||||
"The first column of the first row displays the correct text.");
|
"The first column of the header displays the correct text.");
|
||||||
is(rows[0].querySelectorAll("label")[1].getAttribute("value"), "11.1foo",
|
is(rows[0].querySelectorAll("span")[1].textContent, "label2header",
|
||||||
"The second column of the first row displays the correct text.");
|
"The second column of the header displays the correct text.");
|
||||||
|
|
||||||
ok(rows[1].querySelector(".table-chart-row-box.chart-colored-blob"),
|
ok(rows[1].querySelector(".table-chart-row-box.chart-colored-blob"),
|
||||||
"A colored blob exists for the second row.");
|
"A colored blob exists for the firt row.");
|
||||||
is(rows[1].querySelectorAll("label")[0].getAttribute("name"), "label1",
|
is(rows[1].querySelectorAll("span")[0].getAttribute("name"), "label1",
|
||||||
"The first column of the second row exists.");
|
"The first column of the first row exists.");
|
||||||
is(rows[1].querySelectorAll("label")[1].getAttribute("name"), "label2",
|
is(rows[1].querySelectorAll("span")[1].getAttribute("name"), "label2",
|
||||||
"The second column of the second row exists.");
|
"The second column of the first row exists.");
|
||||||
is(rows[1].querySelectorAll("label")[0].getAttribute("value"), "2",
|
is(rows[1].querySelectorAll("label")[0].getAttribute("value"), "1",
|
||||||
"The first column of the second row displays the correct text.");
|
"The first column of the first row displays the correct text.");
|
||||||
is(rows[1].querySelectorAll("label")[1].getAttribute("value"), "12.2bar",
|
is(rows[1].querySelectorAll("label")[1].getAttribute("value"), "11.1foo",
|
||||||
"The second column of the first row displays the correct text.");
|
"The second column of the first row displays the correct text.");
|
||||||
|
|
||||||
ok(rows[2].querySelector(".table-chart-row-box.chart-colored-blob"),
|
ok(rows[2].querySelector(".table-chart-row-box.chart-colored-blob"),
|
||||||
"A colored blob exists for the third row.");
|
"A colored blob exists for the second row.");
|
||||||
is(rows[2].querySelectorAll("label")[0].getAttribute("name"), "label1",
|
is(rows[2].querySelectorAll("label")[0].getAttribute("name"), "label1",
|
||||||
"The first column of the third row exists.");
|
"The first column of the second row exists.");
|
||||||
is(rows[2].querySelectorAll("label")[1].getAttribute("name"), "label2",
|
is(rows[2].querySelectorAll("label")[1].getAttribute("name"), "label2",
|
||||||
|
"The second column of the second row exists.");
|
||||||
|
is(rows[2].querySelectorAll("label")[0].getAttribute("value"), "2",
|
||||||
|
"The first column of the second row displays the correct text.");
|
||||||
|
is(rows[2].querySelectorAll("label")[1].getAttribute("value"), "12.2bar",
|
||||||
|
"The second column of the first row displays the correct text.");
|
||||||
|
|
||||||
|
ok(rows[3].querySelector(".table-chart-row-box.chart-colored-blob"),
|
||||||
|
"A colored blob exists for the third row.");
|
||||||
|
is(rows[3].querySelectorAll("label")[0].getAttribute("name"), "label1",
|
||||||
|
"The first column of the third row exists.");
|
||||||
|
is(rows[3].querySelectorAll("label")[1].getAttribute("name"), "label2",
|
||||||
"The second column of the third row exists.");
|
"The second column of the third row exists.");
|
||||||
is(rows[2].querySelectorAll("label")[0].getAttribute("value"), "3",
|
is(rows[3].querySelectorAll("label")[0].getAttribute("value"), "3",
|
||||||
"The first column of the third row displays the correct text.");
|
"The first column of the third row displays the correct text.");
|
||||||
is(rows[2].querySelectorAll("label")[1].getAttribute("value"), "13.3baz",
|
is(rows[3].querySelectorAll("label")[1].getAttribute("value"), "13.3baz",
|
||||||
"The second column of the third row displays the correct text.");
|
"The second column of the third row displays the correct text.");
|
||||||
|
|
||||||
is(sums.length, 2, "There should be 2 total summaries created.");
|
is(sums.length, 2, "There should be 2 total summaries created.");
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,10 @@ add_task(function* () {
|
||||||
totals: {
|
totals: {
|
||||||
label1: value => "Hello " + L10N.numberWithDecimals(value, 2),
|
label1: value => "Hello " + L10N.numberWithDecimals(value, 2),
|
||||||
label2: value => "World " + L10N.numberWithDecimals(value, 2)
|
label2: value => "World " + L10N.numberWithDecimals(value, 2)
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
label1: "",
|
||||||
|
label2: ""
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -40,17 +44,17 @@ add_task(function* () {
|
||||||
is(title.getAttribute("value"), "Table title",
|
is(title.getAttribute("value"), "Table title",
|
||||||
"The title node displays the correct text.");
|
"The title node displays the correct text.");
|
||||||
|
|
||||||
is(rows.length, 1, "There should be 1 table chart row created.");
|
is(rows.length, 2, "There should be 1 table chart row and a 1 header created.");
|
||||||
|
|
||||||
ok(rows[0].querySelector(".table-chart-row-box.chart-colored-blob"),
|
ok(rows[1].querySelector(".table-chart-row-box.chart-colored-blob"),
|
||||||
"A colored blob exists for the firt row.");
|
"A colored blob exists for the firt row.");
|
||||||
is(rows[0].querySelectorAll("label")[0].getAttribute("name"), "size",
|
is(rows[1].querySelectorAll("label")[0].getAttribute("name"), "size",
|
||||||
"The first column of the first row exists.");
|
"The first column of the first row exists.");
|
||||||
is(rows[0].querySelectorAll("label")[1].getAttribute("name"), "label",
|
is(rows[1].querySelectorAll("label")[1].getAttribute("name"), "label",
|
||||||
"The second column of the first row exists.");
|
"The second column of the first row exists.");
|
||||||
is(rows[0].querySelectorAll("label")[0].getAttribute("value"), "",
|
is(rows[1].querySelectorAll("label")[0].getAttribute("value"), "",
|
||||||
"The first column of the first row displays the correct text.");
|
"The first column of the first row displays the correct text.");
|
||||||
is(rows[0].querySelectorAll("label")[1].getAttribute("value"),
|
is(rows[1].querySelectorAll("label")[1].getAttribute("value"),
|
||||||
L10N.getStr("tableChart.loading"),
|
L10N.getStr("tableChart.loading"),
|
||||||
"The second column of the first row displays the correct text.");
|
"The second column of the first row displays the correct text.");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,10 @@ add_task(function* () {
|
||||||
totals: {
|
totals: {
|
||||||
size: value => "Hello " + L10N.numberWithDecimals(value, 2),
|
size: value => "Hello " + L10N.numberWithDecimals(value, 2),
|
||||||
label: value => "World " + L10N.numberWithDecimals(value, 2)
|
label: value => "World " + L10N.numberWithDecimals(value, 2)
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
label1: "",
|
||||||
|
label2: ""
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -53,9 +57,9 @@ add_task(function* () {
|
||||||
ok(node.querySelector(".table-chart-container"),
|
ok(node.querySelector(".table-chart-container"),
|
||||||
"A table chart was created successfully.");
|
"A table chart was created successfully.");
|
||||||
|
|
||||||
is(rows.length, 3, "There should be 3 pie chart slices created.");
|
is(rows.length, 4, "There should be 3 pie chart slices and 1 header created.");
|
||||||
is(rows.length, 3, "There should be 3 table chart rows created.");
|
is(rows.length, 4, "There should be 3 table chart rows and 1 header created.");
|
||||||
is(sums.length, 2, "There should be 2 total summaries created.");
|
is(sums.length, 2, "There should be 2 total summaries and 1 header created.");
|
||||||
|
|
||||||
yield teardown(monitor);
|
yield teardown(monitor);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,10 @@ add_task(function* () {
|
||||||
totals: {
|
totals: {
|
||||||
label1: value => "Hello " + L10N.numberWithDecimals(value, 2),
|
label1: value => "Hello " + L10N.numberWithDecimals(value, 2),
|
||||||
label2: value => "World " + L10N.numberWithDecimals(value, 2)
|
label2: value => "World " + L10N.numberWithDecimals(value, 2)
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
label1: "",
|
||||||
|
label2: ""
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -29,17 +33,17 @@ add_task(function* () {
|
||||||
let rows = grid.querySelectorAll(".table-chart-row");
|
let rows = grid.querySelectorAll(".table-chart-row");
|
||||||
let sums = node.querySelectorAll(".table-chart-summary-label");
|
let sums = node.querySelectorAll(".table-chart-summary-label");
|
||||||
|
|
||||||
is(rows.length, 1, "There should be 1 table chart row created.");
|
is(rows.length, 2, "There should be 1 table chart row and 1 header created.");
|
||||||
|
|
||||||
ok(rows[0].querySelector(".table-chart-row-box.chart-colored-blob"),
|
ok(rows[1].querySelector(".table-chart-row-box.chart-colored-blob"),
|
||||||
"A colored blob exists for the firt row.");
|
"A colored blob exists for the firt row.");
|
||||||
is(rows[0].querySelectorAll("label")[0].getAttribute("name"), "size",
|
is(rows[1].querySelectorAll("label")[0].getAttribute("name"), "size",
|
||||||
"The first column of the first row exists.");
|
"The first column of the first row exists.");
|
||||||
is(rows[0].querySelectorAll("label")[1].getAttribute("name"), "label",
|
is(rows[1].querySelectorAll("label")[1].getAttribute("name"), "label",
|
||||||
"The second column of the first row exists.");
|
"The second column of the first row exists.");
|
||||||
is(rows[0].querySelectorAll("label")[0].getAttribute("value"), "",
|
is(rows[1].querySelectorAll("label")[0].getAttribute("value"), "",
|
||||||
"The first column of the first row displays the correct text.");
|
"The first column of the first row displays the correct text.");
|
||||||
is(rows[0].querySelectorAll("label")[1].getAttribute("value"),
|
is(rows[1].querySelectorAll("label")[1].getAttribute("value"),
|
||||||
L10N.getStr("tableChart.unavailable"),
|
L10N.getStr("tableChart.unavailable"),
|
||||||
"The second column of the first row displays the correct text.");
|
"The second column of the first row displays the correct text.");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ add_task(function* () {
|
||||||
yield teardown(monitor);
|
yield teardown(monitor);
|
||||||
|
|
||||||
function testStatus() {
|
function testStatus() {
|
||||||
const { count, totalBytes, totalMillis } = getSummary(gStore.getState());
|
const { count, contentSize, transferredSize, millis } = getSummary(gStore.getState());
|
||||||
let value = $("#requests-menu-network-summary-button").textContent;
|
let value = $("#requests-menu-network-summary-button").textContent;
|
||||||
info("Current summary: " + value);
|
info("Current summary: " + value);
|
||||||
|
|
||||||
|
|
@ -57,13 +57,14 @@ add_task(function* () {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
info("Computed total bytes: " + totalBytes);
|
info("Computed total bytes: " + contentSize);
|
||||||
info("Computed total millis: " + totalMillis);
|
info("Computed total millis: " + millis);
|
||||||
|
|
||||||
is(value, PluralForm.get(count, L10N.getStr("networkMenu.summary"))
|
is(value, PluralForm.get(count, L10N.getStr("networkMenu.summary2"))
|
||||||
.replace("#1", count)
|
.replace("#1", count)
|
||||||
.replace("#2", L10N.numberWithDecimals((totalBytes || 0) / 1024, 2))
|
.replace("#2", L10N.numberWithDecimals((contentSize || 0) / 1024, 2))
|
||||||
.replace("#3", L10N.numberWithDecimals((totalMillis || 0) / 1000, 2))
|
.replace("#3", L10N.numberWithDecimals((transferredSize || 0) / 1024, 2))
|
||||||
|
.replace("#4", L10N.numberWithDecimals((millis || 0) / 1000, 2))
|
||||||
, "The current summary text is incorrect.");
|
, "The current summary text is incorrect.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ function PieTableChart(node, pie, table) {
|
||||||
* - "mouseout", when the mouse leaves a slice or a row
|
* - "mouseout", when the mouse leaves a slice or a row
|
||||||
* - "click", when the mouse enters a slice or a row
|
* - "click", when the mouse enters a slice or a row
|
||||||
*/
|
*/
|
||||||
function createPieTableChart(document, { title, diameter, data, strings, totals, sorted }) {
|
function createPieTableChart(document, { title, diameter, data, strings, totals, sorted, header }) {
|
||||||
if (data && sorted) {
|
if (data && sorted) {
|
||||||
data = data.slice().sort((a, b) => +(a.size < b.size));
|
data = data.slice().sort((a, b) => +(a.size < b.size));
|
||||||
}
|
}
|
||||||
|
|
@ -119,7 +119,8 @@ function createPieTableChart(document, { title, diameter, data, strings, totals,
|
||||||
title: title,
|
title: title,
|
||||||
data: data,
|
data: data,
|
||||||
strings: strings,
|
strings: strings,
|
||||||
totals: totals
|
totals: totals,
|
||||||
|
header: header,
|
||||||
});
|
});
|
||||||
|
|
||||||
let container = document.createElement("hbox");
|
let container = document.createElement("hbox");
|
||||||
|
|
@ -338,7 +339,7 @@ function createPieChart(document, { data, width, height, centerX, centerY, radiu
|
||||||
* - "mouseout", when the mouse leaves a row
|
* - "mouseout", when the mouse leaves a row
|
||||||
* - "click", when the mouse clicks a row
|
* - "click", when the mouse clicks a row
|
||||||
*/
|
*/
|
||||||
function createTableChart(document, { title, data, strings, totals }) {
|
function createTableChart(document, { title, data, strings, totals, header }) {
|
||||||
strings = strings || {};
|
strings = strings || {};
|
||||||
totals = totals || {};
|
totals = totals || {};
|
||||||
let isPlaceholder = false;
|
let isPlaceholder = false;
|
||||||
|
|
@ -371,6 +372,24 @@ function createTableChart(document, { title, data, strings, totals }) {
|
||||||
tableNode.className = "plain table-chart-grid";
|
tableNode.className = "plain table-chart-grid";
|
||||||
container.appendChild(tableNode);
|
container.appendChild(tableNode);
|
||||||
|
|
||||||
|
const headerNode = document.createElement("div");
|
||||||
|
headerNode.className = "table-chart-row";
|
||||||
|
|
||||||
|
const headerBoxNode = document.createElement("div");
|
||||||
|
headerBoxNode.className = "table-chart-row-box";
|
||||||
|
headerNode.appendChild(headerBoxNode);
|
||||||
|
|
||||||
|
for (let [key, value] of Object.entries(header)) {
|
||||||
|
let headerLabelNode = document.createElement("span");
|
||||||
|
headerLabelNode.className = "plain table-chart-row-label";
|
||||||
|
headerLabelNode.setAttribute("name", key);
|
||||||
|
headerLabelNode.textContent = value;
|
||||||
|
|
||||||
|
headerNode.appendChild(headerLabelNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
tableNode.appendChild(headerNode);
|
||||||
|
|
||||||
for (let rowInfo of data) {
|
for (let rowInfo of data) {
|
||||||
let rowNode = document.createElement("hbox");
|
let rowNode = document.createElement("hbox");
|
||||||
rowNode.className = "table-chart-row";
|
rowNode.className = "table-chart-row";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue