docshell/test/test_bug402210.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/docshell/test/test_bug402210.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,50 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +While working on bug 402210, it came up that the code was doing
     1.8 +
     1.9 +a.href = proto + host
    1.10 +
    1.11 +which technically produces "https:host" instead of "https://host" and
    1.12 +that the code was relying on href's setting having fixup behaviour
    1.13 +for this kind of thing.
    1.14 +
    1.15 +If we rely on it, we might as well test for it, even if it isn't the
    1.16 +problem 402210 was meant to fix.
    1.17 +
    1.18 +https://bugzilla.mozilla.org/show_bug.cgi?id=402210
    1.19 +-->
    1.20 +<head>
    1.21 +  <title>Test for Bug 402210</title>
    1.22 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.23 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.24 +</head>
    1.25 +<body>
    1.26 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=402210">Mozilla Bug 402210</a>
    1.27 +<p id="display">
    1.28 +  <a id="testlink">Test Link</a>
    1.29 +</p>
    1.30 +<div id="content" style="display: none">
    1.31 +  
    1.32 +</div>
    1.33 +<pre id="test">
    1.34 +<script class="testbody" type="text/javascript">
    1.35 +
    1.36 +SimpleTest.waitForExplicitFinish();
    1.37 +
    1.38 +function runTest() {
    1.39 +  $("testlink").href = "https:example.com";
    1.40 +  is($("testlink").href, "https://example.com/", "Setting href on an anchor tag should fixup missing slashes after https protocol");
    1.41 +  
    1.42 +  $("testlink").href = "ftp:example.com";
    1.43 +  is($("testlink").href, "ftp://example.com/", "Setting href on an anchor tag should fixup missing slashes after non-http protocol");
    1.44 +  
    1.45 +  SimpleTest.finish();
    1.46 +}
    1.47 +
    1.48 +addLoadEvent(runTest);
    1.49 +</script>
    1.50 +</pre>
    1.51 +</body>
    1.52 +</html>
    1.53 +

mercurial