New issue
Advanced search Search tips

Issue 666503 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Nov 2016
Cc:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 1
Type: Bug



Sign in to add a comment

MacViews: NativeWidgetMacTest.WindowModalSheet (probably) flaky

Project Member Reported by tapted@chromium.org, Nov 17 2016

Issue description

Chrome Version       : 56.0.2914.3
OS Version: OS X 10.12.1

What steps will reproduce the problem?
1. Land an unrelated CL. Test fails.

Context:
CL: https://codereview.chromium.org/2509783002/
revert: https://codereview.chromium.org/2509243002



What is the expected result?

No fail

What happens instead of that?


[ RUN      ] NativeWidgetMacTest.WindowModalSheet
[77654:771:1116/213246:9300463921742:ERROR:native_widget_mac.mm(281)] Not implemented reached in virtual void views::NativeWidgetMac::SetWindowIcons(const gfx::ImageSkia &, const gfx::ImageSkia &)
[77654:771:1116/213246:9301184365087:FATAL:widget_owner_nswindow_adapter.mm(105)] Check failed: [child_->ns_window() parentWindow].
0   libbase.dylib                       0x000000010e5765be _ZN4base5debug10StackTraceC2Ev + 30
1   libbase.dylib                       0x000000010e576625 _ZN4base5debug10StackTraceC1Ev + 21
2   libbase.dylib                       0x000000010e60fec0 _ZN7logging10LogMessageD2Ev + 80
3   libbase.dylib                       0x000000010e60da75 _ZN7logging10LogMessageD1Ev + 21
4   libviews.dylib                      0x000000010e118897 _ZN5views26WidgetOwnerNSWindowAdapter31OnWindowDidChangeOcclusionStateEv + 375
5   libviews.dylib                      0x000000010e118718 -[WidgetOwnerNSWindowAdapterBridge windowDidChangeOcclusionState:] + 40
6   CoreFoundation                      0x00007fff97433e0c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
7   CoreFoundation                      0x00007fff9732782d _CFXNotificationPost + 2893
8   Foundation                          0x00007fff8df09dda -[NSNotificationCenter postNotificationName:object:userInfo:] + 68
9   CoreGraphics                        0x00007fff959beb2e _ZNK21CGSConnectionNotifier16invoke_callbacksEjPvm + 612
10  CoreGraphics                        0x00007fff959be860 _ZN12_GLOBAL__N_123notify_datagram_handlerEj15CGSDatagramTypePvmS1_ + 106
11  CoreGraphics                        0x00007fff95977e52 _ZN21CGSDatagramReadStream22dispatch_next_datagramEv + 758
12  CoreGraphics                        0x00007fff95977b4c _ZN21CGSDatagramReadStream18dispatch_datagramsEv + 50
13  CoreGraphics                        0x00007fff95977993 CGSDatagramReadStreamDispatchDatagramsWithData + 124
14  CoreGraphics                        0x00007fff959776d8 CGSSnarfAndDispatchDatagrams + 338
15  CoreGraphics                        0x00007fff9597748e CGSGetNextEventRecordInternal + 78
16  CoreGraphics                        0x00007fff959773fa CGEventCreateNextEvent + 33
17  HIToolbox                           0x00007fff99e9b74d _ZL38PullEventsFromWindowServerOnConnectionjhP17__CFMachPortBoost + 85
18  HIToolbox                           0x00007fff99ea077c PullEventsFromWindowServer + 46
19  HIToolbox                           0x00007fff99ea06c9 FlushSpecificEventsFromQueue + 54
20  AppKit                              0x00007fff8e5eab13 +[NSEvent _discardEventsForTrackingArea:] + 64
21  AppKit                              0x00007fff8e5ea9c9 -[NSView(NSInternal) _uninstallTrackingArea:] + 227
22  AppKit                              0x00007fff8e4eae25 -[NSView(NSInternal) _uninstallRemovedTrackingAreas] + 461
23  AppKit                              0x00007fff8e5f4559 -[NSView(NSInternal) _updateTrackingAreas] + 679
24  AppKit                              0x00007fff8e64ae24 _handleInvalidCursorRectsNote + 994
25  AppKit                              0x00007fff8ec288a1 __35-[NSWindow _postInvalidCursorRects]_block_invoke2988 + 46
26  CoreFoundation                      0x00007fff97395d67 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
27  CoreFoundation                      0x00007fff97395cd7 __CFRunLoopDoObservers + 391
28  CoreFoundation                      0x00007fff973873b8 __CFRunLoopRun + 776
29  CoreFoundation                      0x00007fff97386e75 CFRunLoopRunSpecific + 309
30  HIToolbox                           0x00007fff99e93a0d RunCurrentEventLoopInMode + 226
31  HIToolbox                           0x00007fff99e93685 ReceiveNextEventCommon + 173
32  HIToolbox                           0x00007fff99e935bc _BlockUntilNextEventMatchingListInModeWithFilter + 65
33  AppKit                              0x00007fff8e4ae24e _DPSNextEvent + 1434
34  AppKit                              0x00007fff8e4ad89b -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 122
35  AppKit                              0x00007fff8e4a199c -[NSApplication run] + 553
36  libbase.dylib                       0x000000010e677172 _ZN4base24MessagePumpNSApplication5DoRunEPNS_11MessagePump8DelegateE + 306
37  libbase.dylib                       0x000000010e67616a _ZN4base24MessagePumpCFRunLoopBase3RunEPNS_11MessagePump8DelegateE + 122
38  libbase.dylib                       0x000000010e663035 _ZN4base11MessageLoop10RunHandlerEv + 645
39  libbase.dylib                       0x000000010e73def5 _ZN4base7RunLoop3RunEv + 85
40  libbase.dylib                       0x000000010e73e199 _ZN4base7RunLoop12RunUntilIdleEv + 25
41  views_unittests                     0x000000010d47e520 _ZN5views4test41NativeWidgetMacTest_WindowModalSheet_Test8TestBodyEv + 7168


 
Project Member

