dom/workers/test/url_worker.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 onmessage = function(event) {
     2   if (event.data != 0) {
     3     var worker = new Worker('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