queue event instead of immediately fire

created checks to see if parser is in use before event dispatch

changed tests to expect crash and added async style test
This commit is contained in:
ddh 2017-11-20 23:07:10 +00:00
parent 462409ada5
commit 79d896d474
9 changed files with 72 additions and 3 deletions

View file

@ -12,7 +12,6 @@ use dom::bindings::root::{DomRoot, MutNullableDom};
use dom::cssstylesheet::CSSStyleSheet;
use dom::document::Document;
use dom::element::{Element, ElementCreator};
use dom::eventtarget::EventTarget;
use dom::htmlelement::HTMLElement;
use dom::node::{ChildrenMutation, Node, UnbindContext, document_from_node, window_from_node};
use dom::stylesheet::StyleSheet as DOMStyleSheet;
@ -105,9 +104,10 @@ impl HTMLStyleElement {
let sheet = Arc::new(sheet);
// No subresource loads were triggered, just fire the load event now.
// No subresource loads were triggered, queue load event
if self.pending_loads.get() == 0 {
self.upcast::<EventTarget>().fire_event(atom!("load"));
let window = window_from_node(self);
window.dom_manipulation_task_source().queue_simple_event(self.upcast(), atom!("load"), &window);
}
self.set_stylesheet(sheet);