Comment 1 by bugdroid1@chromium.org, Nov 18 2016

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

commit cf8095820e7183dfd786330291460d7ea3b0a94f
Author: tapted <tapted@chromium.org>
Date: Fri Nov 18 02:51:02 2016

MacViews: Disable NativeWidgetMacTest.WindowModalSheet.

It seems to fail due to sharding adjustments. A DCHECK is hit in
WidgetOwnerNSWindowAdapter::OnWindowDidChangeOcclusionState() during
closure of the sheet when the parent window receives an asynchronous
occlusion state change from the window server, after the child has its
parent window relationship removed.

This "shouldn't" happen, but sheets (and occulsion states) are weird.
The tests probably should be failing always. It's possibly only
happening on 10.9.

BUG= 666503 
NOTRY=true

Review-Url: https://codereview.chromium.org/2508153003
Cr-Commit-Position: refs/heads/master@{#433028}

[modify] https://crrev.com/cf8095820e7183dfd786330291460d7ea3b0a94f/ui/views/widget/native_widget_mac_unittest.mm

Comment 2 by tapted@chromium.org, Nov 22 2016

Status: Started (was: Assigned)
Fix is in https://codereview.chromium.org/2521753003/ .
Project Member

Comment 3 by bugdroid1@chromium.org, Nov 29 2016

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

commit 9464d37d42d7b7895421a05bd3f0b5f0a3eb3266
Author: tapted <tapted@chromium.org>
Date: Tue Nov 29 04:02:54 2016

MacViews: Protect against orderOut: on an NSWindow with an attached sheet.

This fixes and re-enables NativeWidgetMacTest.WindowModalSheet with some
additional test expectations. It was reverted in r433028 when it started
failing.

Fundamentally, the problem is that calling orderOut: on an NSWindow with
an attached sheet results in utterly broken behavior in AppKit,
documented in http://crbug.com/667602.

AppKit's broken behaviour with orderOut and regular child windows is
already handled by BridgedNativeWidget by recreating the parent/child
relationships. However, it can't do this for sheets. It's not possible
to "reattach" a sheet once it becomes detached. And even giving a sheet
a parentWindow results in graphical glitches ( http://crbug.com/605098 ).
Sheets use -[NSWindow sheetParent], not -[NSWindow parentWindow].

Note that -[NSApp hide:] works. It's just -[NSWindow orderOut:] that's
broken. But we need the triggers from -[NSApp hide:] to be consistent
with the different things that need to happen for sheets.

Add checks to BridgedNativeWidget to detect attempts to orderOut: a
window with an attached sheet. Different solutions need to be sought for
these, such as what Chrome already does for the certificate viewer sheet
when we make it tab-modal.

Update DCHECKs in WidgetOwnerNSWindowAdapter to properly support sheets.
This allows NativeWidgetMacTest.WindowModalSheet to be re-enabled.

Updates BridgedNativeWidget::OnVisibilityChanged() to properly fix
 http://crbug.com/605098 . This bug still manifests in Chrome, but only
after a call to [NSApp hide:]. Re-showing a window improperly attaches
the parent as a parentWindow (rather than only sheetParent), and this is
the cause of the graphical glitches.

BUG= 666503 ,  605098 , 667602

Review-Url: https://codereview.chromium.org/2521753003
Cr-Commit-Position: refs/heads/master@{#434882}

[modify] https://crrev.com/9464d37d42d7b7895421a05bd3f0b5f0a3eb3266/ui/views/cocoa/bridged_native_widget.mm
[modify] https://crrev.com/9464d37d42d7b7895421a05bd3f0b5f0a3eb3266/ui/views/cocoa/widget_owner_nswindow_adapter.mm
[modify] https://crrev.com/9464d37d42d7b7895421a05bd3f0b5f0a3eb3266/ui/views/widget/native_widget_mac_unittest.mm

Comment 4 by tapted@chromium.org, Nov 29 2016

Status: Fixed (was: Started)

Sign in to add a comment