mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Auto merge of #14679 - jdm:nowarntimer, r=asajeffrey
Warn when a timer event is processed for a discarded document. Turn a panic into a warning for a situation that is easy to hit in web content. - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #14677 - [X] There are tests for these changes <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14679) <!-- Reviewable:end -->
This commit is contained in:
commit
f0a74ee0d2
3 changed files with 25 additions and 2 deletions
|
@ -1049,8 +1049,11 @@ impl ScriptThread {
|
||||||
TimerSource::FromWorker => panic!("Worker timeouts must not be sent to script thread"),
|
TimerSource::FromWorker => panic!("Worker timeouts must not be sent to script thread"),
|
||||||
};
|
};
|
||||||
|
|
||||||
let window = self.documents.borrow().find_window(pipeline_id)
|
let window = self.documents.borrow().find_window(pipeline_id);
|
||||||
.expect("ScriptThread: received fire timer msg for a pipeline not in this script thread. This is a bug.");
|
let window = match window {
|
||||||
|
Some(w) => w,
|
||||||
|
None => return warn!("Received fire timer msg for a closed pipeline {}.", pipeline_id),
|
||||||
|
};
|
||||||
|
|
||||||
window.handle_fire_timer(id);
|
window.handle_fire_timer(id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15104,6 +15104,12 @@
|
||||||
"url": "/_mozilla/mozilla/textcontent.html"
|
"url": "/_mozilla/mozilla/textcontent.html"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"mozilla/timeout-in-discarded-document.html": [
|
||||||
|
{
|
||||||
|
"path": "mozilla/timeout-in-discarded-document.html",
|
||||||
|
"url": "/_mozilla/mozilla/timeout-in-discarded-document.html"
|
||||||
|
}
|
||||||
|
],
|
||||||
"mozilla/timer_eventInvalidation.html": [
|
"mozilla/timer_eventInvalidation.html": [
|
||||||
{
|
{
|
||||||
"path": "mozilla/timer_eventInvalidation.html",
|
"path": "mozilla/timer_eventInvalidation.html",
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<!doctype html>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Timeout in a discarded document doesn't break the browser.</title>
|
||||||
|
<script src="/resources/testharness.js"></script>
|
||||||
|
<script src="/resources/testharnessreport.js"></script>
|
||||||
|
<iframe></iframe>
|
||||||
|
<script>
|
||||||
|
async_test(function(t) {
|
||||||
|
var i = document.querySelector('iframe');
|
||||||
|
i.contentWindow.setTimeout(function() {}, 10);
|
||||||
|
i.remove();
|
||||||
|
t.step_timeout(function() { t.done() }, 100);
|
||||||
|
});
|
||||||
|
</script>
|
Loading…
Add table
Add a link
Reference in a new issue