diff options
author | Peter <peter.hall@algomi.com> | 2016-02-28 00:33:11 +0000 |
---|---|---|
committer | Peter <peter.hall@algomi.com> | 2016-03-03 20:21:48 +0000 |
commit | 3e78b54d46fba83e2233e7087c196ee5097c320e (patch) | |
tree | 77aeae27afd024abb907a7dff70bf15b08cbdac9 /components/script/dom/bindings/conversions.rs | |
parent | 875f1e92ccafebc8ddebc722f430e5037007b9dc (diff) | |
download | servo-3e78b54d46fba83e2233e7087c196ee5097c320e.tar.gz servo-3e78b54d46fba83e2233e7087c196ee5097c320e.zip |
Fixed compile error in generated code, when webidl constructors have same number of args
Edited test webidl to show issue, and fix
Diffstat (limited to 'components/script/dom/bindings/conversions.rs')
-rw-r--r-- | components/script/dom/bindings/conversions.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/components/script/dom/bindings/conversions.rs b/components/script/dom/bindings/conversions.rs index 3bf389a6596..6db0d08af4d 100644 --- a/components/script/dom/bindings/conversions.rs +++ b/components/script/dom/bindings/conversions.rs @@ -47,7 +47,7 @@ use js::jsapi::{HandleId, HandleObject, HandleValue, JS_GetClass}; use js::jsapi::{JSClass, JSContext, JSObject, MutableHandleValue}; use js::jsapi::{JS_GetLatin1StringCharsAndLength, JS_GetReservedSlot}; use js::jsapi::{JS_GetObjectAsArrayBufferView, JS_GetArrayBufferViewType}; -use js::jsapi::{JS_GetTwoByteStringCharsAndLength, JS_NewStringCopyN}; +use js::jsapi::{JS_GetTwoByteStringCharsAndLength, JS_IsArrayObject, JS_NewStringCopyN}; use js::jsapi::{JS_StringHasLatin1Chars, JS_WrapValue}; use js::jsapi::{Type}; use js::jsval::{ObjectValue, StringValue}; @@ -458,3 +458,10 @@ pub fn array_buffer_view_to_vec_checked<T: ArrayBufferViewContents>(abv: *mut JS array_buffer_view_data_checked(abv).map(|data| data.to_vec()) } } + +/// Returns whether `value` is an array-like object. +/// Note: Currently only Arrays are supported. +/// TODO: Expand this to support sequences and other array-like objects +pub unsafe fn is_array_like(cx: *mut JSContext, value: HandleValue) -> bool { + JS_IsArrayObject(cx, value) +} |