Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closing last tab should open a new tab #14092

Merged
merged 4 commits into from
Jul 20, 2022
Merged

Closing last tab should open a new tab #14092

merged 4 commits into from
Jul 20, 2022

Conversation

spylogsster
Copy link
Contributor

@spylogsster spylogsster commented Jul 8, 2022

Resolves brave/brave-browser#1002

image

tabs.mp4

Submitter Checklist:

  • I confirm that no security/privacy review is needed, or that I have requested one
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally: npm run test -- brave_browser_tests, npm run test -- brave_unit_tests, npm run lint, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

  • Closing last tab should open a new tab

@spylogsster spylogsster requested a review from bsclifton July 8, 2022 14:59
@spylogsster spylogsster requested a review from a team as a code owner July 8, 2022 14:59
@spylogsster spylogsster force-pushed the brave-1002 branch 3 times, most recently from 105993b to 45b427e Compare July 11, 2022 09:38
@iefremov
Copy link
Contributor

Are you sure we need this by default? E.g. personally I'm kinda used to the existing behavior. Do we have an input from the product team on this?

@bsclifton bsclifton requested a review from simonhong July 11, 2022 20:51
@spylogsster
Copy link
Contributor Author

Are you sure we need this by default? E.g. personally I'm kinda used to the existing behavior. Do we have an input from the product team on this?

@rebron wanted probably to make it under a pref, should we wrap it @rebron ?

@simonhong
Copy link
Member

Are you sure we need this by default? E.g. personally I'm kinda used to the existing behavior. Do we have an input from the product team on this?

+1 IMO, It would be better to have option and disabled by default?

@simonhong
Copy link
Member

I got this failure on macOS when I do cmd + w repeatedly.

