Auto merge of #18370 - pylbrecht:observer, r=ferjm

An observer disconnected after a mark must receive the mark

<!-- Please describe your changes on the following line: -->
I worked on top of #18283 as suggested [here](https://github.com/servo/servo/issues/18284#issuecomment-326043873).

r? @ferjm

<!-- 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 #18284 (github issue number if applicable).

<!-- 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/18370)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-09-08 13:04:26 -05:00 committed by GitHub
commit 867d542261
2 changed files with 9 additions and 13 deletions

View file

@ -182,6 +182,15 @@ impl Performance {
Some(p) => p,
None => return,
};
if self.pending_notification_observers_task.get() {
if let Some(o) = observers.iter().nth(index) {
DOMPerformanceObserver::new(&self.global(),
o.observer.callback(),
o.observer.entries()).notify();
}
}
observers.remove(index);
}