dom/tests/mochitest/chrome/test_subscript_bindings.xul

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/tests/mochitest/chrome/test_subscript_bindings.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,44 @@
     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=741267
     1.9 +-->
    1.10 +<window title="Mozilla Bug 741267"
    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=741267"
    1.19 +     target="_blank">Mozilla Bug 741267</a>
    1.20 +  </body>
    1.21 +
    1.22 +  <!-- test code goes here -->
    1.23 +  <script type="application/javascript">
    1.24 +  <![CDATA[
    1.25 +
    1.26 +  /** Test for Bug 741267 **/
    1.27 +    function doTest() {
    1.28 +      // Resolve XMLHttpRequest on the chrome global
    1.29 +      new XMLHttpRequest();
    1.30 +
    1.31 +      var loader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].getService(Components.interfaces.mozIJSSubScriptLoader);
    1.32 +      var context = { window: $("t").contentWindow };
    1.33 +      var thrown = false;
    1.34 +      try {
    1.35 +        loader.loadSubScript(/.*\//.exec(window.location.href)[0] + "file_subscript_bindings.js", context);
    1.36 +      } catch (e) {
    1.37 +        thrown = true;
    1.38 +      }
    1.39 +      ok(!thrown, "'new window.XMLHttpRequest()' in a subscript shouldn't throw");
    1.40 +      SimpleTest.finish();
    1.41 +    }
    1.42 +
    1.43 +    SimpleTest.waitForExplicitFinish();
    1.44 +    addLoadEvent(doTest);
    1.45 +  ]]>
    1.46 +  </script>
    1.47 +</window>

mercurial