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 | var reader = new FileReaderSync(); |
michael@0 | 2 | |
michael@0 | 3 | /** |
michael@0 | 4 | * Expects an object containing a file and an encoding then uses a |
michael@0 | 5 | * FileReaderSync to read the file. Returns an object containing the |
michael@0 | 6 | * file read a binary string, text, url and ArrayBuffer. |
michael@0 | 7 | */ |
michael@0 | 8 | onmessage = function(event) { |
michael@0 | 9 | var file = event.data.file; |
michael@0 | 10 | var encoding = event.data.encoding; |
michael@0 | 11 | |
michael@0 | 12 | var rtnObj = new Object(); |
michael@0 | 13 | |
michael@0 | 14 | if (encoding != undefined) { |
michael@0 | 15 | rtnObj.text = reader.readAsText(file, encoding); |
michael@0 | 16 | } else { |
michael@0 | 17 | rtnObj.text = reader.readAsText(file); |
michael@0 | 18 | } |
michael@0 | 19 | |
michael@0 | 20 | rtnObj.bin = reader.readAsBinaryString(file); |
michael@0 | 21 | rtnObj.url = reader.readAsDataURL(file); |
michael@0 | 22 | rtnObj.arrayBuffer = reader.readAsArrayBuffer(file); |
michael@0 | 23 | |
michael@0 | 24 | postMessage(rtnObj); |
michael@0 | 25 | }; |