Title: [104317] trunk
Revision
104317
Author
[email protected]
Date
2012-01-06 12:15:59 -0800 (Fri, 06 Jan 2012)

Log Message

Crash with range selection across different documents.
https://bugs.webkit.org/show_bug.cgi?id=74285

Reviewed by Ryosuke Niwa.

Source/WebCore: 

Test: fast/dom/Range/range-selection-across-documents-crash.html

* page/DOMSelection.cpp:
(WebCore::DOMSelection::addRange):

LayoutTests: 

* fast/dom/Range/range-selection-across-documents-crash-expected.txt: Added.
* fast/dom/Range/range-selection-across-documents-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (104316 => 104317)


--- trunk/LayoutTests/ChangeLog	2012-01-06 20:12:50 UTC (rev 104316)
+++ trunk/LayoutTests/ChangeLog	2012-01-06 20:15:59 UTC (rev 104317)
@@ -1,3 +1,13 @@
+2012-01-06  Abhishek Arya  <[email protected]>
+
+        Crash with range selection across different documents.
+        https://bugs.webkit.org/show_bug.cgi?id=74285
+
+        Reviewed by Ryosuke Niwa.
+
+        * fast/dom/Range/range-selection-across-documents-crash-expected.txt: Added.
+        * fast/dom/Range/range-selection-across-documents-crash.html: Added.
+
 2012-01-06  Dmitry Lomov  <[email protected]>
 
         Unreviewed; fixing expectation error. 

Added: trunk/LayoutTests/fast/dom/Range/range-selection-across-documents-crash-expected.txt (0 => 104317)


--- trunk/LayoutTests/fast/dom/Range/range-selection-across-documents-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/Range/range-selection-across-documents-crash-expected.txt	2012-01-06 20:15:59 UTC (rev 104317)
@@ -0,0 +1 @@
+Test passes if it does not crash. 

Added: trunk/LayoutTests/fast/dom/Range/range-selection-across-documents-crash.html (0 => 104317)


--- trunk/LayoutTests/fast/dom/Range/range-selection-across-documents-crash.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/Range/range-selection-across-documents-crash.html	2012-01-06 20:15:59 UTC (rev 104317)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+function runTest()
+{
+    var iframeElement = document.getElementById('iframe1');
+    var iframeDocument = iframeElement.contentDocument;
+    var iframeDocumentRoot = iframeDocument.documentElement;
+
+    var selection = window.getSelection();
+    var range = document.createRange();
+    selection.addRange(range);
+    range.selectNode(iframeDocumentRoot);
+    selection.addRange(range);
+    iframeDocument.removeChild(iframeDocumentRoot);
+}
+</script>
+</head>
+<body>
+Test passes if it does not crash.
+<iframe id="iframe1" _onload_="runTest()"></iframe>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (104316 => 104317)


--- trunk/Source/WebCore/ChangeLog	2012-01-06 20:12:50 UTC (rev 104316)
+++ trunk/Source/WebCore/ChangeLog	2012-01-06 20:15:59 UTC (rev 104317)
@@ -1,3 +1,15 @@
+2012-01-06  Abhishek Arya  <[email protected]>
+
+        Crash with range selection across different documents.
+        https://bugs.webkit.org/show_bug.cgi?id=74285
+
+        Reviewed by Ryosuke Niwa.
+
+        Test: fast/dom/Range/range-selection-across-documents-crash.html
+
+        * page/DOMSelection.cpp:
+        (WebCore::DOMSelection::addRange):
+
 2012-01-06  Sam Weinig  <[email protected]>
 
         Remove unused OwnFastMallocPtr class.

Modified: trunk/Source/WebCore/page/DOMSelection.cpp (104316 => 104317)


--- trunk/Source/WebCore/page/DOMSelection.cpp	2012-01-06 20:12:50 UTC (rev 104316)
+++ trunk/Source/WebCore/page/DOMSelection.cpp	2012-01-06 20:15:59 UTC (rev 104317)
@@ -419,7 +419,7 @@
         }
     } else {
         // We don't support discontiguous selection. We don't do anything if r and range don't intersect.
-        if (r->compareBoundaryPoints(Range::END_TO_START, range.get(), ec) < 1) {
+        if (r->compareBoundaryPoints(Range::END_TO_START, range.get(), ec) < 1 && !ec) {
             if (r->compareBoundaryPoints(Range::END_TO_END, range.get(), ec) == -1)
                 // The original range contains r.
                 selection->setSelection(VisibleSelection(range.get()));
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to