• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html manifest="resources/cyrillic-uri.manifest">
2<head>
3<meta charset="koi8-r">
4</head>
5<body>
6<p>Test that non-ASCII URIs work correctly in cache manifests.</p>
7<p>Should be a series of PASS messages, followed with DONE.</p>
8<div id=result></div>
9
10<script>
11if (window.layoutTestController) {
12    layoutTestController.dumpAsText();
13    layoutTestController.waitUntilDone();
14}
15
16function log(message)
17{
18    document.getElementById("result").innerHTML += message + "<br>";
19}
20
21function load(url)
22{
23    var req = new XMLHttpRequest;
24    req.open("GET", url, false);
25    req.send("");
26    return req.responseText;
27}
28
29function canLoad(url)
30{
31    try {
32        var req = new XMLHttpRequest;
33        req.open("GET", url, false);
34        req.send("");
35        return true;
36    } catch (ex) {
37        return false;
38    }
39}
40
41function shouldBeLoadable(url)
42{
43    log((canLoad(url) ? "PASS: " : "FAIL: ") + url);
44}
45
46function test()
47{
48    // Path is always UTF-8.
49    shouldBeLoadable("resources/intercept/cached-��������");
50    shouldBeLoadable("resources/intercept/cached-%D0%9F%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%BA%D0%B0");
51    shouldBeLoadable("resources/intercept/cached2-��������");
52    shouldBeLoadable("resources/intercept/cached2-%D0%9F%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%BA%D0%B0");
53    shouldBeLoadable("resources/intercept/network-��������-PASS");
54    shouldBeLoadable("resources/intercept/network-%D0%9F%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%BA%D0%B0-PASS");
55    shouldBeLoadable("resources/does-not-exist-��������");
56
57    // To test encodings other than UTF-8, we need to simulate form submission (for XHR, Firefox
58    // always uses UTF-8, even in query part).
59    applicationCache.onnoupdate = null;
60    applicationCache.oncached = null;
61    window.addEventListener("message", frameDone, false);
62    var ifr = document.createElement("iframe");
63    ifr.setAttribute("src", "resources/cyrillic-uri-form.html");
64    document.body.appendChild(ifr);
65}
66
67function frameDone(evt)
68{
69    log("DONE");
70    if (window.layoutTestController)
71        layoutTestController.notifyDone();
72}
73
74applicationCache.onnoupdate = function() { test() }
75applicationCache.oncached = function() { test() }
76
77applicationCache.onupdateready = function() { log("FAIL: received unexpected updateready event") }
78applicationCache.onerror = function() { log("FAIL: received unexpected error event") }
79
80</script>
81</body>
82</html>
83