Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=559526 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 559526</title> |
michael@0 | 8 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 10 | </head> |
michael@0 | 11 | <body> |
michael@0 | 12 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=559526">Mozilla Bug 559526</a> |
michael@0 | 13 | <p id="display"></p> |
michael@0 | 14 | <div id="content" style="display: none"> |
michael@0 | 15 | |
michael@0 | 16 | </div> |
michael@0 | 17 | <pre id="test"> |
michael@0 | 18 | <div id="nodes" style="display:none"> |
michael@0 | 19 | <div id="child1"></div> |
michael@0 | 20 | <div id="child2"></div> |
michael@0 | 21 | |
michael@0 | 22 | <div id="child3"></div> |
michael@0 | 23 | <div id="child4"></div> |
michael@0 | 24 | <div id="child5"></div> |
michael@0 | 25 | <div id="child6"></div> |
michael@0 | 26 | <div id="child7"></div> |
michael@0 | 27 | <div id="child8"></div> |
michael@0 | 28 | </div> |
michael@0 | 29 | <script type="application/javascript"> |
michael@0 | 30 | |
michael@0 | 31 | /** Test for Bug 559526 **/ |
michael@0 | 32 | |
michael@0 | 33 | var it; |
michael@0 | 34 | var recurse = false; |
michael@0 | 35 | var testCount = 0; |
michael@0 | 36 | function filter(node) { |
michael@0 | 37 | if (node.id == "child3" && ! recurse) { |
michael@0 | 38 | recurse = true; |
michael@0 | 39 | var ex = null; |
michael@0 | 40 | try { |
michael@0 | 41 | var foo = it.nextNode(); |
michael@0 | 42 | } catch(e) { |
michael@0 | 43 | ex = e; |
michael@0 | 44 | } |
michael@0 | 45 | ++testCount; |
michael@0 | 46 | is(ex.name, "InvalidStateError", "Should have thrown an exception!"); |
michael@0 | 47 | is(ex.code, DOMException.INVALID_STATE_ERR, "Should have thrown an exception!"); |
michael@0 | 48 | recurse = false; |
michael@0 | 49 | } |
michael@0 | 50 | return NodeFilter.FILTER_ACCEPT; |
michael@0 | 51 | } |
michael@0 | 52 | |
michael@0 | 53 | (function testNodeIterator() { |
michael@0 | 54 | |
michael@0 | 55 | it = document.createNodeIterator( |
michael@0 | 56 | document.getElementById("nodes"), |
michael@0 | 57 | NodeFilter.SHOW_ELEMENT, |
michael@0 | 58 | filter |
michael@0 | 59 | ); |
michael@0 | 60 | while (it.nextNode()); |
michael@0 | 61 | })(); |
michael@0 | 62 | |
michael@0 | 63 | (function testTreeWalker() { |
michael@0 | 64 | it = document.createTreeWalker( |
michael@0 | 65 | document.getElementById("nodes"), |
michael@0 | 66 | NodeFilter.SHOW_ELEMENT, |
michael@0 | 67 | filter |
michael@0 | 68 | ); |
michael@0 | 69 | while(it.nextNode()); |
michael@0 | 70 | |
michael@0 | 71 | it = document.createTreeWalker( |
michael@0 | 72 | document.getElementById("nodes"), |
michael@0 | 73 | NodeFilter.SHOW_ELEMENT, |
michael@0 | 74 | filter |
michael@0 | 75 | ); |
michael@0 | 76 | it.firstChild(); |
michael@0 | 77 | while(it.nextSibling()); |
michael@0 | 78 | |
michael@0 | 79 | it = document.createTreeWalker( |
michael@0 | 80 | document.getElementById("nodes"), |
michael@0 | 81 | NodeFilter.SHOW_ELEMENT, |
michael@0 | 82 | filter |
michael@0 | 83 | ); |
michael@0 | 84 | it.lastChild(); |
michael@0 | 85 | while(it.previousSibling()); |
michael@0 | 86 | })(); |
michael@0 | 87 | |
michael@0 | 88 | is(testCount, 4, "Should have tests 3 filter calls!"); |
michael@0 | 89 | |
michael@0 | 90 | </script> |
michael@0 | 91 | </pre> |
michael@0 | 92 | </body> |
michael@0 | 93 | </html> |