OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <script> | 7 <script> |
8 var testCases = [["div0", "div1", "div2"], | 8 var testCases = [["div0", "div1", "div2"], |
9 ["div0", "div2", "div1"], | 9 ["div0", "div2", "div1"], |
10 ["div1", "div0", "div2"], | 10 ["div1", "div0", "div2"], |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 divX = null; | 57 divX = null; |
58 divY = null; | 58 divY = null; |
59 gc(); | 59 gc(); |
60 checkParentAndChildAlive(divZ, test[2]); | 60 checkParentAndChildAlive(divZ, test[2]); |
61 | 61 |
62 debug("=== After clearing innerHTML, divX, divY and divZ ==="); | 62 debug("=== After clearing innerHTML, divX, divY and divZ ==="); |
63 rootDiv.innerHTML = testHtml; | 63 rootDiv.innerHTML = testHtml; |
64 divX = document.getElementById(test[0]); | 64 divX = document.getElementById(test[0]); |
65 divY = document.getElementById(test[1]); | 65 divY = document.getElementById(test[1]); |
66 divZ = document.getElementById(test[2]); | 66 divZ = document.getElementById(test[2]); |
67 if (window.internals) | 67 |
68 prevNodes = window.internals.numberOfLiveNodes(); | |
69 rootDiv.innerHTML = ""; | 68 rootDiv.innerHTML = ""; |
70 divX = null; | 69 divX = null; |
71 divY = null; | 70 divY = null; |
72 divZ = null; | 71 divZ = null; |
73 gc(); | |
74 if (window.internals) { | |
75 // If all the Node objects in testHtml are successfully destructed, | |
76 // at least 9 <div>s objects will be removed. | |
77 // (Actually, since testHtml rendering requires more than 9 Node objects
.) | |
78 if (window.internals.numberOfLiveNodes() <= prevNodes - 9) | |
79 testPassed("All <div> objects in a DOM tree are successfully destruc
ted."); | |
80 else | |
81 testFailed("<div> objects in a DOM tree are not destructed."); | |
82 } | |
83 }); | 72 }); |
84 | 73 |
85 function checkParentAndChildAlive(div, name) { | 74 function checkParentAndChildAlive(div, name) { |
86 globalDiv = div; | 75 globalDiv = div; |
87 shouldBeEqualToString('globalDiv.id', name); | 76 shouldBeEqualToString('globalDiv.id', name); |
88 shouldBeEqualToString('globalDiv.parentNode.id', name + "-parent"); | 77 shouldBeEqualToString('globalDiv.parentNode.id', name + "-parent"); |
89 shouldBeEqualToString('globalDiv.firstChild.id', name + "-child"); | 78 shouldBeEqualToString('globalDiv.firstChild.id', name + "-child"); |
90 globalDiv = null; | 79 globalDiv = null; |
91 gc(); | 80 gc(); |
92 } | 81 } |
93 | 82 |
94 var successfullyParsed = true; | 83 var successfullyParsed = true; |
95 </script> | 84 </script> |
96 </body> | 85 </body> |
97 </html> | 86 </html> |
OLD | NEW |