dom/tests/mochitest/ajax/offline/test_noManifest.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/tests/mochitest/ajax/offline/test_noManifest.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,43 @@
     1.4 +<html xmlns="http://www.w3.org/1999/xhtml">
     1.5 +<head>
     1.6 +<title>bad manifest content type</title>
     1.7 +
     1.8 +<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     1.9 +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.10 +
    1.11 +<script type="text/javascript">
    1.12 +
    1.13 +function expectInvalidState(fn, desc) {
    1.14 +  var gotInvalidState = false;
    1.15 +  try {
    1.16 +    fn();
    1.17 +  } catch(e) {
    1.18 +    if (e.name == "InvalidStateError" &&
    1.19 +        e.code == DOMException.INVALID_STATE_ERR) {
    1.20 +      gotInvalidState = true;
    1.21 +    }
    1.22 +  }
    1.23 +
    1.24 +  ok(gotInvalidState, desc);
    1.25 +}
    1.26 +
    1.27 +is(typeof(applicationCache), "object");
    1.28 +if (SpecialPowers.isMainProcess()) {
    1.29 +  is(applicationCache.mozLength, 0, "applicationCache.mozLength should be 0");
    1.30 +}
    1.31 +is(applicationCache.status, 0, "applicationCache.status should be 0 (UNCACHED)");
    1.32 +
    1.33 +expectInvalidState(function() { applicationCache.update(); },
    1.34 +                   "applicationCache.update should throw InvalidStateError");
    1.35 +expectInvalidState(function() { applicationCache.swapCache(); },
    1.36 +                   "applicationCache.update should throw InvalidStateError");
    1.37 +
    1.38 +
    1.39 +</script>
    1.40 +
    1.41 +</head>
    1.42 +
    1.43 +<body>
    1.44 +
    1.45 +</body>
    1.46 +</html>

mercurial