dom/tests/mochitest/geolocation/test_optional_api_params.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 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=452566
     5 -->
     6 <head>
     7   <title>Test for Bug 452566</title>
     8   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     9   <script type="text/javascript" src="geolocation_common.js"></script>
    10   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    11 </head>
    12 <body>
    13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=452566">Mozilla Bug 452566</a>
    14 <p id="display"></p>
    15 <div id="content" style="display: none">
    17 </div>
    18 <pre id="test">
    19 <script class="testbody" type="text/javascript">
    21 SimpleTest.waitForExplicitFinish();
    23 // ensure we are using the right testing provider
    24 resume_geolocationProvider(function() {
    25   force_prompt(true, test1);
    26 });
    28 /** Test for Bug 452566 **/
    29 function test1() {
    30   ok(navigator.geolocation, "Should have geolocation");
    32   var exception = null;
    33   try {
    34     navigator.geolocation.getCurrentPosition();
    35   } catch(ex if ex instanceof TypeError) {
    36     exception = ex;
    37   }
    38   ok(exception, "Should have got an exception");
    40   exception = null;
    41   try {
    42     navigator.geolocation.getCurrentPosition(function() {});
    43   } catch(ex if ex instanceof TypeError) {
    44     exception = ex;
    45   }
    46   ok(!exception, exception);
    48   exception = null;
    49   try {
    50     navigator.geolocation.getCurrentPosition(function() {}, function() {});
    51   } catch(ex if ex instanceof TypeError) {
    52     exception = ex;
    53   }
    54   ok(!exception, exception);
    56   exception = null;
    57   try {
    58     navigator.geolocation.getCurrentPosition(function() {}, function() {}, {});
    59   } catch(ex if ex instanceof TypeError) {
    60     exception = ex;
    61   }
    62   ok(!exception, exception);
    64   exception = null;
    65   try {
    66     navigator.geolocation.watchPosition();
    67   } catch(ex if ex instanceof TypeError) {
    68     exception = ex;
    69   }
    70   ok(exception, "Should have got an exception");
    72   exception = null;
    73   try {
    74     navigator.geolocation.watchPosition(function() {});
    75   } catch(ex if ex instanceof TypeError) {
    76     exception = ex;
    77   }
    78   ok(!exception, exception);
    80   exception = null;
    81   try {
    82     navigator.geolocation.watchPosition(function() {}, function() {});
    83   } catch(ex if ex instanceof TypeError) {
    84     exception = ex;
    85   }
    86   ok(!exception, exception);
    88   exception = null;
    89   try {
    90     navigator.geolocation.watchPosition(function() {}, function() {}, {});
    91   } catch(ex if ex instanceof TypeError) {
    92     exception = ex;
    93   }
    94   ok(!exception, exception);
    96   SimpleTest.finish();
    97 }
    99 </script>
   100 </pre>
   101 </body>
   102 </html>

mercurial