mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Implement document.write (fixes #3704)
This is a bit crude because of some missing utility methods on BufferQueue.
This commit is contained in:
parent
708ebdceee
commit
4d93ee134c
91 changed files with 235 additions and 585 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue