New issue
Advanced search Search tips

Issue 717471 link

Starred by 2 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

DCHECK failure in render_widget_host_view_mac.mm on![[NSApp mainMenu] performKeyEquivalent:theEvent]

Project Member Reported by primiano@chromium.org, May 2 2017

Issue description

Chrome Version: ToT, src@84f14ff06916d13518306dbdcb87647d10658b7b
OS: OSX

gn args:
-----
is_component_build = true
is_debug = false
symbol_level = 2
dcheck_always_on = true
-----

repro steps:
- Open chrome://tracing
- Click "Record"
- Select "Manually select settings"
- Untick all categories on boths sides (this is irrelevant for the repro but helps to rule out any tracing-related side effect)
- Hit Meta-T (or whatever is hotkey to open a new tab)

The following DCHECK is hit:

[66686:775:0502/114459.106615:FATAL:render_widget_host_view_mac.mm(2040)] Check failed: ![[NSApp mainMenu] performKeyEquivalent:theEvent].
0   libbase.dylib                       0x000000010d9ebd0c base::debug::StackTrace::StackTrace(unsigned long) + 28
1   libbase.dylib                       0x000000010da16dd0 logging::LogMessage::~LogMessage() + 224
2   libcontent.dylib                    0x00000001131993b8 -[RenderWidgetHostViewCocoa performKeyEquivalent:] + 248
3   AppKit                              0x00007fff93c921c8 routeKeyEquivalent + 572
4   AppKit                              0x00007fff93c8ffa9 -[NSApplication(NSEvent) sendEvent:] + 3377
5   libchrome_dll.dylib                 0x0000000107145c4c __34-[BrowserCrApplication sendEvent:]_block_invoke + 172
6   libbase.dylib                       0x000000010da18f8a base::mac::CallWithEHFrame(void () block_pointer) + 10
7   libchrome_dll.dylib                 0x0000000107145a36 -[BrowserCrApplication sendEvent:] + 262
8   AppKit                              0x00007fff9350a7f7 -[NSApplication run] + 1002
9   libbase.dylib                       0x000000010da365b7 base::MessagePumpNSApplication::DoRun(base::MessagePump::Delegate*) + 359
10  libbase.dylib                       0x000000010da35877 base::MessagePumpCFRunLoopBase::Run(base::MessagePump::Delegate*) + 119
11  libbase.dylib                       0x000000010da30a41 base::MessageLoop::RunHandler() + 369
12  libbase.dylib                       0x000000010da6a797 base::RunLoop::Run() + 151
13  libchrome_dll.dylib                 0x000000010714b4e9 ChromeBrowserMainParts::MainMessageLoopRun(int*) + 297
14  libcontent.dylib                    0x0000000112e10084 content::BrowserMainLoop::RunMainMessageLoopParts() + 52
15  libcontent.dylib                    0x0000000112e131f6 content::BrowserMainRunnerImpl::Run() + 102
16  libcontent.dylib                    0x0000000112e0bbcc content::BrowserMain(content::MainFunctionParams const&) + 124
17  libcontent.dylib                    0x00000001136c1c25 content::ContentMainRunnerImpl::Run() + 1045
18  libembedder.dylib                   0x000000010d8daab3 service_manager::Main(service_manager::MainParams const&) + 2499
19  libcontent.dylib                    0x00000001136c0e14 content::ContentMain(content::ContentMainParams const&) + 68
20  libchrome_dll.dylib                 0x0000000106c42707 ChromeMain + 119
21  Chromium                            0x0000000106bd5daa main + 522
22  libdyld.dylib                       0x00007fffab186235 start + 1
23  ???                                 0x0000000000000001 0x0 + 1


