<?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>69037</bug_id>
          
          <creation_ts>2011-09-28 16:00:30 -0700</creation_ts>
          <short_desc>ASSERT if WebView&apos;s UIDelegate does not implement webView:runOpenPanel</short_desc>
          <delta_ts>2011-09-28 17:44:40 -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>WebKit API</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Joseph Pecoraro">joepeck</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>joepeck</cc>
    
    <cc>webkit.review.bot</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>475056</commentid>
    <comment_count>0</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2011-09-28 16:00:30 -0700</bug_when>
    <thetext>If a WebView&apos;s UIDelegate does not implement any of the webView:runOpenPanel delegates
then WebChromeClient will ASSERT(!_chooser) when the unused WebOpenPanelResultListener
deallocated. WebKit expects an action (-cancel, -chooseFile:, or -chooseFiles:) to be called
on the listener before its deallocated.

We can either not create the listener if its not needed, or just default to cancel if no delegate is implemented.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>475094</commentid>
    <comment_count>1</comment_count>
      <attachid>109096</attachid>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2011-09-28 17:06:01 -0700</bug_when>
    <thetext>Created attachment 109096
[PATCH] Proposed Fix

Easiest approach was to just send a -cancel to the listener.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>475097</commentid>
    <comment_count>2</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2011-09-28 17:08:33 -0700</bug_when>
    <thetext>This would also fix a leak for those cases.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>475107</commentid>
    <comment_count>3</comment_count>
      <attachid>109096</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2011-09-28 17:20:30 -0700</bug_when>
    <thetext>Comment on attachment 109096
[PATCH] Proposed Fix

Is it right to -release after -cancel? This looks like an over-release.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>475112</commentid>
    <comment_count>4</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2011-09-28 17:25:11 -0700</bug_when>
    <thetext>In this case, -cancel doesn&apos;t release the object, it just sends a message down
to the WebCore::FileChooser and clears the FileChooser. -release just
deallocates, which expects the chooser to have already been cleared.

The relevant code here is:

    ifndef NDEBUG
    - (void)dealloc
    {
        ASSERT(!_chooser);
        [super dealloc];
    }
    - (void)finalize
    {
        ASSERT(!_chooser);
        [super finalize];
    }
    #endif

    - (void)cancel
    {
        ASSERT(_chooser);
        if (!_chooser)
            return;
        _chooser-&gt;deref();
        _chooser = 0;
    }</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>475116</commentid>
    <comment_count>5</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2011-09-28 17:27:16 -0700</bug_when>
    <thetext>(In reply to comment #4)
&gt; &quot;it just sends a message down to the WebCore::FileChooser&quot;

Actually the -cancel path doesn&apos;t send a message. The -chooseFile(s) paths
do send a message and clear the chooser. The rest of my comment is still fine.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>475124</commentid>
    <comment_count>6</comment_count>
      <attachid>109096</attachid>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2011-09-28 17:44:36 -0700</bug_when>
    <thetext>Comment on attachment 109096
[PATCH] Proposed Fix

Clearing flags on attachment: 109096

Committed r96279: &lt;http://trac.webkit.org/changeset/96279&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>475126</commentid>
    <comment_count>7</comment_count>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2011-09-28 17:44:40 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>109096</attachid>
            <date>2011-09-28 17:06:01 -0700</date>
            <delta_ts>2011-09-28 17:44:36 -0700</delta_ts>
            <desc>[PATCH] Proposed Fix</desc>
            <filename>runOpen.patch</filename>
            <type>text/plain</type>
            <size>1736</size>
            <attacher name="Joseph Pecoraro">joepeck</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1NvdXJjZS9XZWJLaXQvbWFjL0NoYW5nZUxvZyBiL1NvdXJjZS9XZWJLaXQv
bWFjL0NoYW5nZUxvZwppbmRleCBmYzk3Mzk1Li5hOTkxZjYwIDEwMDY0NAotLS0gYS9Tb3VyY2Uv
V2ViS2l0L21hYy9DaGFuZ2VMb2cKKysrIGIvU291cmNlL1dlYktpdC9tYWMvQ2hhbmdlTG9nCkBA
IC0xLDMgKzEsMTUgQEAKKzIwMTEtMDktMjggIEpvc2VwaCBQZWNvcmFybyAgPGpvZXBlY2tAd2Vi
a2l0Lm9yZz4KKworICAgICAgICBBU1NFUlQgaWYgV2ViVmlldydzIFVJRGVsZWdhdGUgZG9lcyBu
b3QgaW1wbGVtZW50IHdlYlZpZXc6cnVuT3BlblBhbmVsCisgICAgICAgIGh0dHBzOi8vYnVncy53
ZWJraXQub3JnL3Nob3dfYnVnLmNnaT9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