diff options
Diffstat (limited to 'js/src/jit-test/tests/TypedObject/opaqueatopbuffer.js')
-rw-r--r-- | js/src/jit-test/tests/TypedObject/opaqueatopbuffer.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/TypedObject/opaqueatopbuffer.js b/js/src/jit-test/tests/TypedObject/opaqueatopbuffer.js new file mode 100644 index 000000000..739ce05a4 --- /dev/null +++ b/js/src/jit-test/tests/TypedObject/opaqueatopbuffer.js @@ -0,0 +1,19 @@ +if (typeof TypedObject === "undefined") + quit(); + +load(libdir + "asserts.js") + +var {StructType, ArrayType, uint32, Object, + Any, storage, objectType} = TypedObject; + +var anArray = new Uint32Array(100); +anArray[0] = 22; +var buffer = anArray.buffer; + +var Unit = new StructType(({ f : Object, } )); +assertThrowsInstanceOf(() => new Unit(buffer), TypeError, + "Able to instantiate opaque type atop buffer"); + +var Units = new ArrayType(Unit, 2); +assertThrowsInstanceOf(() => new Units(buffer), TypeError, + "Able to instantiate opaque type atop buffer"); |