[66593:259:0712/115650.423508:FATAL:tab_strip_model.cc(86)] Check failed: !*guard_flag_.
0   libbase.dylib                       0x000000010b4f8b59 base::debug::CollectStackTrace(void**, unsigned long) + 9
1   libbase.dylib                       0x000000010b3c7923 base::debug::StackTrace::StackTrace() + 19
2   libbase.dylib                       0x000000010b3ecc3f logging::LogMessage::~LogMessage() + 175
3   libbase.dylib                       0x000000010b3edc9e logging::LogMessage::~LogMessage() + 14
4   libchrome_dll.dylib                 0x0000000110b6f5e0 (anonymous namespace)::ReentrancyCheck::ReentrancyCheck(bool*) + 192
5   libchrome_dll.dylib                 0x0000000110b75e48 TabStripModel::AddWebContents(std::__Cr::unique_ptr<content::WebContents, std::__Cr::default_delete<content::WebContents>>, int, ui::PageTransition, int, absl::optional<tab_groups::TabGroupId>) + 456
6   libchrome_dll.dylib                 0x0000000110afbcde Navigate(NavigateParams*) + 6270
7   libchrome_dll.dylib                 0x0000000110aff295 chrome::AddTabAt(Browser*, GURL const&, int, bool, absl::optional<tab_groups::TabGroupId>) + 245
8   libchrome_dll.dylib                 0x000000010e683f3c BraveBrowser::TabStripEmpty() + 92
9   libchrome_dll.dylib                 0x0000000110b711c7 TabStripModel::SendDetachWebContentsNotifications(TabStripModel::DetachNotifications*) + 1751
10  libchrome_dll.dylib                 0x0000000110b73ce9 TabStripModel::CloseTabs(base::span<content::WebContents* const, 18446744073709551615ul>, unsigned int) + 697
11  libchrome_dll.dylib                 0x0000000110b76398 TabStripModel::CloseSelectedTabs() + 200
12  libchrome_dll.dylib                 0x0000000110aef0e9 chrome::CloseTab(Browser*) + 41
13  libchrome_dll.dylib                 0x0000000110ae922b chrome::BrowserCommandController::ExecuteCommandWithDisposition(int, WindowOpenDisposition, base::TimeTicks) + 955
14  libchrome_dll.dylib                 0x00000001109f5e15 BrowserFrameMac::ExecuteCommand(int, WindowOpenDisposition, bool) + 197
15  libviews.dylib                      0x0000000122d4d629 non-virtual thunk to views::NativeWidgetMacNSWindowHost::ExecuteCommand(int, WindowOpenDisposition, bool, bool*) + 25
16  libchrome_dll.dylib                 0x00000001109c89dc -[ChromeCommandDispatcherDelegate prePerformKeyEquivalent:window:] + 252
17  libui_base.dylib                    0x000000010c75ebd3 -[CommandDispatcher performKeyEquivalent:] + 387
18  libapp_shim.dylib                   0x0000000123bc9c68 -[NativeWidgetMacNSWindow performKeyEquivalent:] + 88
19  AppKit                              0x00007fff2384d87b routeKeyEquivalent + 162
20  AppKit                              0x00007fff2325aaaf -[NSApplication(NSEvent) sendEvent:] + 1147
21  libchrome_dll.dylib                 0x000000010efd5db1 __34-[BrowserCrApplication sendEvent:]_block_invoke + 321
22  libbase.dylib                       0x000000010b510ac2 base::mac::CallWithEHFrame(void () block_pointer) + 10
23  libchrome_dll.dylib                 0x000000010efd59ab -[BrowserCrApplication sendEvent:] + 1003
24  AppKit                              0x00007fff23533531 -[NSApplication _handleEvent:] + 65
25  AppKit                              0x00007fff230c362e -[NSApplication run] + 623
26  libbase.dylib                       0x000000010b51cc9c base::MessagePumpNSApplication::DoRun(base::MessagePump::Delegate*) + 348
27  libbase.dylib                       0x000000010b51b24b base::MessagePumpCFRunLoopBase::Run(base::MessagePump::Delegate*) + 155
28  libbase.dylib                       0x000000010b4a4a77 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run(bool, base::TimeDelta) + 695
29  libbase.dylib                       0x000000010b43fc26 base::RunLoop::Run(base::Location const&) + 726
30  libcontent.dylib                    0x000000011b028f73 content::BrowserMainLoop::RunMainMessageLoop() + 243
31  libcontent.dylib                    0x000000011b02aa62 content::BrowserMainRunnerImpl::Run() + 82
32  libcontent.dylib                    0x000000011b02642d content::BrowserMain(content::MainFunctionParams) + 253
33  libcontent.dylib                    0x000000011bd89534 content::RunBrowserProcessMain(content::MainFunctionParams, content::ContentMainDelegate*) + 260
34  libcontent.dylib                    0x000000011bd8aad2 content::ContentMainRunnerImpl::RunBrowser(content::MainFunctionParams, bool) + 1218
35  libcontent.dylib                    0x000000011bd8a581 content::ContentMainRunnerImpl::Run() + 737
36  libcontent.dylib                    0x000000011bd88ea3 content::RunContentProcess(content::ContentMainParams, content::ContentMainRunner*) + 2739
37  libcontent.dylib                    0x000000011bd88fb0 content::ContentMain(content::ContentMainParams) + 80
38  libchrome_dll.dylib                 0x000000010d913975 ChromeMain + 309
39  Brave Browser Development           0x000000010b251821 main + 289
40  libdyld.dylib                       0x00007fff207eef3d start + 1
41  ???                                 0x0000000000000004 0x0 + 4
Crash keys:

@bsclifton bsclifton requested a review from rebron July 12, 2022 07:55
@bsclifton
Copy link
Member

bsclifton commented Jul 12, 2022

Adding @rebron - should this be off by default? or maybe on by default only for macOS?

I'm not sure I know of a browser that does this by default - and it's against what the OS behavior to open a new window after closing on Linux and Windows

@rebron
Copy link
Collaborator

rebron commented Jul 12, 2022

Adding @rebron - should this be off by default? or maybe on by default only for macOS?

I'm not sure I know of a browser that does this by default - and it's against what the OS behavior to open a new window after closing on Linux and Windows

We should have this off by default probably even for macOS.

@bsclifton
Copy link
Member

@spylogsster can you create a profile preference for this (defaulted to false) and put a guard around the behavior?

@rebron where should this setting live? I think a good place might be under System
brave://settings/system

image

@spylogsster spylogsster force-pushed the brave-1002 branch 4 times, most recently from 6bceab5 to c851445 Compare July 13, 2022 10:09
@spylogsster
Copy link
Contributor Author

