Changeset 175334 in webkit


Ignore:
Timestamp:
Oct 29, 2014 11:22:21 AM (9 years ago)
Author:
Joseph Pecoraro
Message:

[iOS] iPad: Occasional <select> crashes attempting to scroll to non-existing row 0 in viewWillAppear
https://bugs.webkit.org/show_bug.cgi?id=138165

Reviewed by David Kilzer.

This is a speculative fix for a crash attempting to scroll to a row in a
select picker on iPad. In these cases we are trying to scroll to the first
row of the first section, but no such row appears to exist. I was unable
to reproduce the issue, but if it is happening we should be able to protect
safely protect against crashing.

  • UIProcess/ios/forms/WKFormSelectPopover.mm:

(-[WKSelectTableViewController viewWillAppear:]):
Protect against trying to scroll to a section/row that does not exist
by pre-checking that the section/row is valid.

Location:
trunk/Source/WebKit2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r175299 r175334  
     12014-10-29  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        [iOS] iPad: Occasional <select> crashes attempting to scroll to non-existing row 0 in viewWillAppear
     4        https://bugs.webkit.org/show_bug.cgi?id=138165
     5
     6        Reviewed by David Kilzer.
     7
     8        This is a speculative fix for a crash attempting to scroll to a row in a
     9        select picker on iPad. In these cases we are trying to scroll to the first
     10        row of the first section, but no such row appears to exist. I was unable
     11        to reproduce the issue, but if it is happening we should be able to protect
     12        safely protect against crashing.
     13
     14        * UIProcess/ios/forms/WKFormSelectPopover.mm:
     15        (-[WKSelectTableViewController viewWillAppear:]):
     16        Protect against trying to scroll to a section/row that does not exist
     17        by pre-checking that the section/row is valid.
     18
    1192014-10-28  Ting-Wei Lan  <lantw44@gmail.com>
    220
  • trunk/Source/WebKit2/UIProcess/ios/forms/WKFormSelectPopover.mm

    r170321 r175334  
    144144{
    145145    [super viewWillAppear:animated];
    146    
    147     if (_singleSelectionIndex != NSNotFound) {
    148         NSIndexPath *indexPath = [NSIndexPath indexPathForRow:_singleSelectionIndex inSection:_singleSelectionSection];
    149         [self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionMiddle animated:NO];
    150     }
     146
     147    if (_singleSelectionIndex == NSNotFound)
     148        return;
     149
     150    if (_singleSelectionSection >= (NSUInteger)[self.tableView numberOfSections])
     151        return;
     152
     153    if (_singleSelectionIndex >= (NSUInteger)[self.tableView numberOfRowsInSection:_singleSelectionSection])
     154        return;
     155
     156    NSIndexPath *indexPath = [NSIndexPath indexPathForRow:_singleSelectionIndex inSection:_singleSelectionSection];
     157    [self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionMiddle animated:NO];
    151158}
    152159
Note: See TracChangeset for help on using the changeset viewer.