diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /editor/libeditor/tests/test_composition_with_highlight_in_texteditor.html | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | editor/libeditor/tests/test_composition_with_highlight_in_texteditor.html | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/editor/libeditor/tests/test_composition_with_highlight_in_texteditor.html b/editor/libeditor/tests/test_composition_with_highlight_in_texteditor.html new file mode 100644 index 0000000000..d6bb703231 --- /dev/null +++ b/editor/libeditor/tests/test_composition_with_highlight_in_texteditor.html @@ -0,0 +1,62 @@ +<!doctype html> +<html> +<head> +<meta charset="utf-8"> +<title>Test crash bug 1785311</title> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script src="/tests/SimpleTest/EventUtils.js"></script> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> +</head> +<body> +<input value="abc"> +<script> +"use strict"; + +SimpleTest.waitForExplicitFinish(); +SimpleTest.waitForFocus(() => { + const input = document.querySelector("input"); + input.focus(); + const editor = SpecialPowers.wrap(input).editor; + const selectionController = editor.selectionController; + const findSelection = selectionController.getSelection( + SpecialPowers.Ci.nsISelectionController.SELECTION_FIND + ); + const editActionListener = { + QueryInterface: SpecialPowers.ChromeUtils.generateQI(["nsIEditActionListener"]), + WillDeleteText: (textNode, offset, length) => {}, + DidInsertText: (textNode, offset, aString) => {}, + WillDeleteRanges: (rangesToDelete) => {}, + }; + // Highlight "a" + findSelection.setBaseAndExtent( + editor.rootElement.firstChild, 0, + editor.rootElement.firstChild, 1 + ); + try { + editor.addEditActionListener(editActionListener); + // Start composition at end of <input> + editor.selection.collapse(editor.rootElement.firstChild, "abc".length); + synthesizeCompositionChange({ + composition: { + string: "d", + clauses: [ + { length: 1, attr: COMPOSITION_ATTR_RAW_CLAUSE }, + ], + }, + caret: { + start: 1, + length: 0, + }, + }); + synthesizeComposition({ + type: "compositioncommitasis", + }); + ok(true, "Should not crash"); + } finally { + editor.removeEditActionListener(editActionListener); + SimpleTest.finish(); + } +}); +</script> +</body> +</html> |