Auto merge of #26450 - PeterZhizhin:add_referrerpolicy_to_list_of_relevant_mutations, r=jdm

Add referrerpolicy to list of relevant mutations

<!-- Please describe your changes on the following line: -->

`img.referrerPolicy` change now mutates the image.
Not all `referrerPolicy` attribute changes result in an image update event.
Only valid changes are reflected.

All referrerpolicy tests inside `relevant-mutations.html` WPT test now pass.

---
<!-- 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 #26388

<!-- Either: -->
- [x] These have tests:
```
./mach test-wpt tests/wpt/web-platform-tests/html/semantics/embedded-content/the-img-element/relevant-mutations.html
```
This commit is contained in:
bors-servo 2020-05-07 08:45:12 -04:00 committed by GitHub
commit 6aec2c8594
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 58 additions and 54 deletions

View file

@ -126,6 +126,22 @@ pub enum ReferrerPolicy {
StrictOriginWhenCrossOrigin,
}
impl ToString for ReferrerPolicy {
fn to_string(&self) -> String {
match self {
ReferrerPolicy::NoReferrer => "no-referrer",
ReferrerPolicy::NoReferrerWhenDowngrade => "no-referrer-when-downgrade",
ReferrerPolicy::Origin => "origin",
ReferrerPolicy::SameOrigin => "same-origin",
ReferrerPolicy::OriginWhenCrossOrigin => "origin-when-cross-origin",
ReferrerPolicy::UnsafeUrl => "unsafe-url",
ReferrerPolicy::StrictOrigin => "strict-origin",
ReferrerPolicy::StrictOriginWhenCrossOrigin => "strict-origin-when-cross-origin",
}
.to_string()
}
}
impl From<ReferrerPolicyHeader> for ReferrerPolicy {
fn from(policy: ReferrerPolicyHeader) -> Self {
match policy {