summaryrefslogtreecommitdiffstats
path: root/devtools/client/shared
diff options
context:
space:
mode:
authorMoonchild <mcwerewolf@gmail.com>2018-03-02 10:32:45 +0100
committerGitHub <noreply@github.com>2018-03-02 10:32:45 +0100
commite272829137195b46612b7664c9416364089f7baa (patch)
tree20b543048260952a2c4ac8bb4cb22aaaa684bd84 /devtools/client/shared
parentba2c2e5301bb2d993984c62cdf2fd07b361e6bca (diff)
parentc8355b22c047c9737e32f096b816edbb8b0fa181 (diff)
downloadUXP-e272829137195b46612b7664c9416364089f7baa.tar
UXP-e272829137195b46612b7664c9416364089f7baa.tar.gz
UXP-e272829137195b46612b7664c9416364089f7baa.tar.lz
UXP-e272829137195b46612b7664c9416364089f7baa.tar.xz
UXP-e272829137195b46612b7664c9416364089f7baa.zip
Merge pull request #34 from janekptacijarabaci/devtools_import-from-moebius_1
Port across devtools enhancements
Diffstat (limited to 'devtools/client/shared')
-rw-r--r--devtools/client/shared/curl.js6
-rw-r--r--devtools/client/shared/widgets/Chart.jsm25
2 files changed, 27 insertions, 4 deletions
diff --git a/devtools/client/shared/curl.js b/devtools/client/shared/curl.js
index 44465193f..45122be37 100644
--- a/devtools/client/shared/curl.js
+++ b/devtools/client/shared/curl.js
@@ -76,7 +76,8 @@ const Curl = {
// Create post data.
let postData = [];
- if (utils.isUrlEncodedRequest(data) || data.method == "PUT") {
+ if (utils.isUrlEncodedRequest(data) ||
+ ["PUT", "POST"].includes(data.method)) {
postDataText = data.postDataText;
postData.push("--data");
postData.push(escapeString(utils.writePostDataTextParams(postDataText)));
@@ -207,6 +208,9 @@ const CurlUtils = {
* Post data parameters.
*/
writePostDataTextParams: function (postDataText) {
+ if (!postDataText) {
+ return "";
+ }
let lines = postDataText.split("\r\n");
return lines[lines.length - 1];
},
diff --git a/devtools/client/shared/widgets/Chart.jsm b/devtools/client/shared/widgets/Chart.jsm
index 0894a62ca..0b7cb71fb 100644
--- a/devtools/client/shared/widgets/Chart.jsm
+++ b/devtools/client/shared/widgets/Chart.jsm
@@ -105,7 +105,7 @@ function PieTableChart(node, pie, table) {
* - "mouseout", when the mouse leaves 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) {
data = data.slice().sort((a, b) => +(a.size < b.size));
}
@@ -119,7 +119,8 @@ function createPieTableChart(document, { title, diameter, data, strings, totals,
title: title,
data: data,
strings: strings,
- totals: totals
+ totals: totals,
+ header: header,
});
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
* - "click", when the mouse clicks a row
*/
-function createTableChart(document, { title, data, strings, totals }) {
+function createTableChart(document, { title, data, strings, totals, header }) {
strings = strings || {};
totals = totals || {};
let isPlaceholder = false;
@@ -371,6 +372,24 @@ function createTableChart(document, { title, data, strings, totals }) {
tableNode.className = "plain table-chart-grid";
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) {
let rowNode = document.createElement("hbox");
rowNode.className = "table-chart-row";