Srcdoc context documents are currently not service worker clients and not covered by their parent’s service worker. That results in some discrepancies (e.g. Resource Timing reports the URLs that these document load, but service worker doesn’t intercept them). This aims to fix the discrepancies by creating service worker clients for srcdoc iframes and make them inherit parent's service worker controller.
There are basic consensus on spec discussion to make srcdoc iframes inherit parent's service worker controller: - https://github.com/w3c/ServiceWorker/issues/765 - https://github.com/whatwg/html/pull/2809 - https://github.com/whatwg/html/pull/3725 - https://github.com/web-platform-tests/wpt/pull/4610 and Firefox/Safari are already passing basic tests: - https://wpt.fyi/results/service-workers/service-worker/about-blank-replacement.https.html?label=experimental&label=master&aligned ("Nested about:srcdoc is controlled and ..." subtest). While - The actual spec PRs are not yet merged/finalized. - There are minor behevior differences regarding to sandbox attribute interaction (https://chromium-review.googlesource.com/c/chromium/src/+/6085871/comment/5e2b64cc_e0e5b3f1/) it's still beneficial to make Chromium catch up, to provide the basic consistent behavior across browsers.
Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?
None
With this feature, the srcdoc iframe and service worker interaction can be debugged the same way as other iframes. When it is controlled by a service worker, all the normal Service Worker APIs like navigator.serviceWorker.controller work for the frame the same way as other frames, and service worker APIs like clients.matchAll() work the same way for this type of clients.
Basic test at https://wpt.fyi/results/service-workers/service-worker/about-blank-replacement.https.html?label=experimental&label=master&aligned As part of the feature work, we are adding a new srcdoc-iframe.https.html test in the same folder.
Shipping on desktop | 135 |
Shipping on Android | 135 |
Shipping on WebView | 135 |
Open questions about a feature may be a source of future web compat or interop issues. Please list open issues (e.g. links to known github issues in the project for the feature specification) whose resolution may introduce web compat/interop risk (e.g., changing to naming or structure of the API in a non-backward-compatible way).
NoneContact emails
lz...@microsoft.com, yyana...@chromium.orgExplainer
NoneSpecification
https://github.com/w3c/ServiceWorker/issues/765
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/67a9a231.2b0a0220.2908d.03c1.GAE%40google.com.
Hi, comment below.On Sun, Feb 9, 2025 at 10:52 PM Chromestatus <ad...@cr-status.appspotmail.com> wrote:Contact emails
lz...@microsoft.com, yyana...@chromium.orgExplainer
NoneSpecification
https://github.com/w3c/ServiceWorker/issues/765This is an issue and not a specification. Is the srcdoc change in behavior here landed in the service worker specification?
Note: Sandboxed iframe
s without the sandboxing directives, allow-same-origin
and allow-scripts
, result in having the active service worker value of null as their origin is an opaque origin.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.
I'll refrain from giving formal LGTM to let more discussion settle, but I want to provide my API owner perspective that we should approve this without requiring the specification work to finish up.Specifying this is unfortunately very complex. There have been multiple attempts (2015, 2018). Each time we have uncovered foundational issues in the HTML spec, or the service workers spec, or the interaction between them, which have made specifying the behavior rigorously difficult.Over time, we've made significant progress on these foundations, e.g. the original 2015 attempt spawned the introduction of the now-foundational "environment" concept. And 1.5 years ago we landed the big navigation and session history rewrite, which let Dom Farolino make a series of improvements to the srcdoc iframe specification in general.I'm optimistic that we could now specify the behavior described in this Intent! ... With significant effort. And Monica, the new service worker spec editor, has recently indicated interest in taking on that effort!But I don't think we should block on that. The desired behavior has been known since 2015, and Firefox and Safari have mostly aligned on it.I think we should aim for a good balance of effort and interop, by:
- Putting extra effort into landing an exhaustive test suite, as part of this intent
- Updating Chromium to conform to that test suite, by approving this intent
- And then, asynchronously, focus on getting the spec updated, and getting all browsers to converge on the edge cases that the test suite uncovers.
Regarding the test suite, can the Intent authors confirm that all the cases from this 2017 test suite PR are included? I want to make sure we have at least that much coverage.
On Thursday, February 13, 2025 at 5:50:24 AM UTC+1 Domenic Denicola wrote:I'll refrain from giving formal LGTM to let more discussion settle, but I want to provide my API owner perspective that we should approve this without requiring the specification work to finish up.Specifying this is unfortunately very complex. There have been multiple attempts (2015, 2018). Each time we have uncovered foundational issues in the HTML spec, or the service workers spec, or the interaction between them, which have made specifying the behavior rigorously difficult.Over time, we've made significant progress on these foundations, e.g. the original 2015 attempt spawned the introduction of the now-foundational "environment" concept. And 1.5 years ago we landed the big navigation and session history rewrite, which let Dom Farolino make a series of improvements to the srcdoc iframe specification in general.I'm optimistic that we could now specify the behavior described in this Intent! ... With significant effort. And Monica, the new service worker spec editor, has recently indicated interest in taking on that effort!But I don't think we should block on that. The desired behavior has been known since 2015, and Firefox and Safari have mostly aligned on it.I think we should aim for a good balance of effort and interop, by:
- Putting extra effort into landing an exhaustive test suite, as part of this intent
- Updating Chromium to conform to that test suite, by approving this intent
- And then, asynchronously, focus on getting the spec updated, and getting all browsers to converge on the edge cases that the test suite uncovers.
Regarding the test suite, can the Intent authors confirm that all the cases from this 2017 test suite PR are included? I want to make sure we have at least that much coverage.Friendly ping on this question! :)
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/1845551d-cf76-43c8-aaab-121299b1a49bn%40chromium.org.
LGTM3