dom/workers/test/jsm_url_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 onmessage = function(event) {
     2   if (event.data != 0) {
     3     var worker = new Worker('jsm_url_worker.js');
     4     worker.onmessage = function(event) {
     5       postMessage(event.data);
     6     }
     8     worker.postMessage(event.data - 1);
     9     return;
    10   }
    12   status = false;
    13   try {
    14     if ((URL instanceof Object)) {
    15       status = true;
    16     }
    17   } catch(e) {
    18   }
    20   postMessage({type: 'status', status: status, msg: 'URL object:' + URL});
    22   status = false;
    23   var blob = null;
    24   try {
    25     blob = new Blob([]);
    26     status = true;
    27   } catch(e) {
    28   }
    30   postMessage({type: 'status', status: status, msg: 'Blob:' + blob});
    32   status = false;
    33   var url = null;
    34   try {
    35     url = URL.createObjectURL(blob);
    36     status = true;
    37   } catch(e) {
    38   }
    40   postMessage({type: 'status', status: status, msg: 'Blob URL:' + url});
    42   status = false;
    43   try {
    44     URL.revokeObjectURL(url);
    45     status = true;
    46   } catch(e) {
    47   }
    49   postMessage({type: 'status', status: status, msg: 'Blob Revoke URL'});
    51   status = false;
    52   var url = null;
    53   try {
    54     url = URL.createObjectURL(true);
    55   } catch(e) {
    56     status = true;
    57   }
    59   postMessage({type: 'status', status: status, msg: 'CreateObjectURL should fail if the arg is not a blob'});
    61   status = false;
    62   var url = null;
    63   try {
    64     url = URL.createObjectURL(blob);
    65     status = true;
    66   } catch(e) {
    67   }
    69   postMessage({type: 'status', status: status, msg: 'Blob URL2:' + url});
    70   postMessage({type: 'url', url: url});
    72   status = false;
    73   try {
    74     URL.createObjectURL(new Object());
    75   } catch(e) {
    76     status = true;
    77   }
    79   postMessage({type: 'status', status: status, msg: 'Exception wanted' });
    81   postMessage({type: 'finish' });
    82 }

mercurial