mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1147699 - Part 13: Add a test for FetchEvent.request.context when intercepting ping loads; r=nsm
This test is temporarily disabled until bug 1148064 gets fixed.
This commit is contained in:
parent
969e778490
commit
c0909b1151
@ -2,6 +2,7 @@ self.addEventListener("fetch", function(event) {
|
||||
if (event.request.url.indexOf("index.html") >= 0 ||
|
||||
event.request.url.indexOf("register.html") >= 0 ||
|
||||
event.request.url.indexOf("unregister.html") >= 0 ||
|
||||
event.request.url.indexOf("ping.html") >= 0 ||
|
||||
event.request.url.indexOf("csp-violate.sjs") >= 0) {
|
||||
// Handle pass-through requests
|
||||
event.respondWith(fetch(event.request));
|
||||
@ -51,6 +52,8 @@ self.addEventListener("fetch", function(event) {
|
||||
}
|
||||
} else if (event.request.url.indexOf("newwindow") >= 0) {
|
||||
respondToServiceWorker(event, "newwindow");
|
||||
} else if (event.request.url.indexOf("ping") >= 0) {
|
||||
respondToServiceWorker(event, "ping");
|
||||
}
|
||||
// Fail any request that we don't know about.
|
||||
try {
|
||||
|
@ -206,6 +206,23 @@
|
||||
});
|
||||
}
|
||||
|
||||
function testPing() {
|
||||
// FIXME: Temporarily disabled until bug 1148064 gets fixed.
|
||||
return Promise.resolve();
|
||||
return new Promise(function(resolve, reject) {
|
||||
var iframe = document.createElement("iframe");
|
||||
iframe.src = "ping.html";
|
||||
document.documentElement.appendChild(iframe);
|
||||
navigator.serviceWorker.addEventListener("message", function onMessage(e) {
|
||||
if (e.data.data == "ping") {
|
||||
is(e.data.context, "ping", "Expected the ping context on an anchor ping");
|
||||
navigator.serviceWorker.removeEventListener("message", onMessage);
|
||||
resolve();
|
||||
}
|
||||
}, false);
|
||||
});
|
||||
}
|
||||
|
||||
Promise.all([
|
||||
testFetch(),
|
||||
testImage(),
|
||||
@ -221,6 +238,7 @@
|
||||
testIFrame(),
|
||||
testFrame(),
|
||||
testInternal(),
|
||||
testPing(),
|
||||
])
|
||||
.then(function() {
|
||||
finish();
|
||||
|
7
dom/workers/test/serviceworkers/fetch/context/ping.html
Normal file
7
dom/workers/test/serviceworkers/fetch/context/ping.html
Normal file
@ -0,0 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<script>
|
||||
onload = function() {
|
||||
document.querySelector("a").click();
|
||||
};
|
||||
</script>
|
||||
<a ping="ping" href="fetch.txt">link</a>
|
@ -34,6 +34,7 @@ support-files =
|
||||
fetch/context/realaudio.ogg
|
||||
fetch/context/beacon.sjs
|
||||
fetch/context/csp-violate.sjs
|
||||
fetch/context/ping.html
|
||||
fetch/https/index.html
|
||||
fetch/https/register.html
|
||||
fetch/https/unregister.html
|
||||
|
@ -40,6 +40,8 @@
|
||||
onload = function() {
|
||||
SpecialPowers.pushPrefEnv({"set": [
|
||||
["beacon.enabled", true],
|
||||
["browser.send_pings", true],
|
||||
["browser.send_pings.max_per_link", -1],
|
||||
["dom.image.picture.enabled", true],
|
||||
["dom.image.srcset.enabled", true],
|
||||
["dom.serviceWorkers.exemptFromPerDomainMax", true],
|
||||
|
Loading…
Reference in New Issue
Block a user