Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | importScripts('utils_bug743615.js'); |
michael@0 | 2 | |
michael@0 | 3 | self.onmessage = function onMessage(evt) { |
michael@0 | 4 | // Check the pattern that was sent. |
michael@0 | 5 | var imageData = evt.data.imageData; |
michael@0 | 6 | var pattern = evt.data.pattern; |
michael@0 | 7 | var statusMessage = checkPattern(imageData, pattern) |
michael@0 | 8 | ? 'PASS' : 'Got corrupt typed array in worker'; |
michael@0 | 9 | |
michael@0 | 10 | // Check against the interface object. |
michael@0 | 11 | if (!(imageData instanceof ImageData)) |
michael@0 | 12 | statusMessage += ", Bad interface object in worker"; |
michael@0 | 13 | |
michael@0 | 14 | // Check the getters. |
michael@0 | 15 | if (imageData.width * imageData.height != imageData.data.length / 4) { |
michael@0 | 16 | statusMessage += ", Bad ImageData getters in worker: " |
michael@0 | 17 | statusMessage += [imageData.width, imageData.height].join(', '); |
michael@0 | 18 | } |
michael@0 | 19 | |
michael@0 | 20 | // Make sure that writing to .data is a no-op when not in strict mode. |
michael@0 | 21 | var origData = imageData.data; |
michael@0 | 22 | var threw = false; |
michael@0 | 23 | try { |
michael@0 | 24 | imageData.data = []; |
michael@0 | 25 | imageData.width = 2; |
michael@0 | 26 | imageData.height = 2; |
michael@0 | 27 | } catch(e) { threw = true; } |
michael@0 | 28 | if (threw || imageData.data !== origData) |
michael@0 | 29 | statusMessage = statusMessage + ", Should silently ignore sets"; |
michael@0 | 30 | |
michael@0 | 31 | |
michael@0 | 32 | |
michael@0 | 33 | // Send back a new pattern. |
michael@0 | 34 | pattern = makePattern(imageData.data.length, 99, 2); |
michael@0 | 35 | setPattern(imageData, pattern); |
michael@0 | 36 | self.postMessage({ statusMessage: statusMessage, imageData: imageData, |
michael@0 | 37 | pattern: pattern }); |
michael@0 | 38 | } |