Issue metadata
Sign in to add a comment
|
Offline network setting ignored if view-page source is used on a response generated by serviceWorker function which forwards requests and catches failed requests(localhost)
Reported by
chris.hu...@gmail.com,
Jun 12 2018
|
||||||||||||||||||||||
Issue description
UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.79 Safari/537.36
Steps to reproduce the problem:
1. Have serviceworker catch failed fetch request and generate response with html
2. under devtools network tab: disable cache & select offline
3. reload page receiving correct response from service worker
4. view page-source (into new tab via right click -> view page source)
5. reload original tab
What is the expected behavior?
For the tab to behave as though there is no network connection.
What went wrong?
All network fetch requests are made and passed on by chrome. The page source also shows the original page which loads on fulfilled network requests.
Did this work before? N/A
Chrome version: 67.0.3396.79 Channel: stable
OS Version: 4.4.0-57-generic #78-Ubuntu x86_64
Flash Version:
This is all the serviceWorker code minus the response body. It forwards all requests from/for the page and creates response, containing simple html, if request fails.
self.addEventListener("fetch", function(event) {
event.respondWith(
fetch(event.request).catch(function() {
return new Response(
responseContent,
{headers: {"Content-Type": "text/html"}}
);
})
);
});
,
Jun 12 2018
Thanks for filing the issue! @Reporter: if possible could you please provide the sample test file/URL that reproduces the issue which help in further triaging the issue from TE end. Thanks!
,
Jun 12 2018
,
Jun 13 2018
,
Jun 13 2018
@viswa.karala FYI I posted a sample app repo with repro steps in the duplicate ticket: 852127
,
Jun 13 2018
https://danishled.com/debug/ an example on my server reduced to the bare minimum of code. After some more playing the problem is temperamental ie sometimes it works correctly but if the view-source shows the original 'online' page then devtools will ignore the offline setting. |
|||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||
Comment 1 by krajshree@chromium.org
, Jun 12 2018