image

done

@spylogsster
Copy link
Contributor Author

We should have this off by default probably even for macOS.

Default behaviour wasn't changed, users should go and enable it in options to keep browser opened

@spylogsster spylogsster force-pushed the brave-1002 branch 4 times, most recently from 5072fa6 to a9eb316 Compare July 13, 2022 20:48
@rebron
Copy link
Collaborator

rebron commented Jul 14, 2022

@spylogsster can you create a profile preference for this (defaulted to false) and put a guard around the behavior?

@rebron where should this setting live? I think a good place might be under System brave://settings/system

image

I was thinking brave://settings/system but we had closing windows/quitting in Help Tips.

@@ -9,6 +9,10 @@
pref="{{prefs.brave.enable_window_closing_confirm}}"
label="$i18n{braveHelpTipsWarnBeforeClosingWindow}">
</settings-toggle-button>
<settings-toggle-button class="cr-row"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we put this on the system page actually? Great naming on the preference though - as it matches the Firefox setting name 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@spylogsster spylogsster force-pushed the brave-1002 branch 2 times, most recently from 58e63e9 to 9dcad4e Compare July 15, 2022 11:36
@simonhong
Copy link
Member

I still can see above failure after cmd + w althought I only tested it on macOS.

Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New placement looks great! 😄 👍

@bsclifton
Copy link
Member

Good catch @simonhong - I see that crash too, with Ctrl + W

@bsclifton
Copy link
Member

bsclifton commented Jul 18, 2022

Here's the stacktrace from the crash I get after hitting Ctrl + W. I think it's the same as @simonhong's (except I'm on Windows)

