mirror of
https://github.com/servo/servo.git
synced 2025-08-11 16:35:33 +01:00
Auto merge of #17347 - duckinator:fix-issue-17319, r=mbrubeck
Fix setting img src before window.onload causing panic <!-- Please describe your changes on the following line: --> Setting an image source asynchronously (e.g. using `setTimeout` or in the callback of an `XMLHttpRequest`) before `window.onload` fired would cause a panic due to a preexisting load blocker not being terminated before assigning a new one. This PR fixes that and adds a test for it. --- <!-- 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 #17319. <!-- Either: --> - [x] There are tests for these changes <!-- 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. --> <!-- 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/17347) <!-- Reviewable:end -->
This commit is contained in:
commit
04935de3ea
3 changed files with 26 additions and 0 deletions
|
@ -493,6 +493,7 @@ impl HTMLImageElement {
|
|||
request.image = None;
|
||||
request.metadata = None;
|
||||
let document = document_from_node(self);
|
||||
LoadBlocker::terminate(&mut request.blocker);
|
||||
request.blocker = Some(LoadBlocker::new(&*document, LoadType::Image(url.clone())));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue