Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  test_cachedPosition.html

  Sprache: HTML
 

 products/Sources/formale Sprachen/C/Firefox/dom/geolocation/test/mochitest/test_cachedPosition.html


<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=850442
-->

<head>
  <title>Test for getCurrentPosition </title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <script type="text/javascript" src="geolocation_common.js"></script>

<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=850442">Mozilla Bug 850442</a>
<p id="display"></p>
<div id="content" style="display: none">

</div>
<pre id="test">
<script class="testbody" type="text/javascript">
"use strict";

SimpleTest.waitForExplicitFinish();

/*
The request cache vs. the PositionOptions cache is confusing to the reader, to explain:

Testing uses mochitest httpd, so the network cache must be disabled in order for requests
to propagate to mochitest httpd. Otherwise, every request looks like a geoip request,
and the network request cache sees no reason to make a web request for location for geoip
if it has already made geoip (or better) requests.

We should investigate providing fake wifi and cell scans to the
network location provider, then the network cache does not need to be shut off
AND it will get testing coverage.

*/
resume_geolocationProvider(function() {
    force_prompt(true, function () {
      set_network_request_cache_enabled(false, test_cachedPosition)
    });
});

function done() {
  set_network_request_cache_enabled(true, function() {
    resume_geolocationProvider(function() {
      SimpleTest.finish();
    });
  });
}

function errorCallback(_err) {
  ok(false, "error callback should not have been called");
  done();
}

function test_cachedPosition() {
   var cached = null;
   navigator.geolocation.getCurrentPosition(function(pos) {
     // first call is just to warm up the cache
     check_geolocation(pos);

     navigator.geolocation.getCurrentPosition(function(pos2) {
      check_geolocation(pos2);
      cached = pos2;

      navigator.geolocation.getCurrentPosition(function(pos3) {
        check_geolocation(pos3);
        is(pos3.timestamp, cached.timestamp, "position should be equal to cached position");
        navigator.geolocation.getCurrentPosition(function(pos4) {
          // force new position, can't be the one we have
          check_geolocation(pos4);
          isnot(pos4.timestamp, cached.timestamp, "position should not be equal to cached position");
          done();
        }, errorCallback, {maximumAge: 0});
      }, errorCallback, {maximumAge: 21600000});
     }, errorCallback, {maximumAge: 21600000});
   }, errorCallback, {maximumAge: 21600000});
 }
</script>
</pre>
</body>
</html>

Messung V0.5 in Prozent
C=92 H=97 G=94

¤ Dauer der Verarbeitung: 0.14 Sekunden  (vorverarbeitet am  2026-08-25) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=277311
#Domains=752002