| Summary: | VisibleSelection should only accept Range by reference | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Brent Fulgham <bfulgham> | ||||||||
| Component: | WebKit Misc. | Assignee: | Brent Fulgham <bfulgham> | ||||||||
| Status: | RESOLVED FIXED | ||||||||||
| Severity: | Normal | CC: | bfulgham, thorton | ||||||||
| Priority: | P2 | ||||||||||
| Version: | 528+ (Nightly build) | ||||||||||
| Hardware: | All | ||||||||||
| OS: | All | ||||||||||
| Attachments: |
|
||||||||||
|
Description
Brent Fulgham
2015-04-22 09:32:13 PDT
It's interesting (alarming?) that there are cases in the same file (e.g., WebPage.cpp) where null checks are performed, and others where it is missed:
Example 1: (WebPage.cpp Line 4207)
void WebPage::insertTextAsync(const String& text, const EditingRange& replacementEditingRange, bool registerUndoGroup)
RefPtr<Range> replacementRange = rangeFromEditingRange(frame, replacementEditingRange);
if (replacementRange)
frame.selection().setSelection(VisibleSelection(replacementRange.get(), SEL_DEFAULT_AFFINITY));
Example 2: (WebPage.cpp Line 4296)
void WebPage::setCompositionAsync(const String& text, Vector<CompositionUnderline> underlines, const EditingRange& selection, const EditingRange& replacementEditingRange)
replacementRange = rangeFromEditingRange(frame, replacementEditingRange);
frame.selection().setSelection(VisibleSelection(replacementRange.get(), SEL_DEFAULT_AFFINITY));
Created attachment 251383 [details]
Patch
Comment on attachment 251383 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=251383&action=review > Source/WebCore/editing/Editor.cpp:2003 > + RELEASE_ASSERT(badGrammarRange.get()); Please don't RELEASE_ASSERT in all these places. The next line will do a null deref anyway. Created attachment 251387 [details]
Patch v2 (No RELEASE_ASSERT, iOS Fixes)
Created attachment 251390 [details]
Patch v3 (More build fixes for different configurations)
Committed r183158: <http://trac.webkit.org/changeset/183158> |