Auto merge of #7252 - nnethercote:fix-reporter-panics, r=Ms2ger

Fix panics in the script_task memory reporter.

These are caused by page_root being empty.

@jdm, I think it was #6874 that introduced these. I'm seeing them all the time when starting Servo on Reddit with memory profiling enabled. With this patch applied they go away.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7252)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-08-17 08:56:29 -06:00
commit 72fa45155b

View file

@ -1188,7 +1188,9 @@ impl ScriptTask {
let mut urls = vec![];
let mut dom_tree_size = 0;
let mut reports = vec![];
for it_page in self.root_page().iter() {
if let Some(root_page) = self.page.borrow().as_ref() {
for it_page in root_page.iter() {
let current_url = it_page.document().url().serialize();
urls.push(current_url.clone());
@ -1206,6 +1208,7 @@ impl ScriptTask {
size: dom_tree_size,
})
}
}
let path_seg = format!("url({})", urls.join(", "));
reports.extend(ScriptTask::get_reports(self.get_cx(), path_seg));
reports_chan.send(reports);