Commit e1e1e253 authored by olivierrobin's avatar olivierrobin Committed by Commit bot

Fix crash in StaticHTMLNativeContent when deallocating WKWebView on iOS9

Reset the scrollview delegate before releasing the WKWebView.
Move the |scrollview setDelegate:| to static_html_native_content.mm for symetry.

BUG=678118

Review-Url: https://codereview.chromium.org/2616633003
Cr-Commit-Position: refs/heads/master@{#441967}
parent 189cb4ad
...@@ -2750,7 +2750,6 @@ class BrowserBookmarkModelBridge : public bookmarks::BookmarkModelObserver { ...@@ -2750,7 +2750,6 @@ class BrowserBookmarkModelBridge : public bookmarks::BookmarkModelObserver {
OverscrollActionsController* controller = OverscrollActionsController* controller =
[[[OverscrollActionsController alloc] [[[OverscrollActionsController alloc]
initWithScrollView:[nativeContent scrollView]] autorelease]; initWithScrollView:[nativeContent scrollView]] autorelease];
[[nativeContent scrollView] setDelegate:controller];
[controller setDelegate:self]; [controller setDelegate:self];
OverscrollStyle style = _isOffTheRecord OverscrollStyle style = _isOffTheRecord
? OverscrollStyle::REGULAR_PAGE_INCOGNITO ? OverscrollStyle::REGULAR_PAGE_INCOGNITO
......
...@@ -92,6 +92,7 @@ ...@@ -92,6 +92,7 @@
- (void)restoreOnlineURL { - (void)restoreOnlineURL {
web::NavigationItem* item = web::NavigationItem* item =
_webState->GetNavigationManager()->GetLastCommittedItem(); _webState->GetNavigationManager()->GetLastCommittedItem();
DCHECK(item && item->GetVirtualURL() == [self virtualURL]);
item->SetURL([self virtualURL]); item->SetURL([self virtualURL]);
item->SetVirtualURL([self virtualURL]); item->SetVirtualURL([self virtualURL]);
} }
......
...@@ -68,6 +68,11 @@ ...@@ -68,6 +68,11 @@
URL:URL]; URL:URL];
} }
- (void)dealloc {
[[self scrollView] setDelegate:nil];
[super dealloc];
}
- (void)loadURL:(const GURL&)URL - (void)loadURL:(const GURL&)URL
referrer:(const web::Referrer&)referrer referrer:(const web::Referrer&)referrer
transition:(ui::PageTransition)transition transition:(ui::PageTransition)transition
...@@ -85,6 +90,7 @@ ...@@ -85,6 +90,7 @@
- (void)setOverscrollActionsController: - (void)setOverscrollActionsController:
(OverscrollActionsController*)controller { (OverscrollActionsController*)controller {
_overscrollActionsController.reset([controller retain]); _overscrollActionsController.reset([controller retain]);
[[self scrollView] setDelegate:controller];
} }
#pragma mark - #pragma mark -
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment