dom/tests/mochitest/chrome/test_sandbox_image.xul

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/tests/mochitest/chrome/test_sandbox_image.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,37 @@
     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 +<!--
     1.8 +https://bugzilla.mozilla.org/show_bug.cgi?id=616397
     1.9 +-->
    1.10 +<window title="Mozilla Bug 616397"
    1.11 +        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    1.12 +  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
    1.13 +
    1.14 +  <iframe id="t"></iframe>
    1.15 +
    1.16 +  <!-- test results are displayed in the html:body -->
    1.17 +  <body xmlns="http://www.w3.org/1999/xhtml">
    1.18 +  <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=616397"
    1.19 +     target="_blank">Mozilla Bug 616397</a>
    1.20 +  </body>
    1.21 +
    1.22 +
    1.23 +  <!-- test code goes here -->
    1.24 +  <script type="application/javascript">
    1.25 +  <![CDATA[
    1.26 +  /** Test for Bug 616397 **/
    1.27 +    function doTest() {
    1.28 +      var win = $("t").contentWindow;
    1.29 +      var sandbox = Components.utils.Sandbox(win, { sandboxPrototype: win });
    1.30 +      var result = Components.utils.evalInSandbox("new Image()", sandbox);
    1.31 +      isnot(result, null, "Should have an image");
    1.32 +      is(result.tagName, "IMG", "Should have the right tag name");
    1.33 +      SimpleTest.finish();
    1.34 +    }
    1.35 +
    1.36 +    SimpleTest.waitForExplicitFinish();
    1.37 +    addLoadEvent(doTest);
    1.38 +  ]]>
    1.39 +  </script>
    1.40 +</window>

mercurial