mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Check CSP for inline event handlers (#36510)
This also ensures that document now reports all violations and we set the correct directive. With these changes, all `script-src-attr-elem` WPT tests pass. Part of #36437 Requires servo/rust-content-security-policy#3 to land first Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
This commit is contained in:
parent
70b3e24816
commit
2a81987590
64 changed files with 58 additions and 569 deletions
|
@ -1084,14 +1084,14 @@ impl VirtualMethods for HTMLElement {
|
|||
let element = self.as_element();
|
||||
match (attr.local_name(), mutation) {
|
||||
(name, AttributeMutation::Set(_)) if name.starts_with("on") => {
|
||||
let source = &**attr.value();
|
||||
let evtarget = self.upcast::<EventTarget>();
|
||||
let source_line = 1; //TODO(#9604) get current JS execution line
|
||||
evtarget.set_event_handler_uncompiled(
|
||||
self.owner_window().get_url(),
|
||||
source_line,
|
||||
&name[2..],
|
||||
// FIXME(ajeffrey): Convert directly from AttrValue to DOMString
|
||||
DOMString::from(&**attr.value()),
|
||||
source,
|
||||
);
|
||||
},
|
||||
(&local_name!("form"), mutation) if self.is_form_associated_custom_element() => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue