RESOLVED DUPLICATE of bug 16289 Bug 17076
Document Tree isn't surviving long enough (Acid3 bug)
https://bugs.webkit.org/show_bug.cgi?id=17076
Summary Document Tree isn't surviving long enough (Acid3 bug)
Eric Seidel (no email)
Reported 2008-01-29 14:40:36 PST
Document Tree isn't surviving long enough (Acid3 bug) This will need some reduction. function () { // test 26: check that document tree survives while still accessible var d; // e1 - an element that's in a document d = document.implementation.createDocument(null, null, null); var e1 = d.createElement('test'); d.appendChild(d.createElement('root')); d.documentElement.appendChild(e1); assert(e1.parentNode, "e1 - parent element doesn't exist"); assert(e1.parentNode.ownerDocument, "e1 - document doesn't exist"); // e2 - an element that's not in a document d = document.implementation.createDocument(null, null, null); var e2 = d.createElement('test'); d.createElement('root').appendChild(e2); assert(e2.parentNode, "e2 - parent element doesn't exist"); assert(e2.parentNode.ownerDocument, "e2 - document doesn't exist"); // now try to decouple them d = null; kungFuDeathGrip = [e1, e2]; assert(e1.parentNode, "e1 - parent element doesn't exist after dropping reference to document"); assert(e1.parentNode.ownerDocument, "e1 - document doesn't exist after dropping reference to document"); assert(e2.parentNode, "e2 - parent element doesn't exist after dropping reference to document"); assert(e2.parentNode.ownerDocument, "e2 - document doesn't exist after dropping reference to document"); var loops = ((new Date().valueOf() - 1.1e12) / 32e9) * 0x500; // increases linearly over time for (var i = 0; i < loops; i += 1) { // we want to force a GC here, so we use up lots of memory // we take the opportunity to sneak in a perf test to make DOM and JS stuff faster... d = new Date(); d = new (function (x) { return { toString: function () { return x.toString() } } })(d.valueOf()); d = document.createTextNode("iteration " + i + " at " + d); document.createElement('a').appendChild(d); d = d.parentNode; document.body.insertBefore(d, document.getElementById('bucket1').parentNode); assert(document.getElementById('bucket2').nextSibling.parentNode.previousSibling.firstChild.data.match(/AT\W/i), "iteration " + i + " failed"); d.setAttribute('class', d.textContent); document.body.removeChild(d); } assert(e1.parentNode, "e1 - parent element doesn't exist after looping"); assert(e1.parentNode.ownerDocument, "e1 - document doesn't exist after looping"); assertEquals(e1.parentNode.ownerDocument.nodeType, 9, "e1 - document node type has wrong node type"); assert(e2.parentNode, "e2 - parent element doesn't exist after looping"); assert(e2.parentNode.ownerDocument, "e2 - document doesn't exist after looping"); assertEquals(e2.parentNode.ownerDocument.nodeType, 9, "e2 - document node type has wrong node type"); return 2; }, function () { // test 27: a continuation of the previous test var e1 = kungFuDeathGrip[0]; var e2 = kungFuDeathGrip[1]; kungFuDeathGrip = null; assert(e1, "e1 - element itself didn't survive across tests"); assert(e1.parentNode, "e1 - parent element doesn't exist after waiting"); assert(e1.parentNode.ownerDocument, "e1 - document doesn't exist after waiting"); assertEquals(e1.parentNode.ownerDocument.nodeType, 9, "e1 - document node type has wrong node type after waiting"); assert(e2, "e2 - element itself didn't survive across tests"); assert(e2.parentNode, "e2 - parent element doesn't exist after waiting"); assert(e2.parentNode.ownerDocument, "e2 - document doesn't exist after waiting"); assertEquals(e2.parentNode.ownerDocument.nodeType, 9, "e2 - document node type has wrong node type after waiting"); return 2; },
Attachments
Alexey Proskuryakov
Comment 1 2008-01-30 01:08:29 PST
*** This bug has been marked as a duplicate of 16289 ***
Note You need to log in before you can comment on or make changes to this bug.