mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:30:27 +00:00
65d6aee9e0
- Bug 1132141 - Update storage when ServiceWorker registration fails. (5bf56ab4f) - Bug 1001691 - WorkerPrivate::LoadInfo -> WorkerLoadInfo (bc017200f) - Bug 1001691 - Move WorkerType out of WorkerPrivate.h (02751f7b6) - Bug 1131882 - Associate ServiceWorkers with underlying ServiceWorkerInfo. (4492ae042) - Bug 1131874 - ServiceWorker persistence activation fixes. (cd4f32309) - Bug 1142015 - Add source for messages dispatched to a Service Worker. (25b685a06) - Bug 1053275 - Exempt ServiceWorkers from per domain thread limits. (f67251f0d) - Bug 1139561 - Various small ServiceWorker test fixes. (dbd0beae4) - Bug 1130688 - Implement additional scope checking in service worker registration. (cbd8fee66) - Bug 1142841: Convert all nsRefPtr<nsIRunnable> to nsCOMPtr<nsIRunnable>. r=ehsan (9d4e51880) - Bug 1134462 - Synthesize status and headers from Response returned by ServiceWorker. (8203ae32b) - Bug 1134462 - allow null body. (1490bb9bd) - Bug 1141332 - Disable content decoding and use decoded length on intercepted channels. (2eec7968b) - Bug 1134330 - Mark fetch events as reloads appropriately. (a3025a42a) - Bug 1136757 - Add direct Response overload for FetchEvent.respondWith(). (a33248935) - Bug 1134462 - Cleanup Promise usage in fetch test SW. (fbe9f4cd5) - Bug 1134462 followup: Add missing MOZ_OVERRIDE annotation to SynthesizeStatus impls in SynthesizeStatus.h. (fb34b64d4) - Bug 1142124 - Never revalidate cache entries for synthesized responses. (0f4842e41) - Bug 1143155 - Filtered response stores internal response and allows access to headers. (956c334b1) - Bug 1133861 - Enable the Fetch API by default. (e05918105) - Bug 1140791 - Run fetch tests on main thread and workers. (e672969d6) - Bug 1144819 - Change JS_DefineProperty APIs to treat getter=nullptr and setter=nullptr as indicating class getter/setter ops only for data properties. (e030ab7d6)
106 lines
3.8 KiB
JavaScript
106 lines
3.8 KiB
JavaScript
function fetch(name, onload, onerror, headers) {
|
|
expectAsyncResult();
|
|
|
|
onload = onload || function() {
|
|
my_ok(false, "XHR load should not complete successfully");
|
|
finish();
|
|
};
|
|
onerror = onerror || function() {
|
|
my_ok(false, "XHR load should be intercepted successfully");
|
|
finish();
|
|
};
|
|
|
|
var x = new XMLHttpRequest();
|
|
x.open('GET', name, true);
|
|
x.onload = function() { onload(x) };
|
|
x.onerror = function() { onerror(x) };
|
|
headers = headers || [];
|
|
headers.forEach(function(header) {
|
|
x.setRequestHeader(header[0], header[1]);
|
|
});
|
|
x.send();
|
|
}
|
|
|
|
fetch('synthesized.txt', function(xhr) {
|
|
my_ok(xhr.status == 200, "load should be successful");
|
|
my_ok(xhr.responseText == "synthesized response body", "load should have synthesized response");
|
|
finish();
|
|
});
|
|
|
|
fetch('test-respondwith-response.txt', function(xhr) {
|
|
my_ok(xhr.status == 200, "test-respondwith-response load should be successful");
|
|
my_ok(xhr.responseText == "test-respondwith-response response body", "load should have response");
|
|
finish();
|
|
});
|
|
|
|
fetch('synthesized-404.txt', function(xhr) {
|
|
my_ok(xhr.status == 404, "load should 404");
|
|
my_ok(xhr.responseText == "synthesized response body", "404 load should have synthesized response");
|
|
finish();
|
|
});
|
|
|
|
fetch('synthesized-headers.txt', function(xhr) {
|
|
my_ok(xhr.status == 200, "load should be successful");
|
|
my_ok(xhr.getResponseHeader("X-Custom-Greeting") === "Hello", "custom header should be set");
|
|
my_ok(xhr.responseText == "synthesized response body", "custom header load should have synthesized response");
|
|
finish();
|
|
});
|
|
|
|
fetch('ignored.txt', function(xhr) {
|
|
my_ok(xhr.status == 404, "load should be uninterrupted");
|
|
finish();
|
|
});
|
|
|
|
fetch('rejected.txt', null, function(xhr) {
|
|
my_ok(xhr.status == 0, "load should not complete");
|
|
finish();
|
|
});
|
|
|
|
fetch('nonresponse.txt', null, function(xhr) {
|
|
my_ok(xhr.status == 0, "load should not complete");
|
|
finish();
|
|
});
|
|
|
|
fetch('nonresponse2.txt', null, function(xhr) {
|
|
my_ok(xhr.status == 0, "load should not complete");
|
|
finish();
|
|
});
|
|
|
|
fetch('headers.txt', function(xhr) {
|
|
my_ok(xhr.status == 200, "load should be successful");
|
|
my_ok(xhr.responseText == "1", "request header checks should have passed");
|
|
finish();
|
|
}, null, [["X-Test1", "header1"], ["X-Test2", "header2"]]);
|
|
|
|
var expectedUncompressedResponse = "";
|
|
for (var i = 0; i < 10; ++i) {
|
|
expectedUncompressedResponse += "hello";
|
|
}
|
|
expectedUncompressedResponse += "\n";
|
|
|
|
// ServiceWorker does not intercept, at which point the network request should
|
|
// be correctly decoded.
|
|
fetch('deliver-gzip.sjs', function(xhr) {
|
|
my_ok(xhr.status == 200, "network gzip load should be successful");
|
|
my_ok(xhr.responseText == expectedUncompressedResponse, "network gzip load should have synthesized response.");
|
|
my_ok(xhr.getResponseHeader("Content-Encoding") == "gzip", "network Content-Encoding should be gzip.");
|
|
my_ok(xhr.getResponseHeader("Content-Length") == "35", "network Content-Length should be of original gzipped file.");
|
|
finish();
|
|
});
|
|
|
|
fetch('hello.gz', function(xhr) {
|
|
my_ok(xhr.status == 200, "gzip load should be successful");
|
|
my_ok(xhr.responseText == expectedUncompressedResponse, "gzip load should have synthesized response.");
|
|
my_ok(xhr.getResponseHeader("Content-Encoding") == "gzip", "Content-Encoding should be gzip.");
|
|
my_ok(xhr.getResponseHeader("Content-Length") == "35", "Content-Length should be of original gzipped file.");
|
|
finish();
|
|
});
|
|
|
|
fetch('hello-after-extracting.gz', function(xhr) {
|
|
my_ok(xhr.status == 200, "gzip load should be successful");
|
|
my_ok(xhr.responseText == expectedUncompressedResponse, "gzip load should have synthesized response.");
|
|
my_ok(xhr.getResponseHeader("Content-Encoding") == "gzip", "Content-Encoding should be gzip.");
|
|
my_ok(xhr.getResponseHeader("Content-Length") == "35", "Content-Length should be of original gzipped file.");
|
|
finish();
|
|
});
|