Fix referrer policy inheritance WPT for javascript: URLs
According to the specification, executing a javascript: URL in a document does not commit a new document. Indeed, following https://html.spec.whatwg.org/multipage/browsing-the-web.html#javascript-protocol executing a javascript: URL request gives a response whose status is 204, and processing a response with status 204 does not commit a new document: https://html.spec.whatwg.org/multipage/browsing-the-web.html#process-a-navigate-response In particular, executing a javascript: URL does not change the document's URL. So if we create a new (empty) iframe and execute right away some javascript: URL in it, the URL of the iframe document will be "about:blank". On the other side, a document with URL "about:blank" will usually not send any Referer header, since the algorithm for determining the outgoing referrer goes through the stripping section https://w3c.github.io/webappsec-referrer-policy/#strip-url which returns `no-referrer` for a local scheme. As a consequence, we should always expect the Referer header of an outgoing fetch request from an `<iframe src="javascript:...">` without custom referrer to be empty. This CL adjusts the referrer policy inheritance WP test to that. Still, we want to test that the referrer policy is inherited correctly for javascript: URLs. For doing that, we add a custom referrer to the outgoing fetch request, and we check that the content of the received Referer header corresponds to the custom referrer modulo the inherited referrer policy. Change-Id: Ib3fe0808d3f8a1790e3f565cf2b1648fd2ea6c13 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2464930 Commit-Queue: Antonio Sartori <antoniosartori@chromium.org> Reviewed-by:Dominic Farolino <dom@chromium.org> Cr-Commit-Position: refs/heads/master@{#821284}
Showing
Please register or sign in to comment