The test in question is defined across two files, see [2] and [3]. My work-in
progress patch is at [4].
At a high-level, the test takes the following steps:
1. The script attempts to register a new service worker, which triggers a
request for the associated JavaScript file
2. The server responds with the file, specifying `Cache-Control: maxage=3600`
3. The script attempts to register the service worker again, and the test
asserts that no request is made (which is observable in this case by
checking if the script was re-evaluated)
The assertion in step 3 passes when run under Chromium's infrastructure.
Notably, that involves accessing the test from http://127.0.0.1:8000 .
That assertion fails when run under WPT's infrastrcture because another request
is in fact issued, despite the `Cache-Control` header in the previous response.
In contrast to the Chromium infrastructure, the `wptserve` application makes
the test available on the domain https://web-platform.test:8443` (this is
facilitated by a hostfile mapping to 127.0.0.1).
I'm wondering if Chromium has some internal heuristic that is influenced by the
protocol, port, and/or domain. If so, is that defined by some standard? Or is
it a specification-allowed optimization?
Thanks!
Mike
[1] Tracking bug here: https://crbug.com/688116
[2] https://chromium.googlesource.com/chromium/src.git/+/0f5b86386accbd17d06a26475df674a2e1df8bf2/third_party/WebKit/LayoutTests/http/tests/serviceworker/update-served-from-cache.html
[3] https://chromium.googlesource.com/chromium/src.git/+/0f5b86386accbd17d06a26475df674a2e1df8bf2/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/update-served-from-cache-worker.php
[4] https://codereview.chromium.org/2904063003/
--
You received this message because you are subscribed to the Google Groups "net-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to net-dev+unsubscribe@chromium.org.
To post to this group, send email to net...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/net-dev/2d93c296-c433-4f4f-92f7-ef7d1f40fdfd%40chromium.org.
> Does WPT use self-signed certs, along with
ignore-certificate errors? This
> may be due to that.
Yes, WPT uses self-signed certs, and I am running Chromium with that flag.
> If WPT uses HTTP instead of HTTPS, what happens?
The test passes in that case. Service workers are only available
in secure
contexts, which may be provided over HTTP via `localhost` or
`127.0.0.1`.
Unfortunately, WPT cannot support tests that require any specific
domain name
because it is deployed to the web.
It sounds as though this is expected behavior, which makes me
believe it is
allowed by the relevant specifications as a host-defined
optimization. Can you
confirm that? If so, I will proceed by labeling this test as
"Chromium-specific" and aborting my attempts to contribute it to
WPT.
Understood. Thanks, Matt!
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/net-dev/CA%2BOSsVY3wWXALp3FbriOoiHdMTkyoHNy_V-5teObHy1QS9Lr7w%40mail.gmail.com.
> Makes sense. It's unfortunate though that that means we
can't have
> cross-browser tests like this service worker one. It
essentially means we
> won't be able to test things like the upcoming useCache
enum/flag, and
> similar features. We should probably at least file a
web-platform-tests bug
> to track this issue (of spec features that are currently
impossible to test).
I think this is a limitation of standards-based testing generally,
not of the
specific WPT architecture. Even if WPT supported the conditions
that would
satisfy this test in Chromium, WPT couldn't accept the test
because, as Matt
said, "Caching is always best-effort, and never required by spec."
As long as
that's the case, it seems that any tests regarding caching
behavior will
necessarily be vendor-specific. I think that if we wanted to
assert consistent
behavior from a feature like `useCache`/`updateViaCache`, we'd
have to start by
standardizing its effect all the way through HTTP..
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/net-dev/CAEK7mvp1yM_j5DvLvHJBqnDftxRiKkf0drKOdMvnd9ruZhGeOg%40mail.gmail.com.
Thank you for walking me through all that, Ryan! As per my
previous message,
though, I still think we have to omit this test from WPT. If my
interpretation
is correct, it comes down to asserting a "SHOULD." This is
perfectly valid
expectation for Chromium to hold for itself but not appropriate
for a test
suite derived strictly from standards.
I may be wrong though. I've CC'd Anne van Kesteren since he has a
pretty strong
vision for WPT.