mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Implement inline CSP check for style element (#36860)
Part of #4577 Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com> Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
This commit is contained in:
parent
d73b7653b4
commit
e9f364ef51
14 changed files with 23 additions and 59 deletions
|
@ -4,6 +4,7 @@
|
|||
|
||||
use std::cell::Cell;
|
||||
|
||||
use content_security_policy as csp;
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever::{LocalName, Prefix};
|
||||
use js::rust::HandleObject;
|
||||
|
@ -97,8 +98,21 @@ impl HTMLStyleElement {
|
|||
return;
|
||||
}
|
||||
|
||||
let window = node.owner_window();
|
||||
let doc = self.owner_document();
|
||||
|
||||
// Step 5: If the Should element's inline behavior be blocked by Content Security Policy? algorithm
|
||||
// returns "Blocked" when executed upon the style element, "style",
|
||||
// and the style element's child text content, then return. [CSP]
|
||||
if doc.should_elements_inline_type_behavior_be_blocked(
|
||||
self.upcast(),
|
||||
csp::InlineCheckType::Style,
|
||||
&node.child_text_content(),
|
||||
) == csp::CheckResult::Blocked
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
let window = node.owner_window();
|
||||
let data = node
|
||||
.GetTextContent()
|
||||
.expect("Element.textContent must be a string");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue