1 function verifyArray(ta, length) {
2 for (i = 0; i < length; ++i) {
4 postMessage("FAIL: Transferred data is incorrect. Expected " +
9 postMessage("PASS: Transferred data is OK.");
12 function verifyArrayType(ta, name) {
13 var className = Object.prototype.toString.call(ta);
14 if (className.indexOf(name) != -1)
15 postMessage("PASS: Transferred array type is OK.");
17 postMessage("FAIL: Expected array type " + name + " got " + className);
20 self.addEventListener('message', function(e) {
25 switch (e.data.name) {
26 case 'SharedArrayBuffer':
28 ta = new Uint8Array(sab);
29 verifyArray(ta, e.data.length);
34 case 'Uint8ClampedArray':
42 verifyArrayType(ta, e.data.name);
43 verifyArray(ta, e.data.length);
47 postMessage("ERROR: unknown command " + e.data.name);