worker_bug743615.js (1245B)
1 importScripts("utils_bug743615.js"); 2 3 self.onmessage = function onMessage(evt) { 4 // Check the pattern that was sent. 5 var imageData = evt.data.imageData; 6 var pattern = evt.data.pattern; 7 var statusMessage = checkPattern(imageData, pattern) 8 ? "PASS" 9 : "Got corrupt typed array in worker"; 10 11 // Check against the interface object. 12 if (!(imageData instanceof ImageData)) { 13 statusMessage += ", Bad interface object in worker"; 14 } 15 16 // Check the getters. 17 if (imageData.width * imageData.height != imageData.data.length / 4) { 18 statusMessage += ", Bad ImageData getters in worker: "; 19 statusMessage += [imageData.width, imageData.height].join(", "); 20 } 21 22 // Make sure that writing to .data is a no-op when not in strict mode. 23 var origData = imageData.data; 24 var threw = false; 25 try { 26 imageData.data = []; 27 imageData.width = 2; 28 imageData.height = 2; 29 } catch (e) { 30 threw = true; 31 } 32 if (threw || imageData.data !== origData) { 33 statusMessage = statusMessage + ", Should silently ignore sets"; 34 } 35 36 // Send back a new pattern. 37 pattern = makePattern(imageData.data.length, 99, 2); 38 setPattern(imageData, pattern); 39 self.postMessage({ 40 statusMessage, 41 imageData, 42 pattern, 43 }); 44 };