<?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>28206</bug_id>
          
          <creation_ts>2009-08-11 18:18:51 -0700</creation_ts>
          <short_desc>onbeforeunload not called at window close + frame or iframe focused</short_desc>
          <delta_ts>2009-08-11 22:16:09 -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>New Bugs</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows XP</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>27481</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>HasReduction</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="jasneet">jasneet</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>jasneet</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>139195</commentid>
    <comment_count>0</comment_count>
      <attachid>34628</attachid>
    <who name="jasneet">jasneet</who>
    <bug_when>2009-08-11 18:18:51 -0700</bug_when>
    <thetext>Created attachment 34628
testcase

I Steps:
1. open a page with a frameset or an iframe (attached files)
2. focus the frame
3. close the window

II Issue:
onbeforeunload is not executed.

Related Webkit bugs https://bugs.webkit.org/show_bug.cgi?id=19418 as well as https://bugs.webkit.org/show_bug.cgi?id=21669 are about an onbeforeunload handler when it is assigned to the frame content or the iframe itself.

This bug is about onbeforeonload assigned to a window which contain an iframe or a frameset. The handler is properly called if we back the document or if we load the document and immediately close the window. Yet if the contained frame or iframe is focused (using JS as in the attached reduction) when the window is closed then, the window beforeonload handler is not called.

III Browsers info:
Chrome 3.x : NOT OK
Safari 3/Win: NOT OK
    Safari 3/Mac: OK
    Safari 4/Mac: OK
  Firefox 3.x: OK
         IE 8: OK

Bug in Chromium : http://code.google.com/p/chromium/issues/detail?id=17157</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>139196</commentid>
    <comment_count>1</comment_count>
      <attachid>34629</attachid>
    <who name="jasneet">jasneet</who>
    <bug_when>2009-08-11 18:19:21 -0700</bug_when>
    <thetext>Created attachment 34629
testcase</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>139232</commentid>
    <comment_count>2</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-08-11 22:16:09 -0700</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 27481 ***</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>34628</attachid>
            <date>2009-08-11 18:18:51 -0700</date>
            <delta_ts>2009-08-11 18:18:51 -0700</delta_ts>
            <desc>testcase</desc>
            <filename>chrome-win-onbeforeunload-frame.html</filename>
            <type>text/html</type>
            <size>441</size>
            <attacher name="jasneet">jasneet</attacher>
            
              <data encoding="base64">PGh0bWw+CjxoZWFkPgo8dGl0bGU+QlVHOiBjaHJvbWU6IG9uYmVmb3JldW5sb2FkIG5vdCBjYWxs
ZWQgYXQgY2xvc2U8L3RpdGxlPgo8c2NyaXB0IHR5cGU9InRleHQvamF2YXNjcmlwdCI+Ci8vQlVH
OiBDaHJvbWU6IHdoZW4gYSBmcmFtZSBpcyBmb2N1c2VkLCBjbG9zaW5nIHRoZSB3aW5kb3cgd2ls
bCBub3QgY2FsbCBvbmJlZm9yZXVubG9hZC4Kd2luZG93Lm9uYmVmb3JldW5sb2FkID0gdHN0CmZ1
bmN0aW9uIHRzdChldmVudCkgewoJZXZlbnQgPSBldmVudCA/IGV2ZW50IDogd2luZG93LmV2ZW50
CglyZXR1cm4gIkFBQSIKCX0KZnVuY3Rpb24gZG9mb2N1cygpIHsKCWZyYW1lc1swXS5mb2N1cygp
Cgl9Cjwvc2NyaXB0Pgo8L2hlYWQ+CjxmcmFtZXNldCBvbmxvYWQ9ImRvZm9jdXMoKSI+Cgk8ZnJh
bWUgc3JjPSJhYm91dDpibGFuayI+CjwvZnJhbWVzZXQ+CjwvaHRtbD4K
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>34629</attachid>
            <date>2009-08-11 18:19:21 -0700</date>
            <delta_ts>2009-08-11 18:19:21 -0700</delta_ts>
            <desc>testcase</desc>
            <filename>chrome-win-onbeforeunload-iframe.html</filename>
            <type>text/html</type>
            <size>405</size>
            <attacher name="jasneet">jasneet</attacher>
            
              <data encoding="base64">PGh0bWw+CjxoZWFkPgo8dGl0bGU+QlVHOiBjaHJvbWU6IG9uYmVmb3JldW5sb2FkIG5vdCBjYWxs
ZWQgYXQgY2xvc2U8L3RpdGxlPgo8c2NyaXB0IHR5cGU9InRleHQvamF2YXNjcmlwdCI+CndpbmRv
dy5vbmJlZm9yZXVubG9hZCA9IHRzdApmdW5jdGlvbiB0c3QoZXZlbnQpIHsKCXJldHVybiAiQUFB
IgoJfQpmdW5jdGlvbiBkb2ZvY3VzKCkgewoJZnJhbWVzWzBdLmZvY3VzKCkKCX0KPC9zY3JpcHQ+
CjwvaGVhZD4KPGJvZHkgb25sb2FkPSJkb2ZvY3VzKCkiPgpCVUc6IENocm9tZTogd2hlbiBhbiBp
ZnJhbWUgaXMgZm9jdXNlZCwgY2xvc2luZyB0aGUgd2luZG93IHdpbGwgbm90IGNhbGwgb25iZWZv
cmV1bmxvYWQuCgk8aWZyYW1lIHNyYz0iYWJvdXQ6YmxhbmsiPjwvaWZyYW1lPgo8L2JvZHk+Cjwv
aHRtbD4K
</data>

          </attachment>
      

    </bug>

</bugzilla>