-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tests to verify origin headers sent by ping #21485
Conversation
There are no reviewers for this pull request. Please reach out on W3C's irc server (irc.w3.org, port 6665) on channel #testing (web client) to get help with this. Thank you! |
@annevk any idea for the testRunner references? This only needed for chromium. I noticed webnfc uses testRunner as well, not sure how acceptable that is? |
Sorry, I don't really know what that is. @jgraham might know? |
f581076
to
fef9358
Compare
(Copying what I wrote in the chromium codereview). The testRunner preference override is required by [1] at least for Chromium (and maybe WebKit?). So we have to keep the window.testRunner reference. I think we can do this by adding a script to resources/chromium called enable-hyperlink-auditing.js or something that simply calls the overridePreference method. Then, we can follow what [2] did, and modify the lint whitelist to allow this, and simply import the script to all of the tests that need it. |
Thanks Dominic, that makes sense, I'll try to implement this today. |
fef9358
to
4bb7185
Compare
I think this is ready for review after Dominic's suggestions. I think the test expectations are correct since nothing is set for referrer-policy, so the default empty string is used, and according to |
@annevk care for another review, now the testRunner issue is addressed? :) |
<title>Ping attribute Origin Header No Referrer Policy</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<meta name='referrer' content='no-referrer'> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't https://fetch.spec.whatwg.org/#append-a-request-origin-header cause the origin to be null here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you are right. So setting referrer to no-referrer only has an effect on the request's referrer, not its origin header, correct? I updated header-origin-no-referrer.html.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the confusion, I meant "setting referrer to no-referrer" in this context )not the meta tag):
https://html.spec.whatwg.org/multipage/links.html#hyperlink-auditing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It has an effect on the request's Origin
header as well as the request's Referer
header. (It does not always affect the Origin
header, that algorithm defines when it does.)
Does that help?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean https://fetch.spec.whatwg.org/#append-a-request-origin-header right, in case of not GET/HEAD? Right in my examples only no-referrer case is triggered, as the tests are same-origin and same protocol.
Just a general note on the duplication: I notice each test is basically the same with the exception of a couple lines. I wonder if it would be feasible to make one test file that opens a bunch of windows for each test, with parameters that describe each test case, like https://github.com/web-platform-tests/wpt/blob/master/workers/modules/dedicated-worker-import-referrer.html#L61-L79. I'd prefer that approach if it is reasonable to implement, but am not against the one here |
4bb7185
to
79c6f5f
Compare
https://web-platform-tests.org/writing-tests/testharness.html#variants would be the way to avoid duplication I think in combination with the sub pipe https://web-platform-tests.org/writing-tests/server-pipes.html (though that doesn't seem to document how to insert a variant). @zcorpan? I'm also gonna approve this though as I don't think we've made a decision as a project to block on such things... Up to Rob. |
Thanks, those are great ideas. I'll land this now and try to clean up later, as the similar tests for referer in the same directory will need the same treatment. |
@annevk do you mean using something like
? |
@zcorpan yeah, something like that (I was thinking of the referrer policy value and use some logic for the expected origin). |
I had also forgotten that a variant basically has to be a query string so it would naturally be {{GET}}. |
No description provided.