Home | History | Annotate | Download | only in script-tests
      1 description("Tests that when a page is reloaded, the frame is properly detached from the Geolocation object " +
      2             "to ensure that no permission requests are in progress.");
      3 
      4 window.jsTestIsAsync = true;
      5 
      6 var numPendingRequests;
      7 var isReload = false;
      8 
      9 if ("#reload" == location.hash)
     10     isReload = true;
     11 
     12 if (window.layoutTestController) {
     13     numPendingRequests = layoutTestController.numberOfPendingGeolocationPermissionRequests();
     14     shouldBe('numPendingRequests', '0');
     15 
     16     if (isReload)
     17         finishJSTest();
     18 }
     19 
     20 if (!isReload) {
     21     // Kick off a position request and then reload the page, this should set up
     22     // a permission request. Permission should be undecided at this point, so the
     23     // permission request should still be outstanding by page reload.
     24 
     25     function onIframeReady()
     26     {
     27         // Make request on remote frame's Geolocation object.
     28         iframe.contentWindow.navigator.geolocation.getCurrentPosition(
     29             function(p) {
     30                 testFailed('Permission should not be determined for this page: ' + p);
     31                 finishJSTest();
     32             });
     33 
     34         location.hash = '#reload';
     35         location.reload();
     36     }
     37 
     38     debug("Create IFrame");
     39     var iframe = document.createElement('iframe');
     40     iframe.src = 'resources/page-reload-cancel-permission-requests-inner.html';
     41     document.body.appendChild(iframe);
     42 }
     43 
     44 window.successfullyParsed = true;
     45