aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/iterable.rs
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2018-07-06 11:14:44 -0700
committerManish Goregaokar <manishsmail@gmail.com>2018-07-06 13:10:56 -0700
commitcceaede96a18e67d93c087d6d499f27eda022025 (patch)
treeb996f245a09434a0bd4f69e3e13c2e531885a950 /components/script/dom/bindings/iterable.rs
parentc90737e6c8b9436919706f9490ba6d05492b7121 (diff)
downloadservo-cceaede96a18e67d93c087d6d499f27eda022025.tar.gz
servo-cceaede96a18e67d93c087d6d499f27eda022025.zip
Make (dictionary)::empty() safe
It currently works by constructing from null (which will throw a runtime error if there are non-defaultable members). This changes it so that we no longer need a JSContext to construct this, so it can be safely constructed. In the case of non-defaultable members, this method simply does not exist.
Diffstat (limited to 'components/script/dom/bindings/iterable.rs')
-rw-r--r--components/script/dom/bindings/iterable.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/components/script/dom/bindings/iterable.rs b/components/script/dom/bindings/iterable.rs
index 15ccd554c2a..87ee05541fa 100644
--- a/components/script/dom/bindings/iterable.rs
+++ b/components/script/dom/bindings/iterable.rs
@@ -115,7 +115,7 @@ fn dict_return(cx: *mut JSContext,
mut result: MutableHandleObject,
done: bool,
value: HandleValue) -> Fallible<()> {
- let mut dict = unsafe { IterableKeyOrValueResult::empty(cx) };
+ let mut dict = IterableKeyOrValueResult::empty();
dict.done = done;
dict.value.set(value.get());
rooted!(in(cx) let mut dict_value = UndefinedValue());
@@ -130,7 +130,7 @@ fn key_and_value_return(cx: *mut JSContext,
mut result: MutableHandleObject,
key: HandleValue,
value: HandleValue) -> Fallible<()> {
- let mut dict = unsafe { IterableKeyAndValueResult::empty(cx) };
+ let mut dict = IterableKeyAndValueResult::empty();
dict.done = false;
dict.value = Some(vec![key, value]
.into_iter()