Bug 144629

Summary: Navigating to www.apple.com hits assertion in WebCore::TextIteratorCopyableText::set()
Product: WebKit Reporter: zalan <zalan>
Component: Layout and RenderingAssignee: zalan <zalan>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, joepeck, koivisto
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description zalan 2015-05-05 09:34:20 PDT
1. Load apple.com
2. Wait a few seconds.

   1 com.apple.JavaScriptCore       0x113e9d3f7 WTFCrash + 0x27
   2 com.apple.WebCore              0x1174d62b2 WebCore::TextIteratorCopyableText::set(WTF::String&&, unsigned int, unsigned int) + 0x92 (TextIterator.cpp:292)
   3 com.apple.WebCore              0x1174d0684 WebCore::TextIterator::emitText(WebCore::Text&, WebCore::RenderText&, int, int) + 0x1e4 (TextIterator.cpp:1128)
   4 com.apple.WebCore              0x1174cf66b WebCore::TextIterator::handleTextNode() + 0xfbb (TextIterator.cpp:601)
   5 com.apple.WebCore              0x1174cd67b WebCore::TextIterator::advance() + 0x2fb (TextIterator.cpp:437)
   6 com.apple.WebCore              0x1174d44a7 WebCore::plainText(WebCore::Range const*, unsigned short, bool) + 0x107 (TextIterator.cpp:2567)
   7 com.apple.WebKit               0x110a6c985 WebKit::WebFrame::contentsAsString() const + 0x265 (WebFrame.cpp:355)
   8 com.apple.WebKit               0x110b81fc3 WebKit::WebPage::getContentsAsString(unsigned long long) + 0x33 (WebPage.cpp:2500)
Comment 1 zalan 2015-05-05 09:34:43 PDT
rdar://problem/20689877
Comment 2 zalan 2015-05-05 11:23:45 PDT
Created attachment 252389 [details]
Patch
Comment 3 zalan 2015-05-05 11:25:37 PDT
Created attachment 252390 [details]
Patch
Comment 4 Said Abou-Hallawa 2015-05-05 11:48:57 PDT
Comment on attachment 252390 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=252390&action=review

> Source/WebCore/editing/TextIterator.cpp:620
> +        }

Should not we have a loop here to collect all the prefix tabs and newlines in one emitText() instead of emitting each one in emitCharacter()?
Comment 5 zalan 2015-05-05 11:55:51 PDT
Comment on attachment 252390 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=252390&action=review

>> Source/WebCore/editing/TextIterator.cpp:620
>> +        }
> 
> Should not we have a loop here to collect all the prefix tabs and newlines in one emitText() instead of emitting each one in emitCharacter()?

Whitespace is usually collapsed.
Comment 6 zalan 2015-05-05 12:41:09 PDT
Comment on attachment 252390 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=252390&action=review

>>> Source/WebCore/editing/TextIterator.cpp:620
>>> +        }
>> 
>> Should not we have a loop here to collect all the prefix tabs and newlines in one emitText() instead of emitting each one in emitCharacter()?
> 
> Whitespace is usually collapsed.

Non-collapsed case is handled separately. (see TextIterator::handleTextNode -> if (!renderer.style().collapseWhiteSpace()))
Comment 7 zalan 2015-05-05 14:19:26 PDT
Created attachment 252406 [details]
Patch
Comment 8 Andreas Kling 2015-05-05 14:35:10 PDT
Comment on attachment 252406 [details]
Patch

r=me
Comment 9 WebKit Commit Bot 2015-05-05 15:45:51 PDT
Comment on attachment 252406 [details]
Patch

Clearing flags on attachment: 252406

Committed r183835: <http://trac.webkit.org/changeset/183835>
Comment 10 WebKit Commit Bot 2015-05-05 15:45:55 PDT
All reviewed patches have been landed.  Closing bug.