[Webkit-unassigned] [Bug 137651] WeakMap reference w/ DOM element as key does not survive long enough

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Oct 14 22:16:50 PDT 2014


https://bugs.webkit.org/show_bug.cgi?id=137651





--- Comment #5 from Alexey Proskuryakov <ap at webkit.org>  2014-10-14 22:16:44 PST ---
I think that adding a custom property on each node in WeakMap may be a reasonable workaround. Geoff, does this have any serious downsides?

  while (i--) {
    document.body.appendChild(document.createElement('p'));
    document.body.lastElementChild.textContent = i;
    document.body.lastElementChild.webkitWeakMapWorkaround = 1;  // <-- This
    wmap.set(document.body.lastElementChild, { foo: 'bar', id: i });
  }

Perhaps we can use a similar mechanism to make WeakMap work with nodes. Possibly a side HashCountedSet, or even a counter in node rare data.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list