New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 780280 link

Starred by 2 users

Issue metadata

Status: Verified
Owner:
Closed: Dec 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: iOS
Pri: 1
Type: Bug



Sign in to add a comment

In Tab Switcher mode - Tap on Enable sync from Other Devices and it will crash the app.

Project Member Reported by jdhakshinamoor@chromium.org, Oct 31 2017

Issue description

App Version: 64.0.3254.0 Canary
iOS Version:   10.3.3, 11.2
Device: iPad4, iPad mini, iPad only
URL:  NA


Precondition:
Login to any test account

Steps to reproduce:
 1. Launch Google Chrome
 2. Navigate to Menu>  Settings 
 3. Turn Sync OFF
 4. Enter Tab switcher
 5. Tap on other devices 
 6. Tap on Turn On Sync button

Observed results:  
Notice that app crashes when User tap on Enable sync in tab switcher mode

Crash ID
https://crash.corp.google.com/browse?stbtiq=00d402c67f643cac

Magic Signature
-[TabSwitcherPanelOverlayView showSyncSettings]

Expected results: 
App should not crash at any time

Number of times you were able to reproduce: 5/5
Bug reproducible after clean install: Yes
Bug reproducible after clearing cache and cookies: Yes
Bug reproducible on Chrome Mobile on Android: Not tested
Bug reproducible on Safari/Firefox: Firefox: NA, Safari: NA
Bug reproducible on current stable build (App Version, iOS Version): M62 No
Bug reproducible on the current beta channel build (App Version, iOS Version) 63 Yes 
Autofill bugs: Bug reproducible on Chrome desktop? Chrome on Mac → NA
 

Link to video/image:  
https://drive.google.com/a/google.com/file/d/1ipRmWCYlLN4gQDxpU6Y7Mdgaw7LNq9A7/view


 
Owner: pav...@chromium.org

Comment 2 by sczs@chromium.org, Nov 1 2017

Status: Assigned (was: Untriaged)
Can someone from iOS team try reproducing this bug? I'm having hard time making chrome start in my iOS setup.
Cc: pav...@chromium.org
Owner: edchin@chromium.org
The code fails in tab_switcher_panel_overlay_view.mm:462. Ed, could you check if this failure is related to your change https://chromium-review.googlesource.com/659517.
Cc: marq@chromium.org sdefresne@chromium.org
+ sdefresne@ and marq@
Changes in tab_switcher_controller.mm could be related too. Could you guys take a look?
I've reproduced this in the debugger. This happens because the CommandDispatcher has no dispatching target for the selector -showSyncSettings and thus an NSException is raised.

Code that invokes the dispatcher is:

  - (void)showSyncSettings {
    SyncSetupService::SyncServiceState syncState =
        GetSyncStateForBrowserState(_browserState);
    if (ShouldShowSyncSignin(syncState)) {
      [self.dispatcher
          showSignin:[[ShowSigninCommand alloc]
                         initWithOperation:AUTHENTICATION_OPERATION_REAUTHENTICATE
                               accessPoint:signin_metrics::AccessPoint::
                                               ACCESS_POINT_UNKNOWN]];
    } else if (ShouldShowSyncSettings(syncState)) {
      [self.dispatcher showSyncSettings];  // crash happens here
    } else if (ShouldShowSyncPassphraseSettings(syncState)) {
      [self.dispatcher showSyncPassphraseSettings];
    }
  }

Information from debugger:

2017-11-03 11:24:49.410 Chromium[63312:405694] -[CommandDispatcher showSyncSettings]: unrecognized selector sent to instance 0x6000002afa80
(lldb) po self.dispatcher
<CommandDispatcher: 0x6000004b4820>


