[iOS] Make main browser interface initialization explicit.
This CL changes the init of the main BrowserInterface in BrowserViewWrangler to be explicit, and to be done as part of creating the main Browser instance. BrowserViewWrangler's -mainInterface implementation is now a simple (synthesized) getter, and thus will return nil before -createMainBrowser is called. BrowserViewWrangler's -incognitoInterface implementation now returns nil if there's no mainInterface. This mitigates the risks around calling -mainInterface prior to the main browser being created. It does slightly change the timing of BVC creation (it's slightly earlier), but at least now it's explicit. TEST: The crash for this bug is triggered by auth service init forcing a sign-out of a managed account, which causes MainController's removeBrowsingDataForBrowserState: method to be called. The completion block in that method uses mainInterface to disable user interactions. To test this fix, I added an explicit call to SignOut() in AuthService::Initialize() and launched Chrome with a signed-in managed account. It crashes as expected before this fix, and works fine afterwards. Bug: 919932 Change-Id: Iaffb29cd7d0dfb5b54f3347755fc9e15f0aa4539 Reviewed-on: https://chromium-review.googlesource.com/c/1430239 Commit-Queue: Mark Cogan <marq@chromium.org> Reviewed-by:Rohit Rao <rohitrao@chromium.org> Cr-Commit-Position: refs/heads/master@{#625209}
Showing
Please register or sign in to comment