Bug 793400 - Prepare test_bug370098.html for Node WebIDL binding; r=mounir
authorMs2ger <ms2ger@gmail.com>
Tue, 02 Oct 2012 10:24:12 +0200
changeset 108935 bea217523192bcf4e7084ed6fcf2fff45113b342
parent 108934 0bdcf50f507a5086c06611ead9cab04c19e0a417
child 108936 e5f2c48f10c22a85074e31e6d811c2d506f418a1
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
reviewersmounir
bugs793400, 370098
milestone18.0a1
Bug 793400 - Prepare test_bug370098.html for Node WebIDL binding; r=mounir
dom/tests/mochitest/bugs/test_bug370098.html
--- a/dom/tests/mochitest/bugs/test_bug370098.html
+++ b/dom/tests/mochitest/bugs/test_bug370098.html
@@ -12,34 +12,37 @@ https://bugzilla.mozilla.org/show_bug.cg
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=370098">Mozilla Bug 370098</a>
 <p id="display"></p>
 <div id="content" style="display: none">
   
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 /** Test for Bug 370098 **/
-var dom_protos =
-    [ "Document", "Element", "Image", "DOMParser", "XMLSerializer",
-      "XMLHttpRequest", "XPathEvaluator", "XSLTProcessor" ];
-for each (var dom_proto in dom_protos) {
-    var shouldthrow = typeof window[dom_proto] != "function";
+function test_constructor(dom_proto, shouldthrow) {
     var threw = false;
     try {
         window[dom_proto]();
     } catch (e) {
         threw = true;
     }
     is(threw, shouldthrow, "Calling |" + dom_proto + "()| should" + (shouldthrow ? " " : " not ") + "throw");
 
     threw = false;
     try {
         new window[dom_proto]();
     } catch (e) {
         threw = true;
     }
     is(threw, shouldthrow, "Calling |new " + dom_proto + "()| should" + (shouldthrow ? " " : " not ") + "throw");
 }
+var dom_protos = [ "Document", "Element" ];
+var dom_constructors = [ "Image", "DOMParser", "XMLSerializer",
+  "XMLHttpRequest", "XPathEvaluator", "XSLTProcessor" ];
+dom_protos.forEach(
+  function(p) { test_constructor(p, true); });
+dom_constructors.forEach(
+  function(p) { test_constructor(p, false); });
 </script>
 </pre>
 </body>
 </html>