summaryrefslogtreecommitdiffstats
path: root/LayoutTests/http/tests/appcache/disabled.html
blob: e89752a57fa85c5440ede978cba2b87983770e68 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<html>
<body>
<p>Test to ensure the the window.applicationCache attribute is defined but non-functional with the feature disabled.</p>
<div id=result></div>
<script>
    if (window.layoutTestController) {
        layoutTestController.overridePreference("WebKitOfflineWebApplicationCacheEnabled", false);
        layoutTestController.dumpAsText();
    }

    function log(message)
    {
        document.getElementById("result").innerHTML += message + "<br>";
    }

    function isDefined() {
        if (window.applicationCache)
            return true;
        else
            return false;
    }

    function statusIsUncached() {
        return applicationCache.status == 0;
    }

    function swapThrows() {
        try {
            applicationCache.swapCache();
            return false;
        } catch(e) {
            return true;
        }
    }

    function updateThrows() {
        try {
            applicationCache.swapCache();
            return false;
        } catch(e) {
            return true;
        }
    }

    if (isDefined() && statusIsUncached() && swapThrows() && updateThrows())
        log("SUCCESS");
    else
        log("FAILURE");
</script>
</body>
</html>