Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upRefactor follow_hyperlink and its callers #22771
Conversation
highfive
commented
Jan 27, 2019
|
Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @avadacatavra (or someone else) soon. |
highfive
commented
Jan 27, 2019
|
Heads up! This PR modifies the following files:
|
highfive
commented
Jan 27, 2019
|
This looks good! I see one more simplification that we can make, then this should be good to merge. |
| @@ -575,15 +571,14 @@ impl Activatable for HTMLAnchorElement { | |||
| } | |||
| } | |||
|
|
|||
| // Step 4. | |||
| //TODO: Download the link is `download` attribute is set. | |||
|
|
|||
| // https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-delivery | |||
| let referrer_policy = match self.RelList().Contains("noreferrer".into()) { | |||
This comment has been minimized.
This comment has been minimized.
jdm
Jan 29, 2019
Member
We should remove this code and replace it by implementing the missing step 12 of follow_hyperlink. You can use the determine_policy_for_token helper function to get a ReferrerPolicy value from a string.
| } | ||
| // Step 2 | ||
| // TODO : We should be choosing a browsing context and navigating to it. | ||
| // Step 3 | ||
| let referrer_policy = match self.RelList().Contains("noreferrer".into()) { |
This comment has been minimized.
This comment has been minimized.
Now they follow the new spec stated at: https://html.spec.whatwg.org/multipage/links.html#following-hyperlinks-2 It seems like choosing a browsing context is already done in the follow_hyperlink method, so I have removed the TODO in activation_behavior for HTMLAreaElement. The tests in tests/wpt/web-platform-tests/html/semantics/links/following-hyperlinks/ pass in release builds, but still don't pass in dev build, since the timeout in tests/wpt/web-platform-tests/html/semantics/links/following-hyperlinks/activation-behavior.window.js seems to be too short for dev builds. Navigating to error page on failed URL parsing is still not implemented. There seem to be potential code duplication in activation_behavior methods for both htmlanchorelement.rs and htmlareaelement.rs, in: let referrer_policy = match self.RelList().Contains("noreferrer".into()) { true => Some(ReferrerPolicy::NoReferrer), false => None, }; I didn't pull them out to a separate function since I don't know where I would put that new function.
aa5517d
to
0bafa61
|
@bors-servo r+ |
|
|
Refactor follow_hyperlink and its callers Now they follow the new spec stated at: https://html.spec.whatwg.org/multipage/links.html#following-hyperlinks-2 It seems like choosing a browsing context is already done in the follow_hyperlink method, so I have removed the TODO in activation_behavior for HTMLAreaElement. The tests in `tests/wpt/web-platform-tests/html/semantics/links/following-hyperlinks/` pass in release builds, but still don't pass in dev build, since the timeout in `tests/wpt/web-platform-tests/html/semantics/links/following-hyperlinks/activation-behavior.window.js` seems to be too short for dev builds. Navigating to error page on failed URL parsing is still not implemented. There seem to be potential code duplication in activation_behavior methods for both htmlanchorelement.rs and htmlareaelement.rs, in: let referrer_policy = match self.RelList().Contains("noreferrer".into()) { true => Some(ReferrerPolicy::NoReferrer), false => None, }; I didn't pull them out to a separate function since I don't know where I would put that new function. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #22761 (GitHub issue number if applicable) <!-- Either: --> - [X] There are tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22771) <!-- Reviewable:end -->
|
|
MaT1g3R commentedJan 27, 2019
•
edited by SimonSapin
Now they follow the new spec stated at:
https://html.spec.whatwg.org/multipage/links.html#following-hyperlinks-2
It seems like choosing a browsing context is already done in the
follow_hyperlink method, so I have removed the TODO in
activation_behavior for HTMLAreaElement.
The tests in
tests/wpt/web-platform-tests/html/semantics/links/following-hyperlinks/pass in release builds, but still don't pass in dev build,
since the timeout in
tests/wpt/web-platform-tests/html/semantics/links/following-hyperlinks/activation-behavior.window.jsseems to be too short for dev builds.
Navigating to error page on failed URL parsing is still not implemented.
There seem to be potential code duplication in activation_behavior
methods for both htmlanchorelement.rs and htmlareaelement.rs, in:
I didn't pull them out to a separate function since I don't know
where I would put that new function.
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is