js/xpconnect/tests/mochitest/test_bug636097.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/xpconnect/tests/mochitest/test_bug636097.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,62 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=504877
     1.8 +test by moz_bug_r_a4@yahoo.com
     1.9 +-->
    1.10 +<head>
    1.11 +  <title>Test for Bug 504877</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=504877">Mozilla Bug 504877</a>
    1.17 +<p id="display"></p>
    1.18 +<div id="content" style="display: none">
    1.19 +  
    1.20 +</div>
    1.21 +<pre id="test">
    1.22 +<script type="application/javascript">
    1.23 +
    1.24 +/** Test for Bug 504877 **/
    1.25 +SimpleTest.waitForExplicitFinish();
    1.26 +
    1.27 +var targetUrl = "http://example.com/";
    1.28 +var l;
    1.29 +
    1.30 +function a() {
    1.31 +        var r = "FAIL", s;
    1.32 +        try {
    1.33 +                s = l.toString();
    1.34 +        }
    1.35 +        catch (e) {
    1.36 +                if (/denied|insecure/.test(e))
    1.37 +                        r = "PASS";
    1.38 +                s = e;
    1.39 +        }
    1.40 +
    1.41 +        is(r, "PASS", "should have thrown an exception");
    1.42 +        SimpleTest.finish();
    1.43 +}
    1.44 +
    1.45 +var p = 0;
    1.46 +function b() {
    1.47 +        switch (++p) {
    1.48 +        case 1:
    1.49 +                frames[0].location = "about:blank";
    1.50 +                break;
    1.51 +        case 2:
    1.52 +                l = frames[0].location;
    1.53 +                frames[0].location = targetUrl;
    1.54 +                break;
    1.55 +        case 3:
    1.56 +                a();
    1.57 +                break;
    1.58 +        }
    1.59 +}
    1.60 +</script>
    1.61 +
    1.62 +</pre>
    1.63 +<iframe onload="b()"></iframe>
    1.64 +</body>
    1.65 +</html>

mercurial