dom/tests/mochitest/dom-level0/test_crossdomainprops.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/tests/mochitest/dom-level0/test_crossdomainprops.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,36 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<head>
     1.7 +  <title>Test for Cross domain access to properties</title>
     1.8 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>        
     1.9 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.10 +</head>
    1.11 +<body onload="runTest()">
    1.12 +<p id="display"></p>
    1.13 +<div id="content" style="display: none">
    1.14 +  
    1.15 +</div>
    1.16 +<iframe name="frame1" src="file_crossdomainprops_inner.html"></iframe>
    1.17 +<iframe name="frame2" src="http://example.com/tests/dom/tests/mochitest/dom-level0/file_crossdomainprops_inner.html"></iframe>
    1.18 +<pre id="test">
    1.19 +<script class="testbody" type="text/javascript">
    1.20 +
    1.21 +SimpleTest.waitForExplicitFinish();
    1.22 +
    1.23 +function runTest() {
    1.24 +  ok(frames.frame1.myVar == 10, "access same domain inner window variable");
    1.25 +  var otherDomainVar = null;
    1.26 +  try {
    1.27 +    otherDomainVar = frames.frame2.myVar;
    1.28 +  }
    1.29 +  catch (e) {
    1.30 +    otherDomainVar = -1;
    1.31 +  }
    1.32 +  is(otherDomainVar, -1, "access other domain inner window variable");
    1.33 +  SimpleTest.finish();
    1.34 +}
    1.35 +
    1.36 +</script>
    1.37 +</pre>
    1.38 +</body>
    1.39 +</html>

mercurial