mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 983301 Add a test for FetchEvent.respondWith(5). r=bz
This commit is contained in:
parent
82841444d6
commit
ab6a144621
@ -96,6 +96,11 @@ fetchXHR('nonresponse2.txt', null, function(xhr) {
|
||||
finish();
|
||||
});
|
||||
|
||||
fetchXHR('nonpromise.txt', null, function(xhr) {
|
||||
my_ok(xhr.status == 0, "load should not complete");
|
||||
finish();
|
||||
});
|
||||
|
||||
fetchXHR('headers.txt', function(xhr) {
|
||||
my_ok(xhr.status == 200, "load should be successful");
|
||||
my_ok(xhr.responseText == "1", "request header checks should have passed");
|
||||
|
@ -76,6 +76,17 @@ onfetch = function(ev) {
|
||||
ev.respondWith(Promise.resolve({}));
|
||||
}
|
||||
|
||||
else if (ev.request.url.includes("nonpromise.txt")) {
|
||||
try {
|
||||
// This should coerce to Promise(5) instead of throwing
|
||||
ev.respondWith(5);
|
||||
} catch (e) {
|
||||
// test is expecting failure, so return a success if we get a thrown
|
||||
// exception
|
||||
ev.respondWith(new Response('respondWith(5) threw ' + e));
|
||||
}
|
||||
}
|
||||
|
||||
else if (ev.request.url.includes("headers.txt")) {
|
||||
var ok = true;
|
||||
ok &= ev.request.headers.get("X-Test1") == "header1";
|
||||
|
Loading…
Reference in New Issue
Block a user