aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmllinkelement.rs
diff options
context:
space:
mode:
authorGregory Terzian <gterzian@users.noreply.github.com>2018-04-28 22:48:14 +0800
committerGregory Terzian <gterzian@users.noreply.github.com>2018-05-23 21:45:57 +0800
commitd4382407722108a52bf23b1f3a3114984f13fb90 (patch)
tree55f5dad9ccad14e6911cb5434f2d362ba79f166e /components/script/dom/htmllinkelement.rs
parenta297e8f2881d0d1927160d2ebc0e4b26d71f2534 (diff)
downloadservo-d4382407722108a52bf23b1f3a3114984f13fb90.tar.gz
servo-d4382407722108a52bf23b1f3a3114984f13fb90.zip
move msg to embedder_traits, use in script, handle send error in embedder
Diffstat (limited to 'components/script/dom/htmllinkelement.rs')
-rw-r--r--components/script/dom/htmllinkelement.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/components/script/dom/htmllinkelement.rs b/components/script/dom/htmllinkelement.rs
index f3f82cb5ce1..c05bd0ee0f6 100644
--- a/components/script/dom/htmllinkelement.rs
+++ b/components/script/dom/htmllinkelement.rs
@@ -16,15 +16,14 @@ use dom::document::Document;
use dom::domtokenlist::DOMTokenList;
use dom::element::{AttributeMutation, Element, ElementCreator};
use dom::element::{cors_setting_for_element, reflect_cross_origin_attribute, set_cross_origin_attribute};
-use dom::globalscope::GlobalScope;
use dom::htmlelement::HTMLElement;
use dom::node::{Node, UnbindContext, document_from_node, window_from_node};
use dom::stylesheet::StyleSheet as DOMStyleSheet;
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
+use embedder_traits::EmbedderMsg;
use html5ever::{LocalName, Prefix};
use net_traits::ReferrerPolicy;
-use script_traits::ScriptMsg;
use servo_arc::Arc;
use std::borrow::ToOwned;
use std::cell::Cell;
@@ -306,8 +305,13 @@ impl HTMLLinkElement {
let document = document_from_node(self);
match document.base_url().join(href) {
Ok(url) => {
- let event = ScriptMsg::NewFavicon(url.clone());
- document.window().upcast::<GlobalScope>().script_to_constellation_chan().send(event).unwrap();
+ let window = document.window();
+ if window.is_top_level() {
+ let top_level_browsing_context_id = window.top_level_browsing_context_id();
+ let msg = EmbedderMsg::NewFavicon(top_level_browsing_context_id, url.clone());
+ window.send_to_embedder(msg);
+ }
+
}
Err(e) => debug!("Parsing url {} failed: {}", href, e)
}