Bug 24122 - REGRESSION: DOM Range extractContents/deleteContents bug
Summary: REGRESSION: DOM Range extractContents/deleteContents bug
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P1 Critical
Assignee: Alexey Proskuryakov
URL: http://tinymce.moxiecode.com/safari/r...
Keywords: InRadar, Regression
: 24677 24896 (view as bug list)
Depends on:
Reported: 2009-02-24 07:40 PST by Johan "Spocke" Sörlin
Modified: 2009-03-28 10:02 PDT (History)
3 users (show)

See Also:

Test case for the DOM Range implementation (22.06 KB, text/html)
2009-02-24 07:45 PST, Johan "Spocke" Sörlin
no flags Details
proposed fix (6.06 KB, patch)
2009-03-19 16:36 PDT, Alexey Proskuryakov
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Johan "Spocke" Sörlin 2009-02-24 07:40:10 PST
The current implementation of the DOM Range is not compatible with other browsers or previous versions of WebKit.

If you test the attached test case in Safari 3, FF 3, Opera 9 it will only fail on one point the cloneContents but on the latest WebKit it fails on both extractContents and deleteContents.

If you run the same tests on the latest nightly of FF and the latest build of Opera it will pass all tests so the attached test case is compatible to the spec or at least to the latest implementations by other browser vendors.
Comment 1 Johan "Spocke" Sörlin 2009-02-24 07:45:35 PST
Created attachment 27917 [details]
Test case for the DOM Range implementation

Run this test file in latest WebKit.
Comment 2 Johan "Spocke" Sörlin 2009-02-24 07:49:11 PST
Check the URL not the attached file since it requests things using https and it fails from https.
Comment 3 Alexey Proskuryakov 2009-02-25 06:53:30 PST
Confirmed that the test passes in Safari/WebKit 3.2.1 and in Minefield, but fails in r41181.
Comment 4 Alexey Proskuryakov 2009-03-12 02:40:42 PDT
Comment 5 Alexey Proskuryakov 2009-03-19 16:36:22 PDT
Created attachment 28771 [details]
proposed fix

I couldn't find any remnants of code that could make this work, so it's surprising that this is a regression. Perhaps this code was removed in hopes that Document::textRemoved() would automatically take care of fixing the range? It does not, and it is not supposed to - I've verified that a range that's equal to the one that deleteContents is invoked on ends up being different from it in Firefox:

var range1 = something
var range2 = the same
// Both ranges are fixed, but differently - range1 is always collapsed, but range2 may not be.
Comment 6 Darin Adler 2009-03-19 18:04:14 PDT
Comment on attachment 28771 [details]
proposed fix


I was probably the one who broke this. Thanks for fixing it!
Comment 7 Alexey Proskuryakov 2009-03-20 01:19:00 PDT
*** Bug 24677 has been marked as a duplicate of this bug. ***
Comment 8 Alexey Proskuryakov 2009-03-20 01:19:23 PDT
Committed <http://trac.webkit.org/changeset/41855>.
Comment 9 Julie Parent 2009-03-28 10:02:16 PDT
*** Bug 24896 has been marked as a duplicate of this bug. ***