Bug 1199578 - include SharedTypedArray in a type test. r=waldo
authorLars T Hansen <lhansen@mozilla.com>
Wed, 02 Sep 2015 09:33:39 +0200
changeset 260551 62efa6d695d0f7e7e862035ce8c0798faa45ae50
parent 260550 9dc70a671d84539392e2f30b89eeb188b56ae2c8
child 260552 3a05ea83f1dd7994bd88b8551c50aa92864b051d
push id17287
push userryanvm@gmail.com
push dateWed, 02 Sep 2015 18:54:33 +0000
treeherderb2g-inbound@7ca8e465cbd2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswaldo
bugs1199578
milestone43.0a1
Bug 1199578 - include SharedTypedArray in a type test. r=waldo
js/src/vm/TypedArrayObject.cpp
--- a/js/src/vm/TypedArrayObject.cpp
+++ b/js/src/vm/TypedArrayObject.cpp
@@ -658,18 +658,18 @@ struct TypedArrayObject::OfType
     typedef TypedArrayObjectTemplate<T> Type;
 };
 
 template<typename T>
 /* static */ JSObject*
 TypedArrayObjectTemplate<T>::fromArray(JSContext* cx, HandleObject other)
 {
     uint32_t len;
-    if (other->is<TypedArrayObject>()) {
-        len = other->as<TypedArrayObject>().length();
+    if (IsAnyTypedArray(other)) {
+        len = AnyTypedArrayLength(other);
     } else if (!GetLengthProperty(cx, other, &len)) {
         return nullptr;
     }
 
     Rooted<ArrayBufferObject*> buffer(cx);
     if (!maybeCreateArrayBuffer(cx, len, &buffer))
         return nullptr;