dom/base/test/test_console.xul

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/base/test/test_console.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,34 @@
     1.4 +<?xml version="1.0"?>
     1.5 +<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
     1.6 +<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
     1.7 +<window title="Test for URL API"
     1.8 +        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
     1.9 +  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
    1.10 +
    1.11 +  <!-- test results are displayed in the html:body -->
    1.12 +  <body xmlns="http://www.w3.org/1999/xhtml">
    1.13 +    <iframe id="iframe" />
    1.14 +  </body>
    1.15 +
    1.16 +  <!-- test code goes here -->
    1.17 +  <script type="application/javascript"><![CDATA[
    1.18 +
    1.19 +  ok("console" in window, "Console exists");
    1.20 +  window.console.log(42);
    1.21 +  window.console = 42;
    1.22 +  is(window.console, 42, "Console is replacable");
    1.23 +
    1.24 +  var frame = document.getElementById("iframe");
    1.25 +  ok(frame, "Frame must exist");
    1.26 +  frame.src="http://mochi.test:8888/tests/dom/base/test/file_empty.html";
    1.27 +  frame.onload = function() {
    1.28 +    ok("console" in frame.contentWindow, "Console exists in the iframe");
    1.29 +    frame.contentWindow.console.log(42);
    1.30 +    frame.contentWindow.console = 42;
    1.31 +    is(frame.contentWindow.console, 42, "Console is replacable in the iframe");
    1.32 +    SimpleTest.finish();
    1.33 +  }
    1.34 +
    1.35 +  SimpleTest.waitForExplicitFinish();
    1.36 +  ]]></script>
    1.37 +</window>

mercurial