зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1330297 - Part 3: Update mochitests to align with spec since we normalize value before checking and throwing. r=baku
This commit is contained in:
Родитель
6bf6385293
Коммит
b737881864
|
@ -89,6 +89,33 @@ function TestCoreBehavior(headers, name) {
|
|||
checkHas(headers, name, "Has the header after set");
|
||||
checkGet(headers, name, "snafu", "Retrieve all headers after set");
|
||||
|
||||
const value_bam = "boom";
|
||||
let testHTTPWhitespace = ["\t", "\n", "\r", " "];
|
||||
while (testHTTPWhitespace.length != 0) {
|
||||
headers.delete(name);
|
||||
|
||||
let char = testHTTPWhitespace.shift();
|
||||
headers.set(name, char);
|
||||
checkGet(headers, name, "",
|
||||
"Header value " + char +
|
||||
" should be normalized before checking and throwing");
|
||||
headers.delete(name);
|
||||
|
||||
let valueFront = char + value_bam;
|
||||
headers.set(name, valueFront);
|
||||
checkGet(headers, name, value_bam,
|
||||
"Header value " + valueFront +
|
||||
" should be normalized before checking and throwing");
|
||||
|
||||
headers.delete(name);
|
||||
|
||||
let valueBack = value_bam + char;
|
||||
headers.set(name, valueBack);
|
||||
checkGet(headers, name, value_bam,
|
||||
"Header value " + valueBack +
|
||||
" should be normalized before checking and throwing");
|
||||
}
|
||||
|
||||
headers.delete(name.toUpperCase());
|
||||
checkNotHas(headers, name, "Does not have the header after delete");
|
||||
checkGet(headers, name, null, "Retrieve all headers after delete");
|
||||
|
@ -101,11 +128,11 @@ function TestCoreBehavior(headers, name) {
|
|||
}, TypeError, "Append invalid header name should throw TypeError.");
|
||||
|
||||
shouldThrow(function() {
|
||||
headers.append(name, "bam\n");
|
||||
headers.append(name, "ba\nm");
|
||||
}, TypeError, "Append invalid header value should throw TypeError.");
|
||||
|
||||
shouldThrow(function() {
|
||||
headers.append(name, "bam\n\r");
|
||||
headers.append(name, "ba\rm");
|
||||
}, TypeError, "Append invalid header value should throw TypeError.");
|
||||
|
||||
ok(!headers.guard, "guard should be undefined in content");
|
||||
|
|
Загрузка…
Ссылка в новой задаче