summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast/dom/Geolocation/script-tests/disconnected-frame-already.js
blob: b2176410189b65bb7cfb3b4da7dc7bfe0c159f42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
description("Tests that when a request is made on a Geolocation object after its frame has been disconnected, no callbacks are made and no crash occurs.");

if (window.layoutTestController) {
    layoutTestController.setGeolocationPermission(true);
    layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100);
}

function onFirstIframeLoaded() {
    iframeGeolocation = iframe.contentWindow.navigator.geolocation;
    iframe.src = 'resources/disconnected-frame-already-inner2.html';
}

var error;
function onSecondIframeLoaded() {
    iframeGeolocation.getCurrentPosition(function () {
        testFailed('Success callback invoked unexpectedly');
        finishJSTest();
    }, function(e) {
        testFailed('Error callback invoked unexpectedly');
        finishJSTest();
    });
    setTimeout(finishTest, 1000);
}

function finishTest() {
    debug('Method called on Geolocation object with disconnected Frame.');
    finishJSTest();
}

var iframe = document.createElement('iframe');
iframe.src = 'resources/disconnected-frame-already-inner1.html';
document.body.appendChild(iframe);

window.jsTestIsAsync = true;
window.successfullyParsed = true;