New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 851752 link

Starred by 1 user

Issue metadata

Status: Duplicate
Merged: issue 852127
Owner:
Last visit > 30 days ago
Closed: Jun 2018
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Bug



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"}}
      );
    })
  );
});
 
Screenshot from 2018-06-12 00-57-24.png
192 KB View Download
Labels: Needs-Triage-M67
Labels: Needs-Feedback Triaged-ET
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!

Comment 3 by l...@chromium.org, Jun 12 2018

Owner: eostroukhov@chromium.org
Status: Assigned (was: Unconfirmed)

Comment 4 by l...@chromium.org, Jun 13 2018

Mergedinto: 852127
Status: Duplicate (was: Assigned)
@viswa.karala FYI I posted a sample app repo with repro steps in the duplicate ticket: 852127
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.
app.js
258 bytes View Download
index.html
162 bytes View Download
serviceworker.js
341 bytes View Download

Sign in to add a comment