Skip to content

Commit

Permalink
check for a document being "fully-active" before reflows
Browse files Browse the repository at this point in the history
  • Loading branch information
gterzian committed Dec 23, 2018
1 parent eb82e78 commit 7530faa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion components/script/dom/document.rs
Expand Up @@ -1741,7 +1741,11 @@ impl Document {
self.process_deferred_scripts();
},
LoadType::PageSource(_) => {
if self.has_browsing_context {
if self.has_browsing_context && self.is_fully_active() {
// Note: if the document is not fully active, the layout thread will have exited already.
// The underlying problem might actually be that layout exits while it should be kept alive.
// See https://github.com/servo/servo/issues/22507

// Disarm the reflow timer and trigger the initial reflow.
self.reflow_timeout.set(None);
self.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage);
Expand Down
4 changes: 4 additions & 0 deletions components/script/script_thread.rs
Expand Up @@ -1314,6 +1314,10 @@ impl ScriptThread {
// into this loop too, but for now it's only images.
debug!("Issuing batched reflows.");
for (_, document) in self.documents.borrow().iter() {
// Step 13
if !document.is_fully_active() {
continue;
}
let window = document.window();
let pending_reflows = window.get_pending_reflow_count();
if pending_reflows > 0 {
Expand Down
@@ -1,5 +1,4 @@
[active.window.html]
expected: CRASH
[document.open() removes the document's children (non-active document without an associated Window object; createHTMLDocument)]
expected: FAIL
Expand Down

0 comments on commit 7530faa

Please sign in to comment.