Upstream service worker "request" tests to WPT
Re-locate test file to Web Platform Test directory for eventual
automated upstreaming. Update resource URLs to suitable values for that
project. Schedule frame removal to occur following test completion.
Introduce a "use strict" directive.
This test exists in both WPT and the Chromium project tree, although the
two implementations differ in the following ways:
- Test structure - the WPT version uses `async_test` while the Chromium
version uses `promise_test`
- Client-worker communication - the WPT version mediates communication
between the client and the service worker via a dedicated
MessageChannel. The Chromium version implements this communication via
the "Handle Fetch" mechanism.
- "User-Agent" header assertion - the WPT version asserts that the
"User-Agent" header is not set while the Chromium version asserts that
it is set to the value of the client document's `navigator.userAgent`
string (the former is correct)
- "Request construction assertion" - the Chromium version asserts that
the expected exception is thrown when attempting to construct a new
Request instance from the intercepted instance. The WPT version makes
no such assertion.
Modify the WPT version to use the test structure from the Chromium
version, as this improves test readability. Adopt the communication
solution from the Chromium version, as this improves maintainability and
makes the test less susceptible to failure from unrelated bugs. Persist
the "User-Agent" assertion from the WPT version and incorporate the
"Request construction" assertion from the Chromium version. Add "use
strict" directives to the test files.
Because Chromium continues to fail the WPT version of the test, the
Chromium version cannot be removed without negatively effecting test
coverage in that project. Persist the Chromium version of the test, but
re-name the file, remove the faulty assertion, and add a comment
documenting its deprecated status.