mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-28 21:51:51 -10:00
Some bits taken from a patch by Cameron McCormack. This follows a change to the DOM spec that has already been implemented by WebKit. We do no checks for duplicates on initial attribute parsing, only when the DOMTokenList is accessed. We re-check for duplicates on every DOMTokenList access, but optimized with a bloom filter, so it should be fast. It would be possible to add a flag to check if we've already removed duplicates from the atom list, but it would require the nsAttrValue to talk to the nsDOMTokenList somehow, and a spare bit would be needed in nsAttrValue, and it would only help cases where DOMTokenList is repeatedly accessed without the content attribute being modified in between (e.g., .length) where the token list is extremely long. This patch assumes that no one other than nsDOMTokenList cares if duplicates are removed from the nsAttrValue's atom array. If anything does, they will see inconsistent behavior depending on whether nsDOMTokenList has removed duplicates yet. Since we don't want to check for duplicates on parse for performance reasons, the correct fix is to update the code elsewhere to also remove duplicates. MozReview-Commit-ID: 97KRVhPGwm8