Auto merge of #10821 - askeing:fix_10782, r=jdm

Checking the browsing_context before change title

fix #10782

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10821)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-05-06 14:20:45 -07:00
commit 17ba9fb5da
4 changed files with 46 additions and 3 deletions

View file

@ -624,10 +624,12 @@ impl Document {
/// Handles any updates when the document's title has changed.
pub fn title_changed(&self) {
// https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowsertitlechange
self.trigger_mozbrowser_event(MozBrowserEvent::TitleChange(String::from(self.Title())));
if self.browsing_context().is_some() {
// https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowsertitlechange
self.trigger_mozbrowser_event(MozBrowserEvent::TitleChange(String::from(self.Title())));
self.send_title_to_compositor();
self.send_title_to_compositor();
}
}
/// Sends this document's title to the compositor.