Title: [205845] trunk
- Revision
- 205845
- Author
- n_w...@apple.com
- Date
- 2016-09-12 17:58:22 -0700 (Mon, 12 Sep 2016)
Log Message
AX: Crash at WebCore::Range::compareBoundaryPoints(WebCore::Range::CompareHow, WebCore::Range const&, int&) const + 23
https://bugs.webkit.org/show_bug.cgi?id=161878
Reviewed by Chris Fleizach.
Source/WebCore:
In function characterOffsetsInOrder(const CharacterOffset&, const CharacterOffset&), we are creating two
ranges based on the nodes that are associated to the passed in CharacterOffsets. When the first node is a doctype
node, the first range will be a nullptr, and dereferencing it leads to a crash. Fixed this by adding a
NULL check.
Test: accessibility/mac/doctype-node-in-text-marker-crash.html
* accessibility/AXObjectCache.cpp:
(WebCore::characterOffsetsInOrder):
(WebCore::resetNodeAndOffsetForReplacedNode):
LayoutTests:
* accessibility/mac/doctype-node-in-text-marker-crash-expected.txt: Added.
* accessibility/mac/doctype-node-in-text-marker-crash.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (205844 => 205845)
--- trunk/LayoutTests/ChangeLog 2016-09-13 00:29:21 UTC (rev 205844)
+++ trunk/LayoutTests/ChangeLog 2016-09-13 00:58:22 UTC (rev 205845)
@@ -1,3 +1,13 @@
+2016-09-12 Nan Wang <n_w...@apple.com>
+
+ AX: Crash at WebCore::Range::compareBoundaryPoints(WebCore::Range::CompareHow, WebCore::Range const&, int&) const + 23
+ https://bugs.webkit.org/show_bug.cgi?id=161878
+
+ Reviewed by Chris Fleizach.
+
+ * accessibility/mac/doctype-node-in-text-marker-crash-expected.txt: Added.
+ * accessibility/mac/doctype-node-in-text-marker-crash.html: Added.
+
2016-09-12 Joseph Pecoraro <pecor...@apple.com>
HTMLButtonElement.prototype.click should be HTMLElement.prototype.click
Added: trunk/LayoutTests/accessibility/mac/doctype-node-in-text-marker-crash-expected.txt (0 => 205845)
--- trunk/LayoutTests/accessibility/mac/doctype-node-in-text-marker-crash-expected.txt (rev 0)
+++ trunk/LayoutTests/accessibility/mac/doctype-node-in-text-marker-crash-expected.txt 2016-09-13 00:58:22 UTC (rev 205845)
@@ -0,0 +1,10 @@
+text
+This tests that creating a text marker range with a text marker that associated to a doctype node won't lead to crash.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/accessibility/mac/doctype-node-in-text-marker-crash.html (0 => 205845)
--- trunk/LayoutTests/accessibility/mac/doctype-node-in-text-marker-crash.html (rev 0)
+++ trunk/LayoutTests/accessibility/mac/doctype-node-in-text-marker-crash.html 2016-09-13 00:58:22 UTC (rev 205845)
@@ -0,0 +1,59 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body id="body">
+
+<div id="container" role="group" contenteditablt="true">text<iframe id="frame" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" height="100%" width="100%" style="padding: 0px; margin: 0px; border: 0px; height: 100%; width: 100%;"></iframe></div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+ description("This tests that creating a text marker range with a text marker that associated to a doctype node won't lead to crash.");
+
+ function selectElementContents(el) {
+ var range = document.createRange();
+ range.selectNodeContents(el);
+ var sel = window.getSelection();
+ sel.removeAllRanges();
+ sel.addRange(range);
+ }
+
+ if (window.accessibilityController) {
+
+ accessibilityController.enableEnhancedAccessibility(true);
+ var webArea = accessibilityController.rootElement.childAtIndex(0);
+ webArea.setBoolAttributeValue("AXCaretBrowsingEnabled", true);
+
+ // Make sure the iframe has a doctype node
+ var iframe = document.getElementById("frame");
+ var idocument = iframe.contentDocument;
+ idocument.open();
+ idocument.write("<!DOCTYPE html>");
+ idocument.write("<html>");
+ idocument.write("<head></head>");
+ idocument.write("<body></body>");
+ idocument.write("</html>");
+ idocument.close();
+
+ // Select all the contents in the container, and get the selection range.
+ var container = accessibilityController.accessibleElementById("container");
+ var containerElement = document.getElementById("container");
+ selectElementContents(containerElement);
+ var selectionRange = container.selectedTextMarkerRange();
+
+ var startMarker = container.startTextMarkerForTextMarkerRange(selectionRange);
+ var endMarker = container.endTextMarkerForTextMarkerRange(selectionRange);
+
+ // endMarker is now associated with a doctype node, make sure it won't lead to a crash.
+ var markerRange = container.textMarkerRangeForMarkers(endMarker, startMarker);
+ }
+
+</script>
+
+<script src=""
+</body>
+</html>
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (205844 => 205845)
--- trunk/Source/WebCore/ChangeLog 2016-09-13 00:29:21 UTC (rev 205844)
+++ trunk/Source/WebCore/ChangeLog 2016-09-13 00:58:22 UTC (rev 205845)
@@ -1,3 +1,21 @@
+2016-09-12 Nan Wang <n_w...@apple.com>
+
+ AX: Crash at WebCore::Range::compareBoundaryPoints(WebCore::Range::CompareHow, WebCore::Range const&, int&) const + 23
+ https://bugs.webkit.org/show_bug.cgi?id=161878
+
+ Reviewed by Chris Fleizach.
+
+ In function characterOffsetsInOrder(const CharacterOffset&, const CharacterOffset&), we are creating two
+ ranges based on the nodes that are associated to the passed in CharacterOffsets. When the first node is a doctype
+ node, the first range will be a nullptr, and dereferencing it leads to a crash. Fixed this by adding a
+ NULL check.
+
+ Test: accessibility/mac/doctype-node-in-text-marker-crash.html
+
+ * accessibility/AXObjectCache.cpp:
+ (WebCore::characterOffsetsInOrder):
+ (WebCore::resetNodeAndOffsetForReplacedNode):
+
2016-09-12 Said Abou-Hallawa <sabouhall...@apple.com>
Move the pixel data of ImageFrame to a separate class named ImageBackingStore
Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (205844 => 205845)
--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp 2016-09-13 00:29:21 UTC (rev 205844)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp 2016-09-13 00:58:22 UTC (rev 205845)
@@ -1681,7 +1681,7 @@
RefPtr<Range> range1 = AXObjectCache::rangeForNodeContents(node1);
RefPtr<Range> range2 = AXObjectCache::rangeForNodeContents(node2);
- return !range2 || range1->compareBoundaryPoints(Range::START_TO_START, *range2, IGNORE_EXCEPTION) <= 0;
+ return !range2 || (range1 && range1->compareBoundaryPoints(Range::START_TO_START, *range2, IGNORE_EXCEPTION) <= 0);
}
static Node* resetNodeAndOffsetForReplacedNode(Node* replacedNode, int& offset, int characterCount)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes