<?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>62310</bug_id>
          
          <creation_ts>2011-06-08 12:53:42 -0700</creation_ts>
          <short_desc>www.uniteful.com/39 closes itself when opened from a link on Twitter</short_desc>
          <delta_ts>2011-06-08 15:37:55 -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>Page Loading</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></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="Doug Luce">doug</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>abarth</cc>
    
    <cc>ap</cc>
    
    <cc>dbates</cc>
    
    <cc>eric</cc>
    
    <cc>inferno</cc>
    
    <cc>rniwa</cc>
    
    <cc>tonyg</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>417430</commentid>
    <comment_count>0</comment_count>
    <who name="Doug Luce">doug</who>
    <bug_when>2011-06-08 12:53:42 -0700</bug_when>
    <thetext>This is supposedly: Google Chrome 11.0.696.77 (Official Build 87952) WebKit 534.24</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>417435</commentid>
    <comment_count>1</comment_count>
    <who name="Doug Luce">doug</who>
    <bug_when>2011-06-08 12:57:27 -0700</bug_when>
    <thetext>Clicks on a link on a tweet via twitter&apos;s page cause the referred-to page to come up in a new tab, then immediately close.

I can tweet out http://www.uniteful.com/35 and the link will appear in my stream.  Upon clicking, the link comes up very quickly in a new tab. Then, that same tab closes after less than 100ms or so.                            

This behavior happens in Chrome on both OSX and Windows, and also Safari.  It doesn&apos;t happen in Firefox, IE7 (Win), or Opera (10.6 for Win, 11.11 for OSX).
                                          
If I turn off Javascript in Safari, the behavior stops.  But I can&apos;t seem to track down what bit of JS might be responsible for this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>417490</commentid>
    <comment_count>2</comment_count>
    <who name="Daniel Bates">dbates</who>
    <bug_when>2011-06-08 14:03:04 -0700</bug_when>
    <thetext>From briefly debugging the issue, window.close() is being called in the .ready() handler (http://api.jquery.com/ready/) in &lt;http://www.uniteful.com/javascripts/application.js&gt; when the script detects that the window was opened from another window.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>417506</commentid>
    <comment_count>3</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2011-06-08 14:13:05 -0700</bug_when>
    <thetext>Some investigation on Firebug tells me that Firefox&apos;s origin policy prohibits reload:

Permission denied to access property &apos;reload&apos;
[Break On This Error] window.opener.location.reload(true); 

So maybe that&apos;s what we need to do.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>417515</commentid>
    <comment_count>4</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2011-06-08 14:16:42 -0700</bug_when>
    <thetext>Interesting.  Yeah, I don&apos;t think we have security checks on reload.  Maybe we should.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>417523</commentid>
    <comment_count>5</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2011-06-08 14:19:21 -0700</bug_when>
    <thetext>(In reply to comment #4)
&gt; Interesting.  Yeah, I don&apos;t think we have security checks on reload.  Maybe we should.

I think we should.  You can trigger a replay attack if websites aren&apos;t careful about URL they open.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>417538</commentid>
    <comment_count>6</comment_count>
    <who name="Doug Luce">doug</who>
    <bug_when>2011-06-08 14:28:44 -0700</bug_when>
    <thetext>Fine catch from dbates on the misplaced popup-closing code in the ready function.  I&apos;ve taken that out of the www.uniteful.com code, but here&apos;s the original offending bit for reference:

&lt;script src=&quot;/javascripts/jquery-1.4.2.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt; 

(function($){
    $(document).ready(function(){

    // ...

    if(window.opener) {
        window.opener.location.reload(true);
        window.close()
    }

  });
})(jQuery);</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>417552</commentid>
    <comment_count>7</comment_count>
    <who name="Abhishek Arya">inferno</who>
    <bug_when>2011-06-08 14:41:54 -0700</bug_when>
    <thetext>Adam, do you think it is a security bug ?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>417562</commentid>
    <comment_count>8</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2011-06-08 14:47:25 -0700</bug_when>
    <thetext>&gt; Adam, do you think it is a security bug ?

Nope.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>417579</commentid>
    <comment_count>9</comment_count>
    <who name="Doug Luce">doug</who>
    <bug_when>2011-06-08 15:05:51 -0700</bug_when>
    <thetext>I&apos;ve put the original broken page back up for ease-of-repro along with a link to a version without that document.close in the document.ready handler:

  http://webkit.con.com/linking.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>417595</commentid>
    <comment_count>10</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2011-06-08 15:24:05 -0700</bug_when>
    <thetext>I tried to create a http test but I don&apos;t know how I can emulate opening a link by a mouse click.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>417611</commentid>
    <comment_count>11</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2011-06-08 15:35:13 -0700</bug_when>
    <thetext>&gt;        window.opener.location.reload(true);
&gt;        window.close()

Even though Firefox bails out with an assertion on reload() in this particular example, wouldn&apos;t it have prevented close(), if reached? I think that Firefox rarely allows programmatic close().

&gt; I tried to create a http test but I don&apos;t know how I can emulate opening a link by a mouse click.

You can use EventSender if it&apos;s important to simulate mouse click.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>417615</commentid>
    <comment_count>12</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2011-06-08 15:37:55 -0700</bug_when>
    <thetext>(In reply to comment #11)
&gt; &gt; I tried to create a http test but I don&apos;t know how I can emulate opening a link by a mouse click.
&gt; 
&gt; You can use EventSender if it&apos;s important to simulate mouse click.

I tried but the target was never loaded.  I don&apos;t know what I did wrong :(</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>