[Webkit-unassigned] [Bug 33668] WebCore::InsertListCommand::modifyRange infinite loop (100% CPU usage)

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jul 30 10:20:00 PDT 2010


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


Darin Adler <darin at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #63036|review?                     |review+
               Flag|                            |




--- Comment #20 from Darin Adler <darin at apple.com>  2010-07-30 10:20:00 PST ---
(From update of attachment 63036)
> +            ExceptionCode ec = 0;
> +            if (rangeStartIsInList && newList)
> +                currentSelection->setStart(newList->parentNode(), newList->nodeIndex(), ec);
> +            if (rangeEndIsInList && newList)
> +                currentSelection->setEnd(newList->parentNode(), newList->nodeIndex()+1, ec);

There should be spaces around the "+" operator here where we do "+ 1".

Since nodeIndex is potentially a O(n^2) operation, I suggest restructuring the code so we compute it only once. On the other hand, if you don't plan to do that optimization, it would be better to use the Range::setStartAfter and Range::setEndBefore functions instead of calling nodeIndex directly here.

If you're going to ignore the exception code, there is no need to initialize it to 0.

Are all the code changes here covered by this single test?

-- 
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