dom/base/test/test_urlExceptions.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/base/test/test_urlExceptions.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,57 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=926890
     1.8 +-->
     1.9 +<head>
    1.10 +  <meta charset="utf-8">
    1.11 +  <title>Test for Bug 926890</title>
    1.12 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.13 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.14 +</head>
    1.15 +<body>
    1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=926890">Mozilla Bug 926890</a>
    1.17 +<p id="display"></p>
    1.18 +<div id="content" style="display: none">
    1.19 +  <iframe name="x" id="x"></iframe>
    1.20 +  <iframe name="y" id="y"></iframe>
    1.21 +</div>
    1.22 +<pre id="test">
    1.23 +</pre>
    1.24 +  <script type="application/javascript">
    1.25 +
    1.26 +  // URL.href throws
    1.27 +  var url = new URL('http://www.example.com');
    1.28 +  ok(url, "URL created");
    1.29 +
    1.30 +  try {
    1.31 +    url.href = '42';
    1.32 +    ok(false, "url.href = 42 should throw");
    1.33 +  } catch(e) {
    1.34 +    ok(true, "url.href = 42 should throw");
    1.35 +    ok(e instanceof TypeError, "error type typeError");
    1.36 +  }
    1.37 +
    1.38 +  url.href = 'http://www.example.org';
    1.39 +  ok(true, "url.href should not throw");
    1.40 +
    1.41 +  try {
    1.42 +    new URL('42');
    1.43 +    ok(false, "new URL(42) should throw");
    1.44 +  } catch(e) {
    1.45 +    ok(true, "new URL(42) should throw");
    1.46 +    ok(e instanceof TypeError, "error type typeError");
    1.47 +  }
    1.48 +
    1.49 +  try {
    1.50 +    new URL('http://www.example.com', '42');
    1.51 +    ok(false, "new URL(something, 42) should throw");
    1.52 +  } catch(e) {
    1.53 +    ok(true, "new URL(something, 42) should throw");
    1.54 +    ok(e instanceof TypeError, "error type typeError");
    1.55 +  }
    1.56 +
    1.57 +  </script>
    1.58 +</body>
    1.59 +</html>
    1.60 +

mercurial