Home | History | Annotate | Download | only in script-tests
      1 description("Tests that when a request is made on a Geolocation object and its Frame is disconnected before a callback is made, the error callback is invoked with the correct error message.");
      2 
      3 if (window.layoutTestController) {
      4     layoutTestController.setGeolocationPermission(true);
      5     layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100);
      6 }
      7 
      8 function onIframeLoaded() {
      9     iframeGeolocation = iframe.contentWindow.navigator.geolocation;
     10     iframe.src = 'data:text/html,This frame should be visible when the test completes';
     11 }
     12 
     13 var error;
     14 function onIframeUnloaded() {
     15     iframeGeolocation.getCurrentPosition(function () {
     16         testFailed('Success callback invoked unexpectedly');
     17         finishJSTest();
     18     }, function(e) {
     19         error = e;
     20         shouldBe('error.code', '2');
     21         shouldBe('error.message', '"Geolocation cannot be used in frameless documents"');
     22         finishJSTest();
     23     });
     24 }
     25 
     26 var iframe = document.createElement('iframe');
     27 iframe.src = 'resources/disconnected-frame-inner.html';
     28 document.body.appendChild(iframe);
     29 
     30 window.jsTestIsAsync = true;
     31 window.successfullyParsed = true;
     32