Auto merge of #23183 - krk:fix-23144, r=asajeffrey

Replace panic with warn in DocumentLoader.finish_load.

Fix panic on broken script URL with an onerror handler that rewrites the document.

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

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

<!-- 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/23183)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2019-04-11 14:33:44 -04:00 committed by GitHub
commit db9300d3e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -167,8 +167,12 @@ impl DocumentLoader {
.blocking_loads
.iter()
.position(|unfinished| *unfinished == *load);
self.blocking_loads
.remove(idx.unwrap_or_else(|| panic!("unknown completed load {:?}", load)));
match idx {
Some(i) => {
self.blocking_loads.remove(i);
},
None => warn!("unknown completed load {:?}", load),
}
}
pub fn is_blocked(&self) -> bool {