<?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>76114</bug_id>
          
          <creation_ts>2012-01-11 16:10:33 -0800</creation_ts>
          <short_desc>REGRESSION (r96257): Selection should be removed when a document is unloaded</short_desc>
          <delta_ts>2021-09-11 10:58:32 -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>HTML Editing</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="Ojan Vafai">ojan</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>ayg</cc>
    
    <cc>enrica</cc>
    
    <cc>mehmetgelisin</cc>
    
    <cc>morrita</cc>
    
    <cc>rniwa</cc>
    
    <cc>shinyak</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>534369</commentid>
    <comment_count>0</comment_count>
    <who name="Ojan Vafai">ojan</who>
    <bug_when>2012-01-11 16:10:33 -0800</bug_when>
    <thetext>Test case: http://dvcs.w3.org/hg/editing/raw-file/6aaa4b8455c9/selecttest/unload.html
Mozilla bug: https://bugzilla.mozilla.org/show_bug.cgi?id=717339

The editing spec was just changed to require this. Neither Mozilla nor WebKit do this currently, but IE/Opera do and I think it makes sense.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>534436</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2012-01-11 17:18:20 -0800</bug_when>
    <thetext>Safari 5.1 says Pass. When did this regress?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>534861</commentid>
    <comment_count>2</comment_count>
    <who name="Aryeh Gregor">ayg</who>
    <bug_when>2012-01-12 08:26:24 -0800</bug_when>
    <thetext>After discussion with Boris Zbarsky and Ian Hickson: actually, the Selection object is supposed to be replaced with a new one.  This is specified in HTML as part of the document.open() algorithm:

&quot;&quot;&quot;
Replace the Document&apos;s singleton objects with new instances of those objects. (This includes in particular the Window, Location, History, ApplicationCache, and Navigator, objects, the various BarProp objects, the two Storage objects, the various HTMLCollection objects, and objects defined by other specifications, like Selection and the document&apos;s UndoManager. It also includes all the Web IDL prototypes in the JavaScript binding, including the Document object&apos;s prototype.)
&quot;&quot;
http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#dom-document-open

New test: http://dvcs.w3.org/hg/editing/raw-file/56c83bbaa44c/selecttest/Document-open.html

The new test shows that Gecko does replace the selection with a new object, but that object has the same ranges as the old one.  WebKit (Chrome 17 dev) is the same object as before.  Opera clears the ranges but I can&apos;t tell if it&apos;s the same object, because getSelection() != getSelection() in Opera.  IE returns a different object and clears the ranges, so it&apos;s the only one that passes the new test.

This is specific to document.open(), not a general unloading thing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>534908</commentid>
    <comment_count>3</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2012-01-12 09:31:19 -0800</bug_when>
    <thetext>Regressed in &lt;http://trac.webkit.org/changeset/96257&gt;.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>