Implement document.write (fixes #3704)

This is a bit crude because of some missing utility methods on BufferQueue.
This commit is contained in:
Anthony Ramine 2016-11-25 16:19:19 +01:00
parent 708ebdceee
commit 4d93ee134c
91 changed files with 235 additions and 585 deletions

View file

@ -469,19 +469,20 @@ impl HTMLScriptElement {
Ok(script) => script,
};
if script.external {
debug!("loading external script, url = {}", script.url);
}
// TODO(#12446): beforescriptexecute.
if self.dispatch_before_script_execute_event() == EventStatus::Canceled {
return;
}
// Step 3.
// TODO: If the script is from an external file, then increment the
// ignore-destructive-writes counter of the script element's node
// document. Let neutralised doc be that Document.
let neutralized_doc = if script.external {
debug!("loading external script, url = {}", script.url);
let doc = document_from_node(self);
doc.incr_ignore_destructive_writes_counter();
Some(doc)
} else {
None
};
// Step 4.
let document = document_from_node(self);
@ -500,8 +501,9 @@ impl HTMLScriptElement {
document.set_current_script(old_script.r());
// Step 7.
// TODO: Decrement the ignore-destructive-writes counter of neutralised
// doc, if it was incremented in the earlier step.
if let Some(doc) = neutralized_doc {
doc.decr_ignore_destructive_writes_counter();
}
// TODO(#12446): afterscriptexecute.
self.dispatch_after_script_execute_event();