diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2016-11-25 16:19:19 +0100 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2016-11-28 23:05:56 +0100 |
commit | 4d93ee134c84d72f73d7a5556bd2dcaf36e5ca99 (patch) | |
tree | 7f57f6c9a027c9742db9ebce25e30fe654e5a94d /components/script/dom/htmlscriptelement.rs | |
parent | 708ebdceee50547d03713d32c5207c1fa870f902 (diff) | |
download | servo-4d93ee134c84d72f73d7a5556bd2dcaf36e5ca99.tar.gz servo-4d93ee134c84d72f73d7a5556bd2dcaf36e5ca99.zip |
Implement document.write (fixes #3704)
This is a bit crude because of some missing utility methods on BufferQueue.
Diffstat (limited to 'components/script/dom/htmlscriptelement.rs')
-rw-r--r-- | components/script/dom/htmlscriptelement.rs | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs index 18a9a89b433..255137a939d 100644 --- a/components/script/dom/htmlscriptelement.rs +++ b/components/script/dom/htmlscriptelement.rs @@ -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(); |