Title: [105347] branches/chromium/912
Revision
105347
Author
infe...@chromium.org
Date
2012-01-18 16:31:01 -0800 (Wed, 18 Jan 2012)

Log Message

Merge 104317 - Crash with range selection across different documents.
BUG=106484
Review URL: https://chromiumcodereview.appspot.com/9250025

Modified Paths

Added Paths

Diff

Copied: branches/chromium/912/LayoutTests/fast/dom/Range/range-selection-across-documents-crash-expected.txt (from rev 104317, trunk/LayoutTests/fast/dom/Range/range-selection-across-documents-crash-expected.txt) (0 => 105347)


--- branches/chromium/912/LayoutTests/fast/dom/Range/range-selection-across-documents-crash-expected.txt	                        (rev 0)
+++ branches/chromium/912/LayoutTests/fast/dom/Range/range-selection-across-documents-crash-expected.txt	2012-01-19 00:31:01 UTC (rev 105347)
@@ -0,0 +1 @@
+Test passes if it does not crash. 

Copied: branches/chromium/912/LayoutTests/fast/dom/Range/range-selection-across-documents-crash.html (from rev 104317, trunk/LayoutTests/fast/dom/Range/range-selection-across-documents-crash.html) (0 => 105347)


--- branches/chromium/912/LayoutTests/fast/dom/Range/range-selection-across-documents-crash.html	                        (rev 0)
+++ branches/chromium/912/LayoutTests/fast/dom/Range/range-selection-across-documents-crash.html	2012-01-19 00:31:01 UTC (rev 105347)
@@ -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: branches/chromium/912/Source/WebCore/page/DOMSelection.cpp (105346 => 105347)


--- branches/chromium/912/Source/WebCore/page/DOMSelection.cpp	2012-01-19 00:30:07 UTC (rev 105346)
+++ branches/chromium/912/Source/WebCore/page/DOMSelection.cpp	2012-01-19 00:31:01 UTC (rev 105347)
@@ -421,7 +421,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
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to