Auto merge of #24818 - gterzian:fix_panic_on_finish_load, r=jdm

Prevent panic on layout send in finish-load

<!-- Please describe your changes on the following line: -->

Do not run the finish load steps if the pipeline has been discarded by the time the parser finishes.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #22955 (GitHub issue number if applicable)

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
bors-servo 2019-11-22 03:12:59 -05:00 committed by GitHub
commit 1b524ead1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2847,6 +2847,14 @@ impl ScriptThread {
let document = self.documents.borrow_mut().remove(id);
// Abort the parser, if any,
// to prevent any further incoming networking messages from being handled.
if let Some(document) = document.as_ref() {
if let Some(parser) = document.get_current_parser() {
parser.abort();
}
}
// We should never have a pipeline that's still an incomplete load,
// but also has a Document.
debug_assert!(idx.is_none() || document.is_none());