• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<body>
3<p>Test to ensure the the window.applicationCache attribute is defined but non-functional with the feature disabled.</p>
4<div id=result></div>
5<script>
6    if (window.layoutTestController) {
7        layoutTestController.overridePreference("WebKitOfflineWebApplicationCacheEnabled", false);
8        layoutTestController.dumpAsText();
9    }
10
11    function log(message)
12    {
13        document.getElementById("result").innerHTML += message + "<br>";
14    }
15
16    function isDefined() {
17        if (window.applicationCache)
18            return true;
19        else
20            return false;
21    }
22
23    function statusIsUncached() {
24        return applicationCache.status == 0;
25    }
26
27    function swapThrows() {
28        try {
29            applicationCache.swapCache();
30            return false;
31        } catch(e) {
32            return true;
33        }
34    }
35
36    function updateThrows() {
37        try {
38            applicationCache.swapCache();
39            return false;
40        } catch(e) {
41            return true;
42        }
43    }
44
45    if (isDefined() && statusIsUncached() && swapThrows() && updateThrows())
46        log("SUCCESS");
47    else
48        log("FAILURE");
49</script>
50</body>
51</html>
52