зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1184550 - Add a mochitest for the Request constructor that tests that the body is set to used after being fetched and then fails on the second fetch with the same Request. r=bkelly
This commit is contained in:
Родитель
2ae35fec9a
Коммит
5244c3a2d4
|
@ -124,6 +124,19 @@ function testBug1109574() {
|
|||
var r3 = new Request(r1);
|
||||
}
|
||||
|
||||
// Bug 1184550 - Request constructor should always throw if used flag is set,
|
||||
// even if body is null
|
||||
function testBug1184550() {
|
||||
var req = new Request("", { method: 'post', body: "Test" });
|
||||
fetch(req);
|
||||
ok(req.bodyUsed, "Request body should be used immediately after fetch()");
|
||||
return fetch(req).then(function(resp) {
|
||||
ok(false, "Second fetch with same request should fail.");
|
||||
}).catch(function(err) {
|
||||
is(err.name, 'TypeError', "Second fetch with same request should fail.");
|
||||
});
|
||||
}
|
||||
|
||||
function testHeaderGuard() {
|
||||
var headers = {
|
||||
"Cookie": "Custom cookie",
|
||||
|
@ -500,6 +513,7 @@ function runTest() {
|
|||
testUrlMalformed();
|
||||
testMethod();
|
||||
testBug1109574();
|
||||
testBug1184550();
|
||||
testHeaderGuard();
|
||||
testModeCorsPreflightEnumValue();
|
||||
testBug1154268();
|
||||
|
|
Загрузка…
Ссылка в новой задаче