mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-11 17:57:32 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
BIN
dom/workers/test/serviceworkers/fetch/imagecache/image-20px.png
Normal file
BIN
dom/workers/test/serviceworkers/fetch/imagecache/image-20px.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 87 B |
BIN
dom/workers/test/serviceworkers/fetch/imagecache/image-40px.png
Normal file
BIN
dom/workers/test/serviceworkers/fetch/imagecache/image-40px.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 123 B |
|
|
@ -0,0 +1,15 @@
|
|||
function synthesizeImage() {
|
||||
return clients.matchAll().then(clients => {
|
||||
var url = "image-40px.png";
|
||||
clients.forEach(client => {
|
||||
client.postMessage(url);
|
||||
});
|
||||
return fetch(url);
|
||||
});
|
||||
}
|
||||
|
||||
self.addEventListener("fetch", function(event) {
|
||||
if (event.request.url.indexOf("image-20px.png") >= 0) {
|
||||
event.respondWith(synthesizeImage());
|
||||
}
|
||||
});
|
||||
20
dom/workers/test/serviceworkers/fetch/imagecache/index.html
Normal file
20
dom/workers/test/serviceworkers/fetch/imagecache/index.html
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<script>
|
||||
var width, url;
|
||||
function maybeReport() {
|
||||
if (width !== undefined && url !== undefined) {
|
||||
window.parent.postMessage({status: "result",
|
||||
width: width,
|
||||
url: url}, "*");
|
||||
}
|
||||
}
|
||||
onload = function() {
|
||||
width = document.querySelector("img").width;
|
||||
maybeReport();
|
||||
};
|
||||
navigator.serviceWorker.onmessage = function(event) {
|
||||
url = event.data;
|
||||
maybeReport();
|
||||
};
|
||||
</script>
|
||||
<img src="image-20px.png">
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<!DOCTYPE html>
|
||||
<script>
|
||||
onload = function() {
|
||||
var width = document.querySelector("img").width;
|
||||
window.parent.postMessage({status: "postmortem",
|
||||
width: width}, "*");
|
||||
};
|
||||
</script>
|
||||
<img src="image-20px.png">
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- Load the image here to put it in the image cache -->
|
||||
<img src="image-20px.png">
|
||||
<script>
|
||||
function ok(v, msg) {
|
||||
window.parent.postMessage({status: "ok", result: !!v, message: msg}, "*");
|
||||
}
|
||||
|
||||
function done(reg) {
|
||||
ok(reg.active, "The active worker should be available.");
|
||||
window.parent.postMessage({status: "registrationdone"}, "*");
|
||||
}
|
||||
|
||||
navigator.serviceWorker.ready.then(done);
|
||||
navigator.serviceWorker.register("imagecache_test.js", {scope: "."});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<script>
|
||||
navigator.serviceWorker.getRegistration(".").then(function(registration) {
|
||||
registration.unregister().then(function(success) {
|
||||
if (success) {
|
||||
window.parent.postMessage({status: "unregistrationdone"}, "*");
|
||||
}
|
||||
}, function(e) {
|
||||
dump("Unregistering the SW failed with " + e + "\n");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Loading…
Add table
Add a link
Reference in a new issue