Bug 103916
Summary: | MutationObservers should be passed unique MutationRecords | ||
---|---|---|---|
Product: | WebKit | Reporter: | Adam Klein <adamk> |
Component: | WebCore Misc. | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW | ||
Severity: | Normal | CC: | bedney, rafaelw, rniwa, syoichi |
Priority: | P2 | Keywords: | WebExposed |
Version: | 528+ (Nightly build) | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Bug Depends on: | |||
Bug Blocks: | 68729 |
Adam Klein
This is per a change to the DOM spec: see https://www.w3.org/Bugs/Public/show_bug.cgi?id=20131 and https://github.com/whatwg/dom/commit/b5d05659b682b2560af6c24e2e2cdbace82811d3
To minimize the memory impact/mutation-time cost, we could create these unique records only at delivery time (when we're already walking through the list of records to move them from a WTF::Vector to a JS array). Or if we want to get fancy we could build machinery to give each observer its own JS wrapper around a single record.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
William J. Edney
This bug really caused me a lot of confusion. I have a long-lived MO that observes changes on the #document node (observing both childList and subtree, of course). I wondered why I was seeing a lot of the same Mutation Records over and over again (and this list grows as my app runs).
For now, I mark these objects with an expando slot to let me know the record has already been processed, but this should be unnecessary (and it's wildly inefficient to be called with records I've already processed).