js/xpconnect/tests/mochitest/test_bug870423.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/xpconnect/tests/mochitest/test_bug870423.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,51 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=870423
     1.8 +-->
     1.9 +<head>
    1.10 +  <meta charset="utf-8">
    1.11 +  <title>Test for Bug 870423</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 +  <script type="application/javascript">
    1.15 +
    1.16 +  /** Test for cross-scope instanceof. **/
    1.17 +  SimpleTest.waitForExplicitFinish();
    1.18 +
    1.19 +  function go() {
    1.20 +    var sowin = $('soifr').contentWindow;
    1.21 +    var xowin = $('xoifr').contentWindow;
    1.22 +
    1.23 +    check(window, sowin, 'HTMLBodyElement', function(win) { return win.document.body; });
    1.24 +    check(window, sowin, 'HTMLDocument', function(win) { return win.document; });
    1.25 +    check(window, sowin, 'Window', function(win) { return win; });
    1.26 +    check(window, sowin, 'Location', function(win) { return win.location; });
    1.27 +
    1.28 +    todo(xowin instanceof Window, "Cross-origin instanceof should work");
    1.29 +    todo(xowin.location instanceof Location, "Cross-origin instanceof should work");
    1.30 +
    1.31 +    SimpleTest.finish();
    1.32 +  }
    1.33 +
    1.34 +  function check(win1, win2, constructorName, getInstance) {
    1.35 +    ok(getInstance(win1) instanceof win2[constructorName],
    1.36 +       "Cross-Scope instanceof works: " + constructorName + ", " + win1.location + ", " + win2.location);
    1.37 +    ok(getInstance(win2) instanceof win1[constructorName],
    1.38 +       "Cross-Scope instanceof works: " + constructorName + ", " + win2.location + ", " + win1.location);
    1.39 +  }
    1.40 +
    1.41 +  </script>
    1.42 +</head>
    1.43 +<body onload="go();">
    1.44 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=870423">Mozilla Bug 870423</a>
    1.45 +<p id="display"></p>
    1.46 +<div id="content" style="display: none">
    1.47 +
    1.48 +</div>
    1.49 +<iframe id="soifr" src="file_empty.html"></iframe>
    1.50 +<iframe id="xoifr" src="http://example.org/tests/js/xpconnect/tests/mochitest/file_empty.html"></iframe>
    1.51 +<pre id="test">
    1.52 +</pre>
    1.53 +</body>
    1.54 +</html>

mercurial