chromium/third_party/blink/web_tests/fast/dom/javascript-backslash.html

<html>
    <head>
        <script type="text/javascript">
            function log(message)
            {
                var item = document.createElement("li");
                item.appendChild(document.createTextNode(message));
                document.getElementById("console").appendChild(item);
            }
            function test()
            {
                if (window.testRunner)
                    testRunner.dumpAsText();
                log("javascript: function argument containing a backslash (\\) should not be converted to a slash (/): \"" + document.getElementById("1").pathname + "\"");
                log("http: base should convert a \\ to a / : \"" + document.getElementById("2").href + "\"");
                log("https: base should also convert a \\ to a / : \"" + document.getElementById("3").href + "\"");
                log("file: base should convert a \\ to a / : \"" + document.getElementById("4").href + "\"");
                log("any other valid base except javascript: should convert a \\ to a / : \"" + document.getElementById("5").href + "\"");
                log("query strings should be left alone: \"" + document.getElementById("6").href + "\"");
                log("anchors should be left alone as well: \"" + document.getElementById("7").href + "\"");
            }
        </script>
    </head>
    <body onload="test()">
        <p>This tests \ characters being changed to / in all different scenarios.</p>
        <p>If it works you should see seven messages below that have \ or / characters as specified.</p>
        <hr>
        <a id="1" href="javascript:alert('to be\\not')">1</a>
        <a id="2" href="http://apple.com\support">2</a>
        <a id="3" href="https:\\login.apple.com\support/">3</a>
        <a id="4" href="file:///Users\">4</a>
        <a id="5" href="ftp://apple.com\support/">5</a>
        <a id="6" href="http://apple.com\support?path=\\myshare\myfolder\myfile\">6</a>
        <a id="7" href="http://apple.com\support#path=\\myshare\myfolder\myfile\">7</a>
        <hr>
        <p><ol id="console"></ol></p>
    </body>
</html>