|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <head> |
|
4 <title>Test for nsIDOMWindowUtils.getTranslationNodes</title> |
|
5 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
|
7 </head> |
|
8 <body onload="runTest()"> |
|
9 <script type="application/javascript"> |
|
10 var utils = SpecialPowers.wrap(window). |
|
11 QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor). |
|
12 getInterface(SpecialPowers.Ci.nsIDOMWindowUtils); |
|
13 |
|
14 function runTest() { |
|
15 isnot(utils, null, "nsIDOMWindowUtils"); |
|
16 |
|
17 for (var i = 0; i < 16000; i++) { |
|
18 var text = document.createTextNode("a"); |
|
19 var node = document.createElement("b"); |
|
20 node.appendChild(text); |
|
21 document.body.appendChild(node); |
|
22 } |
|
23 |
|
24 var translationRoots = utils.getTranslationNodes(document.body); |
|
25 is (translationRoots.length, 15000, "Translation nodes were limited to 15000 nodes."); |
|
26 |
|
27 SimpleTest.finish(); |
|
28 } |
|
29 |
|
30 SimpleTest.waitForExplicitFinish(); |
|
31 </script> |
|
32 </body> |
|
33 </html> |