Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-pick 259548.273@safari-7615-branch (0501c9f). https://bugs.web…
…kit.org/show_bug.cgi?id=252785 Assertion failure in ContainerNode::removeAllChildrenWithScriptAssertion https://bugs.webkit.org/show_bug.cgi?id=252785 rdar://105643144 Reviewed by Chris Dumez and Geoffrey Garen. The bug was caused by Editor::changeSelectionAfterCommand setting selection pointing to a wrong document. Fixed the bug by detecting this case and exiting early. * LayoutTests/editing/selection/redo-selection-restore-different-document-crash-expected.txt: Added. * LayoutTests/editing/selection/redo-selection-restore-different-document-crash.html: Added. * Source/WebCore/editing/Editor.cpp: (WebCore::Editor::changeSelectionAfterCommand): * Source/WebCore/editing/VisibleSelection.cpp: (WebCore::VisibleSelection::document const): Now returns the document of m_anchor when base is null but anchor isn't. Canonical link: https://commits.webkit.org/259548.273@safari-7615-branch
- Loading branch information
Showing
4 changed files
with
43 additions
and
7 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
LayoutTests/editing/selection/redo-selection-restore-different-document-crash-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
PASS |
30 changes: 30 additions & 0 deletions
30
LayoutTests/editing/selection/redo-selection-restore-different-document-crash.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<script> | ||
if (window.testRunner) | ||
testRunner.dumpAsText(); | ||
function main() { | ||
var input1 = document.getElementById("input1"); | ||
input1.selectionDirection = "backward"; | ||
document.execCommand("insertText", false, "AA"); | ||
x1.show(); | ||
input1.defaultValue = ""; // 4 | ||
input2.setRangeText("A"); // 5 | ||
document.body.textContent = 'PASS'; | ||
} | ||
|
||
function f1() { | ||
document.execCommand("undo",false,null); // 0, insertText "AA" | ||
document.execCommand("redo",false,null); // 3 | ||
} | ||
|
||
function f2() { | ||
parser = new DOMParser(); | ||
doc = parser.parseFromString("A", "text/html"); | ||
input1.defaultValue = "A"; // 1 | ||
doc.body.appendChild(input1); // 2 | ||
} | ||
</script> | ||
<body onload="main()"> | ||
<dialog id="x1" onfocusin="f1()" onfocusout="f2()" tabindex="-1"> | ||
</dialog> | ||
<input id="input1" style="display: contents"> | ||
<input id="input2" value="A"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters