RESOLVED FIXED 93009
Range::isPointInRange incorrectly throws WRONG_DOCUMENT_ERR
https://bugs.webkit.org/show_bug.cgi?id=93009
Summary Range::isPointInRange incorrectly throws WRONG_DOCUMENT_ERR
Emil A Eklund
Reported 2012-08-02 10:47:47 PDT
The latest working draft of the DOM4 spec has all but killed the WRONG_DOCUMENT_ERR exception. Range::compareBoundaryPoints and Range::comparePoint are the only two remaining uses for it. As such, update isPointInRange to return false instead of throwing an exception when the range and point are in different documents. This matches the Mozilla behavior.
Attachments
Patch (4.97 KB, patch)
2012-08-02 10:49 PDT, Emil A Eklund
no flags
Patch for landing (4.70 KB, patch)
2012-08-02 12:54 PDT, Emil A Eklund
no flags
Archive of layout-test-results from gce-cq-02 (325.41 KB, application/zip)
2012-08-02 14:09 PDT, WebKit Review Bot
no flags
Emil A Eklund
Comment 1 2012-08-02 10:49:37 PDT
Ojan Vafai
Comment 2 2012-08-02 10:54:57 PDT
Comment on attachment 156122 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=156122&action=review > LayoutTests/fast/html/range-point-in-range-for-different-documents.html:31 > + if (range.isPointInRange(testNode, 1)) > + testFailed('isPointInRange returned true.'); > + else > + testPassed('isPointInRange returned false.'); Nit: this could be: shouldBeFalse("range.isPointInRange(testNode, 1)")
Alexey Proskuryakov
Comment 3 2012-08-02 11:54:10 PDT
Comment on attachment 156122 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=156122&action=review > Source/WebCore/dom/Range.cpp:307 > + // The DOM4 working draft no longer has these cases throw a > + // WRONG_DOCUMENT_ERR exception. This matches the behavior of Mozilla. I don't think that this comment is helpful. A lot of our code is based on research like this, and the best way to figure out the reasons for some code is to change it, and see which tests break. Such comments are going to get obsolete - we wouldn't be happy if core code was all covered by references to IE 4.
Emil A Eklund
Comment 4 2012-08-02 12:28:48 PDT
(In reply to comment #2) > Nit: this could be: > shouldBeFalse("range.isPointInRange(testNode, 1)") Good idea. (In reply to comment #3) > I don't think that this comment is helpful. A lot of our code is based on research like this, and the best way to figure out the reasons for some code is to change it, and see which tests break. > > Such comments are going to get obsolete - we wouldn't be happy if core code was all covered by references to IE 4. You have a point there, I'll remove the comment. Thank you.
Emil A Eklund
Comment 5 2012-08-02 12:54:32 PDT
Created attachment 156145 [details] Patch for landing
WebKit Review Bot
Comment 6 2012-08-02 14:09:24 PDT
Comment on attachment 156145 [details] Patch for landing Rejecting attachment 156145 [details] from commit-queue. New failing tests: fast/dom/move-nodes-across-documents.html Full output: http://queues.webkit.org/results/13430102
WebKit Review Bot
Comment 7 2012-08-02 14:09:27 PDT
Created attachment 156163 [details] Archive of layout-test-results from gce-cq-02 The attached test failures were seen while running run-webkit-tests on the commit-queue. Bot: gce-cq-02 Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'> Platform: Linux-2.6.39-gcg-201203291735-x86_64-with-Ubuntu-10.04-lucid
Emil A Eklund
Comment 8 2012-08-02 15:00:18 PDT
Note You need to log in before you can comment on or make changes to this bug.