Skip to content

Commit 94619a9

Browse files
committed
script: LoadBlocker's drop impl shouldn't run after termination.
The logic in LoadBlocker::terminate was modified in servo#34122 to `clone` the LoadBlocker's inner `load` member instead of `take`ing it. However, this member serves as a flag so that `LoadBlocker`'s Drop impl can avoid calling `doc.finish_load` on already terminated loads. The change in unnecessary 'unknown completed load' warnings when Servo is run with logging enabled. This patch also updates the expectations for tests which started passing after the change in servo#34122, but now fail again with this change. These test failures will be investigated in servo#36561. Signed-off-by: Mukilan Thiyagarajan <[email protected]>
1 parent a1b9949 commit 94619a9

6 files changed

+26
-3
lines changed

components/script/document_loader.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,18 @@ impl LoadBlocker {
5050

5151
/// Remove this load from the associated document's list of blocking loads.
5252
pub(crate) fn terminate(blocker: &DomRefCell<Option<LoadBlocker>>, can_gc: CanGc) {
53-
if let Some(this) = blocker.borrow().as_ref() {
54-
let load_data = this.load.clone().unwrap();
55-
this.doc.finish_load(load_data, can_gc);
53+
let Some(load) = blocker
54+
.borrow_mut()
55+
.as_mut()
56+
.and_then(|blocker| blocker.load.take())
57+
else {
58+
return;
59+
};
60+
61+
if let Some(blocker) = blocker.borrow().as_ref() {
62+
blocker.doc.finish_load(load, can_gc);
5663
}
64+
5765
*blocker.borrow_mut() = None;
5866
}
5967
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[Range-cloneContents.html]
2+
bug: https://github.com/servo/servo/issues/36561
3+
expected: ERROR
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[Range-deleteContents.html]
2+
bug: https://github.com/servo/servo/issues/36561
3+
expected: ERROR
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[Range-extractContents.html]
2+
bug: https://github.com/servo/servo/issues/36561
3+
expected: ERROR
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[Range-insertNode.html]
2+
bug: https://github.com/servo/servo/issues/36561
3+
expected: ERROR
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[Range-surroundContents.html]
2+
bug: https://github.com/servo/servo/issues/36561
3+
expected: ERROR

0 commit comments

Comments
 (0)