aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2014-09-07 12:42:19 +0200
committerMs2ger <ms2ger@gmail.com>2014-09-07 12:42:59 +0200
commit2d2674e346b5088e42c61431d8f619c8fe718af9 (patch)
treefda65605174c9ae572908dc44fec095f05cae90f
parent0d202b6bda9ca10980e839bf7b00d1e51b51a531 (diff)
downloadservo-2d2674e346b5088e42c61431d8f619c8fe718af9.tar.gz
servo-2d2674e346b5088e42c61431d8f619c8fe718af9.zip
Avoid trying to trace a null JSVal.
JSVal::trace_kind() asserts that it is a markable type; null is a gcthing that is not markable.
-rw-r--r--src/components/script/dom/bindings/trace.rs2
-rw-r--r--src/test/content/test_trace_null.html7
2 files changed, 8 insertions, 1 deletions
diff --git a/src/components/script/dom/bindings/trace.rs b/src/components/script/dom/bindings/trace.rs
index f26af087796..42d944e9781 100644
--- a/src/components/script/dom/bindings/trace.rs
+++ b/src/components/script/dom/bindings/trace.rs
@@ -68,7 +68,7 @@ pub trait JSTraceable {
/// Trace a `JSVal`.
pub fn trace_jsval(tracer: *mut JSTracer, description: &str, val: JSVal) {
- if !val.is_gcthing() {
+ if !val.is_markable() {
return;
}
diff --git a/src/test/content/test_trace_null.html b/src/test/content/test_trace_null.html
new file mode 100644
index 00000000000..af074b94f04
--- /dev/null
+++ b/src/test/content/test_trace_null.html
@@ -0,0 +1,7 @@
+<!-- crashtest -->
+<script src=harness.js></script>
+<script>
+new CustomEvent("foo", { detail: null });
+gc();
+finish();
+</script>