Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / gc-acid3.html
bloba026e19d8f0664f93bfa64ad94656de4dbedd555
1 <div class="buckets"
2 ><p id="bucket1" class="z"></p
3 ><p id="bucket2" class="z"></p
4 ><p id="bucket3" class="z"></p
5 ><p id="bucket4" class="z"></p
6 ><p id="bucket5" class="z"></p
7 ><p id="bucket6" class="z"></p>
8 </div>
9 <p>There should be no assertion failures below, but the word DONE should show up.</p>
10 <script>
11 if (window.testRunner) {
12 testRunner.dumpAsText();
14 </script>
15 <script>
16 function fail(message) {
17 document.write(message + "<br>");
19 function assert(condition, message) {
20 if (!condition)
21 fail(message);
23 function assertEquals(expression, value, message) {
24 if (expression != value) {
25 expression = (""+expression).replace(/[\r\n]+/g, "\\n");
26 value = (""+value).replace(/\r?\n/g, "\\n");
27 fail("expected: " + value + ", got: " + expression + " - " + message);
32 var d;
33 // e1 - an element that's in a document
34 d = document.implementation.createDocument(null, null, null);
35 var e1 = d.createElement('test1');
36 d.appendChild(d.createElement('root'));
37 d.documentElement.appendChild(e1);
38 assert(e1.parentNode, "e1 - parent element doesn't exist");
39 assert(e1.parentNode.ownerDocument, "e1 - document doesn't exist");
40 // e2 - an element that's not in a document
41 d = document.implementation.createDocument(null, null, null);
42 var e2 = d.createElement('test2');
43 d.createElement('root').appendChild(e2);
44 assert(e2.parentNode, "e2 - parent element doesn't exist");
45 assert(e2.parentNode.ownerDocument, "e2 - document doesn't exist");
46 // now try to decouple them
47 d = null;
49 kungFuDeathGrip = [e1, e2];
50 assert(e1.parentNode, "e1 - parent element doesn't exist after dropping reference to document");
51 assert(e1.parentNode.ownerDocument, "e1 - document doesn't exist after dropping reference to document");
52 assert(e2.parentNode, "e2 - parent element doesn't exist after dropping reference to document");
53 assert(e2.parentNode.ownerDocument, "e2 - document doesn't exist after dropping reference to document");
54 var loops = ((new Date().valueOf() - 1.1e12) / 32e9) * 0x500; // increases linearly over time
55 for (var i = 0; i < loops; i += 1) {
56 // we want to force a GC here, so we use up lots of memory
57 // we take the opportunity to sneak in a perf test to make DOM and JS stuff faster...
58 d = new Date();
59 d = new (function (x) { return { toString: function () { return x.toString() } } })(d.valueOf());
60 d = document.createTextNode("iteration " + i + " at " + d);
61 document.createElement('a').appendChild(d);
62 d = d.parentNode;
63 document.body.insertBefore(d, document.getElementById('bucket1').parentNode);
64 assert(document.getElementById('bucket2').nextSibling.parentNode.previousSibling.firstChild.data.match(/AT\W/i), "iteration " + i + " failed");
65 d.setAttribute('class', d.textContent);
66 document.body.removeChild(d);
69 assert(e1.parentNode, "e1 - parent element doesn't exist after looping");
70 assert(e1.parentNode.ownerDocument, "e1 - document doesn't exist after looping");
71 assertEquals(e1.parentNode.ownerDocument.nodeType, 9, "e1 - document node type has wrong node type");
72 assert(e2.parentNode, "e2 - parent element doesn't exist after looping");
73 assert(e2.parentNode.ownerDocument, "e2 - document doesn't exist after looping");
74 assertEquals(e2.parentNode.ownerDocument.nodeType, 9, "e2 - document node type has wrong node type");
76 </script>
77 <p>DONE</p>