diff options
author | Chocolate Pie <106949016+chocolate-pie@users.noreply.github.com> | 2024-08-02 02:26:44 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-01 17:26:44 +0000 |
commit | 92866ab911cb65d09b6b46bc1fb26868854cbafe (patch) | |
tree | 7cb50444580f91ebf55b3a05d2bd638724dd7f93 /components/script/dom/htmlmetaelement.rs | |
parent | 2cf207ddc8133f1abb85704d2d0eee9e26b52723 (diff) | |
download | servo-92866ab911cb65d09b6b46bc1fb26868854cbafe.tar.gz servo-92866ab911cb65d09b6b46bc1fb26868854cbafe.zip |
enhance: Add support for `unsafe-eval` and `wasm-unsafe-eval` (#32893)
Signed-off-by: Chocolate Pie <106949016+chocolate-pie@users.noreply.github.com>
Diffstat (limited to 'components/script/dom/htmlmetaelement.rs')
-rw-r--r-- | components/script/dom/htmlmetaelement.rs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/components/script/dom/htmlmetaelement.rs b/components/script/dom/htmlmetaelement.rs index 60efbb474cb..1cbd709ae1a 100644 --- a/components/script/dom/htmlmetaelement.rs +++ b/components/script/dom/htmlmetaelement.rs @@ -88,8 +88,10 @@ impl HTMLMetaElement { // https://html.spec.whatwg.org/multipage/#attr-meta-http-equiv } else if !self.HttpEquiv().is_empty() { // TODO: Implement additional http-equiv candidates - if self.HttpEquiv().to_ascii_lowercase().as_str() == "refresh" { - self.declarative_refresh(); + match self.HttpEquiv().to_ascii_lowercase().as_str() { + "refresh" => self.declarative_refresh(), + "content-security-policy" => self.apply_csp_list(), + _ => {}, } } } @@ -115,6 +117,15 @@ impl HTMLMetaElement { } } + /// <https://html.spec.whatwg.org/multipage/#attr-meta-http-equiv-content-security-policy> + fn apply_csp_list(&self) { + if let Some(parent) = self.upcast::<Node>().GetParentElement() { + if let Some(head) = parent.downcast::<HTMLHeadElement>() { + head.set_content_security_policy(); + } + } + } + /// <https://html.spec.whatwg.org/multipage/#shared-declarative-refresh-steps> fn declarative_refresh(&self) { // 2 |