<?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>18341</bug_id>
          
          <creation_ts>2008-04-07 06:35:13 -0700</creation_ts>
          <short_desc>window.onunload not fired when the last browser window is being closed</short_desc>
          <delta_ts>2008-07-09 14:32:14 -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>DOM</component>
          <version>525.x (Safari 3.1)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows Vista</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar, PlatformOnly</keywords>
          <priority>P2</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="ptr">petr.zdrahal</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>aroben</cc>
    
    <cc>vicki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>76492</commentid>
    <comment_count>0</comment_count>
    <who name="ptr">petr.zdrahal</who>
    <bug_when>2008-04-07 06:35:13 -0700</bug_when>
    <thetext>We expected that the handler attached to &quot;window.onunload&quot; gets invoked anytime when a document gets unloaded - means for any of following cases you should get same and consistent behavior.

(A) Close last browser window
(B) Close window, but still have another opened
(C) Refresh window
(D) Reload window/ put another URL in address bar

Wrong behavior with Safari 3.1. (525.31.3) [WinXP/SP2]
------------------------------------------------------
Safari-for-Windows doesn&apos;t cover the case (A). When the LAST browser window is being closed, the handler attached to &quot;window.onuload&quot; is not called. Using attached sample, you will not get any alert or window opened for the case (A) at all. The cases (B,C,D) are handled properly. 

Expected behavior
-----------------
MSIE, Firefox or even Safari for Mac 3.1 behaves correctly,
in all cases (A,B,C,C) new window and popup gets displayed.

Note:  Even the scenario may look strange for you - we use the 
window.onuload to perform reasonable actions (to notify backend servers 
about to close backend sessions when the user left the browser), so it 
is not about just annoying popups/windows, but have strong real and valid 
usecase. I put the severity to Critical as it is almost a blocker for our apps.

Can be related to:
* http://bugs.webkit.org/show_bug.cgi?id=12469</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76494</commentid>
    <comment_count>1</comment_count>
      <attachid>20380</attachid>
    <who name="ptr">petr.zdrahal</who>
    <bug_when>2008-04-07 06:38:00 -0700</bug_when>
    <thetext>Created attachment 20380
Testcase for window.onunload bug

Refresh, reload or close browser window and observe whether the browser is performing onunload actions or not. You should see a new new window and alert displayed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76496</commentid>
    <comment_count>2</comment_count>
    <who name="ptr">petr.zdrahal</who>
    <bug_when>2008-04-07 06:57:46 -0700</bug_when>
    <thetext>As the testcase opens new window, make sure you disabled popup blocker before you start testing.  (or comment out the &quot;window.open&quot; line completly, stay only with window.alert).  </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76503</commentid>
    <comment_count>3</comment_count>
    <who name="">mitz</who>
    <bug_when>2008-04-07 08:16:17 -0700</bug_when>
    <thetext>&lt;rdar://problem/5846165&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82062</commentid>
    <comment_count>4</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2008-06-01 08:51:10 -0700</bug_when>
    <thetext>See Bug 12469.

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85572</commentid>
    <comment_count>5</comment_count>
    <who name="Adele Peterson">adele</who>
    <bug_when>2008-07-09 14:32:14 -0700</bug_when>
    <thetext>Seems to be fixed in TOT.  Please let us know if it still doesn&apos;t work for you.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>20380</attachid>
            <date>2008-04-07 06:38:00 -0700</date>
            <delta_ts>2008-04-07 06:38:00 -0700</delta_ts>
            <desc>Testcase for window.onunload bug</desc>
            <filename>startme.html</filename>
            <type>text/html</type>
            <size>454</size>
            <attacher name="ptr">petr.zdrahal</attacher>
            
              <data encoding="base64">PGh0bWw+DQo8aGVhZD4NCjx0aXRsZT51bmxvYWQgdGVzdDwvdGl0bGU+DQo8c2NyaXB0Pg0KZnVu
Y3Rpb24gZG9VbmxvYWQoKXsNCiAgIHdpbmRvdy5vcGVuKCAiaHR0cDovL2VuLndpa2lwZWRpYS5v
cmcvd2lraS9XZWJLaXQiICk7DQogICB3aW5kb3cuYWxlcnQoIm9udW5sb2FkIHBlcmZvcm1lZCIp
Ow0KfQ0KPC9zY3JpcHQ+DQo8L2hlYWQ+DQoNCjxib2R5IGJnY29sb3I9IiNGRkVFREQiIG9udW5s
b2FkPSJkb1VubG9hZCgpOyI+DQo8SDI+b251bmxvYWQgdGVzdDwvSDI+DQpSZWZyZXNoLCByZWxv
YWQgb3IgY2xvc2UgYnJvd3NlciB3aW5kb3cgYW5kIG9ic2VydmUgd2hldGhlciB0aGUgYnJvd3Nl
ciBpcyBwZXJmb3JtaW5nIG9udW5sb2FkIGFjdGlvbnMgb3Igbm90LiAgWW91IHNob3VsZCBzZWUg
YSBuZXcgbmV3IHdpbmRvdyBhbmQgYWxlcnQgZGlzcGxheWVkLg0KPC9ib2R5Pg0KPC9odG1sPg==
</data>

          </attachment>
      

    </bug>

</bugzilla>