Compile raw inline event handlers lazily. Resolves #8489.

This commit is contained in:
Josh Matthews 2015-11-12 11:20:08 -05:00 committed by Ms2ger
parent 3703e6d4f6
commit 2796a4dfa8
11 changed files with 323 additions and 67 deletions

View file

@ -453,12 +453,10 @@ impl VirtualMethods for HTMLElement {
self.super_type().unwrap().attribute_mutated(attr, mutation);
match (attr.local_name(), mutation) {
(name, AttributeMutation::Set(_)) if name.starts_with("on") => {
let window = window_from_node(self);
let (cx, url, reflector) = (window.get_cx(),
window.get_url(),
window.reflector().get_jsobject());
let evtarget = self.upcast::<EventTarget>();
evtarget.set_event_handler_uncompiled(cx, url, reflector,
let source_line = 1; //TODO(#9604) get current JS execution line
evtarget.set_event_handler_uncompiled(window_from_node(self).get_url(),
source_line,
&name[2..],
// FIXME(ajeffrey): Convert directly from AttrValue to DOMString
DOMString::from(&**attr.value()));