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 115124 bea217523192bcf4e7084ed6fcf2fff45113b342
parent 115123 0bdcf50f507a5086c06611ead9cab04c19e0a417
child 115125 e5f2c48f10c22a85074e31e6d811c2d506f418a1
push id1708
push userakeybl@mozilla.com
push dateMon, 19 Nov 2012 21:10:21 +0000
treeherdermozilla-beta@27b14fe50103 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmounir
bugs793400, 370098
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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>