icecat: add release icecat-140.6.0-1gnu1 for ecne
This commit is contained in:
parent
618c9f4145
commit
7d0f5dab3b
3382 changed files with 457689 additions and 569094 deletions
|
|
@ -26,17 +26,17 @@ add_task(async function () {
|
|||
? [
|
||||
{
|
||||
menuItemId: "request-list-context-copy-as-curl-win",
|
||||
data: buildTestData(QUOTE_WIN),
|
||||
data: buildTestData(QUOTE_WIN, true),
|
||||
},
|
||||
{
|
||||
menuItemId: "request-list-context-copy-as-curl-posix",
|
||||
data: buildTestData(QUOTE_POSIX),
|
||||
data: buildTestData(QUOTE_POSIX, false),
|
||||
},
|
||||
]
|
||||
: [
|
||||
{
|
||||
menuItemId: "request-list-context-copy-as-curl",
|
||||
data: buildTestData(QUOTE_POSIX),
|
||||
data: buildTestData(QUOTE_POSIX, false),
|
||||
},
|
||||
];
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ add_task(async function () {
|
|||
await teardown(monitor);
|
||||
});
|
||||
|
||||
function buildTestData(QUOTE) {
|
||||
function buildTestData(QUOTE, isWin) {
|
||||
// Quote a string, escape the quotes inside the string
|
||||
function quote(str) {
|
||||
return QUOTE + str.replace(new RegExp(QUOTE, "g"), `\\${QUOTE}`) + QUOTE;
|
||||
|
|
@ -56,9 +56,11 @@ function buildTestData(QUOTE) {
|
|||
return "-H " + quote(h);
|
||||
}
|
||||
|
||||
const CMD = isWin ? "curl.exe " : "curl ";
|
||||
|
||||
// Construct the expected command
|
||||
const SIMPLE_BASE = ["curl " + quote(HTTPS_SIMPLE_SJS)];
|
||||
const SLOW_BASE = ["curl " + quote(HTTPS_SLOW_SJS)];
|
||||
const SIMPLE_BASE = [CMD + quote(HTTPS_SIMPLE_SJS)];
|
||||
const SLOW_BASE = [CMD + quote(HTTPS_SLOW_SJS)];
|
||||
const BASE_RESULT = [
|
||||
"--compressed",
|
||||
header("User-Agent: " + navigator.userAgent),
|
||||
|
|
@ -220,8 +222,9 @@ async function testForPlatform(tab, monitor, testData) {
|
|||
|
||||
// This monster regexp parses the command line into an array of arguments,
|
||||
// recognizing quoted args with matching quotes and escaped quotes inside:
|
||||
// [ "curl.exe 'url'", "--standalone-arg", "-arg-with-quoted-string 'value\'s'" ]
|
||||
// [ "curl 'url'", "--standalone-arg", "-arg-with-quoted-string 'value\'s'" ]
|
||||
const matchRe = /[-A-Za-z1-9]+(?: ([\^\\"']+)(?:\\\1|.)*?\1)?/g;
|
||||
const matchRe = /[-\.A-Za-z1-9]+(?: ([\^\"']+)(?:\\\1|.)*?\1)?/g;
|
||||
|
||||
const actual = result.match(matchRe);
|
||||
// Must begin with the same "curl 'URL'" segment
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ function testDataArgumentOnGeneratedCommand(data) {
|
|||
}
|
||||
|
||||
function testDataEscapeOnGeneratedCommand(data) {
|
||||
const paramsWin = `--data-raw ^"{\\"param1\\":\\"value1\\",\\"param2\\":\\"value2\\"}^"`;
|
||||
const paramsWin = `--data-raw ^"^{^\\^"param1^\\^":^\\^"value1^\\^",^\\^"param2^\\^":^\\^"value2^\\^"^}^`;
|
||||
const paramsPosix = `--data-raw '{"param1":"value1","param2":"value2"}'`;
|
||||
|
||||
let curlCommand = Curl.generateCommand(data, "WINNT");
|
||||
|
|
@ -209,13 +209,13 @@ function testRemoveBinaryDataFromMultipartText(data) {
|
|||
'^"',
|
||||
boundary,
|
||||
"^\u000A\u000A",
|
||||
'Content-Disposition: form-data; name=\\"param1\\"',
|
||||
'Content-Disposition: form-data; name=^\\^"param1^\\^"',
|
||||
"^\u000A\u000A^\u000A\u000A",
|
||||
"value1",
|
||||
"^\u000A\u000A",
|
||||
boundary,
|
||||
"^\u000A\u000A",
|
||||
'Content-Disposition: form-data; name=\\"file\\"; filename=\\"filename.png\\"',
|
||||
'Content-Disposition: form-data; name=^\\^"file^\\^"; filename=^\\^"filename.png^\\^"',
|
||||
"^\u000A\u000A",
|
||||
"Content-Type: image/png",
|
||||
"^\u000A\u000A^\u000A\u000A",
|
||||
|
|
@ -269,7 +269,14 @@ function testEscapeStringPosix() {
|
|||
const escapeChar = "'!ls:q:gs|ls|;ping 8.8.8.8;|";
|
||||
is(
|
||||
CurlUtils.escapeStringPosix(escapeChar),
|
||||
"$'\\'\\041ls:q:gs^|ls^|;ping 8.8.8.8;^|'",
|
||||
"$'\\'\\041ls:q:gs|ls|;ping 8.8.8.8;|'",
|
||||
"'!' should be escaped."
|
||||
);
|
||||
|
||||
const escapeBangOnlyChar = "!";
|
||||
is(
|
||||
CurlUtils.escapeStringPosix(escapeBangOnlyChar),
|
||||
"$'\\041'",
|
||||
"'!' should be escaped."
|
||||
);
|
||||
|
||||
|
|
@ -295,49 +302,34 @@ function testEscapeStringPosix() {
|
|||
"$'\\xc3\\xa6 \\xc3\\xb8 \\xc3\\xbc \\xc3\\x9f \\xc3\\xb6 \\xc3\\xa9'",
|
||||
"Character codes outside of the decimal range 32 - 126 should be escaped."
|
||||
);
|
||||
|
||||
// Assert that ampersands are correctly escaped in case its tried to run on Windows
|
||||
const evilCommand = `query=evil\n\ncmd & calc.exe\n\n`;
|
||||
is(
|
||||
CurlUtils.escapeStringPosix(evilCommand),
|
||||
"$'query=evil\\n\\ncmd ^& calc.exe\\n\\n'",
|
||||
"The evil command is escaped properly"
|
||||
);
|
||||
|
||||
const str = "EvilHeader: &calc.exe&";
|
||||
is(
|
||||
CurlUtils.escapeStringPosix(str),
|
||||
"'EvilHeader: ^&calc.exe^&'",
|
||||
"The evil command is escaped properly"
|
||||
);
|
||||
}
|
||||
|
||||
function testEscapeStringWin() {
|
||||
const surroundedWithDoubleQuotes = "A simple string";
|
||||
is(
|
||||
CurlUtils.escapeStringWin(surroundedWithDoubleQuotes),
|
||||
'^"A simple string^"',
|
||||
'^\"A simple string^\"',
|
||||
"The string should be surrounded with double quotes."
|
||||
);
|
||||
|
||||
const doubleQuotes = 'Quote: "Time is an illusion. Lunchtime doubly so."';
|
||||
is(
|
||||
CurlUtils.escapeStringWin(doubleQuotes),
|
||||
'^"Quote: \\"Time is an illusion. Lunchtime doubly so.\\"^"',
|
||||
'^\"Quote: ^\\^\"Time is an illusion. Lunchtime doubly so.^\\^\"^\"',
|
||||
"Double quotes should be escaped."
|
||||
);
|
||||
|
||||
const percentSigns = "%TEMP% %@foo% %2XX% %_XX% %?XX%";
|
||||
is(
|
||||
CurlUtils.escapeStringWin(percentSigns),
|
||||
'^"^%^TEMP^% ^%^@foo^% ^%^2XX^% ^%^_XX^% ^%?XX^%^"',
|
||||
'^\"^%^TEMP^% ^%^@foo^% ^%^2XX^% ^%^_XX^% ^%?XX^%^\"',
|
||||
"Percent signs should be escaped."
|
||||
);
|
||||
|
||||
const backslashes = "\\A simple string\\";
|
||||
is(
|
||||
CurlUtils.escapeStringWin(backslashes),
|
||||
'^"\\\\A simple string\\\\^"',
|
||||
'^\"^\\A simple string^\\^\"',
|
||||
"Backslashes should be escaped."
|
||||
);
|
||||
|
||||
|
|
@ -351,23 +343,38 @@ function testEscapeStringWin() {
|
|||
const dollarSignCommand = "$(calc.exe)";
|
||||
is(
|
||||
CurlUtils.escapeStringWin(dollarSignCommand),
|
||||
'^"\\$(calc.exe)^"',
|
||||
'^\"^$(calc.exe)^\"',
|
||||
"Dollar sign should be escaped."
|
||||
);
|
||||
|
||||
const tickSignCommand = "`$(calc.exe)";
|
||||
is(
|
||||
CurlUtils.escapeStringWin(tickSignCommand),
|
||||
'^"\\`\\$(calc.exe)^"',
|
||||
'^\"`^$(calc.exe)^\"',
|
||||
"Both the tick and dollar signs should be escaped."
|
||||
);
|
||||
|
||||
const evilCommand = `query=evil\r\rcmd" /c timeout /t 3 & calc.exe\r\r`;
|
||||
is(
|
||||
CurlUtils.escapeStringWin(evilCommand),
|
||||
'^\"query=evil^\n\n^\n\ncmd\\\" /c timeout /t 3 & calc.exe^\n\n^\n\n^\"',
|
||||
'^\"query=evil^\n\n^\n\ncmd^\\^\" /c timeout /t 3 ^& calc.exe^\n\n^\n\n^\"',
|
||||
"The evil command is escaped properly"
|
||||
);
|
||||
|
||||
// Control characters https://www.ascii-code.com/characters/control-characters
|
||||
const containsControlChars = " - \u0007 \u0010 \u0014 \u001B \x1a - ";
|
||||
is(
|
||||
CurlUtils.escapeStringWin(containsControlChars),
|
||||
'^\" - \u0007 \u0010 \u0014 \u001b \u001a - ^\"',
|
||||
"Control characters should not be escaped with ^."
|
||||
);
|
||||
|
||||
const controlCharsWithWhitespaces = " -\tcalc.exe\f- ";
|
||||
is(
|
||||
CurlUtils.escapeStringWin(controlCharsWithWhitespaces),
|
||||
'^\" - calc.exe - ^\"',
|
||||
"Control (non-printable) characters which are whitespace like charaters e.g (tab & form feed)"
|
||||
);
|
||||
}
|
||||
|
||||
async function createCurlData(selected, getLongString, requestData) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue