summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/TypedObject/opaqueatopbuffer.js
blob: 739ce05a46ed80a0e4e377dd662ba43dc350997a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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");