aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorMs2ger <Ms2ger@gmail.com>2015-10-07 10:52:44 +0200
committerMs2ger <Ms2ger@gmail.com>2015-10-07 10:52:44 +0200
commit6e745b5a00dfeea1a65d5b02c5bd3e834ad1b79d (patch)
tree1c31059547a21ec295a4c465ba19853a9251913f /components
parent409fbafe9cdd16a2b5a25f64eae0bc11d6fc9aa1 (diff)
downloadservo-6e745b5a00dfeea1a65d5b02c5bd3e834ad1b79d.tar.gz
servo-6e745b5a00dfeea1a65d5b02c5bd3e834ad1b79d.zip
Avoid panicking in the implementation of HTMLOptionElement#text for non-element, non-text children.
Diffstat (limited to 'components')
-rw-r--r--components/script/dom/htmloptionelement.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/components/script/dom/htmloptionelement.rs b/components/script/dom/htmloptionelement.rs
index 462ba07021d..a300e0ca74e 100644
--- a/components/script/dom/htmloptionelement.rs
+++ b/components/script/dom/htmloptionelement.rs
@@ -7,6 +7,7 @@ use dom::bindings::codegen::Bindings::CharacterDataBinding::CharacterDataMethods
use dom::bindings::codegen::Bindings::HTMLOptionElementBinding;
use dom::bindings::codegen::Bindings::HTMLOptionElementBinding::HTMLOptionElementMethods;
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
+use dom::bindings::codegen::InheritTypes::ElementDerived;
use dom::bindings::codegen::InheritTypes::{CharacterDataCast, ElementCast, HTMLElementCast, NodeCast, TextDerived};
use dom::bindings::codegen::InheritTypes::{HTMLOptionElementDerived};
use dom::bindings::codegen::InheritTypes::{HTMLScriptElementDerived};
@@ -71,7 +72,7 @@ fn collect_text(node: &&Node, value: &mut DOMString) {
if child.r().is_text() {
let characterdata = CharacterDataCast::to_ref(child.r()).unwrap();
value.push_str(&characterdata.Data());
- } else {
+ } else if child.is_element() {
collect_text(&child.r(), value);
}
}