The dispatcher passed to this TabSwitcherPanelOverlayView is the dispatcher created by TabSwitcherController. That dispatcher only accepts the commands from BrowserCommands and ApplicationCommands, but not ApplicationSettingsCommands.

  @implementation TabSwitcherController
  
  - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState
                          mainTabModel:(TabModel*)mainTabModel
                           otrTabModel:(TabModel*)otrTabModel
                        activeTabModel:(TabModel*)activeTabModel
            applicationCommandEndpoint:(id<ApplicationCommands>)endpoint {
    DCHECK(mainTabModel);
    DCHECK(otrTabModel);
    DCHECK(activeTabModel == otrTabModel || activeTabModel == mainTabModel);
    self = [super initWithNibName:nil bundle:nil];
    if (self) {
      _browserState = browserState;

      _dispatcher = [[CommandDispatcher alloc] init];
      [_dispatcher startDispatchingToTarget:self
                                forProtocol:@protocol(BrowserCommands)];
      [_dispatcher startDispatchingToTarget:endpoint
                                forProtocol:@protocol(ApplicationCommands)];
      // self.dispatcher shouldn't be used in this init method, so duplicate the
      // typecast to pass dispatcher into child objects.
      id<ApplicationCommands, BrowserCommands> passableDispatcher =
          static_cast<id<ApplicationCommands, BrowserCommands>>(_dispatcher);

Looking at TabSwitcherPanelOverlayView initializer, changing the prototype of the dispatcher from id<ApplicationCommands, BrowserCommands> to id<ApplicationCommands, ApplicationSettingsCommands, BrowserCommands> I get one compilation error at the following code (out of the two non-test invocation of the initializer):

@implementation TabSwitcherPanelController

  - (void)setZeroTabStateOverlayVisible:(BOOL)show {
    if (show == [self isOverlayVisible])
      return;

    DCHECK(TabSwitcherSessionTypeIsLocalSession(_sessionType));

    if (!_overlayView) {
      _overlayView =
          [[TabSwitcherPanelOverlayView alloc] initWithFrame:[_panelView bounds]
                                                browserState:_browserState
                                                  dispatcher:self.dispatcher];

This dispatcher should probably be modified to also implements ApplicationSettingsCommands which would probably ultimately mean that TabSwitcherController will need to implement that protocol.

Looking at ios/chrome/browser/ui/commands/application_commands.h, I think this regression was introduced by https://chromium-review.googlesource.com/659517 refactoring.
The dispatcher in TabSwitcherController needed to be modified to handle
ApplicationSettingsCommands.
CL in flight:
https://chromium-review.googlesource.com/c/chromium/src/+/757886

Project Member

Comment 8 by bugdroid1@chromium.org, Nov 8 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/79bea66adb3a154103e4605da3f2387b63dbfc3c

commit 79bea66adb3a154103e4605da3f2387b63dbfc3c
Author: edchin <edchin@chromium.org>
Date: Wed Nov 08 19:26:15 2017

[ios] Must register separately for ApplicationSettingsCommands

-startDispatchingToTarget:forProtocol: doesn't pick up protocols the
passed protocol conforms to, so ApplicationSettingsCommands must be
explicitly registered to the endpoint as well.
Without this, we get a crash: unrecognized selector.

Bug:  780280 
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I03a13c665dde5c10b3615c623d1a3dd8047da8ad
Reviewed-on: https://chromium-review.googlesource.com/757886
Reviewed-by: Mark Cogan <marq@chromium.org>
Reviewed-by: edchin <edchin@chromium.org>
Commit-Queue: edchin <edchin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#514904}
[modify] https://crrev.com/79bea66adb3a154103e4605da3f2387b63dbfc3c/ios/chrome/browser/ui/tab_switcher/tab_switcher_controller.mm

Status: Fixed (was: Assigned)
Status: Verified (was: Fixed)
Verified fix for the issue - In Tab Switcher mode - Tap on Enable sync from Other Devices and it will crash the app.

Build - 64.0.3263.0 Canary 
Devices - iPad, iPad 4, iPad Mini
iOS - 10.3.3, 9.3.5, 11.2

Comment 11 by pkl@chromium.org, Dec 6 2017

Cc: cma...@chromium.org
Labels: M-63
Did fix in comment 8 make it to M63 branch? Fix landed on Nov 08, branch cut for M63 was October 12.
Looking at some new crashes in M63 (app store 1% release), this crash is in M63 release.
I just noticed this as well. It initially landed in 64.0.3263.0 and was never merged into M63. It was not marked as a blocker either so there was no expectation to have it in M63. It is currently top 6 crash with 15 unique clients affected so does not seem too severe yet. Let's wait and see.
I would've liked this to be in M63. Enabling sync from remote tabs then crashing is not a great user experience. How complex/risky is the fix ?
I understand Mardini. This crash only affects few iPad users and there is a way to go around the bug through the setting screen. We currently have only 26 unique clients affected by this crash and I think we should proceed with the rollout and monitor the impact of this crash as we go.
Status: Available (was: Verified)
Re-opening this bug. Crashes are happening in iOS 11.1. and 11.2 on new stable build 63.0.3239.73
As of 2017/12/06
Total number of new occurrences so far in : 27

is it iOS 11 only?
Apparently not

Comment 18 by pkl@chromium.org, Dec 7 2017

Labels: M-64
Status: Assigned (was: Available)
Note that the fix is already in M64 (see comment 8).

Comment 19 by pkl@chromium.org, Dec 11 2017

Labels: -M-63
Status: Fixed (was: Assigned)
Since fix is already in M64 and there's no plan to refresh M63 for this, I'm marking this as Fix and removing M63 label.

Please verify.
Status: Verified (was: Fixed)
Verified on iPad Pro 12'5 iOS 10.3.3 , iPad mini iOS 11.2 on build 64.0.3282.22 Beta as per the steps #0
App does not crash on Enable sync in tab switcher mode.

Sign in to add a comment