| <html manifest="resources/cyrillic-uri.manifest"> |
| <head> |
| <meta charset="koi8-r"> |
| </head> |
| <body> |
| <p>Test that non-ASCII URIs work correctly in cache manifests.</p> |
| <p>Should be a series of PASS messages, followed with DONE.</p> |
| <div id=result></div> |
| |
| <script> |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| testRunner.waitUntilDone(); |
| } |
| |
| function log(message) |
| { |
| document.getElementById("result").innerHTML += message + "<br>"; |
| } |
| |
| function load(url) |
| { |
| var req = new XMLHttpRequest; |
| req.open("GET", url, false); |
| req.send(""); |
| return req.responseText; |
| } |
| |
| function canLoad(url) |
| { |
| try { |
| var req = new XMLHttpRequest; |
| req.open("GET", url, false); |
| req.send(""); |
| return true; |
| } catch (ex) { |
| return false; |
| } |
| } |
| |
| function shouldBeLoadable(url) |
| { |
| log((canLoad(url) ? "PASS: " : "FAIL: ") + url); |
| } |
| |
| function test() |
| { |
| // Path is always UTF-8. |
| shouldBeLoadable("resources/intercept/cached-ðÒÏ×ÅÒËÁ"); |
| shouldBeLoadable("resources/intercept/cached-%D0%9F%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%BA%D0%B0"); |
| shouldBeLoadable("resources/intercept/cached2-ðÒÏ×ÅÒËÁ"); |
| shouldBeLoadable("resources/intercept/cached2-%D0%9F%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%BA%D0%B0"); |
| shouldBeLoadable("resources/intercept/network-ðÒÏ×ÅÒËÁ-PASS"); |
| shouldBeLoadable("resources/intercept/network-%D0%9F%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%BA%D0%B0-PASS"); |
| shouldBeLoadable("resources/does-not-exist-ðÒÏ×ÅÒËÁ"); |
| |
| // To test encodings other than UTF-8, we need to simulate form submission (for XHR, Firefox |
| // always uses UTF-8, even in query part). |
| applicationCache.onnoupdate = null; |
| applicationCache.oncached = null; |
| window.addEventListener("message", frameDone, false); |
| var ifr = document.createElement("iframe"); |
| ifr.setAttribute("src", "resources/cyrillic-uri-form.html"); |
| document.body.appendChild(ifr); |
| } |
| |
| function frameDone(evt) |
| { |
| log("DONE"); |
| if (window.testRunner) |
| testRunner.notifyDone(); |
| } |
| |
| applicationCache.onnoupdate = function() { test() } |
| applicationCache.oncached = function() { test() } |
| |
| applicationCache.onupdateready = function() { log("FAIL: received unexpected updateready event") } |
| applicationCache.onerror = function() { log("FAIL: received unexpected error event") } |
| |
| </script> |
| </body> |
| </html> |