dom/tests/mochitest/webapps/file_bug_779982.html

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 <!DOCTYPE html>
     2 <html>
     3   <body>
     4     foobar!
     5   </body>
     6   <script>
     7     var finished = false;
     8     var data = window.location.search.substring(1).split('&');
    10     function finish(value) {
    11       value ? alert('success') : alert('failure');
    12       finished = true;
    13     }
    15     switch (data[0]) {
    16       case "getSelf":
    17         navigator.mozApps.getSelf().onsuccess = function onGetSelf() {
    18           if (data[1] == 'true') {
    19             finish(this.result == null);
    20           } else {
    21             finish(this.result != null);
    22           }
    23         }
    24         break;
    26       case "checkInstalled":
    27         navigator.mozApps.checkInstalled('http://example.org/manifest.webapp').onsuccess = function onCheckInstalled() {
    28           if (data[1] == 'true') {
    29             finish(!this.result);
    30           } else {
    31             finish(!!this.result);
    32           }
    33         }
    34         break;
    36       case "checkInstalledWrong":
    37         try {
    38           navigator.mozApps.checkInstalled('http://something.org/manifest.webapp');
    39           finish(false);
    40         } catch (e) {
    41           finish(true);
    42         }
    43         break;
    45       default:
    46         finish(false);
    47         break;
    48     }
    49   </script>
    50 </html>

mercurial