<?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>21699</bug_id>
          
          <creation_ts>2008-10-16 18:10:21 -0700</creation_ts>
          <short_desc>onbeforeunload/onunload should fire on frames/iframes</short_desc>
          <delta_ts>2009-07-16 02:40:08 -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>WebCore JavaScript</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>DUPLICATE</resolution>
          <dup_id>19418</dup_id>
          
          <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="Ojan Vafai">ojan</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>bedney</cc>
    
    <cc>dpopa</cc>
    
    <cc>oliver</cc>
    
    <cc>ted</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>95679</commentid>
    <comment_count>0</comment_count>
    <who name="Ojan Vafai">ojan</who>
    <bug_when>2008-10-16 18:10:21 -0700</bug_when>
    <thetext>Testcase coming.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95682</commentid>
    <comment_count>1</comment_count>
      <attachid>24449</attachid>
    <who name="Ojan Vafai">ojan</who>
    <bug_when>2008-10-16 18:33:11 -0700</bug_when>
    <thetext>Created attachment 24449
reduced testcase

page with an iframe that has an onbeforeunload handler. attempting to leave the page should popup the beforeunload dialog.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98047</commentid>
    <comment_count>2</comment_count>
    <who name="Ted Rust">ted</who>
    <bug_when>2008-11-08 17:14:51 -0800</bug_when>
    <thetext>This looks like a duplicate of bug #19418.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98275</commentid>
    <comment_count>3</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2008-11-11 02:44:41 -0800</bug_when>
    <thetext>See also: bug 15652.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98857</commentid>
    <comment_count>4</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2008-11-15 02:22:37 -0800</bug_when>
    <thetext>Confirmed with r38387.

In bug #19418, the handler is installed on the body of iframe document, while here, it is installed on Window object. So, these bugs are not exact duplicates, keeping them separate for now.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98858</commentid>
    <comment_count>5</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2008-11-15 02:29:51 -0800</bug_when>
    <thetext>Note however that fixing this may give a way to ads in iframes to be even more nasty than they are now, and open windows when navigating away from a page with an ad. They could be other undesirable consequences, as well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>119278</commentid>
    <comment_count>6</comment_count>
    <who name="Dan POPA">dpopa</who>
    <bug_when>2009-04-29 02:48:59 -0700</bug_when>
    <thetext>(In reply to comment #5)
&gt; Note however that fixing this may give a way to ads in iframes to be even more
&gt; nasty than they are now, and open windows when navigating away from a page with
&gt; an ad. They could be other undesirable consequences, as well.
&gt; 

From your argument I can see you are against people having guns, because, you say, some will start shooting other people.

The beforeunload event could be abused in the same way as the unload event.

People already have methods of killing other people.

If the beforeunload event does not trigger for iframes, developers have no way of stopping a navigation inside an IFRAME so the user will not have a chance to save their work.

I&apos;m not saying having guns is a good thing, I&apos;m just saying that the beforeunload is really useful.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>126316</commentid>
    <comment_count>7</comment_count>
    <who name="Maciej Stachowiak">mjs</who>
    <bug_when>2009-06-16 14:58:42 -0700</bug_when>
    <thetext>I&apos;m told (though I haven&apos;t tested) that IE and Firefox allow this. The HTML5 spec also describes beforeunload in some detail.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>126318</commentid>
    <comment_count>8</comment_count>
    <who name="William J. Edney">bedney</who>
    <bug_when>2009-06-16 15:10:13 -0700</bug_when>
    <thetext>Maciej -

Yes, I know for a fact that IE and FF allow this, because I use it all day, every day.

For Webkit-based browsers, I had to play major workaround games to get this to work.

Cheers,

- Bill</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>132210</commentid>
    <comment_count>9</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2009-07-16 02:40:08 -0700</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 19418 ***</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>24449</attachid>
            <date>2008-10-16 18:33:11 -0700</date>
            <delta_ts>2008-10-16 18:33:11 -0700</delta_ts>
            <desc>reduced testcase</desc>
            <filename>iframe.html</filename>
            <type>text/html</type>
            <size>315</size>
            <attacher name="Ojan Vafai">ojan</attacher>
            
              <data encoding="base64">PElGUkFNRSBvbmxvYWQ9InJlZ2lzdGVyVW5sb2FkSGFuZGxlcigpIj48L0lGUkFNRT4KVGhpcyBw
YWdlIGRvZXMgbm90IGhhdmUgYW4gb25iZWZvcmV1bmxvYWQgaGFuZGxlci4KPHNjcmlwdD4KZnVu
Y3Rpb24gcmVnaXN0ZXJVbmxvYWRIYW5kbGVyKCkgewogIHZhciBpZnIgPSBkb2N1bWVudC5nZXRF
bGVtZW50c0J5VGFnTmFtZSgnaWZyYW1lJylbMF07CiAgaWZyLmNvbnRlbnRXaW5kb3cub25iZWZv
cmV1bmxvYWQgPSBmdW5jdGlvbigpIHsKICAgIHJldHVybiAnWW91IHNob3VsZCBiZSBzZWVpbmcg
YSBjaGVjayBub3cuJzsKICB9Cn0KPC9zY3JpcHQ+
</data>

          </attachment>
      

    </bug>

</bugzilla>