mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1147699 - Part 10: Add a test for FetchEvent.request.context when intercepting font loads; r=nsm
This commit is contained in:
parent
c7b94a91ea
commit
10f853c059
@ -38,6 +38,8 @@ self.addEventListener("fetch", function(event) {
|
||||
respondToServiceWorker(event, "embed");
|
||||
} else if (event.request.url.indexOf("object") >= 0) {
|
||||
respondToServiceWorker(event, "object");
|
||||
} else if (event.request.url.indexOf("font") >= 0) {
|
||||
respondToServiceWorker(event, "font");
|
||||
}
|
||||
// Fail any request that we don't know about.
|
||||
try {
|
||||
|
@ -141,6 +141,23 @@
|
||||
});
|
||||
}
|
||||
|
||||
function testFont() {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var css = '@font-face { font-family: "sw-font"; src: url("font"); }';
|
||||
css += '* { font-family: "sw-font"; }';
|
||||
var style = document.createElement("style");
|
||||
style.appendChild(document.createTextNode(css));
|
||||
document.documentElement.appendChild(style);
|
||||
navigator.serviceWorker.addEventListener("message", function onMessage(e) {
|
||||
if (e.data.data == "font") {
|
||||
is(e.data.context, "font", "Expected the font context on an font");
|
||||
navigator.serviceWorker.removeEventListener("message", onMessage);
|
||||
resolve();
|
||||
}
|
||||
}, false);
|
||||
});
|
||||
}
|
||||
|
||||
Promise.all([
|
||||
testFetch(),
|
||||
testImage(),
|
||||
@ -152,6 +169,7 @@
|
||||
testCSPReport(),
|
||||
testEmbed(),
|
||||
testObject(),
|
||||
testFont(),
|
||||
])
|
||||
.then(function() {
|
||||
finish();
|
||||
|
Loading…
Reference in New Issue
Block a user