Open
Bug 1478625
Opened 8 years ago
Updated 2 years ago
menuWillOpen events get sent for browser menus shortly after browser window open, interfering with other popups
Categories
(Core :: Widget: Cocoa, defect, P3)
Core
Widget: Cocoa
Tracking
()
NEW
People
(Reporter: Gijs, Unassigned)
Details
Attachments
(1 obsolete file)
menuWillOpen in nsMenuX calls popup rollup.
I'm seeing issues when I run certain individual automated tests locally, because they open e.g. the location bar autocomplete popup at the start of the test, but the popup gets closed almost immediately.
Looking at the backtrace with lldb shows something like this:
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
* frame #0: 0x0000000104255fcf XUL`nsXULPopupManager::HidePopup(this=0x0000000113068c10, aPopup=0x000000012163ce00, aHideChain=true, aDeselectMenu=true, aAsynchronous=false, aIsCancel=true, aLastPopup=0x000000012163ce00) at nsXULPopupManager.cpp:970 [opt]
frame #1: 0x0000000104255f5e XUL`nsXULPopupManager::Rollup(this=0x0000000113068c10, aCount=0, aFlush=true, pos=<unavailable>, aLastRolledUp=<unavailable>) at nsXULPopupManager.cpp:338 [opt]
frame #2: 0x0000000103ed2369 XUL`::-[MenuDelegate menuWillOpen:](self=0x0000000122a5fb10, _cmd=<unavailable>, menu=0x0000000121763ec0) at nsMenuX.mm:838 [opt]
frame #3: 0x00007fff2aa225f8 AppKit`-[NSMenu _sendMenuOpeningNotification:] + 106
frame #4: 0x00007fff2a72cbae AppKit`-[NSCarbonMenuImpl _carbonOpenEvent:handlerCallRef:] + 95
frame #5: 0x00007fff2a5483ff AppKit`NSSLMMenuEventHandler + 1231
frame #6: 0x00007fff2c0f7904 HIToolbox`DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 1541
frame #7: 0x00007fff2c0f6c4d HIToolbox`SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 374
frame #8: 0x00007fff2c0f6ac3 HIToolbox`SendEventToEventTargetWithOptions + 45
frame #9: 0x00007fff2c16578d HIToolbox`SendMenuOpening(MenuSelectData*, MenuData*, double, unsigned int, unsigned int, __CFDictionary*, unsigned char, unsigned char*) + 467
frame #10: 0x00007fff2c295a3c HIToolbox`_SimulateMenuOpening + 111
frame #11: 0x00007fff2c28b2c7 HIToolbox`OpenMenuForInspection(MenuData*) + 94
frame #12: 0x00007fff2c28c0db HIToolbox`MenuData::HandleGetNamedAccessibleAttribute(unsigned long long, __CFString const*, unsigned int, OpaqueEventRef*) + 157
frame #13: 0x00007fff2c28c029 HIToolbox`MenuData::GetNamedAccessibleAttributeSelf(unsigned long long, __CFString const*, unsigned int, OpaqueEventRef*) + 185
frame #14: 0x00007fff2c2a651b HIToolbox`HIObject::DispatchAccessibilityEvent(OpaqueEventRef*, unsigned long long, AccessibilityHandlers const*, void*) + 489
frame #15: 0x00007fff2c2a61ee HIToolbox`HIObject::HandleClassAccessibilityEvent(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) + 106
frame #16: 0x00007fff2c0f7f01 HIToolbox`HIObject::EventHook(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) + 135
frame #17: 0x00007fff2c0f7904 HIToolbox`DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 1541
frame #18: 0x00007fff2c0f6c4d HIToolbox`SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 374
frame #19: 0x00007fff2c17c76a HIToolbox`CallNextEventHandler + 105
frame #20: 0x00007fff2a85cb7b AppKit`-[NSCarbonMenuImpl _carbonGetAccessibleAttributeEvent:handlerCallRef:axElement:] + 37
frame #21: 0x00007fff2a548363 AppKit`NSSLMMenuEventHandler + 1075
frame #22: 0x00007fff2c0f7904 HIToolbox`DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 1541
frame #23: 0x00007fff2c0f6c4d HIToolbox`SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 374
frame #24: 0x00007fff2c0f6ac3 HIToolbox`SendEventToEventTargetWithOptions + 45
frame #25: 0x00007fff2c1944ae HIToolbox`Accessible::GetNamedAttributeData(__CFString const*, void const*, void const**, unsigned char*) + 178
frame #26: 0x00007fff2c194234 HIToolbox`HLTBCopyUIElementAttributeValue + 57
frame #27: 0x00007fff2c1968e4 HIToolbox`CarbonCopyAttributeValueCallback(__CFData const*, unsigned int, __CFString const*, void const**, void*) + 88
frame #28: 0x00007fff2a7b445c AppKit`CopyCarbonUIElementAttributeValue + 55
frame #29: 0x00007fff2a7b1fba AppKit`CopyAttributeValue + 128
frame #30: 0x00007fff2b6b5029 HIServices`_AXXMIGCopyAttributeValue + 282
frame #31: 0x00007fff2b6befa4 HIServices`_XCopyAttributeValue + 455
frame #32: 0x00007fff2b6976ed HIServices`mshMIGPerform + 212
frame #33: 0x00007fff2ce3d3f9 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 41
frame #34: 0x00007fff2ce3d345 CoreFoundation`__CFRunLoopDoSource1 + 533
frame #35: 0x00007fff2ce34f00 CoreFoundation`__CFRunLoopRun + 2848
frame #36: 0x00007fff2ce34153 CoreFoundation`CFRunLoopRunSpecific + 483
frame #37: 0x00007fff2c11ed96 HIToolbox`RunCurrentEventLoopInMode + 286
frame #38: 0x00007fff2c11eb06 HIToolbox`ReceiveNextEventCommon + 613
frame #39: 0x00007fff2c11e884 HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 64
frame #40: 0x00007fff2a3cfa73 AppKit`_DPSNextEvent + 2085
frame #41: 0x00007fff2ab65e34 AppKit`-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 3044
frame #42: 0x0000000103eb15ec XUL`::-[GeckoNSApplication nextEventMatchingMask:untilDate:inMode:dequeue:](self=<unavailable>, _cmd=<unavailable>, mask=18446744073709551615, expiration=4001-01-01 00:00:00 UTC, mode=<unavailable>, flag=YES) at nsAppShell.mm:178 [opt]
frame #43: 0x00007fff2a3c4885 AppKit`-[NSApplication run] + 764
frame #44: 0x0000000103eb25c7 XUL`nsAppShell::Run(this=0x00000001007b9940) at nsAppShell.mm:735 [opt]
frame #45: 0x00000001050577d4 XUL`nsAppStartup::Run(this=0x00000001007cd6a0) at nsAppStartup.cpp:290 [opt]
frame #46: 0x0000000105164c74 XUL`XREMain::XRE_mainRun(this=0x00007ffeefbfeed0) at nsAppRunner.cpp:4761 [opt]
frame #47: 0x00000001051655bc XUL`XREMain::XRE_main(this=0x00007ffeefbfeed0, argc=<unavailable>, argv=<unavailable>, aConfig=0x00007ffeefbff070) at nsAppRunner.cpp:4906 [opt]
frame #48: 0x0000000105165c51 XUL`XRE_main(argc=<unavailable>, argv=<unavailable>, aConfig=<unavailable>) at nsAppRunner.cpp:4998 [opt]
frame #49: 0x000000010000110b firefox`main [inlined] do_main(argc=<unavailable>, argv=<unavailable>, envp=<unavailable>) at nsBrowserApp.cpp:233 [opt]
frame #50: 0x0000000100001029 firefox`main(argc=<unavailable>, argv=<unavailable>, envp=0x00007ffeefbff4f8) at nsBrowserApp.cpp:311 [opt]
frame #51: 0x00007fff54c75015 libdyld.dylib`start + 1
frame #52: 0x00007fff54c75015 libdyld.dylib`start + 1
Logging the menu ids of the menupopups from our menuWillOpen handler, I see something like this at a test startup:
0:03.67 TEST_START: browser/base/content/test/urlbar/browser_urlbar_search_no_speculative_connect_with_client_cert.js
0:03.67 INFO Entering test bound
0:03.75 INFO Console message: [JavaScript Warning: "Use of nsIFile in content process is deprecated." {file: "resource://gre/modules/FileUtils.jsm" line: 170}]
0:03.97 INFO Console message: [JavaScript Warning: "Use of nsIFile in content process is deprecated." {file: "resource://gre/modules/FileUtils.jsm" line: 170}]
0:03.98 GECKO(37488) 2018-07-26 12:33:52.873 plugin-container[37492:3080893] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x7707, name = 'com.apple.tsm.portname'
0:03.98 GECKO(37488) See /usr/include/servers/bootstrap_defs.h for the error codes.
0:04.01 GECKO(37488) menuWillOpen: menu_FilePopup
0:04.01 GECKO(37488) menuWillOpen: menu_EditPopup
0:04.01 GECKO(37488) menuWillOpen: menu_viewPopup
0:04.01 GECKO(37488) menuWillOpen: goPopup
0:04.01 GECKO(37488) menuWillOpen: bookmarksMenuPopup
0:04.01 GECKO(37488) menuWillOpen: menu_ToolsPopup
0:04.02 GECKO(37488) menuWillOpen: windowPopup
It seems that we get these notifications for every toplevel menu. I don't know if this affects infra, but it makes it difficult to debug mid-run failures locally, because running the individual tests fails differently.
Is there some logic by which we could ignore these initial events?
STR (for me, on 10.13.6 (17G65), recent 15" mbp):
1. run ./mach mochitest browser/base/content/test/urlbar/browser_urlbar_search_no_speculative_connect_with_client_cert.js
More often than not, it fails waiting for the second autocomplete result, because the popup has been closed by the file popup "opening".
Comment 1•8 years ago
|
||
Could you confirm that this also occurred before bug 1468053 landed? I would like to make sure that this isn't a regression from our recent fix for popups on macOS 10.14.
Flags: needinfo?(gijskruitbosch+bugs)
| Reporter | ||
Comment 2•8 years ago
|
||
(In reply to Stephen A Pohl [:spohl] from comment #1)
> Could you confirm that this also occurred before bug 1468053 landed? I would
> like to make sure that this isn't a regression from our recent fix for
> popups on macOS 10.14.
hg log -r c3c7401b4277
abort: unknown revision 'c3c7401b4277'!
suggests that I haven't yet pulled in those changes, so I think that means it's not a regression from that fix. Does that sound correct? Do you think this is a recent regression either way, ie should I try to bisect this?
Flags: needinfo?(gijskruitbosch+bugs) → needinfo?(spohl.mozilla.bugs)
Comment 3•8 years ago
|
||
No, I don't have a particular reason to believe that this is a recent regression other than the fact that I just landed bug 1468053 recently, and your bug is the first popup-related bug I've seen in a while. Thanks for checking.
Flags: needinfo?(spohl.mozilla.bugs)
Updated•8 years ago
|
Priority: -- → P3
Updated•4 years ago
|
Severity: normal → S3
Updated•2 years ago
|
Attachment #9386093 -
Attachment is obsolete: true
You need to log in
before you can comment on or make changes to this bug.
Description
•