[Webkit-unassigned] [Bug 245866] New: Safari 16 issuing requests twice with navigationPreload enabled
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Sep 30 00:16:56 PDT 2022
https://bugs.webkit.org/show_bug.cgi?id=245866
Bug ID: 245866
Summary: Safari 16 issuing requests twice with
navigationPreload enabled
Product: WebKit
Version: Safari 16
Hardware: iPhone / iPad
OS: iOS 16
Status: NEW
Severity: Critical
Priority: P2
Component: Service Workers
Assignee: webkit-unassigned at lists.webkit.org
Reporter: vagulisal500 at gmail.com
When I using navigationPreload.enable(), Safari 16.x on macOs and all browser on ios16.x make two requests
Here is my code:
const uri = 'https://uri';
self.addEventListener('activate', event => {
event.waitUntil((async () => {
if (self.registration.navigationPreload) {
await self.registration.navigationPreload.enable();
}
})());
});
self.addEventListener('fetch', (event) => {
const request = event.request;
if (request.mode === 'navigate' && request.destination !== 'iframe') {
event.respondWith((async () => {
try {
return await event.preloadResponse || await fetch(request);
} catch (e) {
const response = await fetch(uri);
if (response.ok) {
const text = await response.text();
const body = decode(text);
return new Response(body, { headers: { 'Content-Type': 'text/html' } });
}
}
})());
}
});
function decode(str) {
return decodeURIComponent(
some code
);
}
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220930/8fadf1ba/attachment-0001.htm>
More information about the webkit-unassigned
mailing list