dom/base/test/test_getTranslationNodes_limit.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/base/test/test_getTranslationNodes_limit.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,33 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<head>
     1.7 +  <title>Test for nsIDOMWindowUtils.getTranslationNodes</title>
     1.8 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     1.9 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.10 +</head>
    1.11 +<body onload="runTest()">
    1.12 +<script type="application/javascript">
    1.13 +  var utils = SpecialPowers.wrap(window).
    1.14 +              QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor).
    1.15 +              getInterface(SpecialPowers.Ci.nsIDOMWindowUtils);
    1.16 +
    1.17 +  function runTest() {
    1.18 +    isnot(utils, null, "nsIDOMWindowUtils");
    1.19 +
    1.20 +    for (var i = 0; i < 16000; i++) {
    1.21 +      var text = document.createTextNode("a");
    1.22 +      var node = document.createElement("b");
    1.23 +      node.appendChild(text);
    1.24 +      document.body.appendChild(node);
    1.25 +    }
    1.26 +
    1.27 +    var translationRoots = utils.getTranslationNodes(document.body);
    1.28 +    is (translationRoots.length, 15000, "Translation nodes were limited to 15000 nodes.");
    1.29 +
    1.30 +    SimpleTest.finish();
    1.31 +  }
    1.32 +
    1.33 +  SimpleTest.waitForExplicitFinish();
    1.34 +</script>
    1.35 +</body>
    1.36 +</html>

mercurial