<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>163999</bug_id>
          
          <creation_ts>2016-10-25 17:29:56 -0700</creation_ts>
          <short_desc>AX: WebView crashes app after opening VoiceOver context box menu from modal dialog</short_desc>
          <delta_ts>2017-07-13 00:47:16 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Accessibility</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Dan Saunders">dasau</reporter>
          <assigned_to name="chris fleizach">cfleizach</assigned_to>
          <cc>aboxhall</cc>
    
    <cc>apinheiro</cc>
    
    <cc>ap</cc>
    
    <cc>buildbot</cc>
    
    <cc>cfleizach</cc>
    
    <cc>commit-queue</cc>
    
    <cc>dmazzoni</cc>
    
    <cc>jcraig</cc>
    
    <cc>jdiggs</cc>
    
    <cc>samuel_white</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1244570</commentid>
    <comment_count>0</comment_count>
    <who name="Dan Saunders">dasau</who>
    <bug_when>2016-10-25 17:29:56 -0700</bug_when>
    <thetext>If WebView is hosted inside a modal dialog, a user with voiceover can try to use control + option + shift + M to open the context box menu. The menu never opens, and then after closing the dialog the application crashes. This consistently repros with WebView. It does not repro with WKWebView.

To prevent the crash we just need a nullptr check on m_object. detach is being called before the delayed selector gets performed. If we want the context box menu to show in this scenario, we need to modify the performSelector to still occur while modal dialog is running.

Something like this would fix both issues:
[self performSelector:@selector(accessibilityShowContextMenu) withObject:nil afterDelay:0.0 inModes:[NSArray arrayWithObjects: NSDefaultRunLoopMode, NSModalPanelRunLoopMode, nil]];

WebAccessibilityObjectWrapperMac.mm (crashing location m_object is nullptr)
- (void)accessibilityShowContextMenu
{
    Page* page = m_object-&gt;page();

#0	0x0000000107007190 in WebCore::AccessibilityObject::page() const at /*/Source/WebCore/accessibility/AccessibilityObject.cpp:1716
#1	0x00000001098b456a in -[WebAccessibilityObjectWrapper accessibilityShowContextMenu] at /*/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:3675
#2	0x00007fff8a484ace in __NSFireDelayedPerform ()
#3	0x00007fff95c56b94 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ ()
#4	0x00007fff95c56823 in __CFRunLoopDoTimer ()
#5	0x00007fff95c5637a in __CFRunLoopDoTimers ()
#6	0x00007fff95c4d871 in __CFRunLoopRun ()
#7	0x00007fff95c4ced8 in CFRunLoopRunSpecific ()
#8	0x00007fff938cf935 in RunCurrentEventLoopInMode ()
#9	0x00007fff938cf677 in ReceiveNextEventCommon ()
#10	0x00007fff938cf5af in _BlockUntilNextEventMatchingListInModeWithFilter ()
#11	0x00007fff94af1efa in _DPSNextEvent ()
#12	0x00007fff94af132a in -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] ()
#13	0x00007fff94ae5e84 in -[NSApplication run] ()
#14	0x00007fff94aaf46c in NSApplicationMain ()
#15	0x00000001000017d2 in main at
#16	0x00007fff9cea35ad in start ()
#17	0x00007fff9cea35ad in start ()</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1244571</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2016-10-25 17:30:19 -0700</bug_when>
    <thetext>&lt;rdar://problem/28949013&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1326949</commentid>
    <comment_count>2</comment_count>
      <attachid>314968</attachid>
    <who name="chris fleizach">cfleizach</who>
    <bug_when>2017-07-10 01:18:18 -0700</bug_when>
    <thetext>Created attachment 314968
patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1328396</commentid>
    <comment_count>3</comment_count>
      <attachid>314968</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2017-07-13 00:47:14 -0700</bug_when>
    <thetext>Comment on attachment 314968
patch

Clearing flags on attachment: 314968

Committed r219444: &lt;http://trac.webkit.org/changeset/219444&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1328397</commentid>
    <comment_count>4</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2017-07-13 00:47:16 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>314968</attachid>
            <date>2017-07-10 01:18:18 -0700</date>
            <delta_ts>2017-07-13 00:47:14 -0700</delta_ts>
            <desc>patch</desc>
            <filename>patch</filename>
            <type>text/plain</type>
            <size>1307</size>
            <attacher name="chris fleizach">cfleizach</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2UvV2Vi
Q29yZS9DaGFuZ2VMb2cJKHJldmlzaW9uIDIxOTI4NikKKysrIFNvdXJjZS9XZWJDb3JlL0NoYW5n
ZUxvZwkod29ya2luZyBjb3B5KQpAQCAtMSwzICsxLDE2IEBACisyMDE3LTA3LTEwICBDaHJpcyBG
bGVpemFjaC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KyBTb3VyY2UvV2ViQ29yZS9hY2Nlc3NpYmlsaXR5L21hYy9XZWJB
Y2Nlc3NpYmlsaXR5T2JqZWN0V3JhcHBlck1hYy5tbQkod29ya2luZyBjb3B5KQpAQCAtMzQ2MSw2
ICszNDYxLDkgQEAKIAogLSAodm9pZClhY2Nlc3NpYmlsaXR5U2hvd0NvbnRleHRNZW51CiB7Cisg
ICAgaWYgKCFtX29iamVjdCkKKyAgICAgICAgcmV0dXJuOworICAgIAogICAgIFBhZ2UqIHBhZ2Ug
PSBtX29iamVjdC0+cGFnZSgpOwogICAgIGlmICghcGFnZSkKICAgICAgICAgcmV0dXJuOwo=
</data>

          </attachment>
      

    </bug>

</bugzilla>