<?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>116073</bug_id>
          
          <creation_ts>2013-05-13 16:30:38 -0700</creation_ts>
          <short_desc>Fix wrong assertions in Range::textNodeSplit</short_desc>
          <delta_ts>2024-01-19 05:56:33 -0800</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>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>116509</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>BlinkMergeCandidate</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ryosuke Niwa">rniwa</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>ap</cc>
    
    <cc>bfulgham</cc>
    
    <cc>rniwa</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>888572</commentid>
    <comment_count>0</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2013-05-13 16:30:38 -0700</bug_when>
    <thetext>We should probably merge
https://chromium.googlesource.com/chromium/blink/+/107e79cd424ad62249584a91fc55bded5bcd89ab

Fix wrong assertions in Range::textNodeSplit

Text::splitText calls Node::insertBefore, in which a DOM mutatino event handler
can update the DOM structure. The function calls Document::textNodeSplit too,
and Range::textNodeSplit called by Document::textNodeSplit assumed no one
updated the DOM structure.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1891485</commentid>
    <comment_count>1</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2022-08-15 16:08:59 -0700</bug_when>
    <thetext>I took the test case from Chromium patch and changed it into JSFiddle:

Link - https://jsfiddle.net/foea2v5g/show

*** Safari Technology Preview 151 ***

No assertion failures even if an DOM mutation event handler updates the new node created by Text::splitText.

On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.


FAIL r.endContainer should be [object Text]. Was [object HTMLDivElement].
FAIL r.endOffset should be 2. Was 1.
PASS successfullyParsed is true

TEST COMPLETE

*** Firefox Nightly 105 ***

No assertion failures even if an DOM mutation event handler updates the new node created by Text::splitText.

On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
FAIL r.endContainer should be [object Text]. Was [object HTMLDivElement].
FAIL r.endOffset should be 2. Was 1.
PASS successfullyParsed is true

TEST COMPLETE

*** Chrome Canary 106 ***

No assertion failures even if an DOM mutation event handler updates the new node created by Text::splitText.

On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.


FAIL r.endContainer should be [object Text]. Was [object HTMLDivElement].
FAIL r.endOffset should be 2. Was 1.
PASS successfullyParsed is true

TEST COMPLETE

_________

I can find &quot;nextSibling&quot;, which Chrome patch removed in Webkit Github source bit differently:

https://github.com/WebKit/WebKit/blob/main/Source/WebCore/dom/Range.cpp#L997

https://github.com/WebKit/WebKit/blob/main/Source/WebCore/dom/Range.cpp#L979

rniwa@webkit.org - Is this need anymore? Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1891535</commentid>
    <comment_count>2</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2022-08-15 18:50:23 -0700</bug_when>
    <thetext>These assertions failures would only be reproducible in a debug build. Guessing that this isn&apos;t relevant any more, but Ryosuke will know for certain.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1920284</commentid>
    <comment_count>3</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2022-12-17 14:04:31 -0800</bug_when>
    <thetext>It seems this was reverted in following commit in favor of other solution:

https://src.chromium.org/viewvc/blink?view=revision&amp;revision=150483

and other alternative solution:

https://src.chromium.org/viewvc/blink?view=revision&amp;revision=150493

^ I can do PR based on both, which is suggested approach? @rniwa - Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2006114</commentid>
    <comment_count>4</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2024-01-19 05:56:33 -0800</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 116509 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>