mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1143833 - Add tests for the ignoreSearch match mode in DOM cache; r=bkelly
This commit is contained in:
parent
0e09c7917d
commit
d83fa2d71e
@ -1,6 +1,7 @@
|
||||
var request1 = new Request("//mochi.test:8888/?1&" + context + "#fragment");
|
||||
var request2 = new Request("//mochi.test:8888/?2&" + context);
|
||||
var request3 = new Request("//mochi.test:8888/?3&" + context);
|
||||
var requestWithAltQS = new Request("//mochi.test:8888/?queryString");
|
||||
var unknownRequest = new Request("//mochi.test:8888/non/existing/path?" + context);
|
||||
var response1, response3;
|
||||
var c;
|
||||
@ -33,10 +34,11 @@ fetch(new Request(request1)).then(function(r) {
|
||||
}).then(function(text) {
|
||||
response3Text = text;
|
||||
return testRequest(request1, request2, request3, unknownRequest,
|
||||
requestWithAltQS,
|
||||
request1.url.replace("#fragment", "#other"));
|
||||
}).then(function() {
|
||||
return testRequest(request1.url, request2.url, request3.url,
|
||||
unknownRequest.url,
|
||||
unknownRequest.url, requestWithAltQS.url,
|
||||
request1.url.replace("#fragment", "#other"));
|
||||
}).then(function() {
|
||||
testDone();
|
||||
@ -44,6 +46,7 @@ fetch(new Request(request1)).then(function(r) {
|
||||
|
||||
// The request arguments can either be a URL string, or a Request object.
|
||||
function testRequest(request1, request2, request3, unknownRequest,
|
||||
requestWithAlternateQueryString,
|
||||
requestWithDifferentFragment) {
|
||||
return caches.open(name).then(function(cache) {
|
||||
c = cache;
|
||||
@ -73,6 +76,15 @@ 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(requestWithAlternateQueryString,
|
||||
{ignoreSearch: true, cacheName: name});
|
||||
}).then(function(r) {
|
||||
is(r.length, 2, "Should find 2 items");
|
||||
return Promise.all([
|
||||
checkResponse(r[0], response1, response1Text),
|
||||
checkResponse(r[1], response3, response3Text)
|
||||
]);
|
||||
}).then(function() {
|
||||
return c.matchAll(request3);
|
||||
}).then(function(r) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
var request = new Request("//mochi.test:8888/?" + context + "#fragment");
|
||||
var requestWithAltQS = new Request("//mochi.test:8888/?queryString");
|
||||
var unknownRequest = new Request("//mochi.test:8888/non/existing/path?" + context);
|
||||
var response;
|
||||
var c;
|
||||
@ -24,17 +25,18 @@ fetch(new Request(request)).then(function(r) {
|
||||
return response.text();
|
||||
}).then(function(text) {
|
||||
responseText = text;
|
||||
return testRequest(request, unknownRequest,
|
||||
return testRequest(request, unknownRequest, requestWithAltQS,
|
||||
request.url.replace("#fragment", "#other"));
|
||||
}).then(function() {
|
||||
return testRequest(request.url, unknownRequest.url,
|
||||
return testRequest(request.url, unknownRequest.url, requestWithAltQS.url,
|
||||
request.url.replace("#fragment", "#other"));
|
||||
}).then(function() {
|
||||
testDone();
|
||||
});
|
||||
|
||||
// The request argument can either be a URL string, or a Request object.
|
||||
function testRequest(request, unknownRequest, requestWithDifferentFragment) {
|
||||
function testRequest(request, unknownRequest, requestWithAlternateQueryString,
|
||||
requestWithDifferentFragment) {
|
||||
return caches.open(name).then(function(cache) {
|
||||
c = cache;
|
||||
return c.add(request);
|
||||
@ -63,6 +65,11 @@ function testRequest(request, unknownRequest, requestWithDifferentFragment) {
|
||||
return caches.match(requestWithDifferentFragment);
|
||||
}).then(function(r) {
|
||||
return checkResponse(r);
|
||||
}).then(function() {
|
||||
return caches.match(requestWithAlternateQueryString,
|
||||
{ignoreSearch: true, cacheName: name});
|
||||
}).then(function(r) {
|
||||
return checkResponse(r);
|
||||
}).then(function() {
|
||||
return caches.match(request, {cacheName: name});
|
||||
}).then(function(r) {
|
||||
|
Loading…
Reference in New Issue
Block a user