Bug 1143813 - Add tests for attempting to store a non-GET request in the DOM Cache; r=bkelly

This commit is contained in:
Ehsan Akhgari 2015-03-16 15:17:58 -04:00
parent e9c57f7ec1
commit d54b1dad9e
2 changed files with 26 additions and 0 deletions

View File

@ -46,6 +46,19 @@ function testRequest(request1, request2, request3, unknownRequest) {
return c.add(request1);
}).then(function() {
return c.add(request3);
}).then(function() {
return Promise.all(
["HEAD", "POST", "PUT", "DELETE", "OPTIONS"]
.map(function(method) {
var r = new Request(request1, {method: method});
return c.add(r)
.then(function() {
ok(false, "Promise should be rejected");
}, function(err) {
is(err.name, "TypeError", "Adding a request with type '" + method + "' should fail");
});
})
);
}).then(function() {
return c.matchAll(request1);
}).then(function(r) {

View File

@ -35,6 +35,19 @@ function testRequest(request, unknownRequest) {
return caches.open(name).then(function(cache) {
c = cache;
return c.add(request);
}).then(function() {
return Promise.all(
["HEAD", "POST", "PUT", "DELETE", "OPTIONS"]
.map(function(method) {
var r = new Request(request, {method: method});
return c.add(r)
.then(function() {
ok(false, "Promise should be rejected");
}, function(err) {
is(err.name, "TypeError", "Adding a request with type '" + method + "' should fail");
});
})
);
}).then(function() {
return c.match(request);
}).then(function(r) {