Implement referrerPolicy for HTMLLinkElement and HTMLScriptElement

This commit is contained in:
YUAN LYU 2020-12-01 00:37:16 -05:00
parent 02af8952eb
commit a999850b24
15 changed files with 50 additions and 668 deletions

View file

@ -13,7 +13,8 @@ use crate::dom::cssstylesheet::CSSStyleSheet;
use crate::dom::document::Document;
use crate::dom::domtokenlist::DOMTokenList;
use crate::dom::element::{
cors_setting_for_element, reflect_cross_origin_attribute, set_cross_origin_attribute,
cors_setting_for_element, reflect_cross_origin_attribute, reflect_referrer_policy_attribute,
set_cross_origin_attribute,
};
use crate::dom::element::{AttributeMutation, Element, ElementCreator};
use crate::dom::htmlelement::HTMLElement;
@ -490,6 +491,14 @@ impl HTMLLinkElementMethods for HTMLLinkElement {
set_cross_origin_attribute(self.upcast::<Element>(), value);
}
// https://html.spec.whatwg.org/multipage/#dom-link-referrerpolicy
fn ReferrerPolicy(&self) -> DOMString {
reflect_referrer_policy_attribute(self.upcast::<Element>())
}
// https://html.spec.whatwg.org/multipage/#dom-link-referrerpolicy
make_setter!(SetReferrerPolicy, "referrerpolicy");
// https://drafts.csswg.org/cssom/#dom-linkstyle-sheet
fn GetSheet(&self) -> Option<DomRoot<DOMStyleSheet>> {
self.get_cssom_stylesheet().map(DomRoot::upcast)