erikchen/mark: can you help triaging this? you seem to have the last ones touching those lines.
Not sure if helps for the repro, but I have remapped the hotkey for "New Tab" to be ^T (CTRL+T) instead of Meta-T via Mac OS Settings -> Keyboard -> Shortcuts -> App Shortcuts (see http://imgur.com/vVLk76n)


 

Comment 1 by mark@chromium.org, May 2 2017

Cc: thakis@chromium.org
This is almost certainly because of your remapping.

https://chromium.googlesource.com/chromium/src/+/51deeb7261c8b729e179362df5698ce11558c6bd/content/browser/renderer_host/render_widget_host_view_mac.mm#2030

It looks like I wrote this DCHECK 7½ years ago (https://chromium.googlesource.com/chromium/src/+/5a9e2bfd0241f824cda5ec92054d857d0dfb7599), but really, I was just removing Nico’s tabs (https://chromium.googlesource.com/chromium/src/+/5c87690ac9aed7e975132b301aed90abbe4e0550).

The DCHECK isn’t unreasonable, we don’t want shortcuts that don’t use Command but use some other modifier in our default set of shortcuts. But the concern then was probably more that someone would borrow a Windows shortcut that used Control without coming up with a proper one for Mac.

If this is interfering with remapped keys, we should probably just get rid of the DCHECK.
I think the DCHECK is there because things depend on it here: https://cs.chromium.org/chromium/src/content/browser/renderer_host/render_widget_host_view_mac.mm?type=cs&q=%22Make+sure+the+menu+does+%22+package:%5Echromium$&l=2037 I don't remember details but I think it was kind of important somehow. Should've wrote a comment.

I apologize for adding tabs :-(
I tried and confirm that this goes away if I don't remap Meta-T to Ctrl-T.
FWIW on official builds, where we don't hit this because is a DCHECK, remapped keys seem to work fine as I've been using that on my corp and personal laptop for 3+ years.
(I know, I am a bad person, I remap hotkeys to match Linux/Windows and I keep saying "symbolization" instead of "symbolication")

On one side it feels to me that a user action (remapping keys) can cause a DCHECK to be hit, which suggests that either the DCHECK is wrong or too broad.
On the more concrete side the impact of this bug seems to be restricted to people who run chrome with dcheck_always_enabled on a mac with remapped keys. Which is perhaps just a very long periphrasis to say strcmp("primiano", getenv("USER")).
Given the not-so-wide userbase, I guess figuring the details of this is not really worth anybody's time, as we all have more important battles to fight.

Comment 4 by tapted@chromium.org, May 12 2017

Cc: tapted@chromium.org
Status: Available (was: Untriaged)
[mac triage]

Our story for supporting users remapping things via Prefs -> App Shortcuts is probably incomplete..

For example "Cmd+t" is not sent to a webcontents on Mac, because
 - websites can not preventDefault on it to prevent you making new tabs
 - commands are less responsive when giving webcontents' javascript an opportunity to see the event first

That `return NO` after the DCHECK makes this still work the same (somewhat coincidentally) for Cmd+t, since it is reserved.

But it will do strange things for non-reserved things like Cmd+f.

E.g. google docs wants to intercept Cmd+f on Mac to show its own find bar. By remapping it to Ctrl+f, and hitting that early exit after the DCHECK, Chrome is bypassing the logic that would have let google docs peek at it and prevent chrome showing the default find bar.

(E.g., I think for you with Find... mapped to Ctrl+f, Cmd+f and Ctrl+f in google docs will show different find bars).



(Also Ctrl+t is an editing command on Mac to transpose characters either side of the cursor. returning NO from performKeyEquivalent could theoretically end up in the -transpose: method that's added at runtime to RenderWidgetHostViewCocoa by RenderWidgetHostViewMacEditCommandHelper --  https://cs.chromium.org/chromium/src/content/browser/renderer_host/render_widget_host_view_mac.mm?q=AddEditingSelectorsToClass+package:%5Echromium$&l=1766 but that doesn't seem to happen when a menu item is triggered.



We probably do want an "intentional" fix here, but I don't know what it is.. (and it will be super complicated because command-key processing on Mac is super complicated to begin with, even for a single process app). Anyway, this particular DCHECK failure probably isn't high priority, but I'll probably need to put some more thought into this when we start using views::WebView on mac, and/or start supporting plugin-IME on Mac.
> (E.g., I think for you with Find... mapped to Ctrl+f, Cmd+f and Ctrl+f in google docs will show different find bars).

Yup your comment is spot on. That's my experience, although it never bothered me too much, because I don't know what is the expectation of the hotkeys of an app (docs) that doesn't allow me to customize them.

Comment 6 by gab@chromium.org, May 25 2017

Labels: -Pri-3 Pri-1
Status: Untriaged (was: Available)
"this particular DCHECK failure probably isn't high priority"

All DCHECKs should be treated with the same priority as a crash or removed. DCHECK should be used to document invariants that never occur. If we know something occurs and can live with it, we should remove the DCHECK.

Comment 7 by tapted@chromium.org, May 25 2017

Labels: -Pri-1 Pri-2
Status: Available (was: Untriaged)
I don't think we should remove the check. This issue is identifying a niche OS feature that Chrome doesn't have full support for (and implementing full support for it is not high priority). Its use here was successful in identifying the use case leading up to the gap in Chrome's support and allowed a developer to report it without unnecessarily impacting users. If a future Chrome developer writes a test or feature that hits this, they deserve to know that the current behaviour is unintentional.

For example, the DCHECK here will correctly crash if a developer modifies Chrome's default shortcuts to include Control but not Command on Mac - that's an invariant that should never occur, and we don't want to live with it in Chrome's default configuration, nor on any trybots.
Project Member

Comment 8 by sheriffbot@chromium.org, May 25 2018

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Cc: -erikc...@chromium.org
Owner: erikc...@chromium.org
Status: Assigned (was: Untriaged)
Triage: Assigning to erikchen@ who's looking into hotkeys again for the MacViews integration.
Labels: Hotlist-DesktopUIToolingRequired Hotlist-DesktopUIChecked
*** UI Mass Triage ***

Sign in to add a comment