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

@ -162,9 +162,6 @@ impl VirtualMethods for HTMLBodyElement {
let do_super_mutate = 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());
// https://html.spec.whatwg.org/multipage/
// #event-handlers-on-elements,-document-objects,-and-window-objects:event-handlers-3
match name {
@ -175,7 +172,9 @@ impl VirtualMethods for HTMLBodyElement {
&atom!("onresize") | &atom!("onunload") | &atom!("onerror")
=> {
let evtarget = window.upcast::<EventTarget>(); // forwarded event
evtarget.set_event_handler_uncompiled(cx, url, reflector,
let source_line = 1; //TODO(#9604) obtain current JS execution line
evtarget.set_event_handler_uncompiled(window.get_url(),
source_line,
&name[2..],
DOMString::from((**attr.value()).to_owned()));
false