Auto merge of #22851 - georgeroman:make_blank_target_imply_noopener, r=cybai,jdm

Make blank target imply noopener, implement "opener" link type

<!-- 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 part of #22845

<!-- 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/22851)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2019-03-09 16:49:00 -05:00 committed by GitHub
commit 169b8cf144
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -609,7 +609,14 @@ pub fn follow_hyperlink(subject: &Element, hyperlink_suffix: Option<String>) {
let values = link_types.Value();
let contains_noopener = values.contains("noopener");
let contains_noreferrer = values.contains("noreferrer");
contains_noreferrer || contains_noopener
let contains_opener = values.contains("opener");
let target_is_blank = if let Some(name) = target_attribute_value.as_ref() {
name.Value().to_lowercase() == "_blank"
} else {
false
};
contains_noreferrer || contains_noopener || (!contains_opener && target_is_blank)
} else {
false
};