aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/document.rs
diff options
context:
space:
mode:
authoraskeing <askeing@gmail.com>2016-04-23 21:20:55 +0900
committeraskeing <askeing@gmail.com>2016-05-05 14:12:03 +0800
commit3c56d416991ddd2022351d8392f3b150f8d8114a (patch)
tree105dc3130f991535da7a4cd5cf39ad4c4885d0ab /components/script/dom/document.rs
parent75ae1c033f41a0c9537c693c546a08cdbddc9dd3 (diff)
downloadservo-3c56d416991ddd2022351d8392f3b150f8d8114a.tar.gz
servo-3c56d416991ddd2022351d8392f3b150f8d8114a.zip
Checking the browsing_context before change title, and adding wpt test
Diffstat (limited to 'components/script/dom/document.rs')
-rw-r--r--components/script/dom/document.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index 2eb9bd8806c..9e73ab8bcf0 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -618,10 +618,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.