Bug 17076 - Document Tree isn't surviving long enough (Acid3 bug)
Summary: Document Tree isn't surviving long enough (Acid3 bug)
Status: RESOLVED DUPLICATE of bug 16289
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords: NeedsReduction
Depends on:
Blocks: Acid3
  Show dependency treegraph
 
Reported: 2008-01-29 14:40 PST by Eric Seidel (no email)
Modified: 2008-01-30 01:08 PST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Seidel (no email) 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;
    },
Comment 1 Alexey Proskuryakov 2008-01-30 01:08:29 PST

*** This bug has been marked as a duplicate of 16289 ***