Bug 1144236 - Add tests for the ignoreMethod match mode in DOM cache; r=bkelly

This commit is contained in:
Ehsan Akhgari 2015-03-17 10:58:00 +01:00
Родитель 6d29d6c974
Коммит 2515f140bb
2 изменённых файлов: 38 добавлений и 0 удалений

Просмотреть файл

@ -74,6 +74,26 @@ function testRequest(request1, request2, request3, unknownRequest,
}).then(function(r) {
is(r.length, 1, "Should only find 1 item");
return checkResponse(r[0], response1, response1Text);
}).then(function() {
return c.matchAll(new Request(request1, {method: "HEAD"}));
}).then(function(r) {
is(r.length, 1, "Should only find 1 item");
return checkResponse(r[0], response1, response1Text);
}).then(function() {
return Promise.all(
["POST", "PUT", "DELETE", "OPTIONS"]
.map(function(method) {
var req = new Request(request1, {method: method});
return c.matchAll(req)
.then(function(r) {
is(r.length, 0, "Searching for a request with a non-GET/HEAD method should not succeed");
return c.matchAll(req, {ignoreMethod: true});
}).then(function(r) {
is(r.length, 1, "Should only find 1 item");
return checkResponse(r[0], response1, response1Text);
});
})
);
}).then(function() {
return c.matchAll(requestWithDifferentFragment);
}).then(function(r) {

Просмотреть файл

@ -60,6 +60,24 @@ function testRequest(request, unknownRequest, requestWithAlternateQueryString,
return c.match(request);
}).then(function(r) {
return checkResponse(r);
}).then(function() {
return c.match(new Request(request, {method: "HEAD"}));
}).then(function(r) {
return checkResponse(r);
}).then(function() {
return Promise.all(
["POST", "PUT", "DELETE", "OPTIONS"]
.map(function(method) {
var req = new Request(request, {method: method});
return c.match(req)
.then(function(r) {
is(typeof r, "undefined", "Searching for a request with a non-GET/HEAD method should not succeed");
return c.match(req, {ignoreMethod: true});
}).then(function(r) {
return checkResponse(r);
});
})
);
}).then(function() {
return caches.match(request);
}).then(function(r) {