Issue metadata
Sign in to add a comment
|
Opening Devtools triggers "only-if-cached" request which cannot be handled by Service Worker
Reported by
aditya.p...@gmail.com,
Mar 19 2018
|
||||||||||||||||||||||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.162 Safari/537.36 Steps to reproduce the problem: 1. Go to instagram.com (logged-in) 2. Open Devtools 3. See error "Uncaught (in promise) TypeError: Failed to execute 'fetch' on 'ServiceWorkerGlobalScope': 'only-if-cached' can be set only with 'same-origin' mode" What is the expected behavior? Unclear to me why devtools is making this request. Seems like a regression. What went wrong? Uncaught (in promise) TypeError: Failed to execute 'fetch' on 'ServiceWorkerGlobalScope': 'only-if-cached' can be set only with 'same-origin' mode Did this work before? Yes Chrome version: 65.0.3325.162 Channel: stable OS Version: OS X 10.13.3 Flash Version: Reference: https://github.com/paulirish/caltrainschedule.io/issues/49
,
Mar 20 2018
Unable to reproduce the issue on mac 10.13.3 using chrome reported version #65.0.3325.162 and latest canary #67.0.3375.0. Attached a screen shot for reference. Following are the steps followed to reproduce the issue. ------------ 1. Opened instagram.com and logged-into it. 2. Opened Dev tools. 3. Did not observe any error in the console. reporter@ - Could you please check the issue on latest canary #67.0.3375.0 by creating a new profile without any apps and extensions and please let us know if the issue still persist or not. Thanks...!!
,
Mar 20 2018
Sorry, Instagram Service Worker might be behind an A/B. Another way to repro this is https://airhorner.com/ 1. Make sure you clear the existing cache storage/service worker. 2. Open https://airhorner.com/ 3. Open Devtools. Able to reproduce on Version 67.0.3376.1 (Official Build) canary (64-bit)
,
Mar 20 2018
Thank you for providing more feedback. Adding the requester to the cc list. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Mar 21 2018
Unable to reproduce the issue on mac 10.13.3 using chrome version #67.0.3376.1. Attached a screen cast for reference. Following are the steps followed to reproduce the issue. ------------ 1. Cleared the existing cache storage and service worker from application tab of dev tools. 2. Opened https://airhorner.com/ 3. Opened Devtools. 4. Did not observe any error logged in console, rather service worker got registered. reporter@ - Could you please check the attached screen cast and please let us know if anything missed from our end. Thanks...!!
,
Mar 22 2018
@krajshree@chromium.org, looks like you cleared the site data on the new tab page, not on the airhorner.com domain. Could you repeat the test but following these exact steps. 1. Go to https://airhorner.com/, make sure Service Workers are registered. 2. Open Devtools -> Application tab, right click on "Cache Storage" under "Cache" and refresh caches. 3. Close devtools. 4. Close tab. 5. Open https://airhorner.com/ and open devtools to see the error.
,
Mar 22 2018
Thank you for providing more feedback. Adding the requester to the cc list. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Mar 23 2018
Unable to reproduce the issue on mac 10.13.3 using chrome stable #65.0.3325.181 and latest canary #67.0.3378.0. Attached a screen cast for reference. Following are the steps followed to reproduce the issue. ------------ 1. Navigated to https://airhorner.com/, and made sure Service Workers are registered. 2. Opened Devtools -> Application tab, right clicked on "Cache Storage" under "Cache" and refreshed caches. 3. Closed devtools. 4. Closed tab. 5. Opened https://airhorner.com/ and did not find any error in console rather showed as Service Worker Ready Service Worker Registered Removing Needs-Bisect label as the issue is not reproducible from TE-end and requesting someone from Platform>DevTools team to please have a look into the issue. Thanks...!!
,
Apr 2 2018
I was able to reproduce only after manually selecting each item in Cache Storage and clearing with the "Clear selected" 'x' toolbar button. Reproduces in Chrome, but not Firefox.
,
Apr 24 2018
@eostroukhov@chromium.org I am still able to reproduce this on the latest version of Chrome.
,
May 22 2018
I have the same issue and can reproduce on Chrome version 66.0.3359.181 (Official Build)(64-bit) and Chrome Version 68.0.3437.1
,
May 29 2018
Someone just reported this issues here as well: https://github.com/NekR/offline-plugin/issues/385 Is this devtools only issue? How can it affect users? Should every service-worker library silent this error until it's being fixed in the browser? Thanks.
,
Aug 31
Getting same error for me with workbox plugin v3.
,
Sep 26
i am also getting the same error in https://wwww.ujjawalpackers.in
,
Oct 12
,
Nov 2
,
Nov 2
,
Nov 5
One theory is DevTools is creating this request in order to get resource information for view-source. Maybe here: https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/inspector/inspector_resource_content_loader.cc?l=84&rcl=ab49452b3e9d18fe8edf23a8dae63a797c6b6da2 This likely causes the console error on sites whose service workers do event.respondWith(fetch(event.request)) when event.request is cross-origin. One option could be to skip service workers for this request by calling resource_request.SetSkipServiceWorker(true).
,
Nov 5
Or maybe we could make that request use the "same-origin" mode so its legal per the fetch spec. In theory the fetch spec says the platform shouldn't be able to make such a request at all.
,
Nov 5
Same issue here. evt.respondWith(fetch(request)); triggers Uncaught (in promise) TypeError: Failed to execute 'fetch' on 'ServiceWorkerGlobalScope': 'only-if-cached' can be set only with 'same-origin' mode Just trying to intercept request to add auth tokens.
,
Nov 6
c#19: I thought that might break for cross-origin resources, but yea worth exploring.
,
Nov 14
,
Nov 24
,
Nov 28
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/a403b514c352ab2eed9b11dfce3f3b7c29989b85 commit a403b514c352ab2eed9b11dfce3f3b7c29989b85 Author: Joey Arhar <jarhar@chromium.org> Date: Wed Nov 28 02:06:15 2018 [DevTools] Prevent css enable fetch from notifying service workers Bug: 823392 Change-Id: I23d47a25a47c5be77971fcde0f24a4bc591788fd Reviewed-on: https://chromium-review.googlesource.com/c/1350170 Commit-Queue: Joey Arhar <jarhar@chromium.org> Reviewed-by: Dmitry Gozman <dgozman@chromium.org> Cr-Commit-Position: refs/heads/master@{#611512} [modify] https://crrev.com/a403b514c352ab2eed9b11dfce3f3b7c29989b85/third_party/blink/renderer/core/inspector/inspector_resource_content_loader.cc [add] https://crrev.com/a403b514c352ab2eed9b11dfce3f3b7c29989b85/third_party/blink/web_tests/http/tests/inspector-protocol/service-worker/intercept-css-enable-fetch-expected.txt [add] https://crrev.com/a403b514c352ab2eed9b11dfce3f3b7c29989b85/third_party/blink/web_tests/http/tests/inspector-protocol/service-worker/intercept-css-enable-fetch.js [add] https://crrev.com/a403b514c352ab2eed9b11dfce3f3b7c29989b85/third_party/blink/web_tests/http/tests/inspector-protocol/service-worker/resources/repeat-fetch-service-worker.html [add] https://crrev.com/a403b514c352ab2eed9b11dfce3f3b7c29989b85/third_party/blink/web_tests/http/tests/inspector-protocol/service-worker/resources/repeat-fetch-service-worker.js
,
Nov 28
Won't the fix in #c25 run into problems on sites that in some way generate different css from the service worker compared to the network? It seems like devtools might show different css from what the page is actually running with. One possible fix would be to generate go to service worker for same-origin stylesheets and set mode:same-origin in fetch() so the error is not hit. For cross-origin stylesheets skipping the service worker may just be necessary since only-if-cached is not supported for content in that case.
,
Nov 28
wanderview@ I see, since the service worker could change the responses of requests we send we should go through it when we can. I will look into it.
,
Nov 30
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/145c32ab33ab879ecacfa039dc4ce832bbf790d4 commit 145c32ab33ab879ecacfa039dc4ce832bbf790d4 Author: Joey Arhar <jarhar@chromium.org> Date: Fri Nov 30 01:47:21 2018 [DevTools] Make css enable fetch compatible with service workers This is a replacement for the fix made in https://chromium-review.googlesource.com/c/chromium/src/+/1350170 which uses the same-origin mode instead of bypassing service workers in order to make sure changes made by the service worker get into devtools properly. Bug: 823392 Change-Id: I7773a0281d52ebeddc1aa3b9facb7353f7fd1dcc Reviewed-on: https://chromium-review.googlesource.com/c/1353991 Commit-Queue: Joey Arhar <jarhar@chromium.org> Reviewed-by: Dmitry Gozman <dgozman@chromium.org> Cr-Commit-Position: refs/heads/master@{#612491} [modify] https://crrev.com/145c32ab33ab879ecacfa039dc4ce832bbf790d4/third_party/blink/renderer/core/inspector/inspector_resource_content_loader.cc [modify] https://crrev.com/145c32ab33ab879ecacfa039dc4ce832bbf790d4/third_party/blink/web_tests/http/tests/inspector-protocol/service-worker/intercept-css-enable-fetch-expected.txt [modify] https://crrev.com/145c32ab33ab879ecacfa039dc4ce832bbf790d4/third_party/blink/web_tests/http/tests/inspector-protocol/service-worker/intercept-css-enable-fetch.js [modify] https://crrev.com/145c32ab33ab879ecacfa039dc4ce832bbf790d4/third_party/blink/web_tests/http/tests/inspector-protocol/service-worker/resources/repeat-fetch-service-worker.js
,
Nov 30
Thanks for the help wanderview@ and falken@ |
|||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||
Comment 1 by krajshree@chromium.org
, Mar 20 2018