dom/bindings/test/test_document_location_set_via_xray.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/bindings/test/test_document_location_set_via_xray.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,49 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=905493
     1.8 +-->
     1.9 +<head>
    1.10 +  <meta charset="utf-8">
    1.11 +  <title>Test for Bug 905493</title>
    1.12 +  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    1.13 +  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
    1.14 +</head>
    1.15 +<body>
    1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=905493">Mozilla Bug 905493</a>
    1.17 +<p id="display"></p>
    1.18 +<div id="content" style="display: none">
    1.19 +<iframe id="t" src="http://example.org/tests/dom/bindings/test/file_document_location_set_via_xray.html"></iframe>
    1.20 +</div>
    1.21 +<pre id="test">
    1.22 +<script type="application/javascript">
    1.23 +
    1.24 +/** Test for Bug 905493 **/
    1.25 +
    1.26 +function test()
    1.27 +{
    1.28 +  var doc = document.getElementById("t").contentWindow.document;
    1.29 +  ok(!("x" in doc), "Should have an Xray here");
    1.30 +  is(doc.x, undefined, "Really should have an Xray here");
    1.31 +  is(doc.wrappedJSObject.x, 5, "And wrapping the right thing");
    1.32 +  document.getElementById("t").onload = function() {
    1.33 +    ok(true, "Load happened");
    1.34 +    SimpleTest.finish();
    1.35 +  };
    1.36 +  try {
    1.37 +    // Test the forwarding location setter
    1.38 +    doc.location = "chrome://mochikit/content/tests/SimpleTest/test.css";
    1.39 +  } catch (e) {
    1.40 +    // Load failed
    1.41 +    ok(false, "Load failed");
    1.42 +    SimpleTest.finish();
    1.43 +  }
    1.44 +}
    1.45 +
    1.46 +SimpleTest.waitForExplicitFinish();
    1.47 +addLoadEvent(test);
    1.48 +
    1.49 +</script>
    1.50 +</pre>
    1.51 +</body>
    1.52 +</html>

mercurial