UIMenuController dissappears when a background webpage finishes loading

Originator:zkrige
Number:rdar://28981605 Date Originated:27 Oct 2016
Status:Open Resolved:
Product:iOS SDK Product Version:10.1
Classification:UI Reproducible:Always
 
Summary:
I create a WKWebView and load data into it. I long press to select text and bring up the context menu.

While the context menu is showing, I create a WKWebView in the background (but never show its view, or add its view to any visible view controller) and load some data into it. As soon as the data finishes loading, the UIMenuController on the visible WKWebView dissappears

Steps to Reproduce:
1. Create WKWebView
2. add it to visible VC
3. Load content into WKWebView
4. Long press on some text to bring up the context menu
5. Create second WKWebView instance, but dont add it to any view or controller.
6. Load data into second WKWebView


Expected Results:
Context menu on first WKWebView should stay in place

Actual Results:
When content is finished loading in second WKWebView, context menu dissappears

Version:
iOS 10.1

Notes:


Configuration:
reproducible on iphone 6+ and ipad air


callstack at time of menu hiding :
<_NSCallStackArray 0x7fe186f97fa0>(
0   ???                                 0x0000000129637a4a 0x0 + 4989352522,
1   Snapplify                           0x000000010c0d9c40 main + 0,
2   CoreFoundation                      0x000000010d716c8c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12,
3   CoreFoundation                      0x000000010d7169cb _CFXRegistrationPost + 427,
4   CoreFoundation                      0x000000010d716732 ___CFXNotificationPost_block_invoke + 50,
5   CoreFoundation                      0x000000010d75f1e2 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1986,
6   CoreFoundation                      0x000000010d60e679 _CFXNotificationPost + 633,
7   Foundation                          0x000000010ea4ecd9 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66,
8   UIKit                               0x0000000111c4e828 -[UIMenuController(UICalloutBarDelegateConformance) calloutBar:willStartAnimation:] + 443,
9   UIKit                               0x0000000111c35055 -[UICalloutBar _fadeAfterCommand:] + 266,
10  UIKit                               0x0000000111c4f90a -[UIWebSelectionAssistant resignedFirstResponder] + 41,
11  WebKit                              0x000000011dcfbfd5 -[WKContentView _didCommitLoadForMainFrame] + 27,
12  WebKit                              0x000000011dc73d2d _ZN6WebKit12WebPageProxy21didCommitLoadForFrameEyyRKN3WTF6StringEbjRKN7WebCore15CertificateInfoERKNS_8UserDataE + 481,
13  WebKit                              0x000000011dc98404 _ZN3IPC22callMemberFunctionImplIN6WebKit12WebPageProxyEMS2_FvyyRKN3WTF6StringEbjRKN7WebCore15CertificateInfoERKNS1_8UserDataEENSt3__15tupleIJyyS4_bjS8_SB_EEEJLm0ELm1ELm2ELm3ELm4ELm5ELm6EEEEvPT_T0_OT1_St14index_sequenceIJXspT2_EEE + 68,
14  WebKit                              0x000000011dc92e60 _ZN3IPC13handleMessageIN8Messages12WebPageProxy21DidCommitLoadForFrameEN6WebKit12WebPageProxyEMS5_FvyyRKN3WTF6StringEbjRKN7WebCore15CertificateInfoERKNS4_8UserDataEEEEvRNS_14MessageDecoderEPT0_T1_ + 109,
15  WebKit                              0x000000011db44cd7 _ZN3IPC18MessageReceiverMap15dispatchMessageERNS_10ConnectionERNS_14MessageDecoderE + 113,
16  WebKit                              0x000000011dcc7270 _ZN6WebKit15WebProcessProxy17didReceiveMessageERN3IPC10ConnectionERNS1_14MessageDecoderE + 24,
17  WebKit                              0x000000011db02d76 _ZN3IPC10Connection15dispatchMessageENSt3__110unique_ptrINS_14MessageDecoderENS1_14default_deleteIS3_EEEE + 102,
18  WebKit                              0x000000011db0503e _ZN3IPC10Connection18dispatchOneMessageEv + 114,
19  JavaScriptCore                      0x000000010f92b635 _ZN3WTF7RunLoop11performWorkEv + 437,
20  JavaScriptCore                      0x000000010f92bd12 _ZN3WTF7RunLoop11performWorkEPv + 34,
21  CoreFoundation                      0x000000010d672301 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17,
22  CoreFoundation                      0x000000010d66822c __CFRunLoopDoSources0 + 556,
23  CoreFoundation                      0x000000010d6676e3 __CFRunLoopRun + 867,
24  CoreFoundation                      0x000000010d6670f8 CFRunLoopRunSpecific + 488,
25  GraphicsServices                    0x0000000115731ad2 GSEventRunModal + 161,
26  UIKit                               0x00000001116d8f09 UIApplicationMain + 171,
27  Snapplify                           0x000000010c0d9c7e main + 62,
28  libdyld.dylib                       0x000000011390892d start + 1
)

Comments

0 ??? 0x00000001097141f4 0x0 + 4453384692,

1 TextNowSwift-Free 0x000000010056b030 main + 0,

2 CoreFoundation 0x000000018c00d5f4 + 20,

3 CoreFoundation 0x000000018c00cd08 + 400,

4 CoreFoundation 0x000000018c00ca84 + 60,

5 CoreFoundation 0x000000018c07b7a8 + 1412,

6 CoreFoundation 0x000000018bf5095c _CFXNotificationPost + 376,

7 Foundation 0x000000018ca62930 + 68,

8 UIKit 0x00000001927d4a20 + 464,

9 UIKit 0x00000001927bade4 + 256,

10 UIKit 0x00000001927d587c + 40,

11 WebKit 0x000000019593788c + 240,

12 WebKit 0x000000019592ae6c + 28,

13 WebKit 0x0000000195887344 + 484,

14 WebKit 0x00000001958a8238 + 124,

15 WebKit 0x00000001958a20e8 + 124,

16 WebKit 0x0000000195743dbc + 120,

17 WebKit 0x00000001958ec848 + 32,

18 WebKit 0x0000000195709ca4 + 164,

19 WebKit 0x000000019570c49c + 232,

20 JavaScriptCore 0x00000001908edff4 + 172,

21 JavaScriptCore 0x00000001908ee2cc + 36,

22 CoreFoundation 0x000000018c02142c + 24,

23 CoreFoundation 0x000000018c020d9c + 540,

24 CoreFoundation 0x000000018c01e9a8 + 744,

25 CoreFoundation 0x000000018bf4eda4 CFRunLoopRunSpecific + 424,

26 GraphicsServices 0x000000018d9b8074 GSEventRunModal + 100,

27 UIKit 0x000000019220c364 UIApplicationMain + 208,

28 TextNowSwift-Free 0x000000010056b07c main + 76,

29 libdyld.dylib 0x000000018af5d59c + 4

)

Having the same issue.

By Brocapitate at May 24, 2017, 1:13 a.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!