[20600:32416:0718/143213.104:FATAL:tab_strip_model.cc(86)] Check failed: !*guard_flag_.
Backtrace:
        base::debug::CollectStackTrace [0x00007FFD85DE8292+18] (C:\bb1\src\base\debug\stack_trace_win.cc:305)
        base::debug::StackTrace::StackTrace [0x00007FFD85CA86C2+18] (C:\bb1\src\base\debug\stack_trace.cc:218)
        logging::LogMessage::~LogMessage [0x00007FFD85CC8F0D+141] (C:\bb1\src\base\logging.cc:614)
        logging::LogMessage::~LogMessage [0x00007FFD85CCA280+16] (C:\bb1\src\base\logging.cc:607)
        `anonymous namespace'::ReentrancyCheck::ReentrancyCheck [0x00007FFD7F525569+213] (C:\bb1\src\chrome\browser\ui\tabs\tab_strip_model.cc:87)
        TabStripModel::AddWebContents [0x00007FFD7F52A08A+290] (C:\bb1\src\chrome\browser\ui\tabs\tab_strip_model.cc:993)
        Navigate [0x00007FFD7F514C71+5105] (C:\bb1\src\chrome\browser\ui\browser_navigator.cc:785)
        chrome::AddTabAt [0x00007FFD7F516A50+272] (C:\bb1\src\chrome\browser\ui\browser_tabstrip.cc:41)
        BraveBrowser::TabStripEmpty [0x00007FFD7E47D5EE+126] (C:\bb1\src\brave\browser\ui\brave_browser.cc:80)
        TabStripModel::SendDetachWebContentsNotifications [0x00007FFD7F5269E7+1359] (C:\bb1\src\chrome\browser\ui\tabs\tab_strip_model.cc:575)
        TabStripModel::CloseTabs [0x00007FFD7F52895B+463] (C:\bb1\src\chrome\browser\ui\tabs\tab_strip_model.cc:1929)
        TabStripModel::CloseSelectedTabs [0x00007FFD7F52A49D+141] (C:\bb1\src\chrome\browser\ui\tabs\tab_strip_model.cc:1095)
        chrome::CloseTab [0x00007FFD7F50AB48+56] (C:\bb1\src\chrome\browser\ui\browser_commands.cc:776)
        chrome::BrowserCommandController::ExecuteCommandWithDisposition [0x00007FFD7F507CCD+1373] (C:\bb1\src\chrome\browser\ui\browser_command_controller.cc:457)
        ui::AcceleratorManager::AcceleratorTargetInfo::TryProcess [0x00007FFD9E7193A8+140] (C:\bb1\src\ui\base\accelerators\accelerator_manager.cc:152)
        ui::AcceleratorManager::Process [0x00007FFD9E7192D5+197] (C:\bb1\src\ui\base\accelerators\accelerator_manager.cc:83)
        views::FocusManager::ProcessAccelerator [0x00007FFD7CEBAD26+22] (C:\bb1\src\ui\views\focus\focus_manager.cc:537)
        BrowserView::PreHandleKeyboardEvent [0x00007FFD7F573167+327] (C:\bb1\src\chrome\browser\ui\views\frame\browser_view.cc:2603)
        content::WebContentsImpl::PreHandleKeyboardEvent [0x00007FFD7B8C8E55+181] (C:\bb1\src\content\browser\web_contents\web_contents_impl.cc:3268)
        content::RenderWidgetHostImpl::ForwardKeyboardEventWithCommands [0x00007FFD7B730BA9+457] (C:\bb1\src\content\browser\renderer_host\render_widget_host_impl.cc:1785)
        content::RenderWidgetHostViewAura::ForwardKeyboardEventWithLatencyInfo [0x00007FFD7B74F556+118] (C:\bb1\src\content\browser\renderer_host\render_widget_host_view_aura.cc:2601)
        content::RenderWidgetHostViewEventHandler::OnKeyEvent [0x00007FFD7BA65391+337] (C:\bb1\src\content\browser\renderer_host\render_widget_host_view_event_handler.cc:272)
        ui::EventDispatcher::DispatchEvent [0x00007FFDCDE35E90+112] (C:\bb1\src\ui\events\event_dispatcher.cc:191)
        ui::EventDispatcher::ProcessEvent [0x00007FFDCDE35B9F+303] (C:\bb1\src\ui\events\event_dispatcher.cc:140)
        ui::EventDispatcherDelegate::DispatchEventToTarget [0x00007FFDCDE359B7+87] (C:\bb1\src\ui\events\event_dispatcher.cc:84)
        ui::EventDispatcherDelegate::DispatchEvent [0x00007FFDCDE358EB+187] (C:\bb1\src\ui\events\event_dispatcher.cc:55)
        ui::EventProcessor::OnEventFromSource [0x00007FFDCDE37182+530] (C:\bb1\src\ui\events\event_processor.cc:21)
        aura::WindowTreeHost::DispatchKeyEventPostIME [0x00007FFD76FE44A4+180] (C:\bb1\src\ui\aura\window_tree_host.cc:374)
        ui::InputMethodBase::DispatchKeyEventPostIME [0x00007FFD636C1BE1+81] (C:\bb1\src\ui\base\ime\input_method_base.cc:140)
        ui::InputMethodWinBase::ProcessUnhandledKeyEvent [0x00007FFD5B2D29A3+147] (C:\bb1\src\ui\base\ime\win\input_method_win_base.cc:499)
        ui::InputMethodWinBase::DispatchKeyEvent [0x00007FFD5B2D256A+842] (C:\bb1\src\ui\base\ime\win\input_method_win_base.cc:235)
        aura::WindowEventDispatcher::PreDispatchKeyEvent [0x00007FFD76FD86BD+221] (C:\bb1\src\ui\aura\window_event_dispatcher.cc:1081)
        aura::WindowEventDispatcher::PreDispatchEvent [0x00007FFD76FD7EBA+682] (C:\bb1\src\ui\aura\window_event_dispatcher.cc:568)
        ui::EventDispatcherDelegate::DispatchEvent [0x00007FFDCDE358BF+143] (C:\bb1\src\ui\events\event_dispatcher.cc:52)
        ui::EventProcessor::OnEventFromSource [0x00007FFDCDE37182+530] (C:\bb1\src\ui\events\event_processor.cc:21)
        ui::EventSource::DeliverEventToSink [0x00007FFDCDE3800D+125] (C:\bb1\src\ui\events\event_source.cc:118)
        ui::EventSource::SendEventToSinkFromRewriter [0x00007FFDCDE37F14+372] (C:\bb1\src\ui\events\event_source.cc:146)
        ui::EventSource::SendEventToSink [0x00007FFDCDE37D90+16] (C:\bb1\src\ui\events\event_source.cc:112)
        views::DesktopWindowTreeHostWin::HandleKeyEvent [0x00007FFD7CF502FB+107] (C:\bb1\src\ui\views\widget\desktop_aura\desktop_window_tree_host_win.cc:1026)
        views::HWNDMessageHandler::OnKeyEvent [0x00007FFD7CF206FE+190] (C:\bb1\src\ui\views\win\hwnd_message_handler.cc:1981)
        views::HWNDMessageHandler::_ProcessWindowMessage [0x00007FFD7CF1F1B2+1726] (C:\bb1\src\ui\views\win\hwnd_message_handler.h:397)
        views::HWNDMessageHandler::OnWndProc [0x00007FFD7CF1E892+226] (C:\bb1\src\ui\views\win\hwnd_message_handler.cc:1054)
        gfx::WindowImpl::WndProc [0x00007FFD9E64C3F8+216] (C:\bb1\src\ui\gfx\win\window_impl.cc:306)
        base::win::WrappedWindowProc<&gfx::WindowImpl::WndProc> [0x00007FFD9E64BABF+15] (C:\bb1\src\base\win\wrapped_window_proc.h:77)
        CallWindowProcW [0x00007FFDF306E858+1016]
        DispatchMessageW [0x00007FFDF306E299+601]
        base::MessagePumpForUI::ProcessMessageHelper [0x00007FFD85DF3C7F+479] (C:\bb1\src\base\message_loop\message_pump_win.cc:531)
        base::MessagePumpForUI::ProcessNextWindowsMessage [0x00007FFD85DF30BE+334] (C:\bb1\src\base\message_loop\message_pump_win.cc:498)
        base::MessagePumpForUI::DoRunLoop [0x00007FFD85DF2E3B+171] (C:\bb1\src\base\message_loop\message_pump_win.cc:209)
        base::MessagePumpWin::Run [0x00007FFD85DF2058+136] (C:\bb1\src\base\message_loop\message_pump_win.cc:79)
        base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run [0x00007FFD85D8A131+769] (C:\bb1\src\base\task\sequence_manager\thread_controller_with_message_pump_impl.cc:500)
        base::RunLoop::Run [0x00007FFD85D1FBD2+658] (C:\bb1\src\base\run_loop.cc:143)
        content::BrowserMainLoop::RunMainMessageLoop [0x00007FFD7B13F93B+219] (C:\bb1\src\content\browser\browser_main_loop.cc:1057)
        content::BrowserMainRunnerImpl::Run [0x00007FFD7B141EE5+149] (C:\bb1\src\content\browser\browser_main_runner_impl.cc:159)
        content::BrowserMain [0x00007FFD7B13CA33+223] (C:\bb1\src\content\browser\browser_main.cc:30)
        content::RunBrowserProcessMain [0x00007FFD7BF3C223+331] (C:\bb1\src\content\app\content_main_runner_impl.cc:658)
        content::ContentMainRunnerImpl::RunBrowser [0x00007FFD7BF3D7FE+1308] (C:\bb1\src\content\app\content_main_runner_impl.cc:1165)
        content::ContentMainRunnerImpl::Run [0x00007FFD7BF3D2AF+639] (C:\bb1\src\content\app\content_main_runner_impl.cc:1041)
        content::RunContentProcess [0x00007FFD7BF3BBEC+1692] (C:\bb1\src\content\app\content_main.cc:407)
        content::ContentMain [0x00007FFD7BF3BD04+84] (C:\bb1\src\content\app\content_main.cc:435)
        ChromeMain [0x00007FFD7D0F1287+487] (C:\bb1\src\chrome\app\chrome_main.cc:177)
        MainDllLoader::Launch [0x00007FF6AE022862+358] (C:\bb1\src\chrome\app\main_dll_loader_win.cc:167)
        wWinMain [0x00007FF6AE021BE1+3010] (C:\bb1\src\chrome\app\chrome_exe_main_win.cc:385)
        __scrt_common_main_seh [0x00007FF6AE0CF5F6+262] (D:\agent\_work\10\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)
        BaseThreadInitThunk [0x00007FFDF4177034+20]
        RtlUserThreadStart [0x00007FFDF4AA2651+33]

@spylogsster
Copy link
Contributor Author

Here's the stacktrace from the crash I get after hitting Ctrl + W. I think it's the same as @simonhong's (except I'm on Windows)

[20600:32416:0718/143213.104:FATAL:tab_strip_model.cc(86)] Check failed: !*guard_flag_.
Backtrace:
        base::debug::CollectStackTrace [0x00007FFD85DE8292+18] (C:\bb1\src\base\debug\stack_trace_win.cc:305)
        base::debug::StackTrace::StackTrace [0x00007FFD85CA86C2+18] (C:\bb1\src\base\debug\stack_trace.cc:218)
        logging::LogMessage::~LogMessage [0x00007FFD85CC8F0D+141] (C:\bb1\src\base\logging.cc:614)
        logging::LogMessage::~LogMessage [0x00007FFD85CCA280+16] (C:\bb1\src\base\logging.cc:607)
        `anonymous namespace'::ReentrancyCheck::ReentrancyCheck [0x00007FFD7F525569+213] (C:\bb1\src\chrome\browser\ui\tabs\tab_strip_model.cc:87)
        TabStripModel::AddWebContents [0x00007FFD7F52A08A+290] (C:\bb1\src\chrome\browser\ui\tabs\tab_strip_model.cc:993)
        Navigate [0x00007FFD7F514C71+5105] (C:\bb1\src\chrome\browser\ui\browser_navigator.cc:785)
        chrome::AddTabAt [0x00007FFD7F516A50+272] (C:\bb1\src\chrome\browser\ui\browser_tabstrip.cc:41)
        BraveBrowser::TabStripEmpty [0x00007FFD7E47D5EE+126] (C:\bb1\src\brave\browser\ui\brave_browser.cc:80)
        TabStripModel::SendDetachWebContentsNotifications [0x00007FFD7F5269E7+1359] (C:\bb1\src\chrome\browser\ui\tabs\tab_strip_model.cc:575)
        TabStripModel::CloseTabs [0x00007FFD7F52895B+463] (C:\bb1\src\chrome\browser\ui\tabs\tab_strip_model.cc:1929)
        TabStripModel::CloseSelectedTabs [0x00007FFD7F52A49D+141] (C:\bb1\src\chrome\browser\ui\tabs\tab_strip_model.cc:1095)
        chrome::CloseTab [0x00007FFD7F50AB48+56] (C:\bb1\src\chrome\browser\ui\browser_commands.cc:776)
        chrome::BrowserCommandController::ExecuteCommandWithDisposition [0x00007FFD7F507CCD+1373] (C:\bb1\src\chrome\browser\ui\browser_command_controller.cc:457)
        ui::AcceleratorManager::AcceleratorTargetInfo::TryProcess [0x00007FFD9E7193A8+140] (C:\bb1\src\ui\base\accelerators\accelerator_manager.cc:152)
        ui::AcceleratorManager::Process [0x00007FFD9E7192D5+197] (C:\bb1\src\ui\base\accelerators\accelerator_manager.cc:83)
        views::FocusManager::ProcessAccelerator [0x00007FFD7CEBAD26+22] (C:\bb1\src\ui\views\focus\focus_manager.cc:537)
        BrowserView::PreHandleKeyboardEvent [0x00007FFD7F573167+327] (C:\bb1\src\chrome\browser\ui\views\frame\browser_view.cc:2603)
        content::WebContentsImpl::PreHandleKeyboardEvent [0x00007FFD7B8C8E55+181] (C:\bb1\src\content\browser\web_contents\web_contents_impl.cc:3268)
        content::RenderWidgetHostImpl::ForwardKeyboardEventWithCommands [0x00007FFD7B730BA9+457] (C:\bb1\src\content\browser\renderer_host\render_widget_host_impl.cc:1785)
        content::RenderWidgetHostViewAura::ForwardKeyboardEventWithLatencyInfo [0x00007FFD7B74F556+118] (C:\bb1\src\content\browser\renderer_host\render_widget_host_view_aura.cc:2601)
        content::RenderWidgetHostViewEventHandler::OnKeyEvent [0x00007FFD7BA65391+337] (C:\bb1\src\content\browser\renderer_host\render_widget_host_view_event_handler.cc:272)
        ui::EventDispatcher::DispatchEvent [0x00007FFDCDE35E90+112] (C:\bb1\src\ui\events\event_dispatcher.cc:191)
        ui::EventDispatcher::ProcessEvent [0x00007FFDCDE35B9F+303] (C:\bb1\src\ui\events\event_dispatcher.cc:140)
        ui::EventDispatcherDelegate::DispatchEventToTarget [0x00007FFDCDE359B7+87] (C:\bb1\src\ui\events\event_dispatcher.cc:84)
        ui::EventDispatcherDelegate::DispatchEvent [0x00007FFDCDE358EB+187] (C:\bb1\src\ui\events\event_dispatcher.cc:55)
        ui::EventProcessor::OnEventFromSource [0x00007FFDCDE37182+530] (C:\bb1\src\ui\events\event_processor.cc:21)
        aura::WindowTreeHost::DispatchKeyEventPostIME [0x00007FFD76FE44A4+180] (C:\bb1\src\ui\aura\window_tree_host.cc:374)
        ui::InputMethodBase::DispatchKeyEventPostIME [0x00007FFD636C1BE1+81] (C:\bb1\src\ui\base\ime\input_method_base.cc:140)
        ui::InputMethodWinBase::ProcessUnhandledKeyEvent [0x00007FFD5B2D29A3+147] (C:\bb1\src\ui\base\ime\win\input_method_win_base.cc:499)
        ui::InputMethodWinBase::DispatchKeyEvent [0x00007FFD5B2D256A+842] (C:\bb1\src\ui\base\ime\win\input_method_win_base.cc:235)
        aura::WindowEventDispatcher::PreDispatchKeyEvent [0x00007FFD76FD86BD+221] (C:\bb1\src\ui\aura\window_event_dispatcher.cc:1081)
        aura::WindowEventDispatcher::PreDispatchEvent [0x00007FFD76FD7EBA+682] (C:\bb1\src\ui\aura\window_event_dispatcher.cc:568)
        ui::EventDispatcherDelegate::DispatchEvent [0x00007FFDCDE358BF+143] (C:\bb1\src\ui\events\event_dispatcher.cc:52)
        ui::EventProcessor::OnEventFromSource [0x00007FFDCDE37182+530] (C:\bb1\src\ui\events\event_processor.cc:21)
        ui::EventSource::DeliverEventToSink [0x00007FFDCDE3800D+125] (C:\bb1\src\ui\events\event_source.cc:118)
        ui::EventSource::SendEventToSinkFromRewriter [0x00007FFDCDE37F14+372] (C:\bb1\src\ui\events\event_source.cc:146)
        ui::EventSource::SendEventToSink [0x00007FFDCDE37D90+16] (C:\bb1\src\ui\events\event_source.cc:112)
        views::DesktopWindowTreeHostWin::HandleKeyEvent [0x00007FFD7CF502FB+107] (C:\bb1\src\ui\views\widget\desktop_aura\desktop_window_tree_host_win.cc:1026)
        views::HWNDMessageHandler::OnKeyEvent [0x00007FFD7CF206FE+190] (C:\bb1\src\ui\views\win\hwnd_message_handler.cc:1981)
        views::HWNDMessageHandler::_ProcessWindowMessage [0x00007FFD7CF1F1B2+1726] (C:\bb1\src\ui\views\win\hwnd_message_handler.h:397)
        views::HWNDMessageHandler::OnWndProc [0x00007FFD7CF1E892+226] (C:\bb1\src\ui\views\win\hwnd_message_handler.cc:1054)
        gfx::WindowImpl::WndProc [0x00007FFD9E64C3F8+216] (C:\bb1\src\ui\gfx\win\window_impl.cc:306)
        base::win::WrappedWindowProc<&gfx::WindowImpl::WndProc> [0x00007FFD9E64BABF+15] (C:\bb1\src\base\win\wrapped_window_proc.h:77)
        CallWindowProcW [0x00007FFDF306E858+1016]
        DispatchMessageW [0x00007FFDF306E299+601]
        base::MessagePumpForUI::ProcessMessageHelper [0x00007FFD85DF3C7F+479] (C:\bb1\src\base\message_loop\message_pump_win.cc:531)
        base::MessagePumpForUI::ProcessNextWindowsMessage [0x00007FFD85DF30BE+334] (C:\bb1\src\base\message_loop\message_pump_win.cc:498)
        base::MessagePumpForUI::DoRunLoop [0x00007FFD85DF2E3B+171] (C:\bb1\src\base\message_loop\message_pump_win.cc:209)
        base::MessagePumpWin::Run [0x00007FFD85DF2058+136] (C:\bb1\src\base\message_loop\message_pump_win.cc:79)
        base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run [0x00007FFD85D8A131+769] (C:\bb1\src\base\task\sequence_manager\thread_controller_with_message_pump_impl.cc:500)
        base::RunLoop::Run [0x00007FFD85D1FBD2+658] (C:\bb1\src\base\run_loop.cc:143)
        content::BrowserMainLoop::RunMainMessageLoop [0x00007FFD7B13F93B+219] (C:\bb1\src\content\browser\browser_main_loop.cc:1057)
        content::BrowserMainRunnerImpl::Run [0x00007FFD7B141EE5+149] (C:\bb1\src\content\browser\browser_main_runner_impl.cc:159)
        content::BrowserMain [0x00007FFD7B13CA33+223] (C:\bb1\src\content\browser\browser_main.cc:30)
        content::RunBrowserProcessMain [0x00007FFD7BF3C223+331] (C:\bb1\src\content\app\content_main_runner_impl.cc:658)
        content::ContentMainRunnerImpl::RunBrowser [0x00007FFD7BF3D7FE+1308] (C:\bb1\src\content\app\content_main_runner_impl.cc:1165)
        content::ContentMainRunnerImpl::Run [0x00007FFD7BF3D2AF+639] (C:\bb1\src\content\app\content_main_runner_impl.cc:1041)
        content::RunContentProcess [0x00007FFD7BF3BBEC+1692] (C:\bb1\src\content\app\content_main.cc:407)
        content::ContentMain [0x00007FFD7BF3BD04+84] (C:\bb1\src\content\app\content_main.cc:435)
        ChromeMain [0x00007FFD7D0F1287+487] (C:\bb1\src\chrome\app\chrome_main.cc:177)
        MainDllLoader::Launch [0x00007FF6AE022862+358] (C:\bb1\src\chrome\app\main_dll_loader_win.cc:167)
        wWinMain [0x00007FF6AE021BE1+3010] (C:\bb1\src\chrome\app\chrome_exe_main_win.cc:385)
        __scrt_common_main_seh [0x00007FF6AE0CF5F6+262] (D:\agent\_work\10\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)
        BaseThreadInitThunk [0x00007FFDF4177034+20]
        RtlUserThreadStart [0x00007FFDF4AA2651+33]

