Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / fast / canvas / canvas-bg-multiple-removal.html
1 <html>
2 <script>
3 if (window.testRunner) {
4     testRunner.dumpAsText();
5     testRunner.waitUntilDone();
6 }
7
8 window.onload = function()
9 {
10     if (location.hash == "#2") {
11         document.body.innerHTML = "PASSED: Duplicate webkit-canvas styles removed without crash.";
12         if (window.testRunner)
13             testRunner.notifyDone();
14     } else {
15         if (location.hash)
16             location.hash = "#" + (parseInt(location.hash.slice(1)) + 1).toString();
17         else
18             location.hash = "#1";
19
20         iframe = document.body.appendChild(document.createElement('iframe'));
21         element1 = document.createElement('a');
22         iframe.contentDocument.body.appendChild(element1);
23         element1.style.setProperty('background', '-webkit-canvas(canvas)');
24
25         element2 = document.createElement('a');
26         iframe.contentDocument.body.appendChild(element2);  
27         element2.style.setProperty('background', '-webkit-canvas(canvas)');  
28
29         element1.textContent = element2.textContent = 1;
30         setTimeout(removeElements, 0);
31     }
32 }
33
34 function removeElements()
35
36     iframe.contentDocument.body.removeChild(element1);
37     document.adoptNode(element1);
38
39     iframe.contentDocument.body.removeChild(element2);
40     document.adoptNode(element2);  
41
42     document.body.removeChild(iframe);
43     delete iframe;
44
45     var timeout = 50;
46     if (window.GCController)
47         window.GCController.collect();
48     else if (window.gc)
49         gc();
50     else
51         timeout = 400;
52     setTimeout(finishTest, timeout);
53 }
54
55 function finishTest()
56 {
57     document.body.appendChild(element1);
58     setTimeout(function () { location.reload() }, 0);
59 }
60
61 </script>
62 </html>