dom/workers/test/url_exceptions_worker.js

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 function ok(a, msg) {
     2   postMessage({type: 'status', status: !!a, msg: msg });
     3 }
     5 onmessage = function(event) {
     6   // URL.href throws
     7   var url = new URL('http://www.example.com');
     8   ok(url, "URL created");
    10   var status = false;
    11   try {
    12     url.href = '42';
    13   } catch(e) {
    14     status = true;
    15   }
    16   ok(status, "url.href = 42 should throw");
    18   url.href = 'http://www.example.org';
    19   ok(true, "url.href should not throw");
    21   status = false
    22   try {
    23     new URL('42');
    24   } catch(e) {
    25     status = true;
    26   }
    27   ok(status, "new URL(42) should throw");
    29   status = false
    30   try {
    31     new URL('http://www.example.com', '42');
    32   } catch(e) {
    33     status = true;
    34   }
    35   ok(status, "new URL(something, 42) should throw");
    37   postMessage({type: 'finish' });
    38 }

mercurial