Fixed

Copy link
Member

@simonhong simonhong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++ with one suggestion 👍🏼

return;
}

base::ThreadTaskRunnerHandle::Get()->PostTask(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the document (https://chromium.googlesource.com/chromium/src/+/lkgr/docs/threading_and_tasks.md#posting-to-the-current-virtual_thread), base::SequencedTaskRunnerHandle::Get() is more preferred over base::ThreadTaskRunnerHandle::Get() when posting to current thread

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, thanks!

@spylogsster spylogsster force-pushed the brave-1002 branch 3 times, most recently from 67f698b to f7b1f27 Compare July 19, 2022 16:44
Copy link
Collaborator

@rebron rebron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++ Looks good. New placement looks good in brave://settings/system.

Copy link
Contributor

@iefremov iefremov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chromium_src/* LGTM

@spylogsster spylogsster merged commit 51e4cc1 into master Jul 20, 2022
@spylogsster spylogsster deleted the brave-1002 branch July 20, 2022 11:26
@github-actions github-actions bot added this to the 1.43.x - Nightly milestone Jul 20, 2022
@bsclifton
Copy link
Member

bsclifton commented Jul 25, 2022

Noticed we have this on Android, although with different text:
Closing all tabs closes Brave

Which has the preference key closing_all_tabs_closes_brave. We could use the same key if we wanted to sync this (maybe we don't) or we can unify the wording
image

cc: @rebron @spylogsster

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Closing last tab should open a new tab (not exit browser)
5 participants