dom/workers/test/fileReaderSync_worker.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

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

mercurial