<?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>40036</bug_id>
          
          <creation_ts>2010-06-01 18:19:25 -0700</creation_ts>
          <short_desc>Make WebChromeClient::closeWindowSoon work for all RunLoop modes</short_desc>
          <delta_ts>2010-09-14 19:26:29 -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 Misc.</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</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>
          
          <blocked>35350</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Prasad Tammana">prasadt</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>darin</cc>
    
    <cc>dimich</cc>
    
    <cc>levin</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>233016</commentid>
    <comment_count>0</comment_count>
    <who name="Prasad Tammana">prasadt</who>
    <bug_when>2010-06-01 18:19:25 -0700</bug_when>
    <thetext>performSelector:withObject:afterDelay method is being used to post the _closeWindow message to the queue.  Those message will only get dispatched if the RunLoop is in NSDefaultRunLoopMode.  Since RunLoop is in NSModalPanelRunLoopMode mode when a modal window is being displayed, you can&apos;t close the window.  Replaced the call with the inModes version to allow the close window message to be dispatched in all RunLoop modes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>233019</commentid>
    <comment_count>1</comment_count>
      <attachid>57611</attachid>
    <who name="Prasad Tammana">prasadt</who>
    <bug_when>2010-06-01 18:25:49 -0700</bug_when>
    <thetext>Created attachment 57611
Patch to make closeWindowSoon work in all RunLoop modes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>233301</commentid>
    <comment_count>2</comment_count>
    <who name="David Levin">levin</who>
    <bug_when>2010-06-02 09:37:00 -0700</bug_when>
    <thetext>This is follow up from http://www.mail-archive.com/webkit-dev@lists.webkit.org/msg11394.html as  understand it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>234541</commentid>
    <comment_count>3</comment_count>
      <attachid>57611</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2010-06-04 22:52:35 -0700</bug_when>
    <thetext>Comment on attachment 57611
Patch to make closeWindowSoon work in all RunLoop modes.

I don’t think this change is correct or helpful. For example, I don’t think we want to close a window and run all the code that triggers inside an NSConnectionReply modal event loop.

I don’t understand the benefit side of this patch either.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>234886</commentid>
    <comment_count>4</comment_count>
    <who name="Prasad Tammana">prasadt</who>
    <bug_when>2010-06-07 09:36:00 -0700</bug_when>
    <thetext>(In reply to comment #3)
&gt; (From update of attachment 57611 [details])
&gt; I don’t think this change is correct or helpful. For example, I don’t think we want to close a window and run all the code that triggers inside an NSConnectionReply modal event loop.
&gt; 
&gt; I don’t understand the benefit side of this patch either.

When you write a WebKit application that implements showModalDialog, you don&apos;t have a way to close the window from script.  The close call ends up in the closeWindowSoon() function and the _closeWindow() doesn&apos;t get dispatched because the run loop is in NSModalPanelRunLoopMode mode.

I didn&apos;t realize that dispatching these calls is inappropriate in certain modes.  I could make this fix more targeted and make it to be:

[m_webView performSelector:@selector(_closeWindow) withObject:nil afterDelay:0.0
        inModes:[NSArray arrayWithObjects:NSDefaultRunLoopMode, NSModalPanelRunLoopMode]];

With that change the only new mode we&apos;ll be closing windows would be in NSModalPanelRunLoopMode.  Does that seem like a correct change?

I ran into this issue when adding showModalDialog to DumpRenderTree as part of the bug fix for - https://bugs.webkit.org/show_bug.cgi?id=35350.  You&apos;ll notice I have a patch attached to that bug that includes this change.  I decided to factor out this particular change into a separate patch as this is the more sensitive part of that big patch.


Thanks,
Prasad</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>253442</commentid>
    <comment_count>5</comment_count>
      <attachid>57611</attachid>
    <who name="Dmitry Titov">dimich</who>
    <bug_when>2010-07-19 16:06:34 -0700</bug_when>
    <thetext>Comment on attachment 57611
Patch to make closeWindowSoon work in all RunLoop modes.

Removing r? since the root bug 35350 has landed and it seems a different approach was selected to support showModalDialog testing. Please update if this is not so.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>279332</commentid>
    <comment_count>6</comment_count>
    <who name="Prasad Tammana">prasadt</who>
    <bug_when>2010-09-14 19:26:29 -0700</bug_when>
    <thetext>We don&apos;t need this change anymore.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>57611</attachid>
            <date>2010-06-01 18:25:49 -0700</date>
            <delta_ts>2010-07-19 16:06:34 -0700</delta_ts>
            <desc>Patch to make closeWindowSoon work in all RunLoop modes.</desc>
            <filename>closeWindowSoon.txt</filename>
            <type>text/plain</type>
            <size>1816</size>
            <attacher name="Prasad Tammana">prasadt</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYktpdC9tYWMvV2ViQ29yZVN1cHBvcnQvV2ViQ2hyb21lQ2xpZW50Lm1tCj09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT0KLS0tIFdlYktpdC9tYWMvV2ViQ29yZVN1cHBvcnQvV2ViQ2hyb21lQ2xpZW50Lm1tCShy
ZXZpc2lvbiA2MDUxNCkKKysrIFdlYktpdC9tYWMvV2ViQ29yZVN1cHBvcnQvV2ViQ2hyb21lQ2xp
ZW50Lm1tCSh3b3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