From 9e3c08db40b8916968b9f30096c7be3f00ce9647 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 21 Apr 2024 13:44:51 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- editor/AsyncSpellCheckTestHelper.sys.mjs | 125 + editor/composer/ComposerCommandsUpdater.cpp | 199 + editor/composer/ComposerCommandsUpdater.h | 132 + editor/composer/crashtests/351236-1.html | 37 + editor/composer/crashtests/407062-1.html | 20 + editor/composer/crashtests/419563-1.xhtml | 20 + editor/composer/crashtests/428844-1-inner.xhtml | 4 + editor/composer/crashtests/428844-1.html | 17 + editor/composer/crashtests/461049-1.html | 25 + editor/composer/crashtests/crashtests.list | 6 + .../crashtests/removing-editable-xslt-inner.xhtml | 4 + .../crashtests/removing-editable-xslt.html | 17 + editor/composer/moz.build | 60 + editor/composer/nsEditingSession.cpp | 1301 ++ editor/composer/nsEditingSession.h | 172 + editor/composer/nsIEditingSession.idl | 84 + editor/composer/res/EditorOverride.css | 322 + editor/composer/res/grabber.gif | Bin 0 -> 858 bytes .../composer/res/table-add-column-after-active.gif | Bin 0 -> 58 bytes .../composer/res/table-add-column-after-hover.gif | Bin 0 -> 826 bytes editor/composer/res/table-add-column-after.gif | Bin 0 -> 826 bytes .../res/table-add-column-before-active.gif | Bin 0 -> 57 bytes .../composer/res/table-add-column-before-hover.gif | Bin 0 -> 825 bytes editor/composer/res/table-add-column-before.gif | Bin 0 -> 825 bytes editor/composer/res/table-add-row-after-active.gif | Bin 0 -> 57 bytes editor/composer/res/table-add-row-after-hover.gif | Bin 0 -> 826 bytes editor/composer/res/table-add-row-after.gif | Bin 0 -> 826 bytes .../composer/res/table-add-row-before-active.gif | Bin 0 -> 57 bytes editor/composer/res/table-add-row-before-hover.gif | Bin 0 -> 825 bytes editor/composer/res/table-add-row-before.gif | Bin 0 -> 825 bytes editor/composer/res/table-remove-column-active.gif | Bin 0 -> 835 bytes editor/composer/res/table-remove-column-hover.gif | Bin 0 -> 841 bytes editor/composer/res/table-remove-column.gif | Bin 0 -> 841 bytes editor/composer/res/table-remove-row-active.gif | Bin 0 -> 835 bytes editor/composer/res/table-remove-row-hover.gif | Bin 0 -> 841 bytes editor/composer/res/table-remove-row.gif | Bin 0 -> 841 bytes editor/composer/test/chrome.ini | 5 + editor/composer/test/file_bug1453190.html | 12 + editor/composer/test/mochitest.ini | 9 + editor/composer/test/test_bug1266815.html | 97 + editor/composer/test/test_bug1453190.html | 36 + editor/composer/test/test_bug348497.html | 36 + editor/composer/test/test_bug384147.html | 203 + editor/composer/test/test_bug389350.html | 33 + editor/composer/test/test_bug434998.xhtml | 106 + editor/composer/test/test_bug519928.html | 119 + editor/composer/test/test_bug738440.html | 37 + editor/docs/ChangJie.png | Bin 0 -> 544 bytes editor/docs/EditorModuleSpecificRules.rst | 215 + editor/docs/EditorModuleStructure.rst | 219 + editor/docs/IMEHandlingGuide.rst | 1092 ++ editor/docs/candidatewindow.png | Bin 0 -> 5667 bytes editor/docs/converted_composition_string.png | Bin 0 -> 1260 bytes editor/docs/index.rst | 12 + editor/docs/inputting_composition_string.png | Bin 0 -> 1303 bytes editor/docs/raw_composition_string.png | Bin 0 -> 1302 bytes editor/libeditor/AutoRangeArray.cpp | 1195 ++ editor/libeditor/AutoRangeArray.h | 469 + editor/libeditor/CSSEditUtils.cpp | 1320 +++ editor/libeditor/CSSEditUtils.h | 389 + editor/libeditor/ChangeAttributeTransaction.cpp | 143 + editor/libeditor/ChangeAttributeTransaction.h | 91 + editor/libeditor/ChangeStyleTransaction.cpp | 342 + editor/libeditor/ChangeStyleTransaction.h | 133 + editor/libeditor/CompositionTransaction.cpp | 435 + editor/libeditor/CompositionTransaction.h | 102 + editor/libeditor/DeleteContentTransactionBase.cpp | 24 + editor/libeditor/DeleteContentTransactionBase.h | 46 + .../libeditor/DeleteMultipleRangesTransaction.cpp | 122 + editor/libeditor/DeleteMultipleRangesTransaction.h | 54 + editor/libeditor/DeleteNodeTransaction.cpp | 167 + editor/libeditor/DeleteNodeTransaction.h | 77 + editor/libeditor/DeleteRangeTransaction.cpp | 399 + editor/libeditor/DeleteRangeTransaction.h | 156 + editor/libeditor/DeleteTextTransaction.cpp | 194 + editor/libeditor/DeleteTextTransaction.h | 99 + editor/libeditor/EditAction.h | 862 ++ editor/libeditor/EditAggregateTransaction.cpp | 124 + editor/libeditor/EditAggregateTransaction.h | 57 + editor/libeditor/EditTransactionBase.cpp | 97 + editor/libeditor/EditTransactionBase.h | 86 + editor/libeditor/EditorBase.cpp | 7065 +++++++++++ editor/libeditor/EditorBase.h | 2963 +++++ editor/libeditor/EditorCommands.cpp | 981 ++ editor/libeditor/EditorCommands.h | 906 ++ editor/libeditor/EditorController.cpp | 140 + editor/libeditor/EditorController.h | 30 + editor/libeditor/EditorDOMPoint.h | 1586 +++ editor/libeditor/EditorEventListener.cpp | 1187 ++ editor/libeditor/EditorEventListener.h | 128 + editor/libeditor/EditorForwards.h | 169 + editor/libeditor/EditorUtils.cpp | 474 + editor/libeditor/EditorUtils.h | 483 + editor/libeditor/HTMLAbsPositionEditor.cpp | 993 ++ editor/libeditor/HTMLAnonymousNodeEditor.cpp | 611 + editor/libeditor/HTMLEditHelpers.cpp | 176 + editor/libeditor/HTMLEditHelpers.h | 1209 ++ editor/libeditor/HTMLEditSubActionHandler.cpp | 11794 +++++++++++++++++++ editor/libeditor/HTMLEditUtils.cpp | 2514 ++++ editor/libeditor/HTMLEditUtils.h | 2559 ++++ editor/libeditor/HTMLEditor.cpp | 7199 +++++++++++ editor/libeditor/HTMLEditor.h | 4696 ++++++++ editor/libeditor/HTMLEditorCommands.cpp | 1302 ++ editor/libeditor/HTMLEditorController.cpp | 142 + editor/libeditor/HTMLEditorController.h | 26 + editor/libeditor/HTMLEditorDataTransfer.cpp | 4325 +++++++ editor/libeditor/HTMLEditorDeleteHandler.cpp | 6854 +++++++++++ editor/libeditor/HTMLEditorDocumentCommands.cpp | 482 + editor/libeditor/HTMLEditorEventListener.cpp | 442 + editor/libeditor/HTMLEditorEventListener.h | 100 + editor/libeditor/HTMLEditorInlines.h | 144 + editor/libeditor/HTMLEditorNestedClasses.h | 522 + editor/libeditor/HTMLEditorObjectResizer.cpp | 1495 +++ editor/libeditor/HTMLEditorState.cpp | 656 ++ editor/libeditor/HTMLInlineTableEditor.cpp | 493 + editor/libeditor/HTMLStyleEditor.cpp | 4430 +++++++ editor/libeditor/HTMLTableEditor.cpp | 4600 ++++++++ editor/libeditor/InsertNodeTransaction.cpp | 184 + editor/libeditor/InsertNodeTransaction.h | 91 + editor/libeditor/InsertTextTransaction.cpp | 182 + editor/libeditor/InsertTextTransaction.h | 93 + editor/libeditor/InternetCiter.cpp | 293 + editor/libeditor/InternetCiter.h | 28 + editor/libeditor/JoinNodesTransaction.cpp | 212 + editor/libeditor/JoinNodesTransaction.h | 112 + editor/libeditor/JoinSplitNodeDirection.h | 51 + editor/libeditor/ManualNAC.h | 118 + editor/libeditor/MoveNodeTransaction.cpp | 300 + editor/libeditor/MoveNodeTransaction.h | 119 + editor/libeditor/PendingStyles.cpp | 503 + editor/libeditor/PendingStyles.h | 339 + editor/libeditor/PlaceholderTransaction.cpp | 351 + editor/libeditor/PlaceholderTransaction.h | 100 + editor/libeditor/ReplaceTextTransaction.cpp | 186 + editor/libeditor/ReplaceTextTransaction.h | 95 + editor/libeditor/SelectionState.cpp | 621 + editor/libeditor/SelectionState.h | 591 + editor/libeditor/SplitNodeTransaction.cpp | 241 + editor/libeditor/SplitNodeTransaction.h | 97 + editor/libeditor/TextEditSubActionHandler.cpp | 817 ++ editor/libeditor/TextEditor.cpp | 1140 ++ editor/libeditor/TextEditor.h | 614 + editor/libeditor/TextEditorDataTransfer.cpp | 273 + editor/libeditor/WSRunObject.cpp | 4390 +++++++ editor/libeditor/WSRunObject.h | 1633 +++ editor/libeditor/crashtests/1057677.html | 9 + editor/libeditor/crashtests/1128787.html | 17 + editor/libeditor/crashtests/1134545.html | 26 + editor/libeditor/crashtests/1158452.html | 10 + editor/libeditor/crashtests/1158651.html | 18 + editor/libeditor/crashtests/1244894.xhtml | 21 + editor/libeditor/crashtests/1264921.html | 1 + editor/libeditor/crashtests/1272490.html | 20 + editor/libeditor/crashtests/1274050.html | 17 + editor/libeditor/crashtests/1317704.html | 42 + editor/libeditor/crashtests/1317718.html | 14 + editor/libeditor/crashtests/1324505.html | 24 + editor/libeditor/crashtests/1343918.html | 21 + editor/libeditor/crashtests/1344097.html | 20 + editor/libeditor/crashtests/1345015.html | 28 + editor/libeditor/crashtests/1348851.html | 19 + editor/libeditor/crashtests/1350772.html | 16 + editor/libeditor/crashtests/1364133.html | 42 + editor/libeditor/crashtests/1366176.html | 30 + editor/libeditor/crashtests/1375131.html | 33 + editor/libeditor/crashtests/1381541.html | 20 + editor/libeditor/crashtests/1383747.html | 15 + editor/libeditor/crashtests/1383755.html | 26 + editor/libeditor/crashtests/1383763.html | 17 + editor/libeditor/crashtests/1384161.html | 17 + editor/libeditor/crashtests/1388075.html | 60 + editor/libeditor/crashtests/1393171.html | 10 + editor/libeditor/crashtests/1402196.html | 29 + editor/libeditor/crashtests/1402469.html | 22 + editor/libeditor/crashtests/1402526.html | 24 + editor/libeditor/crashtests/1402904.html | 38 + editor/libeditor/crashtests/1405747.html | 40 + editor/libeditor/crashtests/1405897.html | 23 + editor/libeditor/crashtests/1408170.html | 40 + editor/libeditor/crashtests/1414581.html | 31 + editor/libeditor/crashtests/1415231.html | 26 + editor/libeditor/crashtests/1423767.html | 17 + editor/libeditor/crashtests/1423776.html | 25 + editor/libeditor/crashtests/1424450.html | 51 + editor/libeditor/crashtests/1425091.html | 25 + editor/libeditor/crashtests/1426709.html | 27 + editor/libeditor/crashtests/1429523.html | 18 + editor/libeditor/crashtests/1429523.xhtml | 18 + editor/libeditor/crashtests/1441619.html | 12 + editor/libeditor/crashtests/1443664.html | 15 + editor/libeditor/crashtests/1444630.html | 29 + editor/libeditor/crashtests/1446451.html | 13 + editor/libeditor/crashtests/1464251.html | 25 + editor/libeditor/crashtests/1470926.html | 9 + editor/libeditor/crashtests/1474978.html | 21 + editor/libeditor/crashtests/1517028.html | 23 + editor/libeditor/crashtests/1525481.html | 23 + editor/libeditor/crashtests/1533913.html | 19 + editor/libeditor/crashtests/1534394.html | 29 + editor/libeditor/crashtests/1547897.html | 25 + editor/libeditor/crashtests/1547898.html | 16 + editor/libeditor/crashtests/1556799.html | 18 + editor/libeditor/crashtests/1574544.html | 17 + editor/libeditor/crashtests/1578916.html | 28 + editor/libeditor/crashtests/1579934.html | 39 + editor/libeditor/crashtests/1581246.html | 21 + editor/libeditor/crashtests/1596516.html | 18 + editor/libeditor/crashtests/1605741.html | 14 + editor/libeditor/crashtests/1613521.html | 16 + editor/libeditor/crashtests/1618906.html | 17 + editor/libeditor/crashtests/1623166.html | 21 + editor/libeditor/crashtests/1623913.html | 30 + editor/libeditor/crashtests/1624005.html | 14 + editor/libeditor/crashtests/1624007.html | 19 + editor/libeditor/crashtests/1624011.html | 12 + editor/libeditor/crashtests/1626002.html | 27 + editor/libeditor/crashtests/1636541.html | 14 + editor/libeditor/crashtests/1644903.html | 19 + editor/libeditor/crashtests/1645983-1.html | 11 + editor/libeditor/crashtests/1645983-2.html | 14 + editor/libeditor/crashtests/1648564.html | 29 + editor/libeditor/crashtests/1655508.html | 34 + editor/libeditor/crashtests/1655539.html | 15 + editor/libeditor/crashtests/1655988.html | 29 + editor/libeditor/crashtests/1659717.html | 14 + editor/libeditor/crashtests/1663725.html | 18 + editor/libeditor/crashtests/1666556.html | 28 + editor/libeditor/crashtests/1677566.html | 31 + editor/libeditor/crashtests/1691051.html | 15 + editor/libeditor/crashtests/1699866.html | 22 + editor/libeditor/crashtests/1701348.html | 10 + editor/libeditor/crashtests/1707630.html | 16 + editor/libeditor/crashtests/336081-1.xhtml | 52 + editor/libeditor/crashtests/403965-1.xhtml | 7 + editor/libeditor/crashtests/428489-1.html | 8 + editor/libeditor/crashtests/429586-1.html | 8 + editor/libeditor/crashtests/431086-1.xhtml | 22 + editor/libeditor/crashtests/475132-1.xhtml | 21 + editor/libeditor/crashtests/503709-1.xhtml | 11 + editor/libeditor/crashtests/513375-1.xhtml | 19 + editor/libeditor/crashtests/535632-1.xhtml | 1 + editor/libeditor/crashtests/574558-1.xhtml | 15 + editor/libeditor/crashtests/580151-1.xhtml | 26 + editor/libeditor/crashtests/582138-1.xhtml | 10 + editor/libeditor/crashtests/633709.xhtml | 68 + editor/libeditor/crashtests/639736-1.xhtml | 19 + editor/libeditor/crashtests/713427-2.xhtml | 28 + editor/libeditor/crashtests/766360.html | 18 + editor/libeditor/crashtests/766387.html | 21 + editor/libeditor/crashtests/766413.html | 42 + editor/libeditor/crashtests/766795.html | 21 + editor/libeditor/crashtests/766845.xhtml | 27 + editor/libeditor/crashtests/767169.html | 23 + editor/libeditor/crashtests/768748.html | 16 + editor/libeditor/crashtests/768765.html | 36 + editor/libeditor/crashtests/769008-1.html | 23 + editor/libeditor/crashtests/769967.xhtml | 16 + editor/libeditor/crashtests/771749.html | 21 + editor/libeditor/crashtests/772282.html | 27 + editor/libeditor/crashtests/776323.html | 18 + editor/libeditor/crashtests/793866.html | 21 + editor/libeditor/crashtests/848644.html | 2 + editor/libeditor/crashtests/crashtests.list | 117 + editor/libeditor/moz.build | 98 + editor/libeditor/tests/.eslintrc.js | 9 + editor/libeditor/tests/browser.ini | 8 + editor/libeditor/tests/browser_bug527935.js | 78 + .../tests/browser_content_command_insert_text.js | 271 + .../tests/browserscope/lib/richtext/LICENSE | 202 + .../tests/browserscope/lib/richtext/README | 58 + .../tests/browserscope/lib/richtext/README.Mozilla | 17 + .../browserscope/lib/richtext/currentStatus.js | 43 + .../browserscope/lib/richtext/current_revision | 1 + .../lib/richtext/richtext/editable.html | 11 + .../lib/richtext/richtext/richtext.html | 1081 ++ .../browserscope/lib/richtext/update_from_upstream | 16 + .../tests/browserscope/lib/richtext2/LICENSE | 202 + .../tests/browserscope/lib/richtext2/README | 58 + .../browserscope/lib/richtext2/README.Mozilla | 27 + .../browserscope/lib/richtext2/currentStatus.js | 1867 +++ .../browserscope/lib/richtext2/current_revision | 1 + .../browserscope/lib/richtext2/platformFailures.js | 28 + .../lib/richtext2/richtext2/__init__.py | 0 .../browserscope/lib/richtext2/richtext2/common.py | 25 + .../lib/richtext2/richtext2/handlers.py | 107 + .../lib/richtext2/richtext2/static/common.css | 116 + .../richtext2/richtext2/static/editable-body.html | 11 + .../richtext2/richtext2/static/editable-dM.html | 17 + .../richtext2/richtext2/static/editable-div.html | 11 + .../lib/richtext2/richtext2/static/editable.css | 66 + .../richtext2/richtext2/static/js/canonicalize.js | 436 + .../lib/richtext2/richtext2/static/js/compare.js | 489 + .../lib/richtext2/richtext2/static/js/output.js | 456 + .../lib/richtext2/richtext2/static/js/pad.js | 269 + .../richtext2/static/js/range-bootstrap.js | 5 + .../lib/richtext2/richtext2/static/js/range.js | 6184 ++++++++++ .../lib/richtext2/richtext2/static/js/run.js | 383 + .../lib/richtext2/richtext2/static/js/units.js | 416 + .../lib/richtext2/richtext2/static/js/variables.js | 227 + .../lib/richtext2/richtext2/templates/output.html | 138 + .../richtext2/richtext2/templates/richtext2.html | 107 + .../lib/richtext2/richtext2/tests/__init__.py | 17 + .../lib/richtext2/richtext2/tests/apply.py | 364 + .../lib/richtext2/richtext2/tests/applyCSS.py | 244 + .../lib/richtext2/richtext2/tests/change.py | 273 + .../lib/richtext2/richtext2/tests/changeCSS.py | 210 + .../lib/richtext2/richtext2/tests/delete.py | 330 + .../lib/richtext2/richtext2/tests/forwarddelete.py | 315 + .../lib/richtext2/richtext2/tests/insert.py | 285 + .../lib/richtext2/richtext2/tests/queryEnabled.py | 215 + .../lib/richtext2/richtext2/tests/queryIndeterm.py | 214 + .../lib/richtext2/richtext2/tests/queryState.py | 575 + .../richtext2/richtext2/tests/querySupported.py | 226 + .../lib/richtext2/richtext2/tests/queryValue.py | 429 + .../lib/richtext2/richtext2/tests/selection.py | 801 ++ .../lib/richtext2/richtext2/tests/unapply.py | 462 + .../lib/richtext2/richtext2/tests/unapplyCSS.py | 226 + .../lib/richtext2/richtext2/unittestexample.html | 103 + .../lib/richtext2/update_from_upstream | 19 + editor/libeditor/tests/browserscope/mochitest.ini | 59 + .../tests/browserscope/test_richtext.html | 48 + .../tests/browserscope/test_richtext2.html | 238 + editor/libeditor/tests/bug527935.html | 11 + editor/libeditor/tests/bug527935_2.html | 1 + editor/libeditor/tests/chrome.ini | 20 + editor/libeditor/tests/data/cfhtml-chromium.txt | Bin 0 -> 856 bytes editor/libeditor/tests/data/cfhtml-firefox.txt | Bin 0 -> 266 bytes editor/libeditor/tests/data/cfhtml-ie.txt | Bin 0 -> 1080 bytes editor/libeditor/tests/data/cfhtml-nocontext.txt | 18 + editor/libeditor/tests/data/cfhtml-ooo.txt | Bin 0 -> 649 bytes editor/libeditor/tests/file_bug289384-1.html | 1 + editor/libeditor/tests/file_bug289384-2.html | 1 + editor/libeditor/tests/file_bug549262.html | 8 + editor/libeditor/tests/file_bug586662.html | 7 + editor/libeditor/tests/file_bug611182.html | 1 + editor/libeditor/tests/file_bug611182.sjs | 254 + editor/libeditor/tests/file_bug635636.xhtml | 3 + editor/libeditor/tests/file_bug635636_2.html | 1 + editor/libeditor/tests/file_bug674770-1.html | 5 + editor/libeditor/tests/file_bug795418-2.sjs | 10 + editor/libeditor/tests/file_bug915962.html | 13 + editor/libeditor/tests/file_bug966155.html | 1 + editor/libeditor/tests/file_bug966552.html | 1 + editor/libeditor/tests/file_sanitizer_on_paste.sjs | 19 + .../tests/file_select_all_without_body.html | 38 + editor/libeditor/tests/green.png | Bin 0 -> 334 bytes editor/libeditor/tests/mochitest.ini | 353 + editor/libeditor/tests/test_CF_HTML_clipboard.html | 149 + .../tests/test_abs_positioner_appearance.html | 177 + ...test_abs_positioner_hidden_during_dragging.html | 102 + .../test_abs_positioner_positioning_elements.html | 196 + editor/libeditor/tests/test_backspace_vs.html | 128 + editor/libeditor/tests/test_bug1026397.html | 101 + editor/libeditor/tests/test_bug1053048.html | 71 + editor/libeditor/tests/test_bug1068979.html | 72 + editor/libeditor/tests/test_bug1094000.html | 147 + editor/libeditor/tests/test_bug1102906.html | 51 + editor/libeditor/tests/test_bug1109465.html | 65 + editor/libeditor/tests/test_bug1130651.html | 17 + editor/libeditor/tests/test_bug1140105.html | 64 + editor/libeditor/tests/test_bug1140617.html | 37 + editor/libeditor/tests/test_bug1151186.html | 69 + editor/libeditor/tests/test_bug1153237.html | 48 + editor/libeditor/tests/test_bug1162952.html | 43 + editor/libeditor/tests/test_bug1181130-1.html | 50 + editor/libeditor/tests/test_bug1181130-2.html | 44 + editor/libeditor/tests/test_bug1186799.html | 78 + editor/libeditor/tests/test_bug1230473.html | 103 + editor/libeditor/tests/test_bug1247483.html | 61 + editor/libeditor/tests/test_bug1248128.html | 52 + editor/libeditor/tests/test_bug1248185.html | 56 + editor/libeditor/tests/test_bug1250010.html | 87 + editor/libeditor/tests/test_bug1257363.html | 180 + editor/libeditor/tests/test_bug1258085.html | 66 + editor/libeditor/tests/test_bug1268736.html | 62 + editor/libeditor/tests/test_bug1270235.html | 46 + editor/libeditor/tests/test_bug1306532.html | 68 + editor/libeditor/tests/test_bug1310912.html | 242 + editor/libeditor/tests/test_bug1314790.html | 57 + editor/libeditor/tests/test_bug1315065.html | 145 + editor/libeditor/tests/test_bug1316302.html | 50 + editor/libeditor/tests/test_bug1328023.html | 61 + editor/libeditor/tests/test_bug1330796.html | 95 + editor/libeditor/tests/test_bug1332876.html | 57 + editor/libeditor/tests/test_bug1352799.html | 84 + editor/libeditor/tests/test_bug1355792.html | 17 + editor/libeditor/tests/test_bug1358025.html | 98 + editor/libeditor/tests/test_bug1361008.html | 61 + editor/libeditor/tests/test_bug1361052.html | 50 + editor/libeditor/tests/test_bug1385905.html | 51 + editor/libeditor/tests/test_bug1390562.html | 67 + editor/libeditor/tests/test_bug1394758.html | 60 + editor/libeditor/tests/test_bug1397412.xhtml | 65 + editor/libeditor/tests/test_bug1399722.html | 38 + editor/libeditor/tests/test_bug1406726.html | 126 + editor/libeditor/tests/test_bug1409520.html | 45 + editor/libeditor/tests/test_bug1425997.html | 63 + editor/libeditor/tests/test_bug1543312.html | 70 + editor/libeditor/tests/test_bug1568996.html | 67 + editor/libeditor/tests/test_bug1574596.html | 64 + editor/libeditor/tests/test_bug1581337.html | 33 + editor/libeditor/tests/test_bug1619852.html | 34 + editor/libeditor/tests/test_bug1620778.html | 27 + editor/libeditor/tests/test_bug1649005.html | 49 + editor/libeditor/tests/test_bug1659276.html | 78 + editor/libeditor/tests/test_bug1704381.html | 48 + editor/libeditor/tests/test_bug200416.html | 15 + editor/libeditor/tests/test_bug289384.html | 48 + editor/libeditor/tests/test_bug290026.html | 52 + editor/libeditor/tests/test_bug291780.html | 49 + editor/libeditor/tests/test_bug309731.html | 58 + editor/libeditor/tests/test_bug316447.html | 16 + editor/libeditor/tests/test_bug318065.html | 82 + editor/libeditor/tests/test_bug332636.html | 75 + .../libeditor/tests/test_bug332636.html^headers^ | 1 + editor/libeditor/tests/test_bug358033.html | 41 + editor/libeditor/tests/test_bug372345.html | 58 + editor/libeditor/tests/test_bug404320.html | 87 + editor/libeditor/tests/test_bug408231.html | 233 + editor/libeditor/tests/test_bug410986.html | 80 + editor/libeditor/tests/test_bug414526.html | 234 + editor/libeditor/tests/test_bug417418.html | 78 + editor/libeditor/tests/test_bug426246.html | 71 + editor/libeditor/tests/test_bug430392.html | 171 + editor/libeditor/tests/test_bug439808.html | 37 + editor/libeditor/tests/test_bug442186.html | 103 + editor/libeditor/tests/test_bug455992.html | 102 + editor/libeditor/tests/test_bug456244.html | 69 + editor/libeditor/tests/test_bug460740.html | 124 + editor/libeditor/tests/test_bug46555.html | 47 + editor/libeditor/tests/test_bug471319.html | 77 + editor/libeditor/tests/test_bug471722.html | 74 + editor/libeditor/tests/test_bug478725.html | 130 + editor/libeditor/tests/test_bug480647.html | 110 + editor/libeditor/tests/test_bug480972.html | 97 + editor/libeditor/tests/test_bug483651.html | 52 + editor/libeditor/tests/test_bug489202.xhtml | 73 + editor/libeditor/tests/test_bug490879.html | 54 + editor/libeditor/tests/test_bug502673.html | 97 + editor/libeditor/tests/test_bug514156.html | 46 + editor/libeditor/tests/test_bug520189.html | 620 + editor/libeditor/tests/test_bug525389.html | 207 + editor/libeditor/tests/test_bug537046.html | 49 + editor/libeditor/tests/test_bug549262.html | 160 + editor/libeditor/tests/test_bug550434.html | 42 + editor/libeditor/tests/test_bug551704.html | 126 + editor/libeditor/tests/test_bug552782.html | 46 + editor/libeditor/tests/test_bug567213.html | 58 + editor/libeditor/tests/test_bug569988.html | 103 + editor/libeditor/tests/test_bug570144.html | 123 + editor/libeditor/tests/test_bug578771.html | 63 + editor/libeditor/tests/test_bug586662.html | 62 + editor/libeditor/tests/test_bug590554.html | 36 + editor/libeditor/tests/test_bug592592.html | 72 + editor/libeditor/tests/test_bug596001.html | 57 + editor/libeditor/tests/test_bug596506.html | 55 + editor/libeditor/tests/test_bug597331.html | 73 + editor/libeditor/tests/test_bug597784.html | 37 + editor/libeditor/tests/test_bug599322.html | 58 + editor/libeditor/tests/test_bug599983.html | 16 + editor/libeditor/tests/test_bug599983.xhtml | 67 + editor/libeditor/tests/test_bug600570.html | 81 + editor/libeditor/tests/test_bug603556.html | 53 + editor/libeditor/tests/test_bug604532.html | 42 + editor/libeditor/tests/test_bug607584.html | 41 + editor/libeditor/tests/test_bug607584.xhtml | 112 + editor/libeditor/tests/test_bug611182.html | 105 + editor/libeditor/tests/test_bug612128.html | 42 + editor/libeditor/tests/test_bug612447.html | 74 + editor/libeditor/tests/test_bug616590.xhtml | 101 + editor/libeditor/tests/test_bug620906.html | 50 + editor/libeditor/tests/test_bug622371.html | 44 + editor/libeditor/tests/test_bug625452.html | 66 + editor/libeditor/tests/test_bug629172.html | 105 + editor/libeditor/tests/test_bug629845.html | 58 + editor/libeditor/tests/test_bug635636.html | 63 + editor/libeditor/tests/test_bug638596.html | 34 + editor/libeditor/tests/test_bug641466.html | 48 + editor/libeditor/tests/test_bug645914.html | 63 + editor/libeditor/tests/test_bug646194.html | 36 + editor/libeditor/tests/test_bug668599.html | 73 + editor/libeditor/tests/test_bug674770-1.html | 85 + editor/libeditor/tests/test_bug674770-2.html | 374 + editor/libeditor/tests/test_bug674861.html | 194 + editor/libeditor/tests/test_bug676401.html | 129 + editor/libeditor/tests/test_bug677752.html | 107 + editor/libeditor/tests/test_bug681229.html | 50 + editor/libeditor/tests/test_bug686203.html | 50 + editor/libeditor/tests/test_bug692520.html | 41 + editor/libeditor/tests/test_bug697842.html | 114 + editor/libeditor/tests/test_bug725069.html | 34 + editor/libeditor/tests/test_bug735059.html | 22 + editor/libeditor/tests/test_bug738366.html | 24 + editor/libeditor/tests/test_bug740784.html | 46 + editor/libeditor/tests/test_bug742261.html | 14 + editor/libeditor/tests/test_bug757371.html | 26 + editor/libeditor/tests/test_bug757771.html | 31 + editor/libeditor/tests/test_bug772796.html | 487 + editor/libeditor/tests/test_bug773262.html | 63 + editor/libeditor/tests/test_bug780035.html | 23 + editor/libeditor/tests/test_bug780908.xhtml | 110 + editor/libeditor/tests/test_bug787432.html | 17 + editor/libeditor/tests/test_bug790475.html | 90 + editor/libeditor/tests/test_bug795418-2.html | 87 + editor/libeditor/tests/test_bug795418-3.html | 89 + editor/libeditor/tests/test_bug795418-4.html | 70 + editor/libeditor/tests/test_bug795418-5.html | 69 + editor/libeditor/tests/test_bug795418-6.html | 69 + editor/libeditor/tests/test_bug795418.html | 70 + editor/libeditor/tests/test_bug795785.html | 139 + editor/libeditor/tests/test_bug796839.html | 17 + editor/libeditor/tests/test_bug830600.html | 97 + editor/libeditor/tests/test_bug832025.html | 43 + editor/libeditor/tests/test_bug850043.html | 59 + editor/libeditor/tests/test_bug857487.html | 68 + editor/libeditor/tests/test_bug858918.html | 16 + editor/libeditor/tests/test_bug915962.html | 120 + editor/libeditor/tests/test_bug966155.html | 54 + editor/libeditor/tests/test_bug966552.html | 42 + editor/libeditor/tests/test_bug974309.html | 74 + editor/libeditor/tests/test_bug998188.html | 51 + .../tests/test_can_undo_after_setting_value.xhtml | 38 + ...st_cannot_undo_after_reinitializing_editor.html | 50 + .../tests/test_caret_move_in_vertical_content.html | 209 + editor/libeditor/tests/test_cmd_absPos.html | 296 + .../libeditor/tests/test_cmd_backgroundColor.html | 223 + .../tests/test_cmd_fontFace_with_empty_string.html | 30 + .../libeditor/tests/test_cmd_fontFace_with_tt.html | 73 + editor/libeditor/tests/test_cmd_increaseFont.html | 22 + .../libeditor/tests/test_cmd_paragraphState.html | 55 + .../test_composition_event_created_in_chrome.html | 76 + ...t_composition_with_highlight_in_texteditor.html | 62 + .../tests/test_contenteditable_focus.html | 335 + .../test_contenteditable_text_input_handling.html | 315 + .../test_cut_copy_delete_command_enabled.html | 227 + .../test_cut_copy_delete_command_enabled.xhtml | 215 + editor/libeditor/tests/test_cut_copy_password.html | 92 + ...defaultParagraphSeparatorBR_between_blocks.html | 62 + .../tests/test_dom_input_event_on_htmleditor.html | 1694 +++ .../tests/test_dom_input_event_on_texteditor.html | 926 ++ editor/libeditor/tests/test_dragdrop.html | 3451 ++++++ .../tests/test_execCommandPaste_noTarget.html | 45 + ...us_caret_navigation_between_nested_editors.html | 207 + ...focused_document_element_becoming_editable.html | 157 + editor/libeditor/tests/test_handle_new_lines.html | 129 + .../tests/test_htmleditor_keyevent_handling.html | 676 ++ .../tests/test_htmleditor_tab_key_handling.html | 112 + ..._initial_selection_and_caret_of_designMode.html | 57 + .../libeditor/tests/test_inlineTableEditing.html | 45 + .../libeditor/tests/test_inline_style_cache.html | 151 + ...tHTML_starting_with_multiple_comment_nodes.html | 40 + .../tests/test_insertParagraph_in_h2_and_li.html | 172 + ...est_insertParagraph_in_inline_editing_host.html | 67 + ...t_join_split_node_direction_change_command.html | 197 + .../tests/test_keypress_untrusted_event.html | 105 + .../tests/test_label_contenteditable.html | 18 + .../libeditor/tests/test_middle_click_paste.html | 680 ++ ...sIEditorMailSupport_insertAsCitedQuotation.html | 322 + ...EditorMailSupport_insertTextWithQuotations.html | 104 + .../tests/test_nsIEditor_beginningOfDocument.html | 119 + .../tests/test_nsIEditor_canUndo_canRedo.html | 183 + .../tests/test_nsIEditor_clearUndoRedo.html | 125 + .../tests/test_nsIEditor_documentCharacterSet.html | 113 + .../tests/test_nsIEditor_documentIsEmpty.html | 150 + .../tests/test_nsIEditor_insertLineBreak.html | 416 + .../tests/test_nsIEditor_isSelectionEditable.html | 16 + .../tests/test_nsIEditor_outputToString.html | 135 + editor/libeditor/tests/test_nsIEditor_undoAll.html | 115 + .../tests/test_nsIEditor_undoRedoEnabled.html | 91 + ..._nsIHTMLEditor_getElementOrParentByTagName.html | 449 + .../test_nsIHTMLEditor_getParagraphState.html | 156 + .../test_nsIHTMLEditor_getSelectedElement.html | 816 ++ ...est_nsIHTMLEditor_insertElementAtSelection.html | 185 + .../test_nsIHTMLEditor_removeInlineProperty.html | 420 + .../tests/test_nsIHTMLEditor_selectElement.html | 131 + .../test_nsIHTMLEditor_setBackgroundColor.html | 187 + .../test_nsIHTMLObjectResizer_hideResizers.html | 54 + .../tests/test_nsITableEditor_deleteTableCell.html | 716 ++ ...est_nsITableEditor_deleteTableCellContents.html | 296 + .../test_nsITableEditor_deleteTableColumn.html | 515 + .../tests/test_nsITableEditor_deleteTableRow.html | 522 + .../tests/test_nsITableEditor_getCellAt.html | 138 + .../tests/test_nsITableEditor_getCellDataAt.html | 751 ++ .../tests/test_nsITableEditor_getCellIndexes.html | 91 + .../tests/test_nsITableEditor_getFirstRow.html | 105 + ...nsITableEditor_getFirstSelectedCellInTable.html | 201 + .../test_nsITableEditor_getSelectedCells.html | 295 + .../test_nsITableEditor_getSelectedCellsType.html | 251 + ...ableEditor_getSelectedOrParentTableElement.html | 283 + .../tests/test_nsITableEditor_getTableSize.html | 94 + .../tests/test_nsITableEditor_insertTableCell.html | 558 + .../test_nsITableEditor_insertTableColumn.html | 547 + .../tests/test_nsITableEditor_insertTableRow.html | 432 + .../test_password_input_with_unmasked_range.html | 417 + editor/libeditor/tests/test_password_paste.html | 65 + .../tests/test_password_per_word_operation.html | 148 + .../libeditor/tests/test_password_unmask_API.html | 318 + .../tests/test_pasteImgFromTransferable.html | 78 + editor/libeditor/tests/test_pasteImgTextarea.html | 19 + editor/libeditor/tests/test_pasteImgTextarea.xhtml | 26 + .../tests/test_paste_as_quote_in_text_control.html | 48 + .../libeditor/tests/test_paste_no_formatting.html | 218 + ...ste_redirect_focus_in_paste_event_listener.html | 143 + .../tests/test_pasting_in_root_element.xhtml | 74 + ...ng_in_temporarily_created_div_outside_body.html | 42 + .../libeditor/tests/test_pasting_table_rows.html | 554 + .../test_pasting_text_longer_than_maxlength.html | 53 + .../libeditor/tests/test_resizers_appearance.html | 109 + .../tests/test_resizers_resizing_elements.html | 299 + .../tests/test_root_element_replacement.html | 140 + .../libeditor/tests/test_sanitizer_on_paste.html | 48 + .../tests/test_select_all_without_body.html | 26 + .../tests/test_selection_move_commands.html | 225 + ...ue_longer_than_maxlength_with_setUserInput.html | 69 + editor/libeditor/tests/test_spellcheck_pref.html | 22 + .../tests/test_state_change_on_reframe.html | 29 + .../tests/test_textarea_value_not_include_cr.html | 95 + .../tests/test_texteditor_keyevent_handling.html | 349 + .../libeditor/tests/test_texteditor_textnode.html | 52 + .../test_texteditor_tripleclick_setvalue.html | 27 + .../tests/test_texteditor_wrapping_long_line.html | 45 + .../tests/test_typing_at_edge_of_anchor.html | 476 + ...test_undo_after_spellchecker_replaces_word.html | 179 + .../test_undo_redo_stack_after_setting_value.html | 168 + .../libeditor/tests/test_undo_with_editingui.html | 160 + editor/moz.build | 41 + editor/nsIDocumentStateListener.idl | 32 + editor/nsIEditActionListener.idl | 91 + editor/nsIEditor.idl | 678 ++ editor/nsIEditorMailSupport.idl | 48 + editor/nsIEditorSpellCheck.idl | 165 + editor/nsIHTMLAbsPosEditor.idl | 31 + editor/nsIHTMLEditor.idl | 342 + editor/nsIHTMLInlineTableEditor.idl | 20 + editor/nsIHTMLObjectResizer.idl | 37 + editor/nsITableEditor.idl | 460 + editor/reftests/1088158-ref.html | 2 + editor/reftests/1088158.html | 8 + editor/reftests/1443902-1-ref.html | 15 + editor/reftests/1443902-1.html | 16 + editor/reftests/1443902-2-ref.html | 17 + editor/reftests/1443902-2.html | 18 + editor/reftests/1443902-3-ref.html | 17 + editor/reftests/1443902-3.html | 18 + editor/reftests/1443902-4-ref.html | 18 + editor/reftests/1443902-4.html | 19 + editor/reftests/338427-1-ref.html | 7 + editor/reftests/338427-1.html | 7 + editor/reftests/338427-2-ref.html | 19 + editor/reftests/338427-2.html | 18 + editor/reftests/338427-3-ref.html | 19 + editor/reftests/338427-3.html | 19 + editor/reftests/388980-1-ref.html | 25 + editor/reftests/388980-1.html | 43 + editor/reftests/462758-grabbers-resizers-ref.html | 34 + editor/reftests/462758-grabbers-resizers.html | 33 + editor/reftests/642800-iframe.html | 29 + editor/reftests/642800-ref.html | 7 + editor/reftests/642800.html | 18 + editor/reftests/672709-ref.html | 22 + editor/reftests/672709.html | 12 + editor/reftests/674212-spellcheck-ref.html | 20 + editor/reftests/674212-spellcheck.html | 20 + editor/reftests/694880-1.html | 10 + editor/reftests/694880-2.html | 11 + editor/reftests/694880-3.html | 10 + editor/reftests/694880-ref.html | 9 + editor/reftests/824080-1-ref.html | 17 + editor/reftests/824080-1.html | 19 + editor/reftests/824080-2-ref.html | 22 + editor/reftests/824080-2.html | 22 + editor/reftests/824080-3-ref.html | 21 + editor/reftests/824080-3.html | 21 + editor/reftests/824080-4-ref.html | 21 + editor/reftests/824080-4.html | 26 + editor/reftests/824080-5-ref.html | 22 + editor/reftests/824080-5.html | 25 + editor/reftests/824080-6-ref.html | 18 + editor/reftests/824080-6.html | 20 + editor/reftests/824080-7-ref.html | 19 + editor/reftests/824080-7.html | 22 + editor/reftests/911201-ref.html | 2 + editor/reftests/911201.html | 2 + editor/reftests/969773-ref.html | 24 + editor/reftests/969773.html | 29 + editor/reftests/997805-ref.html | 2 + editor/reftests/997805.html | 16 + editor/reftests/caret_after_reframe-ref.html | 6 + editor/reftests/caret_after_reframe.html | 14 + editor/reftests/caret_on_focus-ref.html | 11 + editor/reftests/caret_on_focus.html | 11 + editor/reftests/caret_on_positioned-ref.html | 8 + editor/reftests/caret_on_positioned.html | 8 + editor/reftests/caret_on_presshell_reinit-2.html | 27 + editor/reftests/caret_on_presshell_reinit-ref.html | 19 + editor/reftests/caret_on_presshell_reinit.html | 22 + .../reftests/caret_on_textarea_lastline-ref.html | 13 + editor/reftests/caret_on_textarea_lastline.html | 14 + editor/reftests/dynamic-1.html | 9 + editor/reftests/dynamic-overflow-change-ref.html | 13 + editor/reftests/dynamic-overflow-change.html | 13 + editor/reftests/dynamic-ref.html | 6 + editor/reftests/dynamic-type-1.html | 11 + editor/reftests/dynamic-type-2.html | 11 + editor/reftests/dynamic-type-3.html | 11 + editor/reftests/dynamic-type-4.html | 11 + editor/reftests/emptypasswd-1.html | 6 + editor/reftests/emptypasswd-2.html | 9 + editor/reftests/emptypasswd-ref.html | 6 + editor/reftests/exec-command-indent-ws-ref.html | 61 + editor/reftests/exec-command-indent-ws.html | 81 + ...g-table-size-from-input-event-listener-ref.html | 26 + ...ating-table-size-from-input-event-listener.html | 33 + .../input-text-notheme-onfocus-reframe-ref.html | 28 + .../input-text-notheme-onfocus-reframe.html | 32 + .../reftests/input-text-onfocus-reframe-ref.html | 25 + editor/reftests/input-text-onfocus-reframe.html | 29 + editor/reftests/newline-1.html | 6 + editor/reftests/newline-2.html | 6 + editor/reftests/newline-3.html | 6 + editor/reftests/newline-4.html | 6 + editor/reftests/newline-ref.html | 6 + editor/reftests/nobogusnode-1.html | 6 + editor/reftests/nobogusnode-2.html | 5 + editor/reftests/nobogusnode-ref.html | 6 + editor/reftests/passwd-1.html | 6 + editor/reftests/passwd-2.html | 6 + editor/reftests/passwd-3.html | 9 + editor/reftests/passwd-4.html | 19 + editor/reftests/passwd-5-with-Preview.html | 6 + editor/reftests/passwd-5-with-TextEditor.html | 8 + editor/reftests/passwd-6-ref.html | 6 + editor/reftests/passwd-6-with-Preview.html | 10 + editor/reftests/passwd-6-with-TextEditor.html | 12 + editor/reftests/passwd-7-with-Preview.html | 6 + editor/reftests/passwd-7-with-TextEditor.html | 8 + editor/reftests/passwd-8-with-Preview.html | 7 + editor/reftests/passwd-8-with-TextEditor.html | 9 + editor/reftests/passwd-9-with-Preview.html | 9 + editor/reftests/passwd-9-with-TextEditor.html | 7 + editor/reftests/passwd-ref.html | 6 + editor/reftests/readonly-editable-ref.html | 13 + editor/reftests/readonly-editable.html | 24 + editor/reftests/readonly-non-editable-ref.html | 21 + editor/reftests/readonly-non-editable.html | 24 + editor/reftests/readwrite-editable-ref.html | 13 + editor/reftests/readwrite-editable.html | 24 + editor/reftests/readwrite-non-editable-ref.html | 21 + editor/reftests/readwrite-non-editable.html | 24 + editor/reftests/reftest.list | 157 + .../selection_visibility_after_reframe-2.html | 12 + .../selection_visibility_after_reframe-3.html | 15 + .../selection_visibility_after_reframe-ref.html | 6 + .../selection_visibility_after_reframe.html | 15 + editor/reftests/spellcheck-comma-valid-ref.html | 6 + editor/reftests/spellcheck-comma-valid.html | 6 + ...check-contenteditable-attr-dynamic-inherit.html | 11 + ...tenteditable-attr-dynamic-override-inherit.html | 11 + ...heck-contenteditable-attr-dynamic-override.html | 11 + .../spellcheck-contenteditable-attr-dynamic.html | 11 + .../spellcheck-contenteditable-attr-inherit.html | 6 + .../reftests/spellcheck-contenteditable-attr.html | 6 + ...check-contenteditable-disabled-partial-ref.html | 12 + ...pellcheck-contenteditable-disabled-partial.html | 11 + .../spellcheck-contenteditable-disabled-ref.html | 6 + .../spellcheck-contenteditable-disabled.html | 11 + ...spellcheck-contenteditable-focused-reframe.html | 18 + .../spellcheck-contenteditable-focused.html | 13 + .../spellcheck-contenteditable-nofocus-1.html | 6 + .../spellcheck-contenteditable-nofocus-2.html | 2 + .../spellcheck-contenteditable-nofocus-ref.html | 6 + ...k-contenteditable-property-dynamic-inherit.html | 11 + ...editable-property-dynamic-override-inherit.html | 11 + ...-contenteditable-property-dynamic-override.html | 11 + ...pellcheck-contenteditable-property-dynamic.html | 11 + .../reftests/spellcheck-contenteditable-ref.html | 11 + .../spellcheck-dotafterquote-valid-ref.html | 6 + .../reftests/spellcheck-dotafterquote-valid.html | 6 + editor/reftests/spellcheck-hyphen-invalid-ref.html | 6 + editor/reftests/spellcheck-hyphen-invalid.html | 6 + .../spellcheck-hyphen-multiple-invalid-ref.html | 6 + .../spellcheck-hyphen-multiple-invalid.html | 6 + .../spellcheck-hyphen-multiple-valid-ref.html | 6 + .../reftests/spellcheck-hyphen-multiple-valid.html | 6 + editor/reftests/spellcheck-hyphen-valid-ref.html | 6 + editor/reftests/spellcheck-hyphen-valid.html | 6 + editor/reftests/spellcheck-input-attr-after.html | 6 + editor/reftests/spellcheck-input-attr-before.html | 6 + .../spellcheck-input-attr-dynamic-inherit.html | 11 + ...lcheck-input-attr-dynamic-override-inherit.html | 11 + .../spellcheck-input-attr-dynamic-override.html | 11 + editor/reftests/spellcheck-input-attr-dynamic.html | 11 + editor/reftests/spellcheck-input-attr-inherit.html | 6 + editor/reftests/spellcheck-input-disabled.html | 6 + editor/reftests/spellcheck-input-nofocus-ref.html | 6 + .../spellcheck-input-property-dynamic-inherit.html | 11 + ...ck-input-property-dynamic-override-inherit.html | 11 + ...spellcheck-input-property-dynamic-override.html | 11 + .../spellcheck-input-property-dynamic.html | 11 + editor/reftests/spellcheck-input-ref.html | 22 + .../reftests/spellcheck-non-latin-arabic-ref.html | 9 + editor/reftests/spellcheck-non-latin-arabic.html | 9 + ...pellcheck-non-latin-chinese-simplified-ref.html | 9 + .../spellcheck-non-latin-chinese-simplified.html | 9 + ...ellcheck-non-latin-chinese-traditional-ref.html | 9 + .../spellcheck-non-latin-chinese-traditional.html | 9 + .../reftests/spellcheck-non-latin-hebrew-ref.html | 9 + editor/reftests/spellcheck-non-latin-hebrew.html | 9 + .../spellcheck-non-latin-japanese-ref.html | 9 + editor/reftests/spellcheck-non-latin-japanese.html | 9 + .../reftests/spellcheck-non-latin-korean-ref.html | 9 + editor/reftests/spellcheck-non-latin-korean.html | 9 + editor/reftests/spellcheck-period-valid-ref.html | 6 + editor/reftests/spellcheck-period-valid.html | 6 + editor/reftests/spellcheck-slash-valid-ref.html | 6 + editor/reftests/spellcheck-slash-valid.html | 6 + editor/reftests/spellcheck-space-valid-ref.html | 6 + editor/reftests/spellcheck-space-valid.html | 6 + editor/reftests/spellcheck-superscript-1-ref.html | 3 + editor/reftests/spellcheck-superscript-1.html | 3 + editor/reftests/spellcheck-superscript-2-ref.html | 3 + editor/reftests/spellcheck-superscript-2.html | 3 + .../spellcheck-textarea-attr-dynamic-inherit.html | 11 + ...eck-textarea-attr-dynamic-override-inherit.html | 11 + .../spellcheck-textarea-attr-dynamic-override.html | 11 + .../reftests/spellcheck-textarea-attr-dynamic.html | 11 + .../reftests/spellcheck-textarea-attr-inherit.html | 6 + editor/reftests/spellcheck-textarea-attr.html | 6 + editor/reftests/spellcheck-textarea-disabled.html | 6 + .../spellcheck-textarea-focused-notreadonly.html | 19 + .../spellcheck-textarea-focused-reframe.html | 18 + editor/reftests/spellcheck-textarea-focused.html | 13 + .../reftests/spellcheck-textarea-nofocus-ref.html | 6 + editor/reftests/spellcheck-textarea-nofocus.html | 6 + ...ellcheck-textarea-property-dynamic-inherit.html | 11 + ...textarea-property-dynamic-override-inherit.html | 11 + ...llcheck-textarea-property-dynamic-override.html | 11 + .../spellcheck-textarea-property-dynamic.html | 11 + editor/reftests/spellcheck-textarea-ref.html | 11 + editor/reftests/spellcheck-textarea-ref2.html | 11 + editor/reftests/spellcheck-url-valid-ref.html | 14 + editor/reftests/spellcheck-url-valid.html | 14 + editor/reftests/unneeded_scroll-ref.html | 16 + editor/reftests/unneeded_scroll.html | 24 + editor/reftests/xul/empty-ref.xhtml | 13 + editor/reftests/xul/emptytextbox-4.xhtml | 12 + editor/reftests/xul/emptytextbox-ref.xhtml | 13 + editor/reftests/xul/input.css | 36 + editor/reftests/xul/placeholder-reset.css | 8 + editor/reftests/xul/platform.js | 28 + editor/reftests/xul/reftest.list | 1 + editor/spellchecker/EditorSpellCheck.cpp | 1179 ++ editor/spellchecker/EditorSpellCheck.h | 99 + editor/spellchecker/FilteredContentIterator.cpp | 398 + editor/spellchecker/FilteredContentIterator.h | 82 + editor/spellchecker/TextServicesDocument.cpp | 2809 +++++ editor/spellchecker/TextServicesDocument.h | 438 + editor/spellchecker/moz.build | 34 + editor/spellchecker/nsComposeTxtSrvFilter.cpp | 64 + editor/spellchecker/nsComposeTxtSrvFilter.h | 45 + editor/spellchecker/nsIInlineSpellChecker.idl | 40 + editor/spellchecker/tests/bug1200533_subframe.html | 15 + editor/spellchecker/tests/bug1204147_subframe.html | 11 + .../spellchecker/tests/bug1204147_subframe2.html | 9 + editor/spellchecker/tests/bug678842_subframe.html | 8 + editor/spellchecker/tests/bug717433_subframe.html | 8 + editor/spellchecker/tests/chrome.ini | 9 + editor/spellchecker/tests/de-DE/de_DE.aff | 2 + editor/spellchecker/tests/de-DE/de_DE.dic | 6 + editor/spellchecker/tests/en-AU/en_AU.aff | 2 + editor/spellchecker/tests/en-AU/en_AU.dic | 4 + editor/spellchecker/tests/en-GB/en_GB.aff | 2 + editor/spellchecker/tests/en-GB/en_GB.dic | 4 + editor/spellchecker/tests/mochitest.ini | 68 + .../tests/multiple_content_languages_subframe.html | 13 + editor/spellchecker/tests/ru-RU/ru_RU.aff | 1 + editor/spellchecker/tests/ru-RU/ru_RU.dic | 2 + editor/spellchecker/tests/spellcheck.js | 36 + .../tests/test_async_UpdateCurrentDictionary.html | 60 + editor/spellchecker/tests/test_bug1100966.html | 74 + editor/spellchecker/tests/test_bug1154791.html | 74 + editor/spellchecker/tests/test_bug1200533.html | 163 + editor/spellchecker/tests/test_bug1204147.html | 115 + editor/spellchecker/tests/test_bug1205983.html | 134 + editor/spellchecker/tests/test_bug1209414.html | 144 + editor/spellchecker/tests/test_bug1219928.html | 69 + editor/spellchecker/tests/test_bug1365383.html | 46 + editor/spellchecker/tests/test_bug1368544.html | 91 + editor/spellchecker/tests/test_bug1402822.html | 114 + editor/spellchecker/tests/test_bug1418629.html | 210 + editor/spellchecker/tests/test_bug1497480.html | 94 + editor/spellchecker/tests/test_bug1602526.html | 57 + editor/spellchecker/tests/test_bug1761273.html | 96 + editor/spellchecker/tests/test_bug1773802.html | 96 + editor/spellchecker/tests/test_bug1837268.html | 79 + editor/spellchecker/tests/test_bug338427.html | 61 + editor/spellchecker/tests/test_bug366682.html | 65 + editor/spellchecker/tests/test_bug432225.html | 72 + editor/spellchecker/tests/test_bug484181.html | 73 + editor/spellchecker/tests/test_bug596333.html | 135 + editor/spellchecker/tests/test_bug636465.html | 54 + editor/spellchecker/tests/test_bug678842.html | 106 + editor/spellchecker/tests/test_bug697981.html | 137 + editor/spellchecker/tests/test_bug717433.html | 111 + .../tests/test_multiple_content_languages.html | 176 + .../test_nsIEditorSpellCheck_ReplaceWord.html | 64 + .../tests/test_spellcheck_after_edit.html | 198 + ...t_spellcheck_after_pressing_navigation_key.html | 77 + .../tests/test_spellcheck_selection.html | 36 + editor/spellchecker/tests/test_suggest.html | 42 + editor/txmgr/TransactionItem.cpp | 257 + editor/txmgr/TransactionItem.h | 74 + editor/txmgr/TransactionManager.cpp | 509 + editor/txmgr/TransactionManager.h | 93 + editor/txmgr/TransactionStack.cpp | 75 + editor/txmgr/TransactionStack.h | 44 + editor/txmgr/moz.build | 31 + editor/txmgr/nsITransaction.idl | 82 + editor/txmgr/nsITransactionManager.idl | 148 + editor/txmgr/nsTransactionManagerCID.h | 7 + editor/txmgr/tests/TestTXMgr.cpp | 2013 ++++ editor/txmgr/tests/crashtests/407072-1.html | 22 + editor/txmgr/tests/crashtests/449006-1.html | 28 + editor/txmgr/tests/crashtests/crashtests.list | 2 + editor/txmgr/tests/moz.build | 10 + 925 files changed, 179216 insertions(+) create mode 100644 editor/AsyncSpellCheckTestHelper.sys.mjs create mode 100644 editor/composer/ComposerCommandsUpdater.cpp create mode 100644 editor/composer/ComposerCommandsUpdater.h create mode 100644 editor/composer/crashtests/351236-1.html create mode 100644 editor/composer/crashtests/407062-1.html create mode 100644 editor/composer/crashtests/419563-1.xhtml create mode 100644 editor/composer/crashtests/428844-1-inner.xhtml create mode 100644 editor/composer/crashtests/428844-1.html create mode 100644 editor/composer/crashtests/461049-1.html create mode 100644 editor/composer/crashtests/crashtests.list create mode 100644 editor/composer/crashtests/removing-editable-xslt-inner.xhtml create mode 100644 editor/composer/crashtests/removing-editable-xslt.html create mode 100644 editor/composer/moz.build create mode 100644 editor/composer/nsEditingSession.cpp create mode 100644 editor/composer/nsEditingSession.h create mode 100644 editor/composer/nsIEditingSession.idl create mode 100644 editor/composer/res/EditorOverride.css create mode 100644 editor/composer/res/grabber.gif create mode 100644 editor/composer/res/table-add-column-after-active.gif create mode 100644 editor/composer/res/table-add-column-after-hover.gif create mode 100644 editor/composer/res/table-add-column-after.gif create mode 100644 editor/composer/res/table-add-column-before-active.gif create mode 100644 editor/composer/res/table-add-column-before-hover.gif create mode 100644 editor/composer/res/table-add-column-before.gif create mode 100644 editor/composer/res/table-add-row-after-active.gif create mode 100644 editor/composer/res/table-add-row-after-hover.gif create mode 100644 editor/composer/res/table-add-row-after.gif create mode 100644 editor/composer/res/table-add-row-before-active.gif create mode 100644 editor/composer/res/table-add-row-before-hover.gif create mode 100644 editor/composer/res/table-add-row-before.gif create mode 100644 editor/composer/res/table-remove-column-active.gif create mode 100644 editor/composer/res/table-remove-column-hover.gif create mode 100644 editor/composer/res/table-remove-column.gif create mode 100644 editor/composer/res/table-remove-row-active.gif create mode 100644 editor/composer/res/table-remove-row-hover.gif create mode 100644 editor/composer/res/table-remove-row.gif create mode 100644 editor/composer/test/chrome.ini create mode 100644 editor/composer/test/file_bug1453190.html create mode 100644 editor/composer/test/mochitest.ini create mode 100644 editor/composer/test/test_bug1266815.html create mode 100644 editor/composer/test/test_bug1453190.html create mode 100644 editor/composer/test/test_bug348497.html create mode 100644 editor/composer/test/test_bug384147.html create mode 100644 editor/composer/test/test_bug389350.html create mode 100644 editor/composer/test/test_bug434998.xhtml create mode 100644 editor/composer/test/test_bug519928.html create mode 100644 editor/composer/test/test_bug738440.html create mode 100644 editor/docs/ChangJie.png create mode 100644 editor/docs/EditorModuleSpecificRules.rst create mode 100644 editor/docs/EditorModuleStructure.rst create mode 100644 editor/docs/IMEHandlingGuide.rst create mode 100644 editor/docs/candidatewindow.png create mode 100644 editor/docs/converted_composition_string.png create mode 100644 editor/docs/index.rst create mode 100644 editor/docs/inputting_composition_string.png create mode 100644 editor/docs/raw_composition_string.png create mode 100644 editor/libeditor/AutoRangeArray.cpp create mode 100644 editor/libeditor/AutoRangeArray.h create mode 100644 editor/libeditor/CSSEditUtils.cpp create mode 100644 editor/libeditor/CSSEditUtils.h create mode 100644 editor/libeditor/ChangeAttributeTransaction.cpp create mode 100644 editor/libeditor/ChangeAttributeTransaction.h create mode 100644 editor/libeditor/ChangeStyleTransaction.cpp create mode 100644 editor/libeditor/ChangeStyleTransaction.h create mode 100644 editor/libeditor/CompositionTransaction.cpp create mode 100644 editor/libeditor/CompositionTransaction.h create mode 100644 editor/libeditor/DeleteContentTransactionBase.cpp create mode 100644 editor/libeditor/DeleteContentTransactionBase.h create mode 100644 editor/libeditor/DeleteMultipleRangesTransaction.cpp create mode 100644 editor/libeditor/DeleteMultipleRangesTransaction.h create mode 100644 editor/libeditor/DeleteNodeTransaction.cpp create mode 100644 editor/libeditor/DeleteNodeTransaction.h create mode 100644 editor/libeditor/DeleteRangeTransaction.cpp create mode 100644 editor/libeditor/DeleteRangeTransaction.h create mode 100644 editor/libeditor/DeleteTextTransaction.cpp create mode 100644 editor/libeditor/DeleteTextTransaction.h create mode 100644 editor/libeditor/EditAction.h create mode 100644 editor/libeditor/EditAggregateTransaction.cpp create mode 100644 editor/libeditor/EditAggregateTransaction.h create mode 100644 editor/libeditor/EditTransactionBase.cpp create mode 100644 editor/libeditor/EditTransactionBase.h create mode 100644 editor/libeditor/EditorBase.cpp create mode 100644 editor/libeditor/EditorBase.h create mode 100644 editor/libeditor/EditorCommands.cpp create mode 100644 editor/libeditor/EditorCommands.h create mode 100644 editor/libeditor/EditorController.cpp create mode 100644 editor/libeditor/EditorController.h create mode 100644 editor/libeditor/EditorDOMPoint.h create mode 100644 editor/libeditor/EditorEventListener.cpp create mode 100644 editor/libeditor/EditorEventListener.h create mode 100644 editor/libeditor/EditorForwards.h create mode 100644 editor/libeditor/EditorUtils.cpp create mode 100644 editor/libeditor/EditorUtils.h create mode 100644 editor/libeditor/HTMLAbsPositionEditor.cpp create mode 100644 editor/libeditor/HTMLAnonymousNodeEditor.cpp create mode 100644 editor/libeditor/HTMLEditHelpers.cpp create mode 100644 editor/libeditor/HTMLEditHelpers.h create mode 100644 editor/libeditor/HTMLEditSubActionHandler.cpp create mode 100644 editor/libeditor/HTMLEditUtils.cpp create mode 100644 editor/libeditor/HTMLEditUtils.h create mode 100644 editor/libeditor/HTMLEditor.cpp create mode 100644 editor/libeditor/HTMLEditor.h create mode 100644 editor/libeditor/HTMLEditorCommands.cpp create mode 100644 editor/libeditor/HTMLEditorController.cpp create mode 100644 editor/libeditor/HTMLEditorController.h create mode 100644 editor/libeditor/HTMLEditorDataTransfer.cpp create mode 100644 editor/libeditor/HTMLEditorDeleteHandler.cpp create mode 100644 editor/libeditor/HTMLEditorDocumentCommands.cpp create mode 100644 editor/libeditor/HTMLEditorEventListener.cpp create mode 100644 editor/libeditor/HTMLEditorEventListener.h create mode 100644 editor/libeditor/HTMLEditorInlines.h create mode 100644 editor/libeditor/HTMLEditorNestedClasses.h create mode 100644 editor/libeditor/HTMLEditorObjectResizer.cpp create mode 100644 editor/libeditor/HTMLEditorState.cpp create mode 100644 editor/libeditor/HTMLInlineTableEditor.cpp create mode 100644 editor/libeditor/HTMLStyleEditor.cpp create mode 100644 editor/libeditor/HTMLTableEditor.cpp create mode 100644 editor/libeditor/InsertNodeTransaction.cpp create mode 100644 editor/libeditor/InsertNodeTransaction.h create mode 100644 editor/libeditor/InsertTextTransaction.cpp create mode 100644 editor/libeditor/InsertTextTransaction.h create mode 100644 editor/libeditor/InternetCiter.cpp create mode 100644 editor/libeditor/InternetCiter.h create mode 100644 editor/libeditor/JoinNodesTransaction.cpp create mode 100644 editor/libeditor/JoinNodesTransaction.h create mode 100644 editor/libeditor/JoinSplitNodeDirection.h create mode 100644 editor/libeditor/ManualNAC.h create mode 100644 editor/libeditor/MoveNodeTransaction.cpp create mode 100644 editor/libeditor/MoveNodeTransaction.h create mode 100644 editor/libeditor/PendingStyles.cpp create mode 100644 editor/libeditor/PendingStyles.h create mode 100644 editor/libeditor/PlaceholderTransaction.cpp create mode 100644 editor/libeditor/PlaceholderTransaction.h create mode 100644 editor/libeditor/ReplaceTextTransaction.cpp create mode 100644 editor/libeditor/ReplaceTextTransaction.h create mode 100644 editor/libeditor/SelectionState.cpp create mode 100644 editor/libeditor/SelectionState.h create mode 100644 editor/libeditor/SplitNodeTransaction.cpp create mode 100644 editor/libeditor/SplitNodeTransaction.h create mode 100644 editor/libeditor/TextEditSubActionHandler.cpp create mode 100644 editor/libeditor/TextEditor.cpp create mode 100644 editor/libeditor/TextEditor.h create mode 100644 editor/libeditor/TextEditorDataTransfer.cpp create mode 100644 editor/libeditor/WSRunObject.cpp create mode 100644 editor/libeditor/WSRunObject.h create mode 100644 editor/libeditor/crashtests/1057677.html create mode 100644 editor/libeditor/crashtests/1128787.html create mode 100644 editor/libeditor/crashtests/1134545.html create mode 100644 editor/libeditor/crashtests/1158452.html create mode 100644 editor/libeditor/crashtests/1158651.html create mode 100644 editor/libeditor/crashtests/1244894.xhtml create mode 100644 editor/libeditor/crashtests/1264921.html create mode 100644 editor/libeditor/crashtests/1272490.html create mode 100644 editor/libeditor/crashtests/1274050.html create mode 100644 editor/libeditor/crashtests/1317704.html create mode 100644 editor/libeditor/crashtests/1317718.html create mode 100644 editor/libeditor/crashtests/1324505.html create mode 100644 editor/libeditor/crashtests/1343918.html create mode 100644 editor/libeditor/crashtests/1344097.html create mode 100644 editor/libeditor/crashtests/1345015.html create mode 100644 editor/libeditor/crashtests/1348851.html create mode 100644 editor/libeditor/crashtests/1350772.html create mode 100644 editor/libeditor/crashtests/1364133.html create mode 100644 editor/libeditor/crashtests/1366176.html create mode 100644 editor/libeditor/crashtests/1375131.html create mode 100644 editor/libeditor/crashtests/1381541.html create mode 100644 editor/libeditor/crashtests/1383747.html create mode 100644 editor/libeditor/crashtests/1383755.html create mode 100644 editor/libeditor/crashtests/1383763.html create mode 100644 editor/libeditor/crashtests/1384161.html create mode 100644 editor/libeditor/crashtests/1388075.html create mode 100644 editor/libeditor/crashtests/1393171.html create mode 100644 editor/libeditor/crashtests/1402196.html create mode 100644 editor/libeditor/crashtests/1402469.html create mode 100644 editor/libeditor/crashtests/1402526.html create mode 100644 editor/libeditor/crashtests/1402904.html create mode 100644 editor/libeditor/crashtests/1405747.html create mode 100644 editor/libeditor/crashtests/1405897.html create mode 100644 editor/libeditor/crashtests/1408170.html create mode 100644 editor/libeditor/crashtests/1414581.html create mode 100644 editor/libeditor/crashtests/1415231.html create mode 100644 editor/libeditor/crashtests/1423767.html create mode 100644 editor/libeditor/crashtests/1423776.html create mode 100644 editor/libeditor/crashtests/1424450.html create mode 100644 editor/libeditor/crashtests/1425091.html create mode 100644 editor/libeditor/crashtests/1426709.html create mode 100644 editor/libeditor/crashtests/1429523.html create mode 100644 editor/libeditor/crashtests/1429523.xhtml create mode 100644 editor/libeditor/crashtests/1441619.html create mode 100644 editor/libeditor/crashtests/1443664.html create mode 100644 editor/libeditor/crashtests/1444630.html create mode 100644 editor/libeditor/crashtests/1446451.html create mode 100644 editor/libeditor/crashtests/1464251.html create mode 100644 editor/libeditor/crashtests/1470926.html create mode 100644 editor/libeditor/crashtests/1474978.html create mode 100644 editor/libeditor/crashtests/1517028.html create mode 100644 editor/libeditor/crashtests/1525481.html create mode 100644 editor/libeditor/crashtests/1533913.html create mode 100644 editor/libeditor/crashtests/1534394.html create mode 100644 editor/libeditor/crashtests/1547897.html create mode 100644 editor/libeditor/crashtests/1547898.html create mode 100644 editor/libeditor/crashtests/1556799.html create mode 100644 editor/libeditor/crashtests/1574544.html create mode 100644 editor/libeditor/crashtests/1578916.html create mode 100644 editor/libeditor/crashtests/1579934.html create mode 100644 editor/libeditor/crashtests/1581246.html create mode 100644 editor/libeditor/crashtests/1596516.html create mode 100644 editor/libeditor/crashtests/1605741.html create mode 100644 editor/libeditor/crashtests/1613521.html create mode 100644 editor/libeditor/crashtests/1618906.html create mode 100644 editor/libeditor/crashtests/1623166.html create mode 100644 editor/libeditor/crashtests/1623913.html create mode 100644 editor/libeditor/crashtests/1624005.html create mode 100644 editor/libeditor/crashtests/1624007.html create mode 100644 editor/libeditor/crashtests/1624011.html create mode 100644 editor/libeditor/crashtests/1626002.html create mode 100644 editor/libeditor/crashtests/1636541.html create mode 100644 editor/libeditor/crashtests/1644903.html create mode 100644 editor/libeditor/crashtests/1645983-1.html create mode 100644 editor/libeditor/crashtests/1645983-2.html create mode 100644 editor/libeditor/crashtests/1648564.html create mode 100644 editor/libeditor/crashtests/1655508.html create mode 100644 editor/libeditor/crashtests/1655539.html create mode 100644 editor/libeditor/crashtests/1655988.html create mode 100644 editor/libeditor/crashtests/1659717.html create mode 100644 editor/libeditor/crashtests/1663725.html create mode 100644 editor/libeditor/crashtests/1666556.html create mode 100644 editor/libeditor/crashtests/1677566.html create mode 100644 editor/libeditor/crashtests/1691051.html create mode 100644 editor/libeditor/crashtests/1699866.html create mode 100644 editor/libeditor/crashtests/1701348.html create mode 100644 editor/libeditor/crashtests/1707630.html create mode 100644 editor/libeditor/crashtests/336081-1.xhtml create mode 100644 editor/libeditor/crashtests/403965-1.xhtml create mode 100644 editor/libeditor/crashtests/428489-1.html create mode 100644 editor/libeditor/crashtests/429586-1.html create mode 100644 editor/libeditor/crashtests/431086-1.xhtml create mode 100644 editor/libeditor/crashtests/475132-1.xhtml create mode 100644 editor/libeditor/crashtests/503709-1.xhtml create mode 100644 editor/libeditor/crashtests/513375-1.xhtml create mode 100644 editor/libeditor/crashtests/535632-1.xhtml create mode 100644 editor/libeditor/crashtests/574558-1.xhtml create mode 100644 editor/libeditor/crashtests/580151-1.xhtml create mode 100644 editor/libeditor/crashtests/582138-1.xhtml create mode 100644 editor/libeditor/crashtests/633709.xhtml create mode 100644 editor/libeditor/crashtests/639736-1.xhtml create mode 100644 editor/libeditor/crashtests/713427-2.xhtml create mode 100644 editor/libeditor/crashtests/766360.html create mode 100644 editor/libeditor/crashtests/766387.html create mode 100644 editor/libeditor/crashtests/766413.html create mode 100644 editor/libeditor/crashtests/766795.html create mode 100644 editor/libeditor/crashtests/766845.xhtml create mode 100644 editor/libeditor/crashtests/767169.html create mode 100644 editor/libeditor/crashtests/768748.html create mode 100644 editor/libeditor/crashtests/768765.html create mode 100644 editor/libeditor/crashtests/769008-1.html create mode 100644 editor/libeditor/crashtests/769967.xhtml create mode 100644 editor/libeditor/crashtests/771749.html create mode 100644 editor/libeditor/crashtests/772282.html create mode 100644 editor/libeditor/crashtests/776323.html create mode 100644 editor/libeditor/crashtests/793866.html create mode 100644 editor/libeditor/crashtests/848644.html create mode 100644 editor/libeditor/crashtests/crashtests.list create mode 100644 editor/libeditor/moz.build create mode 100644 editor/libeditor/tests/.eslintrc.js create mode 100644 editor/libeditor/tests/browser.ini create mode 100644 editor/libeditor/tests/browser_bug527935.js create mode 100644 editor/libeditor/tests/browser_content_command_insert_text.js create mode 100644 editor/libeditor/tests/browserscope/lib/richtext/LICENSE create mode 100644 editor/libeditor/tests/browserscope/lib/richtext/README create mode 100644 editor/libeditor/tests/browserscope/lib/richtext/README.Mozilla create mode 100644 editor/libeditor/tests/browserscope/lib/richtext/currentStatus.js create mode 100644 editor/libeditor/tests/browserscope/lib/richtext/current_revision create mode 100644 editor/libeditor/tests/browserscope/lib/richtext/richtext/editable.html create mode 100644 editor/libeditor/tests/browserscope/lib/richtext/richtext/richtext.html create mode 100644 editor/libeditor/tests/browserscope/lib/richtext/update_from_upstream create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/LICENSE create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/README create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/README.Mozilla create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/currentStatus.js create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/current_revision create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/platformFailures.js create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/__init__.py create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/common.py create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/handlers.py create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/static/common.css create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/static/editable-body.html create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/static/editable-dM.html create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/static/editable-div.html create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/static/editable.css create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/static/js/canonicalize.js create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/static/js/compare.js create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/static/js/output.js create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/static/js/pad.js create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/static/js/range-bootstrap.js create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/static/js/range.js create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/static/js/run.js create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/static/js/units.js create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/static/js/variables.js create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/templates/output.html create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/templates/richtext2.html create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/tests/__init__.py create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/tests/apply.py create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/tests/applyCSS.py create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/tests/change.py create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/tests/changeCSS.py create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/tests/delete.py create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/tests/forwarddelete.py create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/tests/insert.py create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/tests/queryEnabled.py create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/tests/queryIndeterm.py create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/tests/queryState.py create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/tests/querySupported.py create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/tests/queryValue.py create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/tests/selection.py create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/tests/unapply.py create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/tests/unapplyCSS.py create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/richtext2/unittestexample.html create mode 100644 editor/libeditor/tests/browserscope/lib/richtext2/update_from_upstream create mode 100644 editor/libeditor/tests/browserscope/mochitest.ini create mode 100644 editor/libeditor/tests/browserscope/test_richtext.html create mode 100644 editor/libeditor/tests/browserscope/test_richtext2.html create mode 100644 editor/libeditor/tests/bug527935.html create mode 100644 editor/libeditor/tests/bug527935_2.html create mode 100644 editor/libeditor/tests/chrome.ini create mode 100644 editor/libeditor/tests/data/cfhtml-chromium.txt create mode 100644 editor/libeditor/tests/data/cfhtml-firefox.txt create mode 100644 editor/libeditor/tests/data/cfhtml-ie.txt create mode 100644 editor/libeditor/tests/data/cfhtml-nocontext.txt create mode 100644 editor/libeditor/tests/data/cfhtml-ooo.txt create mode 100644 editor/libeditor/tests/file_bug289384-1.html create mode 100644 editor/libeditor/tests/file_bug289384-2.html create mode 100644 editor/libeditor/tests/file_bug549262.html create mode 100644 editor/libeditor/tests/file_bug586662.html create mode 100644 editor/libeditor/tests/file_bug611182.html create mode 100644 editor/libeditor/tests/file_bug611182.sjs create mode 100644 editor/libeditor/tests/file_bug635636.xhtml create mode 100644 editor/libeditor/tests/file_bug635636_2.html create mode 100644 editor/libeditor/tests/file_bug674770-1.html create mode 100644 editor/libeditor/tests/file_bug795418-2.sjs create mode 100644 editor/libeditor/tests/file_bug915962.html create mode 100644 editor/libeditor/tests/file_bug966155.html create mode 100644 editor/libeditor/tests/file_bug966552.html create mode 100644 editor/libeditor/tests/file_sanitizer_on_paste.sjs create mode 100644 editor/libeditor/tests/file_select_all_without_body.html create mode 100644 editor/libeditor/tests/green.png create mode 100644 editor/libeditor/tests/mochitest.ini create mode 100644 editor/libeditor/tests/test_CF_HTML_clipboard.html create mode 100644 editor/libeditor/tests/test_abs_positioner_appearance.html create mode 100644 editor/libeditor/tests/test_abs_positioner_hidden_during_dragging.html create mode 100644 editor/libeditor/tests/test_abs_positioner_positioning_elements.html create mode 100644 editor/libeditor/tests/test_backspace_vs.html create mode 100644 editor/libeditor/tests/test_bug1026397.html create mode 100644 editor/libeditor/tests/test_bug1053048.html create mode 100644 editor/libeditor/tests/test_bug1068979.html create mode 100644 editor/libeditor/tests/test_bug1094000.html create mode 100644 editor/libeditor/tests/test_bug1102906.html create mode 100644 editor/libeditor/tests/test_bug1109465.html create mode 100644 editor/libeditor/tests/test_bug1130651.html create mode 100644 editor/libeditor/tests/test_bug1140105.html create mode 100644 editor/libeditor/tests/test_bug1140617.html create mode 100644 editor/libeditor/tests/test_bug1151186.html create mode 100644 editor/libeditor/tests/test_bug1153237.html create mode 100644 editor/libeditor/tests/test_bug1162952.html create mode 100644 editor/libeditor/tests/test_bug1181130-1.html create mode 100644 editor/libeditor/tests/test_bug1181130-2.html create mode 100644 editor/libeditor/tests/test_bug1186799.html create mode 100644 editor/libeditor/tests/test_bug1230473.html create mode 100644 editor/libeditor/tests/test_bug1247483.html create mode 100644 editor/libeditor/tests/test_bug1248128.html create mode 100644 editor/libeditor/tests/test_bug1248185.html create mode 100644 editor/libeditor/tests/test_bug1250010.html create mode 100644 editor/libeditor/tests/test_bug1257363.html create mode 100644 editor/libeditor/tests/test_bug1258085.html create mode 100644 editor/libeditor/tests/test_bug1268736.html create mode 100644 editor/libeditor/tests/test_bug1270235.html create mode 100644 editor/libeditor/tests/test_bug1306532.html create mode 100644 editor/libeditor/tests/test_bug1310912.html create mode 100644 editor/libeditor/tests/test_bug1314790.html create mode 100644 editor/libeditor/tests/test_bug1315065.html create mode 100644 editor/libeditor/tests/test_bug1316302.html create mode 100644 editor/libeditor/tests/test_bug1328023.html create mode 100644 editor/libeditor/tests/test_bug1330796.html create mode 100644 editor/libeditor/tests/test_bug1332876.html create mode 100644 editor/libeditor/tests/test_bug1352799.html create mode 100644 editor/libeditor/tests/test_bug1355792.html create mode 100644 editor/libeditor/tests/test_bug1358025.html create mode 100644 editor/libeditor/tests/test_bug1361008.html create mode 100644 editor/libeditor/tests/test_bug1361052.html create mode 100644 editor/libeditor/tests/test_bug1385905.html create mode 100644 editor/libeditor/tests/test_bug1390562.html create mode 100644 editor/libeditor/tests/test_bug1394758.html create mode 100644 editor/libeditor/tests/test_bug1397412.xhtml create mode 100644 editor/libeditor/tests/test_bug1399722.html create mode 100644 editor/libeditor/tests/test_bug1406726.html create mode 100644 editor/libeditor/tests/test_bug1409520.html create mode 100644 editor/libeditor/tests/test_bug1425997.html create mode 100644 editor/libeditor/tests/test_bug1543312.html create mode 100644 editor/libeditor/tests/test_bug1568996.html create mode 100644 editor/libeditor/tests/test_bug1574596.html create mode 100644 editor/libeditor/tests/test_bug1581337.html create mode 100644 editor/libeditor/tests/test_bug1619852.html create mode 100644 editor/libeditor/tests/test_bug1620778.html create mode 100644 editor/libeditor/tests/test_bug1649005.html create mode 100644 editor/libeditor/tests/test_bug1659276.html create mode 100644 editor/libeditor/tests/test_bug1704381.html create mode 100644 editor/libeditor/tests/test_bug200416.html create mode 100644 editor/libeditor/tests/test_bug289384.html create mode 100644 editor/libeditor/tests/test_bug290026.html create mode 100644 editor/libeditor/tests/test_bug291780.html create mode 100644 editor/libeditor/tests/test_bug309731.html create mode 100644 editor/libeditor/tests/test_bug316447.html create mode 100644 editor/libeditor/tests/test_bug318065.html create mode 100644 editor/libeditor/tests/test_bug332636.html create mode 100644 editor/libeditor/tests/test_bug332636.html^headers^ create mode 100644 editor/libeditor/tests/test_bug358033.html create mode 100644 editor/libeditor/tests/test_bug372345.html create mode 100644 editor/libeditor/tests/test_bug404320.html create mode 100644 editor/libeditor/tests/test_bug408231.html create mode 100644 editor/libeditor/tests/test_bug410986.html create mode 100644 editor/libeditor/tests/test_bug414526.html create mode 100644 editor/libeditor/tests/test_bug417418.html create mode 100644 editor/libeditor/tests/test_bug426246.html create mode 100644 editor/libeditor/tests/test_bug430392.html create mode 100644 editor/libeditor/tests/test_bug439808.html create mode 100644 editor/libeditor/tests/test_bug442186.html create mode 100644 editor/libeditor/tests/test_bug455992.html create mode 100644 editor/libeditor/tests/test_bug456244.html create mode 100644 editor/libeditor/tests/test_bug460740.html create mode 100644 editor/libeditor/tests/test_bug46555.html create mode 100644 editor/libeditor/tests/test_bug471319.html create mode 100644 editor/libeditor/tests/test_bug471722.html create mode 100644 editor/libeditor/tests/test_bug478725.html create mode 100644 editor/libeditor/tests/test_bug480647.html create mode 100644 editor/libeditor/tests/test_bug480972.html create mode 100644 editor/libeditor/tests/test_bug483651.html create mode 100644 editor/libeditor/tests/test_bug489202.xhtml create mode 100644 editor/libeditor/tests/test_bug490879.html create mode 100644 editor/libeditor/tests/test_bug502673.html create mode 100644 editor/libeditor/tests/test_bug514156.html create mode 100644 editor/libeditor/tests/test_bug520189.html create mode 100644 editor/libeditor/tests/test_bug525389.html create mode 100644 editor/libeditor/tests/test_bug537046.html create mode 100644 editor/libeditor/tests/test_bug549262.html create mode 100644 editor/libeditor/tests/test_bug550434.html create mode 100644 editor/libeditor/tests/test_bug551704.html create mode 100644 editor/libeditor/tests/test_bug552782.html create mode 100644 editor/libeditor/tests/test_bug567213.html create mode 100644 editor/libeditor/tests/test_bug569988.html create mode 100644 editor/libeditor/tests/test_bug570144.html create mode 100644 editor/libeditor/tests/test_bug578771.html create mode 100644 editor/libeditor/tests/test_bug586662.html create mode 100644 editor/libeditor/tests/test_bug590554.html create mode 100644 editor/libeditor/tests/test_bug592592.html create mode 100644 editor/libeditor/tests/test_bug596001.html create mode 100644 editor/libeditor/tests/test_bug596506.html create mode 100644 editor/libeditor/tests/test_bug597331.html create mode 100644 editor/libeditor/tests/test_bug597784.html create mode 100644 editor/libeditor/tests/test_bug599322.html create mode 100644 editor/libeditor/tests/test_bug599983.html create mode 100644 editor/libeditor/tests/test_bug599983.xhtml create mode 100644 editor/libeditor/tests/test_bug600570.html create mode 100644 editor/libeditor/tests/test_bug603556.html create mode 100644 editor/libeditor/tests/test_bug604532.html create mode 100644 editor/libeditor/tests/test_bug607584.html create mode 100644 editor/libeditor/tests/test_bug607584.xhtml create mode 100644 editor/libeditor/tests/test_bug611182.html create mode 100644 editor/libeditor/tests/test_bug612128.html create mode 100644 editor/libeditor/tests/test_bug612447.html create mode 100644 editor/libeditor/tests/test_bug616590.xhtml create mode 100644 editor/libeditor/tests/test_bug620906.html create mode 100644 editor/libeditor/tests/test_bug622371.html create mode 100644 editor/libeditor/tests/test_bug625452.html create mode 100644 editor/libeditor/tests/test_bug629172.html create mode 100644 editor/libeditor/tests/test_bug629845.html create mode 100644 editor/libeditor/tests/test_bug635636.html create mode 100644 editor/libeditor/tests/test_bug638596.html create mode 100644 editor/libeditor/tests/test_bug641466.html create mode 100644 editor/libeditor/tests/test_bug645914.html create mode 100644 editor/libeditor/tests/test_bug646194.html create mode 100644 editor/libeditor/tests/test_bug668599.html create mode 100644 editor/libeditor/tests/test_bug674770-1.html create mode 100644 editor/libeditor/tests/test_bug674770-2.html create mode 100644 editor/libeditor/tests/test_bug674861.html create mode 100644 editor/libeditor/tests/test_bug676401.html create mode 100644 editor/libeditor/tests/test_bug677752.html create mode 100644 editor/libeditor/tests/test_bug681229.html create mode 100644 editor/libeditor/tests/test_bug686203.html create mode 100644 editor/libeditor/tests/test_bug692520.html create mode 100644 editor/libeditor/tests/test_bug697842.html create mode 100644 editor/libeditor/tests/test_bug725069.html create mode 100644 editor/libeditor/tests/test_bug735059.html create mode 100644 editor/libeditor/tests/test_bug738366.html create mode 100644 editor/libeditor/tests/test_bug740784.html create mode 100644 editor/libeditor/tests/test_bug742261.html create mode 100644 editor/libeditor/tests/test_bug757371.html create mode 100644 editor/libeditor/tests/test_bug757771.html create mode 100644 editor/libeditor/tests/test_bug772796.html create mode 100644 editor/libeditor/tests/test_bug773262.html create mode 100644 editor/libeditor/tests/test_bug780035.html create mode 100644 editor/libeditor/tests/test_bug780908.xhtml create mode 100644 editor/libeditor/tests/test_bug787432.html create mode 100644 editor/libeditor/tests/test_bug790475.html create mode 100644 editor/libeditor/tests/test_bug795418-2.html create mode 100644 editor/libeditor/tests/test_bug795418-3.html create mode 100644 editor/libeditor/tests/test_bug795418-4.html create mode 100644 editor/libeditor/tests/test_bug795418-5.html create mode 100644 editor/libeditor/tests/test_bug795418-6.html create mode 100644 editor/libeditor/tests/test_bug795418.html create mode 100644 editor/libeditor/tests/test_bug795785.html create mode 100644 editor/libeditor/tests/test_bug796839.html create mode 100644 editor/libeditor/tests/test_bug830600.html create mode 100644 editor/libeditor/tests/test_bug832025.html create mode 100644 editor/libeditor/tests/test_bug850043.html create mode 100644 editor/libeditor/tests/test_bug857487.html create mode 100644 editor/libeditor/tests/test_bug858918.html create mode 100644 editor/libeditor/tests/test_bug915962.html create mode 100644 editor/libeditor/tests/test_bug966155.html create mode 100644 editor/libeditor/tests/test_bug966552.html create mode 100644 editor/libeditor/tests/test_bug974309.html create mode 100644 editor/libeditor/tests/test_bug998188.html create mode 100644 editor/libeditor/tests/test_can_undo_after_setting_value.xhtml create mode 100644 editor/libeditor/tests/test_cannot_undo_after_reinitializing_editor.html create mode 100644 editor/libeditor/tests/test_caret_move_in_vertical_content.html create mode 100644 editor/libeditor/tests/test_cmd_absPos.html create mode 100644 editor/libeditor/tests/test_cmd_backgroundColor.html create mode 100644 editor/libeditor/tests/test_cmd_fontFace_with_empty_string.html create mode 100644 editor/libeditor/tests/test_cmd_fontFace_with_tt.html create mode 100644 editor/libeditor/tests/test_cmd_increaseFont.html create mode 100644 editor/libeditor/tests/test_cmd_paragraphState.html create mode 100644 editor/libeditor/tests/test_composition_event_created_in_chrome.html create mode 100644 editor/libeditor/tests/test_composition_with_highlight_in_texteditor.html create mode 100644 editor/libeditor/tests/test_contenteditable_focus.html create mode 100644 editor/libeditor/tests/test_contenteditable_text_input_handling.html create mode 100644 editor/libeditor/tests/test_cut_copy_delete_command_enabled.html create mode 100644 editor/libeditor/tests/test_cut_copy_delete_command_enabled.xhtml create mode 100644 editor/libeditor/tests/test_cut_copy_password.html create mode 100644 editor/libeditor/tests/test_defaultParagraphSeparatorBR_between_blocks.html create mode 100644 editor/libeditor/tests/test_dom_input_event_on_htmleditor.html create mode 100644 editor/libeditor/tests/test_dom_input_event_on_texteditor.html create mode 100644 editor/libeditor/tests/test_dragdrop.html create mode 100644 editor/libeditor/tests/test_execCommandPaste_noTarget.html create mode 100644 editor/libeditor/tests/test_focus_caret_navigation_between_nested_editors.html create mode 100644 editor/libeditor/tests/test_focused_document_element_becoming_editable.html create mode 100644 editor/libeditor/tests/test_handle_new_lines.html create mode 100644 editor/libeditor/tests/test_htmleditor_keyevent_handling.html create mode 100644 editor/libeditor/tests/test_htmleditor_tab_key_handling.html create mode 100644 editor/libeditor/tests/test_initial_selection_and_caret_of_designMode.html create mode 100644 editor/libeditor/tests/test_inlineTableEditing.html create mode 100644 editor/libeditor/tests/test_inline_style_cache.html create mode 100644 editor/libeditor/tests/test_insertHTML_starting_with_multiple_comment_nodes.html create mode 100644 editor/libeditor/tests/test_insertParagraph_in_h2_and_li.html create mode 100644 editor/libeditor/tests/test_insertParagraph_in_inline_editing_host.html create mode 100644 editor/libeditor/tests/test_join_split_node_direction_change_command.html create mode 100644 editor/libeditor/tests/test_keypress_untrusted_event.html create mode 100644 editor/libeditor/tests/test_label_contenteditable.html create mode 100644 editor/libeditor/tests/test_middle_click_paste.html create mode 100644 editor/libeditor/tests/test_nsIEditorMailSupport_insertAsCitedQuotation.html create mode 100644 editor/libeditor/tests/test_nsIEditorMailSupport_insertTextWithQuotations.html create mode 100644 editor/libeditor/tests/test_nsIEditor_beginningOfDocument.html create mode 100644 editor/libeditor/tests/test_nsIEditor_canUndo_canRedo.html create mode 100644 editor/libeditor/tests/test_nsIEditor_clearUndoRedo.html create mode 100644 editor/libeditor/tests/test_nsIEditor_documentCharacterSet.html create mode 100644 editor/libeditor/tests/test_nsIEditor_documentIsEmpty.html create mode 100644 editor/libeditor/tests/test_nsIEditor_insertLineBreak.html create mode 100644 editor/libeditor/tests/test_nsIEditor_isSelectionEditable.html create mode 100644 editor/libeditor/tests/test_nsIEditor_outputToString.html create mode 100644 editor/libeditor/tests/test_nsIEditor_undoAll.html create mode 100644 editor/libeditor/tests/test_nsIEditor_undoRedoEnabled.html create mode 100644 editor/libeditor/tests/test_nsIHTMLEditor_getElementOrParentByTagName.html create mode 100644 editor/libeditor/tests/test_nsIHTMLEditor_getParagraphState.html create mode 100644 editor/libeditor/tests/test_nsIHTMLEditor_getSelectedElement.html create mode 100644 editor/libeditor/tests/test_nsIHTMLEditor_insertElementAtSelection.html create mode 100644 editor/libeditor/tests/test_nsIHTMLEditor_removeInlineProperty.html create mode 100644 editor/libeditor/tests/test_nsIHTMLEditor_selectElement.html create mode 100644 editor/libeditor/tests/test_nsIHTMLEditor_setBackgroundColor.html create mode 100644 editor/libeditor/tests/test_nsIHTMLObjectResizer_hideResizers.html create mode 100644 editor/libeditor/tests/test_nsITableEditor_deleteTableCell.html create mode 100644 editor/libeditor/tests/test_nsITableEditor_deleteTableCellContents.html create mode 100644 editor/libeditor/tests/test_nsITableEditor_deleteTableColumn.html create mode 100644 editor/libeditor/tests/test_nsITableEditor_deleteTableRow.html create mode 100644 editor/libeditor/tests/test_nsITableEditor_getCellAt.html create mode 100644 editor/libeditor/tests/test_nsITableEditor_getCellDataAt.html create mode 100644 editor/libeditor/tests/test_nsITableEditor_getCellIndexes.html create mode 100644 editor/libeditor/tests/test_nsITableEditor_getFirstRow.html create mode 100644 editor/libeditor/tests/test_nsITableEditor_getFirstSelectedCellInTable.html create mode 100644 editor/libeditor/tests/test_nsITableEditor_getSelectedCells.html create mode 100644 editor/libeditor/tests/test_nsITableEditor_getSelectedCellsType.html create mode 100644 editor/libeditor/tests/test_nsITableEditor_getSelectedOrParentTableElement.html create mode 100644 editor/libeditor/tests/test_nsITableEditor_getTableSize.html create mode 100644 editor/libeditor/tests/test_nsITableEditor_insertTableCell.html create mode 100644 editor/libeditor/tests/test_nsITableEditor_insertTableColumn.html create mode 100644 editor/libeditor/tests/test_nsITableEditor_insertTableRow.html create mode 100644 editor/libeditor/tests/test_password_input_with_unmasked_range.html create mode 100644 editor/libeditor/tests/test_password_paste.html create mode 100644 editor/libeditor/tests/test_password_per_word_operation.html create mode 100644 editor/libeditor/tests/test_password_unmask_API.html create mode 100644 editor/libeditor/tests/test_pasteImgFromTransferable.html create mode 100644 editor/libeditor/tests/test_pasteImgTextarea.html create mode 100644 editor/libeditor/tests/test_pasteImgTextarea.xhtml create mode 100644 editor/libeditor/tests/test_paste_as_quote_in_text_control.html create mode 100644 editor/libeditor/tests/test_paste_no_formatting.html create mode 100644 editor/libeditor/tests/test_paste_redirect_focus_in_paste_event_listener.html create mode 100644 editor/libeditor/tests/test_pasting_in_root_element.xhtml create mode 100644 editor/libeditor/tests/test_pasting_in_temporarily_created_div_outside_body.html create mode 100644 editor/libeditor/tests/test_pasting_table_rows.html create mode 100644 editor/libeditor/tests/test_pasting_text_longer_than_maxlength.html create mode 100644 editor/libeditor/tests/test_resizers_appearance.html create mode 100644 editor/libeditor/tests/test_resizers_resizing_elements.html create mode 100644 editor/libeditor/tests/test_root_element_replacement.html create mode 100644 editor/libeditor/tests/test_sanitizer_on_paste.html create mode 100644 editor/libeditor/tests/test_select_all_without_body.html create mode 100644 editor/libeditor/tests/test_selection_move_commands.html create mode 100644 editor/libeditor/tests/test_setting_value_longer_than_maxlength_with_setUserInput.html create mode 100644 editor/libeditor/tests/test_spellcheck_pref.html create mode 100644 editor/libeditor/tests/test_state_change_on_reframe.html create mode 100644 editor/libeditor/tests/test_textarea_value_not_include_cr.html create mode 100644 editor/libeditor/tests/test_texteditor_keyevent_handling.html create mode 100644 editor/libeditor/tests/test_texteditor_textnode.html create mode 100644 editor/libeditor/tests/test_texteditor_tripleclick_setvalue.html create mode 100644 editor/libeditor/tests/test_texteditor_wrapping_long_line.html create mode 100644 editor/libeditor/tests/test_typing_at_edge_of_anchor.html create mode 100644 editor/libeditor/tests/test_undo_after_spellchecker_replaces_word.html create mode 100644 editor/libeditor/tests/test_undo_redo_stack_after_setting_value.html create mode 100644 editor/libeditor/tests/test_undo_with_editingui.html create mode 100644 editor/moz.build create mode 100644 editor/nsIDocumentStateListener.idl create mode 100644 editor/nsIEditActionListener.idl create mode 100644 editor/nsIEditor.idl create mode 100644 editor/nsIEditorMailSupport.idl create mode 100644 editor/nsIEditorSpellCheck.idl create mode 100644 editor/nsIHTMLAbsPosEditor.idl create mode 100644 editor/nsIHTMLEditor.idl create mode 100644 editor/nsIHTMLInlineTableEditor.idl create mode 100644 editor/nsIHTMLObjectResizer.idl create mode 100644 editor/nsITableEditor.idl create mode 100644 editor/reftests/1088158-ref.html create mode 100644 editor/reftests/1088158.html create mode 100644 editor/reftests/1443902-1-ref.html create mode 100644 editor/reftests/1443902-1.html create mode 100644 editor/reftests/1443902-2-ref.html create mode 100644 editor/reftests/1443902-2.html create mode 100644 editor/reftests/1443902-3-ref.html create mode 100644 editor/reftests/1443902-3.html create mode 100644 editor/reftests/1443902-4-ref.html create mode 100644 editor/reftests/1443902-4.html create mode 100644 editor/reftests/338427-1-ref.html create mode 100644 editor/reftests/338427-1.html create mode 100644 editor/reftests/338427-2-ref.html create mode 100644 editor/reftests/338427-2.html create mode 100644 editor/reftests/338427-3-ref.html create mode 100644 editor/reftests/338427-3.html create mode 100644 editor/reftests/388980-1-ref.html create mode 100644 editor/reftests/388980-1.html create mode 100644 editor/reftests/462758-grabbers-resizers-ref.html create mode 100644 editor/reftests/462758-grabbers-resizers.html create mode 100644 editor/reftests/642800-iframe.html create mode 100644 editor/reftests/642800-ref.html create mode 100644 editor/reftests/642800.html create mode 100644 editor/reftests/672709-ref.html create mode 100644 editor/reftests/672709.html create mode 100644 editor/reftests/674212-spellcheck-ref.html create mode 100644 editor/reftests/674212-spellcheck.html create mode 100644 editor/reftests/694880-1.html create mode 100644 editor/reftests/694880-2.html create mode 100644 editor/reftests/694880-3.html create mode 100644 editor/reftests/694880-ref.html create mode 100644 editor/reftests/824080-1-ref.html create mode 100644 editor/reftests/824080-1.html create mode 100644 editor/reftests/824080-2-ref.html create mode 100644 editor/reftests/824080-2.html create mode 100644 editor/reftests/824080-3-ref.html create mode 100644 editor/reftests/824080-3.html create mode 100644 editor/reftests/824080-4-ref.html create mode 100644 editor/reftests/824080-4.html create mode 100644 editor/reftests/824080-5-ref.html create mode 100644 editor/reftests/824080-5.html create mode 100644 editor/reftests/824080-6-ref.html create mode 100644 editor/reftests/824080-6.html create mode 100644 editor/reftests/824080-7-ref.html create mode 100644 editor/reftests/824080-7.html create mode 100644 editor/reftests/911201-ref.html create mode 100644 editor/reftests/911201.html create mode 100644 editor/reftests/969773-ref.html create mode 100644 editor/reftests/969773.html create mode 100644 editor/reftests/997805-ref.html create mode 100644 editor/reftests/997805.html create mode 100644 editor/reftests/caret_after_reframe-ref.html create mode 100644 editor/reftests/caret_after_reframe.html create mode 100644 editor/reftests/caret_on_focus-ref.html create mode 100644 editor/reftests/caret_on_focus.html create mode 100644 editor/reftests/caret_on_positioned-ref.html create mode 100644 editor/reftests/caret_on_positioned.html create mode 100644 editor/reftests/caret_on_presshell_reinit-2.html create mode 100644 editor/reftests/caret_on_presshell_reinit-ref.html create mode 100644 editor/reftests/caret_on_presshell_reinit.html create mode 100644 editor/reftests/caret_on_textarea_lastline-ref.html create mode 100644 editor/reftests/caret_on_textarea_lastline.html create mode 100644 editor/reftests/dynamic-1.html create mode 100644 editor/reftests/dynamic-overflow-change-ref.html create mode 100644 editor/reftests/dynamic-overflow-change.html create mode 100644 editor/reftests/dynamic-ref.html create mode 100644 editor/reftests/dynamic-type-1.html create mode 100644 editor/reftests/dynamic-type-2.html create mode 100644 editor/reftests/dynamic-type-3.html create mode 100644 editor/reftests/dynamic-type-4.html create mode 100644 editor/reftests/emptypasswd-1.html create mode 100644 editor/reftests/emptypasswd-2.html create mode 100644 editor/reftests/emptypasswd-ref.html create mode 100644 editor/reftests/exec-command-indent-ws-ref.html create mode 100644 editor/reftests/exec-command-indent-ws.html create mode 100644 editor/reftests/inline-table-editor-position-after-updating-table-size-from-input-event-listener-ref.html create mode 100644 editor/reftests/inline-table-editor-position-after-updating-table-size-from-input-event-listener.html create mode 100644 editor/reftests/input-text-notheme-onfocus-reframe-ref.html create mode 100644 editor/reftests/input-text-notheme-onfocus-reframe.html create mode 100644 editor/reftests/input-text-onfocus-reframe-ref.html create mode 100644 editor/reftests/input-text-onfocus-reframe.html create mode 100644 editor/reftests/newline-1.html create mode 100644 editor/reftests/newline-2.html create mode 100644 editor/reftests/newline-3.html create mode 100644 editor/reftests/newline-4.html create mode 100644 editor/reftests/newline-ref.html create mode 100644 editor/reftests/nobogusnode-1.html create mode 100644 editor/reftests/nobogusnode-2.html create mode 100644 editor/reftests/nobogusnode-ref.html create mode 100644 editor/reftests/passwd-1.html create mode 100644 editor/reftests/passwd-2.html create mode 100644 editor/reftests/passwd-3.html create mode 100644 editor/reftests/passwd-4.html create mode 100644 editor/reftests/passwd-5-with-Preview.html create mode 100644 editor/reftests/passwd-5-with-TextEditor.html create mode 100644 editor/reftests/passwd-6-ref.html create mode 100644 editor/reftests/passwd-6-with-Preview.html create mode 100644 editor/reftests/passwd-6-with-TextEditor.html create mode 100644 editor/reftests/passwd-7-with-Preview.html create mode 100644 editor/reftests/passwd-7-with-TextEditor.html create mode 100644 editor/reftests/passwd-8-with-Preview.html create mode 100644 editor/reftests/passwd-8-with-TextEditor.html create mode 100644 editor/reftests/passwd-9-with-Preview.html create mode 100644 editor/reftests/passwd-9-with-TextEditor.html create mode 100644 editor/reftests/passwd-ref.html create mode 100644 editor/reftests/readonly-editable-ref.html create mode 100644 editor/reftests/readonly-editable.html create mode 100644 editor/reftests/readonly-non-editable-ref.html create mode 100644 editor/reftests/readonly-non-editable.html create mode 100644 editor/reftests/readwrite-editable-ref.html create mode 100644 editor/reftests/readwrite-editable.html create mode 100644 editor/reftests/readwrite-non-editable-ref.html create mode 100644 editor/reftests/readwrite-non-editable.html create mode 100644 editor/reftests/reftest.list create mode 100644 editor/reftests/selection_visibility_after_reframe-2.html create mode 100644 editor/reftests/selection_visibility_after_reframe-3.html create mode 100644 editor/reftests/selection_visibility_after_reframe-ref.html create mode 100644 editor/reftests/selection_visibility_after_reframe.html create mode 100644 editor/reftests/spellcheck-comma-valid-ref.html create mode 100644 editor/reftests/spellcheck-comma-valid.html create mode 100644 editor/reftests/spellcheck-contenteditable-attr-dynamic-inherit.html create mode 100644 editor/reftests/spellcheck-contenteditable-attr-dynamic-override-inherit.html create mode 100644 editor/reftests/spellcheck-contenteditable-attr-dynamic-override.html create mode 100644 editor/reftests/spellcheck-contenteditable-attr-dynamic.html create mode 100644 editor/reftests/spellcheck-contenteditable-attr-inherit.html create mode 100644 editor/reftests/spellcheck-contenteditable-attr.html create mode 100644 editor/reftests/spellcheck-contenteditable-disabled-partial-ref.html create mode 100644 editor/reftests/spellcheck-contenteditable-disabled-partial.html create mode 100644 editor/reftests/spellcheck-contenteditable-disabled-ref.html create mode 100644 editor/reftests/spellcheck-contenteditable-disabled.html create mode 100644 editor/reftests/spellcheck-contenteditable-focused-reframe.html create mode 100644 editor/reftests/spellcheck-contenteditable-focused.html create mode 100644 editor/reftests/spellcheck-contenteditable-nofocus-1.html create mode 100644 editor/reftests/spellcheck-contenteditable-nofocus-2.html create mode 100644 editor/reftests/spellcheck-contenteditable-nofocus-ref.html create mode 100644 editor/reftests/spellcheck-contenteditable-property-dynamic-inherit.html create mode 100644 editor/reftests/spellcheck-contenteditable-property-dynamic-override-inherit.html create mode 100644 editor/reftests/spellcheck-contenteditable-property-dynamic-override.html create mode 100644 editor/reftests/spellcheck-contenteditable-property-dynamic.html create mode 100644 editor/reftests/spellcheck-contenteditable-ref.html create mode 100644 editor/reftests/spellcheck-dotafterquote-valid-ref.html create mode 100644 editor/reftests/spellcheck-dotafterquote-valid.html create mode 100644 editor/reftests/spellcheck-hyphen-invalid-ref.html create mode 100644 editor/reftests/spellcheck-hyphen-invalid.html create mode 100644 editor/reftests/spellcheck-hyphen-multiple-invalid-ref.html create mode 100644 editor/reftests/spellcheck-hyphen-multiple-invalid.html create mode 100644 editor/reftests/spellcheck-hyphen-multiple-valid-ref.html create mode 100644 editor/reftests/spellcheck-hyphen-multiple-valid.html create mode 100644 editor/reftests/spellcheck-hyphen-valid-ref.html create mode 100644 editor/reftests/spellcheck-hyphen-valid.html create mode 100644 editor/reftests/spellcheck-input-attr-after.html create mode 100644 editor/reftests/spellcheck-input-attr-before.html create mode 100644 editor/reftests/spellcheck-input-attr-dynamic-inherit.html create mode 100644 editor/reftests/spellcheck-input-attr-dynamic-override-inherit.html create mode 100644 editor/reftests/spellcheck-input-attr-dynamic-override.html create mode 100644 editor/reftests/spellcheck-input-attr-dynamic.html create mode 100644 editor/reftests/spellcheck-input-attr-inherit.html create mode 100644 editor/reftests/spellcheck-input-disabled.html create mode 100644 editor/reftests/spellcheck-input-nofocus-ref.html create mode 100644 editor/reftests/spellcheck-input-property-dynamic-inherit.html create mode 100644 editor/reftests/spellcheck-input-property-dynamic-override-inherit.html create mode 100644 editor/reftests/spellcheck-input-property-dynamic-override.html create mode 100644 editor/reftests/spellcheck-input-property-dynamic.html create mode 100644 editor/reftests/spellcheck-input-ref.html create mode 100644 editor/reftests/spellcheck-non-latin-arabic-ref.html create mode 100644 editor/reftests/spellcheck-non-latin-arabic.html create mode 100644 editor/reftests/spellcheck-non-latin-chinese-simplified-ref.html create mode 100644 editor/reftests/spellcheck-non-latin-chinese-simplified.html create mode 100644 editor/reftests/spellcheck-non-latin-chinese-traditional-ref.html create mode 100644 editor/reftests/spellcheck-non-latin-chinese-traditional.html create mode 100644 editor/reftests/spellcheck-non-latin-hebrew-ref.html create mode 100644 editor/reftests/spellcheck-non-latin-hebrew.html create mode 100644 editor/reftests/spellcheck-non-latin-japanese-ref.html create mode 100644 editor/reftests/spellcheck-non-latin-japanese.html create mode 100644 editor/reftests/spellcheck-non-latin-korean-ref.html create mode 100644 editor/reftests/spellcheck-non-latin-korean.html create mode 100644 editor/reftests/spellcheck-period-valid-ref.html create mode 100644 editor/reftests/spellcheck-period-valid.html create mode 100644 editor/reftests/spellcheck-slash-valid-ref.html create mode 100644 editor/reftests/spellcheck-slash-valid.html create mode 100644 editor/reftests/spellcheck-space-valid-ref.html create mode 100644 editor/reftests/spellcheck-space-valid.html create mode 100644 editor/reftests/spellcheck-superscript-1-ref.html create mode 100644 editor/reftests/spellcheck-superscript-1.html create mode 100644 editor/reftests/spellcheck-superscript-2-ref.html create mode 100644 editor/reftests/spellcheck-superscript-2.html create mode 100644 editor/reftests/spellcheck-textarea-attr-dynamic-inherit.html create mode 100644 editor/reftests/spellcheck-textarea-attr-dynamic-override-inherit.html create mode 100644 editor/reftests/spellcheck-textarea-attr-dynamic-override.html create mode 100644 editor/reftests/spellcheck-textarea-attr-dynamic.html create mode 100644 editor/reftests/spellcheck-textarea-attr-inherit.html create mode 100644 editor/reftests/spellcheck-textarea-attr.html create mode 100644 editor/reftests/spellcheck-textarea-disabled.html create mode 100644 editor/reftests/spellcheck-textarea-focused-notreadonly.html create mode 100644 editor/reftests/spellcheck-textarea-focused-reframe.html create mode 100644 editor/reftests/spellcheck-textarea-focused.html create mode 100644 editor/reftests/spellcheck-textarea-nofocus-ref.html create mode 100644 editor/reftests/spellcheck-textarea-nofocus.html create mode 100644 editor/reftests/spellcheck-textarea-property-dynamic-inherit.html create mode 100644 editor/reftests/spellcheck-textarea-property-dynamic-override-inherit.html create mode 100644 editor/reftests/spellcheck-textarea-property-dynamic-override.html create mode 100644 editor/reftests/spellcheck-textarea-property-dynamic.html create mode 100644 editor/reftests/spellcheck-textarea-ref.html create mode 100644 editor/reftests/spellcheck-textarea-ref2.html create mode 100644 editor/reftests/spellcheck-url-valid-ref.html create mode 100644 editor/reftests/spellcheck-url-valid.html create mode 100644 editor/reftests/unneeded_scroll-ref.html create mode 100644 editor/reftests/unneeded_scroll.html create mode 100644 editor/reftests/xul/empty-ref.xhtml create mode 100644 editor/reftests/xul/emptytextbox-4.xhtml create mode 100644 editor/reftests/xul/emptytextbox-ref.xhtml create mode 100644 editor/reftests/xul/input.css create mode 100644 editor/reftests/xul/placeholder-reset.css create mode 100644 editor/reftests/xul/platform.js create mode 100644 editor/reftests/xul/reftest.list create mode 100644 editor/spellchecker/EditorSpellCheck.cpp create mode 100644 editor/spellchecker/EditorSpellCheck.h create mode 100644 editor/spellchecker/FilteredContentIterator.cpp create mode 100644 editor/spellchecker/FilteredContentIterator.h create mode 100644 editor/spellchecker/TextServicesDocument.cpp create mode 100644 editor/spellchecker/TextServicesDocument.h create mode 100644 editor/spellchecker/moz.build create mode 100644 editor/spellchecker/nsComposeTxtSrvFilter.cpp create mode 100644 editor/spellchecker/nsComposeTxtSrvFilter.h create mode 100644 editor/spellchecker/nsIInlineSpellChecker.idl create mode 100644 editor/spellchecker/tests/bug1200533_subframe.html create mode 100644 editor/spellchecker/tests/bug1204147_subframe.html create mode 100644 editor/spellchecker/tests/bug1204147_subframe2.html create mode 100644 editor/spellchecker/tests/bug678842_subframe.html create mode 100644 editor/spellchecker/tests/bug717433_subframe.html create mode 100644 editor/spellchecker/tests/chrome.ini create mode 100644 editor/spellchecker/tests/de-DE/de_DE.aff create mode 100644 editor/spellchecker/tests/de-DE/de_DE.dic create mode 100644 editor/spellchecker/tests/en-AU/en_AU.aff create mode 100644 editor/spellchecker/tests/en-AU/en_AU.dic create mode 100644 editor/spellchecker/tests/en-GB/en_GB.aff create mode 100644 editor/spellchecker/tests/en-GB/en_GB.dic create mode 100644 editor/spellchecker/tests/mochitest.ini create mode 100644 editor/spellchecker/tests/multiple_content_languages_subframe.html create mode 100644 editor/spellchecker/tests/ru-RU/ru_RU.aff create mode 100644 editor/spellchecker/tests/ru-RU/ru_RU.dic create mode 100644 editor/spellchecker/tests/spellcheck.js create mode 100644 editor/spellchecker/tests/test_async_UpdateCurrentDictionary.html create mode 100644 editor/spellchecker/tests/test_bug1100966.html create mode 100644 editor/spellchecker/tests/test_bug1154791.html create mode 100644 editor/spellchecker/tests/test_bug1200533.html create mode 100644 editor/spellchecker/tests/test_bug1204147.html create mode 100644 editor/spellchecker/tests/test_bug1205983.html create mode 100644 editor/spellchecker/tests/test_bug1209414.html create mode 100644 editor/spellchecker/tests/test_bug1219928.html create mode 100644 editor/spellchecker/tests/test_bug1365383.html create mode 100644 editor/spellchecker/tests/test_bug1368544.html create mode 100644 editor/spellchecker/tests/test_bug1402822.html create mode 100644 editor/spellchecker/tests/test_bug1418629.html create mode 100644 editor/spellchecker/tests/test_bug1497480.html create mode 100644 editor/spellchecker/tests/test_bug1602526.html create mode 100644 editor/spellchecker/tests/test_bug1761273.html create mode 100644 editor/spellchecker/tests/test_bug1773802.html create mode 100644 editor/spellchecker/tests/test_bug1837268.html create mode 100644 editor/spellchecker/tests/test_bug338427.html create mode 100644 editor/spellchecker/tests/test_bug366682.html create mode 100644 editor/spellchecker/tests/test_bug432225.html create mode 100644 editor/spellchecker/tests/test_bug484181.html create mode 100644 editor/spellchecker/tests/test_bug596333.html create mode 100644 editor/spellchecker/tests/test_bug636465.html create mode 100644 editor/spellchecker/tests/test_bug678842.html create mode 100644 editor/spellchecker/tests/test_bug697981.html create mode 100644 editor/spellchecker/tests/test_bug717433.html create mode 100644 editor/spellchecker/tests/test_multiple_content_languages.html create mode 100644 editor/spellchecker/tests/test_nsIEditorSpellCheck_ReplaceWord.html create mode 100644 editor/spellchecker/tests/test_spellcheck_after_edit.html create mode 100644 editor/spellchecker/tests/test_spellcheck_after_pressing_navigation_key.html create mode 100644 editor/spellchecker/tests/test_spellcheck_selection.html create mode 100644 editor/spellchecker/tests/test_suggest.html create mode 100644 editor/txmgr/TransactionItem.cpp create mode 100644 editor/txmgr/TransactionItem.h create mode 100644 editor/txmgr/TransactionManager.cpp create mode 100644 editor/txmgr/TransactionManager.h create mode 100644 editor/txmgr/TransactionStack.cpp create mode 100644 editor/txmgr/TransactionStack.h create mode 100644 editor/txmgr/moz.build create mode 100644 editor/txmgr/nsITransaction.idl create mode 100644 editor/txmgr/nsITransactionManager.idl create mode 100644 editor/txmgr/nsTransactionManagerCID.h create mode 100644 editor/txmgr/tests/TestTXMgr.cpp create mode 100644 editor/txmgr/tests/crashtests/407072-1.html create mode 100644 editor/txmgr/tests/crashtests/449006-1.html create mode 100644 editor/txmgr/tests/crashtests/crashtests.list create mode 100644 editor/txmgr/tests/moz.build (limited to 'editor') diff --git a/editor/AsyncSpellCheckTestHelper.sys.mjs b/editor/AsyncSpellCheckTestHelper.sys.mjs new file mode 100644 index 0000000000..6ceb2a86b2 --- /dev/null +++ b/editor/AsyncSpellCheckTestHelper.sys.mjs @@ -0,0 +1,125 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +const SPELL_CHECK_ENDED_TOPIC = "inlineSpellChecker-spellCheck-ended"; +const SPELL_CHECK_STARTED_TOPIC = "inlineSpellChecker-spellCheck-started"; + +const CP = Cc["@mozilla.org/content-pref/service;1"].getService( + Ci.nsIContentPrefService2 +); + +/** + * Waits until spell checking has stopped on the given element. + * + * When a spell check is pending, this waits indefinitely until the spell check + * ends. When a spell check is not pending, it waits a small number of turns of + * the event loop: if a spell check begins, it resumes waiting indefinitely for + * the end, and otherwise it stops waiting and calls the callback. + * + * This this can therefore trap spell checks that have not started at the time + * of calling, spell checks that have already started, multiple consecutive + * spell checks, and the absence of spell checks altogether. + * + * @param editableElement The element being spell checked. + * @param callback Called when spell check has completed or enough turns + * of the event loop have passed to determine it has not + * started. + */ +export function maybeOnSpellCheck(editableElement, callback) { + let editor = editableElement.editor; + if (!editor) { + let win = editableElement.ownerGlobal; + editor = win.docShell.editingSession.getEditorForWindow(win); + } + if (!editor) { + throw new Error("Unable to find editor for element " + editableElement); + } + + try { + // False is important here. Pass false so that the inline spell checker + // isn't created if it doesn't already exist. + var isc = editor.getInlineSpellChecker(false); + } catch (err) { + // getInlineSpellChecker throws if spell checking is not enabled instead of + // just returning null, which seems kind of lame. (Spell checking is not + // enabled on Android.) The point here is only to determine whether spell + // check is pending, and if getInlineSpellChecker throws, then it's not + // pending. + } + let waitingForEnded = isc && isc.spellCheckPending; + let count = 0; + + function observe(subj, topic, data) { + if (subj != editor) { + return; + } + count = 0; + let expectedTopic = waitingForEnded + ? SPELL_CHECK_ENDED_TOPIC + : SPELL_CHECK_STARTED_TOPIC; + if (topic != expectedTopic) { + console.error("Expected " + expectedTopic + " but got " + topic + "!"); + } + waitingForEnded = !waitingForEnded; + } + + // eslint-disable-next-line mozilla/use-services + let os = Cc["@mozilla.org/observer-service;1"].getService( + Ci.nsIObserverService + ); + os.addObserver(observe, SPELL_CHECK_STARTED_TOPIC); + os.addObserver(observe, SPELL_CHECK_ENDED_TOPIC); + + let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); + timer.init( + function tick() { + // Wait an arbitrarily large number -- 100 -- turns of the event loop before + // declaring that no spell checks will start. + if (waitingForEnded || ++count < 100) { + return; + } + timer.cancel(); + os.removeObserver(observe, SPELL_CHECK_STARTED_TOPIC); + os.removeObserver(observe, SPELL_CHECK_ENDED_TOPIC); + callback(); + }, + 0, + Ci.nsITimer.TYPE_REPEATING_SLACK + ); +} + +/** + * Waits until spell checking has stopped on the given element. + * + * @param editableElement The element being spell checked. + * @param callback Called when spell check has completed or enough turns + * of the event loop have passed to determine it has not + * started. + */ +export function onSpellCheck(editableElement, callback) { + const { TestUtils } = ChromeUtils.importESModule( + "resource://testing-common/TestUtils.sys.mjs" + ); + + let editor = editableElement.editor; + TestUtils.topicObserved(SPELL_CHECK_ENDED_TOPIC, s => s == editor).then( + callback + ); +} + +export async function getDictionaryContentPref() { + let dictionaries = await new Promise(resolve => { + let value = ""; + CP.getByDomainAndName("mochi.test", "spellcheck.lang", null, { + handleResult(pref) { + value = pref.value; + }, + handleCompletion() { + resolve(value); + }, + }); + }); + + return dictionaries; +} diff --git a/editor/composer/ComposerCommandsUpdater.cpp b/editor/composer/ComposerCommandsUpdater.cpp new file mode 100644 index 0000000000..efeb9d9544 --- /dev/null +++ b/editor/composer/ComposerCommandsUpdater.cpp @@ -0,0 +1,199 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "mozilla/ComposerCommandsUpdater.h" + +#include "mozilla/mozalloc.h" // for operator new +#include "mozilla/TransactionManager.h" // for TransactionManager +#include "mozilla/dom/Selection.h" +#include "nsCommandManager.h" // for nsCommandManager +#include "nsComponentManagerUtils.h" // for do_CreateInstance +#include "nsDebug.h" // for NS_ENSURE_TRUE, etc +#include "nsDocShell.h" // for nsIDocShell +#include "nsError.h" // for NS_OK, NS_ERROR_FAILURE, etc +#include "nsID.h" // for NS_GET_IID, etc +#include "nsIInterfaceRequestorUtils.h" // for do_GetInterface +#include "nsLiteralString.h" // for NS_LITERAL_STRING +#include "nsPIDOMWindow.h" // for nsPIDOMWindow + +class nsITransaction; + +namespace mozilla { + +ComposerCommandsUpdater::ComposerCommandsUpdater() + : mDirtyState(eStateUninitialized), + mSelectionCollapsed(eStateUninitialized), + mFirstDoOfFirstUndo(true) {} + +ComposerCommandsUpdater::~ComposerCommandsUpdater() { + // cancel any outstanding update timer + if (mUpdateTimer) { + mUpdateTimer->Cancel(); + } +} + +NS_IMPL_CYCLE_COLLECTING_ADDREF(ComposerCommandsUpdater) +NS_IMPL_CYCLE_COLLECTING_RELEASE(ComposerCommandsUpdater) + +NS_INTERFACE_MAP_BEGIN(ComposerCommandsUpdater) + NS_INTERFACE_MAP_ENTRY(nsITimerCallback) + NS_INTERFACE_MAP_ENTRY(nsINamed) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsITimerCallback) + NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(ComposerCommandsUpdater) +NS_INTERFACE_MAP_END + +NS_IMPL_CYCLE_COLLECTION(ComposerCommandsUpdater, mUpdateTimer, mDOMWindow, + mDocShell) + +#if 0 +# pragma mark - +#endif + +void ComposerCommandsUpdater::DidDoTransaction( + TransactionManager& aTransactionManager) { + // only need to update if the status of the Undo menu item changes. + if (aTransactionManager.NumberOfUndoItems() == 1) { + if (mFirstDoOfFirstUndo) { + UpdateCommandGroup(CommandGroup::Undo); + } + mFirstDoOfFirstUndo = false; + } +} + +void ComposerCommandsUpdater::DidUndoTransaction( + TransactionManager& aTransactionManager) { + if (!aTransactionManager.NumberOfUndoItems()) { + mFirstDoOfFirstUndo = true; // reset the state for the next do + } + UpdateCommandGroup(CommandGroup::Undo); +} + +void ComposerCommandsUpdater::DidRedoTransaction( + TransactionManager& aTransactionManager) { + UpdateCommandGroup(CommandGroup::Undo); +} + +#if 0 +# pragma mark - +#endif + +void ComposerCommandsUpdater::Init(nsPIDOMWindowOuter& aDOMWindow) { + mDOMWindow = &aDOMWindow; + mDocShell = aDOMWindow.GetDocShell(); +} + +nsresult ComposerCommandsUpdater::PrimeUpdateTimer() { + if (!mUpdateTimer) { + mUpdateTimer = NS_NewTimer(); + } + const uint32_t kUpdateTimerDelay = 150; + return mUpdateTimer->InitWithCallback(static_cast(this), + kUpdateTimerDelay, + nsITimer::TYPE_ONE_SHOT); +} + +MOZ_CAN_RUN_SCRIPT_BOUNDARY +void ComposerCommandsUpdater::TimerCallback() { + mSelectionCollapsed = SelectionIsCollapsed(); + UpdateCommandGroup(CommandGroup::Style); +} + +void ComposerCommandsUpdater::UpdateCommandGroup(CommandGroup aCommandGroup) { + RefPtr commandManager = GetCommandManager(); + if (NS_WARN_IF(!commandManager)) { + return; + } + + switch (aCommandGroup) { + case CommandGroup::Undo: + commandManager->CommandStatusChanged("cmd_undo"); + commandManager->CommandStatusChanged("cmd_redo"); + return; + case CommandGroup::Style: + commandManager->CommandStatusChanged("cmd_bold"); + commandManager->CommandStatusChanged("cmd_italic"); + commandManager->CommandStatusChanged("cmd_underline"); + commandManager->CommandStatusChanged("cmd_tt"); + + commandManager->CommandStatusChanged("cmd_strikethrough"); + commandManager->CommandStatusChanged("cmd_superscript"); + commandManager->CommandStatusChanged("cmd_subscript"); + commandManager->CommandStatusChanged("cmd_nobreak"); + + commandManager->CommandStatusChanged("cmd_em"); + commandManager->CommandStatusChanged("cmd_strong"); + commandManager->CommandStatusChanged("cmd_cite"); + commandManager->CommandStatusChanged("cmd_abbr"); + commandManager->CommandStatusChanged("cmd_acronym"); + commandManager->CommandStatusChanged("cmd_code"); + commandManager->CommandStatusChanged("cmd_samp"); + commandManager->CommandStatusChanged("cmd_var"); + + commandManager->CommandStatusChanged("cmd_increaseFont"); + commandManager->CommandStatusChanged("cmd_decreaseFont"); + + commandManager->CommandStatusChanged("cmd_paragraphState"); + commandManager->CommandStatusChanged("cmd_fontFace"); + commandManager->CommandStatusChanged("cmd_fontColor"); + commandManager->CommandStatusChanged("cmd_backgroundColor"); + commandManager->CommandStatusChanged("cmd_highlight"); + return; + case CommandGroup::Save: + commandManager->CommandStatusChanged("cmd_setDocumentModified"); + commandManager->CommandStatusChanged("cmd_save"); + return; + default: + MOZ_ASSERT_UNREACHABLE("New command group hasn't been implemented yet"); + } +} + +nsresult ComposerCommandsUpdater::UpdateOneCommand(const char* aCommand) { + RefPtr commandManager = GetCommandManager(); + NS_ENSURE_TRUE(commandManager, NS_ERROR_FAILURE); + commandManager->CommandStatusChanged(aCommand); + return NS_OK; +} + +bool ComposerCommandsUpdater::SelectionIsCollapsed() { + if (NS_WARN_IF(!mDOMWindow)) { + return true; + } + + RefPtr domSelection = mDOMWindow->GetSelection(); + if (NS_WARN_IF(!domSelection)) { + return false; + } + + return domSelection->IsCollapsed(); +} + +nsCommandManager* ComposerCommandsUpdater::GetCommandManager() { + if (NS_WARN_IF(!mDocShell)) { + return nullptr; + } + return mDocShell->GetCommandManager(); +} + +NS_IMETHODIMP ComposerCommandsUpdater::GetName(nsACString& aName) { + aName.AssignLiteral("ComposerCommandsUpdater"); + return NS_OK; +} + +#if 0 +# pragma mark - +#endif + +nsresult ComposerCommandsUpdater::Notify(nsITimer* aTimer) { + NS_ASSERTION(aTimer == mUpdateTimer.get(), "Hey, this ain't my timer!"); + TimerCallback(); + return NS_OK; +} + +#if 0 +# pragma mark - +#endif + +} // namespace mozilla diff --git a/editor/composer/ComposerCommandsUpdater.h b/editor/composer/ComposerCommandsUpdater.h new file mode 100644 index 0000000000..6cf0886c57 --- /dev/null +++ b/editor/composer/ComposerCommandsUpdater.h @@ -0,0 +1,132 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef mozilla_ComposerCommandsUpdater_h +#define mozilla_ComposerCommandsUpdater_h + +#include "nsCOMPtr.h" // for already_AddRefed, nsCOMPtr +#include "nsCycleCollectionParticipant.h" +#include "nsINamed.h" +#include "nsISupportsImpl.h" // for NS_DECL_ISUPPORTS +#include "nsITimer.h" // for NS_DECL_NSITIMERCALLBACK, etc +#include "nscore.h" // for NS_IMETHOD, nsresult, etc + +class nsCommandManager; +class nsIDocShell; +class nsITransaction; +class nsITransactionManager; +class nsPIDOMWindowOuter; + +namespace mozilla { + +class TransactionManager; + +class ComposerCommandsUpdater final : public nsITimerCallback, public nsINamed { + public: + ComposerCommandsUpdater(); + + // nsISupports + NS_DECL_CYCLE_COLLECTING_ISUPPORTS + NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(ComposerCommandsUpdater, + nsITimerCallback) + + // nsITimerCallback + NS_DECL_NSITIMERCALLBACK + + // nsINamed + NS_DECL_NSINAMED + + void Init(nsPIDOMWindowOuter& aDOMWindow); + + /** + * OnSelectionChange() is called when selection is changed in the editor. + */ + void OnSelectionChange() { PrimeUpdateTimer(); } + + /** + * OnHTMLEditorCreated() is called when `HTMLEditor` is created and + * initialized. + */ + MOZ_CAN_RUN_SCRIPT void OnHTMLEditorCreated() { + UpdateOneCommand("obs_documentCreated"); + } + + /** + * OnBeforeHTMLEditorDestroyed() is called when `HTMLEditor` is being + * destroyed. + */ + MOZ_CAN_RUN_SCRIPT void OnBeforeHTMLEditorDestroyed() { + // cancel any outstanding update timer + if (mUpdateTimer) { + mUpdateTimer->Cancel(); + mUpdateTimer = nullptr; + } + + // We can't notify the command manager of this right now; it is too late in + // some cases and the window is already partially destructed (e.g. JS + // objects may be gone). + } + + /** + * OnHTMLEditorDirtyStateChanged() is called when dirty state of `HTMLEditor` + * is changed form or to "dirty". + */ + MOZ_CAN_RUN_SCRIPT void OnHTMLEditorDirtyStateChanged(bool aNowDirty) { + if (mDirtyState == static_cast(aNowDirty)) { + return; + } + UpdateCommandGroup(CommandGroup::Save); + UpdateCommandGroup(CommandGroup::Undo); + mDirtyState = aNowDirty; + } + + /** + * The following methods are called when aTransactionManager did + * `DoTransaction`, `UndoTransaction` or `RedoTransaction` of a transaction + * instance. + */ + MOZ_CAN_RUN_SCRIPT void DidDoTransaction( + TransactionManager& aTransactionManager); + MOZ_CAN_RUN_SCRIPT void DidUndoTransaction( + TransactionManager& aTransactionManager); + MOZ_CAN_RUN_SCRIPT void DidRedoTransaction( + TransactionManager& aTransactionManager); + + protected: + virtual ~ComposerCommandsUpdater(); + + enum { + eStateUninitialized = -1, + eStateOff = 0, + eStateOn = 1, + }; + + bool SelectionIsCollapsed(); + MOZ_CAN_RUN_SCRIPT nsresult UpdateOneCommand(const char* aCommand); + enum class CommandGroup { + Save, + Style, + Undo, + }; + MOZ_CAN_RUN_SCRIPT void UpdateCommandGroup(CommandGroup aCommandGroup); + + nsCommandManager* GetCommandManager(); + + nsresult PrimeUpdateTimer(); + void TimerCallback(); + + nsCOMPtr mUpdateTimer; + nsCOMPtr mDOMWindow; + nsCOMPtr mDocShell; + + int8_t mDirtyState; + int8_t mSelectionCollapsed; + bool mFirstDoOfFirstUndo; +}; + +} // namespace mozilla + +#endif // #ifndef mozilla_ComposerCommandsUpdater_h diff --git a/editor/composer/crashtests/351236-1.html b/editor/composer/crashtests/351236-1.html new file mode 100644 index 0000000000..99674f1814 --- /dev/null +++ b/editor/composer/crashtests/351236-1.html @@ -0,0 +1,37 @@ + +Testcase bug 351236 - Crash [@ nsGetInterface::operator()] with designMode iframes, removing styles, removing iframes, reloading, etc + + + + +This page should not crash Mozilla within 2 seconds
+ + + + + + diff --git a/editor/composer/crashtests/407062-1.html b/editor/composer/crashtests/407062-1.html new file mode 100644 index 0000000000..9bd5d02e59 --- /dev/null +++ b/editor/composer/crashtests/407062-1.html @@ -0,0 +1,20 @@ + + + + + + + + diff --git a/editor/composer/crashtests/419563-1.xhtml b/editor/composer/crashtests/419563-1.xhtml new file mode 100644 index 0000000000..417530c13a --- /dev/null +++ b/editor/composer/crashtests/419563-1.xhtml @@ -0,0 +1,20 @@ + + + + + +thesewords arenot realwords
Five
+ + diff --git a/editor/composer/crashtests/428844-1-inner.xhtml b/editor/composer/crashtests/428844-1-inner.xhtml new file mode 100644 index 0000000000..1cc72d0856 --- /dev/null +++ b/editor/composer/crashtests/428844-1-inner.xhtml @@ -0,0 +1,4 @@ + + + + diff --git a/editor/composer/crashtests/428844-1.html b/editor/composer/crashtests/428844-1.html new file mode 100644 index 0000000000..793aababd4 --- /dev/null +++ b/editor/composer/crashtests/428844-1.html @@ -0,0 +1,17 @@ + + + + + + + + diff --git a/editor/composer/crashtests/461049-1.html b/editor/composer/crashtests/461049-1.html new file mode 100644 index 0000000000..fea188e646 --- /dev/null +++ b/editor/composer/crashtests/461049-1.html @@ -0,0 +1,25 @@ + + + + + + +
+ + diff --git a/editor/composer/crashtests/crashtests.list b/editor/composer/crashtests/crashtests.list new file mode 100644 index 0000000000..db84e0e5b1 --- /dev/null +++ b/editor/composer/crashtests/crashtests.list @@ -0,0 +1,6 @@ +load 351236-1.html +load 407062-1.html +load 419563-1.xhtml +load 428844-1.html +load 461049-1.html +load removing-editable-xslt.html diff --git a/editor/composer/crashtests/removing-editable-xslt-inner.xhtml b/editor/composer/crashtests/removing-editable-xslt-inner.xhtml new file mode 100644 index 0000000000..cbf206d7ed --- /dev/null +++ b/editor/composer/crashtests/removing-editable-xslt-inner.xhtml @@ -0,0 +1,4 @@ + + + + diff --git a/editor/composer/crashtests/removing-editable-xslt.html b/editor/composer/crashtests/removing-editable-xslt.html new file mode 100644 index 0000000000..cbf104ac99 --- /dev/null +++ b/editor/composer/crashtests/removing-editable-xslt.html @@ -0,0 +1,17 @@ + + + + + + + + diff --git a/editor/composer/moz.build b/editor/composer/moz.build new file mode 100644 index 0000000000..38f0506665 --- /dev/null +++ b/editor/composer/moz.build @@ -0,0 +1,60 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +MOCHITEST_MANIFESTS += ["test/mochitest.ini"] + +MOCHITEST_CHROME_MANIFESTS += ["test/chrome.ini"] + +XPIDL_SOURCES += [ + "nsIEditingSession.idl", +] + +XPIDL_MODULE = "composer" + +UNIFIED_SOURCES += [ + "ComposerCommandsUpdater.cpp", + "nsEditingSession.cpp", +] + +EXPORTS += [ + "nsEditingSession.h", +] + +EXPORTS.mozilla += [ + "ComposerCommandsUpdater.h", +] + +# Needed because we include HTMLEditor.h which indirectly includes Document.h +LOCAL_INCLUDES += [ + "/dom/base", + "/dom/html", # For nsHTMLDocument + "/editor/spellchecker", # nsComposeTxtSrvFilter.h + "/layout/style", # For things nsHTMLDocument includes. +] + +FINAL_LIBRARY = "xul" +RESOURCE_FILES += [ + "res/EditorOverride.css", + "res/grabber.gif", + "res/table-add-column-after-active.gif", + "res/table-add-column-after-hover.gif", + "res/table-add-column-after.gif", + "res/table-add-column-before-active.gif", + "res/table-add-column-before-hover.gif", + "res/table-add-column-before.gif", + "res/table-add-row-after-active.gif", + "res/table-add-row-after-hover.gif", + "res/table-add-row-after.gif", + "res/table-add-row-before-active.gif", + "res/table-add-row-before-hover.gif", + "res/table-add-row-before.gif", + "res/table-remove-column-active.gif", + "res/table-remove-column-hover.gif", + "res/table-remove-column.gif", + "res/table-remove-row-active.gif", + "res/table-remove-row-hover.gif", + "res/table-remove-row.gif", +] diff --git a/editor/composer/nsEditingSession.cpp b/editor/composer/nsEditingSession.cpp new file mode 100644 index 0000000000..72435ded45 --- /dev/null +++ b/editor/composer/nsEditingSession.cpp @@ -0,0 +1,1301 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=2 sw=2 et tw=78: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include // for nullptr, strcmp + +#include "imgIContainer.h" // for imgIContainer, etc +#include "mozilla/ComposerCommandsUpdater.h" // for ComposerCommandsUpdater +#include "mozilla/FlushType.h" // for FlushType::Frames +#include "mozilla/HTMLEditor.h" // for HTMLEditor +#include "mozilla/mozalloc.h" // for operator new +#include "mozilla/PresShell.h" // for PresShell +#include "nsAString.h" +#include "nsBaseCommandController.h" // for nsBaseCommandController +#include "nsCommandManager.h" // for nsCommandManager +#include "nsComponentManagerUtils.h" // for do_CreateInstance +#include "nsContentUtils.h" +#include "nsDebug.h" // for NS_ENSURE_SUCCESS, etc +#include "nsDocShell.h" // for nsDocShell +#include "nsEditingSession.h" +#include "nsError.h" // for NS_ERROR_FAILURE, NS_OK, etc +#include "nsIChannel.h" // for nsIChannel +#include "nsIContentViewer.h" // for nsIContentViewer +#include "nsIControllers.h" // for nsIControllers +#include "nsID.h" // for NS_GET_IID, etc +#include "nsHTMLDocument.h" // for nsHTMLDocument +#include "nsIDocShell.h" // for nsIDocShell +#include "mozilla/dom/Document.h" // for Document +#include "nsIEditor.h" // for nsIEditor +#include "nsIInterfaceRequestorUtils.h" // for do_GetInterface +#include "nsIRefreshURI.h" // for nsIRefreshURI +#include "nsIRequest.h" // for nsIRequest +#include "nsITimer.h" // for nsITimer, etc +#include "nsIWeakReference.h" // for nsISupportsWeakReference, etc +#include "nsIWebNavigation.h" // for nsIWebNavigation +#include "nsIWebProgress.h" // for nsIWebProgress, etc +#include "nsLiteralString.h" // for NS_LITERAL_STRING +#include "nsPIDOMWindow.h" // for nsPIDOMWindow +#include "nsPresContext.h" // for nsPresContext +#include "nsReadableUtils.h" // for AppendUTF16toUTF8 +#include "nsStringFwd.h" // for nsString +#include "mozilla/dom/BrowsingContext.h" // for BrowsingContext +#include "mozilla/dom/Selection.h" // for AutoHideSelectionChanges, etc +#include "mozilla/dom/WindowContext.h" // for WindowContext +#include "nsFrameSelection.h" // for nsFrameSelection +#include "nsBaseCommandController.h" // for nsBaseCommandController +#include "mozilla/dom/LoadURIOptionsBinding.h" + +class nsISupports; +class nsIURI; + +using namespace mozilla; +using namespace mozilla::dom; + +/*--------------------------------------------------------------------------- + + nsEditingSession + +----------------------------------------------------------------------------*/ +nsEditingSession::nsEditingSession() + : mDoneSetup(false), + mCanCreateEditor(false), + mInteractive(false), + mMakeWholeDocumentEditable(true), + mDisabledJSAndPlugins(false), + mScriptsEnabled(true), + mPluginsEnabled(true), + mProgressListenerRegistered(false), + mImageAnimationMode(0), + mEditorFlags(0), + mEditorStatus(eEditorOK), + mBaseCommandControllerId(0), + mDocStateControllerId(0), + mHTMLCommandControllerId(0) {} + +/*--------------------------------------------------------------------------- + + ~nsEditingSession + +----------------------------------------------------------------------------*/ +nsEditingSession::~nsEditingSession() { + // Must cancel previous timer? + if (mLoadBlankDocTimer) mLoadBlankDocTimer->Cancel(); +} + +NS_IMPL_ISUPPORTS(nsEditingSession, nsIEditingSession, nsIWebProgressListener, + nsISupportsWeakReference) + +/*--------------------------------------------------------------------------- + + MakeWindowEditable + + aEditorType string, "html" "htmlsimple" "text" "textsimple" + void makeWindowEditable(in nsIDOMWindow aWindow, in string aEditorType, + in boolean aDoAfterUriLoad, + in boolean aMakeWholeDocumentEditable, + in boolean aInteractive); +----------------------------------------------------------------------------*/ +#define DEFAULT_EDITOR_TYPE "html" + +NS_IMETHODIMP +nsEditingSession::MakeWindowEditable(mozIDOMWindowProxy* aWindow, + const char* aEditorType, + bool aDoAfterUriLoad, + bool aMakeWholeDocumentEditable, + bool aInteractive) { + mEditorType.Truncate(); + mEditorFlags = 0; + + NS_ENSURE_TRUE(aWindow, NS_ERROR_FAILURE); + auto* window = nsPIDOMWindowOuter::From(aWindow); + + // disable plugins + nsCOMPtr docShell = window->GetDocShell(); + NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE); + mDocShell = do_GetWeakReference(docShell); + + mInteractive = aInteractive; + mMakeWholeDocumentEditable = aMakeWholeDocumentEditable; + + nsresult rv; + if (!mInteractive) { + rv = DisableJSAndPlugins(window->GetCurrentInnerWindow()); + NS_ENSURE_SUCCESS(rv, rv); + } + + // Always remove existing editor + TearDownEditorOnWindow(aWindow); + + // Tells embedder that startup is in progress + mEditorStatus = eEditorCreationInProgress; + + // temporary to set editor type here. we will need different classes soon. + if (!aEditorType) aEditorType = DEFAULT_EDITOR_TYPE; + mEditorType = aEditorType; + + // if all this does is setup listeners and I don't need listeners, + // can't this step be ignored?? (based on aDoAfterURILoad) + rv = PrepareForEditing(window); + NS_ENSURE_SUCCESS(rv, rv); + + // set the flag on the docShell to say that it's editable + rv = docShell->MakeEditable(aDoAfterUriLoad); + NS_ENSURE_SUCCESS(rv, rv); + + // Setup commands common to plaintext and html editors, + // including the document creation observers + // the first is an editing controller + rv = SetupEditorCommandController( + nsBaseCommandController::CreateEditingController, aWindow, + static_cast(this), &mBaseCommandControllerId); + NS_ENSURE_SUCCESS(rv, rv); + + // The second is a controller to monitor doc state, + // such as creation and "dirty flag" + rv = SetupEditorCommandController( + nsBaseCommandController::CreateHTMLEditorDocStateController, aWindow, + static_cast(this), &mDocStateControllerId); + NS_ENSURE_SUCCESS(rv, rv); + + // aDoAfterUriLoad can be false only when making an existing window editable + if (!aDoAfterUriLoad) { + rv = SetupEditorOnWindow(MOZ_KnownLive(*window)); + + // mEditorStatus is set to the error reason + // Since this is used only when editing an existing page, + // it IS ok to destroy current editor + if (NS_FAILED(rv)) { + TearDownEditorOnWindow(aWindow); + } + } + return rv; +} + +nsresult nsEditingSession::DisableJSAndPlugins(nsPIDOMWindowInner* aWindow) { + WindowContext* wc = aWindow->GetWindowContext(); + BrowsingContext* bc = wc->GetBrowsingContext(); + + mScriptsEnabled = wc->GetAllowJavascript(); + + MOZ_TRY(wc->SetAllowJavascript(false)); + + // Disable plugins in this document: + mPluginsEnabled = bc->GetAllowPlugins(); + + MOZ_TRY(bc->SetAllowPlugins(false)); + + mDisabledJSAndPlugins = true; + + return NS_OK; +} + +nsresult nsEditingSession::RestoreJSAndPlugins(nsPIDOMWindowInner* aWindow) { + if (!mDisabledJSAndPlugins) { + return NS_OK; + } + + mDisabledJSAndPlugins = false; + + if (NS_WARN_IF(!aWindow)) { + // DetachFromWindow may call this method with nullptr. + return NS_ERROR_FAILURE; + } + + WindowContext* wc = aWindow->GetWindowContext(); + BrowsingContext* bc = wc->GetBrowsingContext(); + + MOZ_TRY(wc->SetAllowJavascript(mScriptsEnabled)); + + // Disable plugins in this document: + + return bc->SetAllowPlugins(mPluginsEnabled); +} + +/*--------------------------------------------------------------------------- + + WindowIsEditable + + boolean windowIsEditable (in nsIDOMWindow aWindow); +----------------------------------------------------------------------------*/ +NS_IMETHODIMP +nsEditingSession::WindowIsEditable(mozIDOMWindowProxy* aWindow, + bool* outIsEditable) { + NS_ENSURE_STATE(aWindow); + nsCOMPtr docShell = + nsPIDOMWindowOuter::From(aWindow)->GetDocShell(); + NS_ENSURE_STATE(docShell); + + return docShell->GetEditable(outIsEditable); +} + +bool IsSupportedTextType(const nsAString& aMIMEType) { + // These are MIME types that are automatically parsed as "text/plain" + // and thus we can edit them as plaintext + // Note: in older versions, we attempted to convert the mimetype of + // the network channel for these and "text/xml" to "text/plain", + // but further investigation reveals that strategy doesn't work + static constexpr nsLiteralString sSupportedTextTypes[] = { + u"text/plain"_ns, + u"text/css"_ns, + u"text/rdf"_ns, + u"text/xsl"_ns, + u"text/javascript"_ns, // obsolete type + u"text/ecmascript"_ns, // obsolete type + u"application/javascript"_ns, + u"application/ecmascript"_ns, + u"application/x-javascript"_ns, // obsolete type + u"text/xul"_ns // obsolete type + }; + + for (const nsLiteralString& supportedTextType : sSupportedTextTypes) { + if (aMIMEType.Equals(supportedTextType)) { + return true; + } + } + + return false; +} + +nsresult nsEditingSession::SetupEditorOnWindow(nsPIDOMWindowOuter& aWindow) { + mDoneSetup = true; + + // MIME CHECKING + // must get the content type + // Note: the doc gets this from the network channel during StartPageLoad, + // so we don't have to get it from there ourselves + nsAutoString mimeType; + + // then lets check the mime type + if (RefPtr doc = aWindow.GetDoc()) { + doc->GetContentType(mimeType); + + if (IsSupportedTextType(mimeType)) { + mEditorType.AssignLiteral("text"); + mimeType.AssignLiteral("text/plain"); + } else if (!doc->IsHTMLOrXHTML()) { + // Neither an acceptable text or html type. + mEditorStatus = eEditorErrorCantEditMimeType; + + // Turn editor into HTML -- we will load blank page later + mEditorType.AssignLiteral("html"); + mimeType.AssignLiteral("text/html"); + } + + // Flush out frame construction to make sure that the subframe's + // presshell is set up if it needs to be. + doc->FlushPendingNotifications(mozilla::FlushType::Frames); + if (mMakeWholeDocumentEditable) { + doc->SetEditableFlag(true); + // Enable usage of the execCommand API + doc->SetEditingState(Document::EditingState::eDesignMode); + } + } + bool needHTMLController = false; + + if (mEditorType.EqualsLiteral("textmail")) { + mEditorFlags = nsIEditor::eEditorPlaintextMask | + nsIEditor::eEditorEnableWrapHackMask | + nsIEditor::eEditorMailMask; + } else if (mEditorType.EqualsLiteral("text")) { + mEditorFlags = + nsIEditor::eEditorPlaintextMask | nsIEditor::eEditorEnableWrapHackMask; + } else if (mEditorType.EqualsLiteral("htmlmail")) { + if (mimeType.EqualsLiteral("text/html")) { + needHTMLController = true; + mEditorFlags = nsIEditor::eEditorMailMask; + } else { + // Set the flags back to textplain. + mEditorFlags = nsIEditor::eEditorPlaintextMask | + nsIEditor::eEditorEnableWrapHackMask; + } + } else { + // Defaulted to html + needHTMLController = true; + } + + if (mInteractive) { + mEditorFlags |= nsIEditor::eEditorAllowInteraction; + } + + // make the UI state maintainer + RefPtr commandsUpdater = + new ComposerCommandsUpdater(); + mComposerCommandsUpdater = commandsUpdater; + + // now init the state maintainer + // This allows notification of error state + // even if we don't create an editor + commandsUpdater->Init(aWindow); + + if (mEditorStatus != eEditorCreationInProgress) { + commandsUpdater->OnHTMLEditorCreated(); + + // At this point we have made a final decision that we don't support + // editing the current document. This is an internal failure state, but + // we return NS_OK to avoid throwing an exception from the designMode + // setter for web compatibility. The document editing APIs will tell the + // developer if editing has been disabled because we're in a document type + // that doesn't support editing. + return NS_OK; + } + + // Create editor and do other things + // only if we haven't found some error above, + const RefPtr docShell = nsDocShell::Cast(aWindow.GetDocShell()); + if (NS_WARN_IF(!docShell)) { + return NS_ERROR_FAILURE; + } + const RefPtr presShell = docShell->GetPresShell(); + if (NS_WARN_IF(!presShell)) { + return NS_ERROR_FAILURE; + } + + if (!mInteractive) { + // Disable animation of images in this document: + nsPresContext* presContext = presShell->GetPresContext(); + NS_ENSURE_TRUE(presContext, NS_ERROR_FAILURE); + + mImageAnimationMode = presContext->ImageAnimationMode(); + presContext->SetImageAnimationMode(imgIContainer::kDontAnimMode); + } + + // Hide selection changes during initialization, in order to hide this + // from web pages. + RefPtr fs = presShell->FrameSelection(); + NS_ENSURE_TRUE(fs, NS_ERROR_FAILURE); + AutoHideSelectionChanges hideSelectionChanges(fs); + + nsCOMPtr contentViewer; + nsresult rv = docShell->GetContentViewer(getter_AddRefs(contentViewer)); + if (NS_FAILED(rv) || NS_WARN_IF(!contentViewer)) { + NS_WARNING("nsDocShell::GetContentViewer() failed"); + return rv; + } + + const RefPtr doc = contentViewer->GetDocument(); + if (NS_WARN_IF(!doc)) { + return NS_ERROR_FAILURE; + } + + // create and set editor + // Try to reuse an existing editor + nsCOMPtr editor = do_QueryReferent(mExistingEditor); + RefPtr htmlEditor = HTMLEditor::GetFrom(editor); + MOZ_ASSERT_IF(editor, htmlEditor); + if (htmlEditor) { + htmlEditor->PreDestroy(); + } else { + htmlEditor = new HTMLEditor(*doc); + mExistingEditor = + do_GetWeakReference(static_cast(htmlEditor.get())); + } + // set the editor on the docShell. The docShell now owns it. + rv = docShell->SetHTMLEditor(htmlEditor); + NS_ENSURE_SUCCESS(rv, rv); + + // setup the HTML editor command controller + if (needHTMLController) { + // The third controller takes an nsIEditor as the context + rv = SetupEditorCommandController( + nsBaseCommandController::CreateHTMLEditorController, &aWindow, + static_cast(htmlEditor), &mHTMLCommandControllerId); + NS_ENSURE_SUCCESS(rv, rv); + } + + // Set mimetype on editor + rv = htmlEditor->SetContentsMIMEType(mimeType); + NS_ENSURE_SUCCESS(rv, rv); + + MOZ_ASSERT(docShell->HasContentViewer()); + MOZ_ASSERT(contentViewer->GetDocument()); + + MOZ_DIAGNOSTIC_ASSERT(commandsUpdater == mComposerCommandsUpdater); + if (MOZ_UNLIKELY(commandsUpdater != mComposerCommandsUpdater)) { + commandsUpdater = mComposerCommandsUpdater; + } + rv = htmlEditor->Init(*doc, *commandsUpdater, mEditorFlags); + NS_ENSURE_SUCCESS(rv, rv); + + RefPtr selection = htmlEditor->GetSelection(); + if (NS_WARN_IF(!selection)) { + return NS_ERROR_FAILURE; + } + + // Set context on all controllers to be the editor + rv = SetEditorOnControllers(aWindow, htmlEditor); + NS_ENSURE_SUCCESS(rv, rv); + + // Everything went fine! + mEditorStatus = eEditorOK; + + // This will trigger documentCreation notification + return htmlEditor->PostCreate(); +} + +// Removes all listeners and controllers from aWindow and aEditor. +void nsEditingSession::RemoveListenersAndControllers( + nsPIDOMWindowOuter* aWindow, HTMLEditor* aHTMLEditor) { + if (!mComposerCommandsUpdater || !aHTMLEditor) { + return; + } + + // Remove all the listeners + RefPtr composertCommandsUpdater = + std::move(mComposerCommandsUpdater); + MOZ_ASSERT(!mComposerCommandsUpdater); + aHTMLEditor->Detach(*composertCommandsUpdater); + + // Remove editor controllers from the window now that we're not + // editing in that window any more. + RemoveEditorControllers(aWindow); +} + +/*--------------------------------------------------------------------------- + + TearDownEditorOnWindow + + void tearDownEditorOnWindow (in nsIDOMWindow aWindow); +----------------------------------------------------------------------------*/ +NS_IMETHODIMP +nsEditingSession::TearDownEditorOnWindow(mozIDOMWindowProxy* aWindow) { + if (!mDoneSetup) { + return NS_OK; + } + + NS_ENSURE_TRUE(aWindow, NS_ERROR_NULL_POINTER); + + // Kill any existing reload timer + if (mLoadBlankDocTimer) { + mLoadBlankDocTimer->Cancel(); + mLoadBlankDocTimer = nullptr; + } + + mDoneSetup = false; + + // Check if we're turning off editing (from contentEditable or designMode). + auto* window = nsPIDOMWindowOuter::From(aWindow); + + RefPtr doc = window->GetDoc(); + bool stopEditing = doc && doc->IsEditingOn(); + if (stopEditing) { + RemoveWebProgressListener(window); + } + + nsCOMPtr docShell = window->GetDocShell(); + NS_ENSURE_STATE(docShell); + + RefPtr htmlEditor = docShell->GetHTMLEditor(); + if (stopEditing) { + doc->TearingDownEditor(); + } + + if (mComposerCommandsUpdater && htmlEditor) { + // Null out the editor on the controllers first to prevent their weak + // references from pointing to a destroyed editor. + SetEditorOnControllers(*window, nullptr); + } + + // Null out the editor on the docShell to trigger PreDestroy which + // needs to happen before document state listeners are removed below. + docShell->SetEditor(nullptr); + + RemoveListenersAndControllers(window, htmlEditor); + + if (stopEditing) { + // Make things the way they were before we started editing. + RestoreJSAndPlugins(window->GetCurrentInnerWindow()); + RestoreAnimationMode(window); + + if (mMakeWholeDocumentEditable) { + doc->SetEditableFlag(false); + doc->SetEditingState(Document::EditingState::eOff); + } + } + + return NS_OK; +} + +/*--------------------------------------------------------------------------- + + GetEditorForFrame + + nsIEditor getEditorForFrame (in nsIDOMWindow aWindow); +----------------------------------------------------------------------------*/ +NS_IMETHODIMP +nsEditingSession::GetEditorForWindow(mozIDOMWindowProxy* aWindow, + nsIEditor** outEditor) { + if (NS_WARN_IF(!aWindow)) { + return NS_ERROR_INVALID_ARG; + } + nsCOMPtr editor = GetHTMLEditorForWindow(aWindow); + editor.forget(outEditor); + return NS_OK; +} + +/*--------------------------------------------------------------------------- + + OnStateChange + +----------------------------------------------------------------------------*/ +NS_IMETHODIMP +nsEditingSession::OnStateChange(nsIWebProgress* aWebProgress, + nsIRequest* aRequest, uint32_t aStateFlags, + nsresult aStatus) { +#ifdef NOISY_DOC_LOADING + nsCOMPtr channel(do_QueryInterface(aRequest)); + if (channel) { + nsAutoCString contentType; + channel->GetContentType(contentType); + if (!contentType.IsEmpty()) { + printf(" ++++++ MIMETYPE = %s\n", contentType.get()); + } + } +#endif + + // + // A Request has started... + // + if (aStateFlags & nsIWebProgressListener::STATE_START) { +#ifdef NOISY_DOC_LOADING + { + nsCOMPtr channel(do_QueryInterface(aRequest)); + if (channel) { + nsCOMPtr uri; + channel->GetURI(getter_AddRefs(uri)); + if (uri) { + nsCString spec; + uri->GetSpec(spec); + printf(" **** STATE_START: CHANNEL URI=%s, flags=%x\n", spec.get(), + aStateFlags); + } + } else { + printf(" STATE_START: NO CHANNEL flags=%x\n", aStateFlags); + } + } +#endif + // Page level notification... + if (aStateFlags & nsIWebProgressListener::STATE_IS_NETWORK) { + nsCOMPtr channel(do_QueryInterface(aRequest)); + StartPageLoad(channel); +#ifdef NOISY_DOC_LOADING + printf("STATE_START & STATE_IS_NETWORK flags=%x\n", aStateFlags); +#endif + } + + // Document level notification... + if (aStateFlags & nsIWebProgressListener::STATE_IS_DOCUMENT && + !(aStateFlags & nsIWebProgressListener::STATE_RESTORING)) { +#ifdef NOISY_DOC_LOADING + printf("STATE_START & STATE_IS_DOCUMENT flags=%x\n", aStateFlags); +#endif + + bool progressIsForTargetDocument = + IsProgressForTargetDocument(aWebProgress); + + if (progressIsForTargetDocument) { + nsCOMPtr window; + aWebProgress->GetDOMWindow(getter_AddRefs(window)); + + auto* piWindow = nsPIDOMWindowOuter::From(window); + RefPtr doc = piWindow->GetDoc(); + nsHTMLDocument* htmlDoc = + doc && doc->IsHTMLOrXHTML() ? doc->AsHTMLDocument() : nullptr; + if (htmlDoc && doc->IsWriting()) { + nsAutoString designMode; + htmlDoc->GetDesignMode(designMode); + + if (designMode.EqualsLiteral("on")) { + // This notification is for data coming in through + // document.open/write/close(), ignore it. + + return NS_OK; + } + } + + mCanCreateEditor = true; + StartDocumentLoad(aWebProgress, progressIsForTargetDocument); + } + } + } + // + // A Request is being processed + // + else if (aStateFlags & nsIWebProgressListener::STATE_TRANSFERRING) { + if (aStateFlags & nsIWebProgressListener::STATE_IS_DOCUMENT) { + // document transfer started + } + } + // + // Got a redirection + // + else if (aStateFlags & nsIWebProgressListener::STATE_REDIRECTING) { + if (aStateFlags & nsIWebProgressListener::STATE_IS_DOCUMENT) { + // got a redirect + } + } + // + // A network or document Request has finished... + // + else if (aStateFlags & nsIWebProgressListener::STATE_STOP) { +#ifdef NOISY_DOC_LOADING + { + nsCOMPtr channel(do_QueryInterface(aRequest)); + if (channel) { + nsCOMPtr uri; + channel->GetURI(getter_AddRefs(uri)); + if (uri) { + nsCString spec; + uri->GetSpec(spec); + printf(" **** STATE_STOP: CHANNEL URI=%s, flags=%x\n", spec.get(), + aStateFlags); + } + } else { + printf(" STATE_STOP: NO CHANNEL flags=%x\n", aStateFlags); + } + } +#endif + + // Document level notification... + if (aStateFlags & nsIWebProgressListener::STATE_IS_DOCUMENT) { + nsCOMPtr channel = do_QueryInterface(aRequest); + EndDocumentLoad(aWebProgress, channel, aStatus, + IsProgressForTargetDocument(aWebProgress)); +#ifdef NOISY_DOC_LOADING + printf("STATE_STOP & STATE_IS_DOCUMENT flags=%x\n", aStateFlags); +#endif + } + + // Page level notification... + if (aStateFlags & nsIWebProgressListener::STATE_IS_NETWORK) { + nsCOMPtr channel = do_QueryInterface(aRequest); + (void)EndPageLoad(aWebProgress, channel, aStatus); +#ifdef NOISY_DOC_LOADING + printf("STATE_STOP & STATE_IS_NETWORK flags=%x\n", aStateFlags); +#endif + } + } + + return NS_OK; +} + +/*--------------------------------------------------------------------------- + + OnProgressChange + +----------------------------------------------------------------------------*/ +NS_IMETHODIMP +nsEditingSession::OnProgressChange(nsIWebProgress* aWebProgress, + nsIRequest* aRequest, + int32_t aCurSelfProgress, + int32_t aMaxSelfProgress, + int32_t aCurTotalProgress, + int32_t aMaxTotalProgress) { + MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)"); + return NS_OK; +} + +/*--------------------------------------------------------------------------- + + OnLocationChange + +----------------------------------------------------------------------------*/ +NS_IMETHODIMP +nsEditingSession::OnLocationChange(nsIWebProgress* aWebProgress, + nsIRequest* aRequest, nsIURI* aURI, + uint32_t aFlags) { + nsCOMPtr domWindow; + nsresult rv = aWebProgress->GetDOMWindow(getter_AddRefs(domWindow)); + NS_ENSURE_SUCCESS(rv, rv); + + auto* piWindow = nsPIDOMWindowOuter::From(domWindow); + + RefPtr doc = piWindow->GetDoc(); + NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE); + + doc->SetDocumentURI(aURI); + + // Notify the location-changed observer that + // the document URL has changed + nsIDocShell* docShell = piWindow->GetDocShell(); + NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE); + + RefPtr commandManager = docShell->GetCommandManager(); + commandManager->CommandStatusChanged("obs_documentLocationChanged"); + return NS_OK; +} + +/*--------------------------------------------------------------------------- + + OnStatusChange + +----------------------------------------------------------------------------*/ +NS_IMETHODIMP +nsEditingSession::OnStatusChange(nsIWebProgress* aWebProgress, + nsIRequest* aRequest, nsresult aStatus, + const char16_t* aMessage) { + MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)"); + return NS_OK; +} + +/*--------------------------------------------------------------------------- + + OnSecurityChange + +----------------------------------------------------------------------------*/ +NS_IMETHODIMP +nsEditingSession::OnSecurityChange(nsIWebProgress* aWebProgress, + nsIRequest* aRequest, uint32_t aState) { + MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)"); + return NS_OK; +} + +/*--------------------------------------------------------------------------- + + OnContentBlockingEvent + +----------------------------------------------------------------------------*/ +NS_IMETHODIMP +nsEditingSession::OnContentBlockingEvent(nsIWebProgress* aWebProgress, + nsIRequest* aRequest, + uint32_t aEvent) { + MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)"); + return NS_OK; +} + +/*--------------------------------------------------------------------------- + + IsProgressForTargetDocument + + Check that this notification is for our document. +----------------------------------------------------------------------------*/ + +bool nsEditingSession::IsProgressForTargetDocument( + nsIWebProgress* aWebProgress) { + nsCOMPtr editedWebProgress = do_QueryReferent(mDocShell); + return editedWebProgress == aWebProgress; +} + +/*--------------------------------------------------------------------------- + + GetEditorStatus + + Called during GetCommandStateParams("obs_documentCreated"...) + to determine if editor was created and document + was loaded successfully +----------------------------------------------------------------------------*/ +NS_IMETHODIMP +nsEditingSession::GetEditorStatus(uint32_t* aStatus) { + NS_ENSURE_ARG_POINTER(aStatus); + *aStatus = mEditorStatus; + return NS_OK; +} + +/*--------------------------------------------------------------------------- + + StartDocumentLoad + + Called on start of load in a single frame +----------------------------------------------------------------------------*/ +nsresult nsEditingSession::StartDocumentLoad(nsIWebProgress* aWebProgress, + bool aIsToBeMadeEditable) { +#ifdef NOISY_DOC_LOADING + printf("======= StartDocumentLoad ========\n"); +#endif + + NS_ENSURE_ARG_POINTER(aWebProgress); + + if (aIsToBeMadeEditable) { + mEditorStatus = eEditorCreationInProgress; + } + + return NS_OK; +} + +/*--------------------------------------------------------------------------- + + EndDocumentLoad + + Called on end of load in a single frame +----------------------------------------------------------------------------*/ +nsresult nsEditingSession::EndDocumentLoad(nsIWebProgress* aWebProgress, + nsIChannel* aChannel, + nsresult aStatus, + bool aIsToBeMadeEditable) { + NS_ENSURE_ARG_POINTER(aWebProgress); + +#ifdef NOISY_DOC_LOADING + printf("======= EndDocumentLoad ========\n"); + printf("with status %d, ", aStatus); + nsCOMPtr uri; + nsCString spec; + if (NS_SUCCEEDED(aChannel->GetURI(getter_AddRefs(uri)))) { + uri->GetSpec(spec); + printf(" uri %s\n", spec.get()); + } +#endif + + // We want to call the base class EndDocumentLoad, + // but avoid some of the stuff + // that nsDocShell does (need to refactor). + + // OK, time to make an editor on this document + nsCOMPtr domWindow; + aWebProgress->GetDOMWindow(getter_AddRefs(domWindow)); + NS_ENSURE_TRUE(domWindow, NS_ERROR_FAILURE); + + // Set the error state -- we will create an editor + // anyway and load empty doc later + if (aIsToBeMadeEditable && aStatus == NS_ERROR_FILE_NOT_FOUND) { + mEditorStatus = eEditorErrorFileNotFound; + } + + auto* window = nsPIDOMWindowOuter::From(domWindow); + nsIDocShell* docShell = window->GetDocShell(); + NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE); // better error handling? + + // cancel refresh from meta tags + // we need to make sure that all pages in editor (whether editable or not) + // can't refresh contents being edited + nsCOMPtr refreshURI = do_QueryInterface(docShell); + if (refreshURI) { + refreshURI->CancelRefreshURITimers(); + } + + nsresult rv = NS_OK; + + // did someone set the flag to make this shell editable? + if (aIsToBeMadeEditable && mCanCreateEditor) { + bool makeEditable; + docShell->GetEditable(&makeEditable); + + if (makeEditable) { + // To keep pre Gecko 1.9 behavior, setup editor always when + // mMakeWholeDocumentEditable. + bool needsSetup = false; + if (mMakeWholeDocumentEditable) { + needsSetup = true; + } else { + // do we already have an editor here? + needsSetup = !docShell->GetHTMLEditor(); + } + + if (needsSetup) { + mCanCreateEditor = false; + rv = SetupEditorOnWindow(MOZ_KnownLive(*window)); + if (NS_FAILED(rv)) { + // If we had an error, setup timer to load a blank page later + if (mLoadBlankDocTimer) { + // Must cancel previous timer? + mLoadBlankDocTimer->Cancel(); + mLoadBlankDocTimer = nullptr; + } + + rv = NS_NewTimerWithFuncCallback(getter_AddRefs(mLoadBlankDocTimer), + nsEditingSession::TimerCallback, + static_cast(mDocShell.get()), + 10, nsITimer::TYPE_ONE_SHOT, + "nsEditingSession::EndDocumentLoad"); + NS_ENSURE_SUCCESS(rv, rv); + + mEditorStatus = eEditorCreationInProgress; + } + } + } + } + return rv; +} + +void nsEditingSession::TimerCallback(nsITimer* aTimer, void* aClosure) { + nsCOMPtr docShell = + do_QueryReferent(static_cast(aClosure)); + if (docShell) { + nsCOMPtr webNav(do_QueryInterface(docShell)); + if (webNav) { + LoadURIOptions loadURIOptions; + loadURIOptions.mTriggeringPrincipal = + nsContentUtils::GetSystemPrincipal(); + nsCOMPtr uri; + MOZ_ALWAYS_SUCCEEDS(NS_NewURI(getter_AddRefs(uri), "about:blank"_ns)); + webNav->LoadURI(uri, loadURIOptions); + } + } +} + +/*--------------------------------------------------------------------------- + + StartPageLoad + + Called on start load of the entire page (incl. subframes) +----------------------------------------------------------------------------*/ +nsresult nsEditingSession::StartPageLoad(nsIChannel* aChannel) { +#ifdef NOISY_DOC_LOADING + printf("======= StartPageLoad ========\n"); +#endif + return NS_OK; +} + +/*--------------------------------------------------------------------------- + + EndPageLoad + + Called on end load of the entire page (incl. subframes) +----------------------------------------------------------------------------*/ +nsresult nsEditingSession::EndPageLoad(nsIWebProgress* aWebProgress, + nsIChannel* aChannel, nsresult aStatus) { +#ifdef NOISY_DOC_LOADING + printf("======= EndPageLoad ========\n"); + printf(" with status %d, ", aStatus); + nsCOMPtr uri; + nsCString spec; + if (NS_SUCCEEDED(aChannel->GetURI(getter_AddRefs(uri)))) { + uri->GetSpec(spec); + printf("uri %s\n", spec.get()); + } + + nsAutoCString contentType; + aChannel->GetContentType(contentType); + if (!contentType.IsEmpty()) { + printf(" flags = %d, status = %d, MIMETYPE = %s\n", mEditorFlags, + mEditorStatus, contentType.get()); + } +#endif + + // Set the error state -- we will create an editor anyway + // and load empty doc later + if (aStatus == NS_ERROR_FILE_NOT_FOUND) { + mEditorStatus = eEditorErrorFileNotFound; + } + + nsCOMPtr domWindow; + aWebProgress->GetDOMWindow(getter_AddRefs(domWindow)); + + nsIDocShell* docShell = + domWindow ? nsPIDOMWindowOuter::From(domWindow)->GetDocShell() : nullptr; + NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE); + + // cancel refresh from meta tags + // we need to make sure that all pages in editor (whether editable or not) + // can't refresh contents being edited + nsCOMPtr refreshURI = do_QueryInterface(docShell); + if (refreshURI) { + refreshURI->CancelRefreshURITimers(); + } + +#if 0 + // Shouldn't we do this when we want to edit sub-frames? + return MakeWindowEditable(domWindow, "html", false, mInteractive); +#else + return NS_OK; +#endif +} + +/*--------------------------------------------------------------------------- + + PrepareForEditing + + Set up this editing session for one or more editors +----------------------------------------------------------------------------*/ +nsresult nsEditingSession::PrepareForEditing(nsPIDOMWindowOuter* aWindow) { + if (mProgressListenerRegistered) { + return NS_OK; + } + + nsIDocShell* docShell = aWindow ? aWindow->GetDocShell() : nullptr; + + // register callback + nsCOMPtr webProgress = do_GetInterface(docShell); + NS_ENSURE_TRUE(webProgress, NS_ERROR_FAILURE); + + nsresult rv = webProgress->AddProgressListener( + this, (nsIWebProgress::NOTIFY_STATE_NETWORK | + nsIWebProgress::NOTIFY_STATE_DOCUMENT | + nsIWebProgress::NOTIFY_LOCATION)); + + mProgressListenerRegistered = NS_SUCCEEDED(rv); + + return rv; +} + +/*--------------------------------------------------------------------------- + + SetupEditorCommandController + + Create a command controller, append to controllers, + get and return the controller ID, and set the context +----------------------------------------------------------------------------*/ +nsresult nsEditingSession::SetupEditorCommandController( + nsEditingSession::ControllerCreatorFn aControllerCreatorFn, + mozIDOMWindowProxy* aWindow, nsISupports* aContext, + uint32_t* aControllerId) { + NS_ENSURE_ARG_POINTER(aControllerCreatorFn); + NS_ENSURE_ARG_POINTER(aWindow); + NS_ENSURE_ARG_POINTER(aContext); + NS_ENSURE_ARG_POINTER(aControllerId); + + auto* piWindow = nsPIDOMWindowOuter::From(aWindow); + MOZ_ASSERT(piWindow); + + nsCOMPtr controllers; + nsresult rv = piWindow->GetControllers(getter_AddRefs(controllers)); + NS_ENSURE_SUCCESS(rv, rv); + + // We only have to create each singleton controller once + // We know this has happened once we have a controllerId value + if (!*aControllerId) { + RefPtr commandController = aControllerCreatorFn(); + NS_ENSURE_TRUE(commandController, NS_ERROR_FAILURE); + + // We must insert at head of the list to be sure our + // controller is found before other implementations + // (e.g., not-implemented versions by browser) + rv = controllers->InsertControllerAt(0, commandController); + NS_ENSURE_SUCCESS(rv, rv); + + // Remember the ID for the controller + rv = controllers->GetControllerId(commandController, aControllerId); + NS_ENSURE_SUCCESS(rv, rv); + } + + // Set the context + return SetContextOnControllerById(controllers, aContext, *aControllerId); +} + +nsresult nsEditingSession::SetEditorOnControllers(nsPIDOMWindowOuter& aWindow, + HTMLEditor* aEditor) { + nsCOMPtr controllers; + nsresult rv = aWindow.GetControllers(getter_AddRefs(controllers)); + NS_ENSURE_SUCCESS(rv, rv); + + nsCOMPtr editorAsISupports = static_cast(aEditor); + if (mBaseCommandControllerId) { + rv = SetContextOnControllerById(controllers, editorAsISupports, + mBaseCommandControllerId); + NS_ENSURE_SUCCESS(rv, rv); + } + + if (mDocStateControllerId) { + rv = SetContextOnControllerById(controllers, editorAsISupports, + mDocStateControllerId); + NS_ENSURE_SUCCESS(rv, rv); + } + + if (mHTMLCommandControllerId) { + rv = SetContextOnControllerById(controllers, editorAsISupports, + mHTMLCommandControllerId); + } + + return rv; +} + +nsresult nsEditingSession::SetContextOnControllerById( + nsIControllers* aControllers, nsISupports* aContext, uint32_t aID) { + NS_ENSURE_ARG_POINTER(aControllers); + + // aContext can be null (when destroying editor) + nsCOMPtr controller; + aControllers->GetControllerById(aID, getter_AddRefs(controller)); + + // ok with nil controller + nsCOMPtr editorController = + do_QueryInterface(controller); + NS_ENSURE_TRUE(editorController, NS_ERROR_FAILURE); + + return editorController->SetCommandContext(aContext); +} + +void nsEditingSession::RemoveEditorControllers(nsPIDOMWindowOuter* aWindow) { + // Remove editor controllers from the aWindow, call when we're + // tearing down/detaching editor. + + nsCOMPtr controllers; + if (aWindow) { + aWindow->GetControllers(getter_AddRefs(controllers)); + } + + if (controllers) { + nsCOMPtr controller; + if (mBaseCommandControllerId) { + controllers->GetControllerById(mBaseCommandControllerId, + getter_AddRefs(controller)); + if (controller) { + controllers->RemoveController(controller); + } + } + + if (mDocStateControllerId) { + controllers->GetControllerById(mDocStateControllerId, + getter_AddRefs(controller)); + if (controller) { + controllers->RemoveController(controller); + } + } + + if (mHTMLCommandControllerId) { + controllers->GetControllerById(mHTMLCommandControllerId, + getter_AddRefs(controller)); + if (controller) { + controllers->RemoveController(controller); + } + } + } + + // Clear IDs to trigger creation of new controllers. + mBaseCommandControllerId = 0; + mDocStateControllerId = 0; + mHTMLCommandControllerId = 0; +} + +void nsEditingSession::RemoveWebProgressListener(nsPIDOMWindowOuter* aWindow) { + nsIDocShell* docShell = aWindow ? aWindow->GetDocShell() : nullptr; + nsCOMPtr webProgress = do_GetInterface(docShell); + if (webProgress) { + webProgress->RemoveProgressListener(this); + mProgressListenerRegistered = false; + } +} + +void nsEditingSession::RestoreAnimationMode(nsPIDOMWindowOuter* aWindow) { + if (mInteractive) { + return; + } + + nsCOMPtr docShell = aWindow ? aWindow->GetDocShell() : nullptr; + NS_ENSURE_TRUE_VOID(docShell); + RefPtr presShell = docShell->GetPresShell(); + if (NS_WARN_IF(!presShell)) { + return; + } + nsPresContext* presContext = presShell->GetPresContext(); + NS_ENSURE_TRUE_VOID(presContext); + + presContext->SetImageAnimationMode(mImageAnimationMode); +} + +nsresult nsEditingSession::DetachFromWindow(nsPIDOMWindowOuter* aWindow) { + NS_ENSURE_TRUE(mDoneSetup, NS_OK); + + NS_ASSERTION(mComposerCommandsUpdater, + "mComposerCommandsUpdater should exist."); + + // Kill any existing reload timer + if (mLoadBlankDocTimer) { + mLoadBlankDocTimer->Cancel(); + mLoadBlankDocTimer = nullptr; + } + + // Remove controllers, webprogress listener, and otherwise + // make things the way they were before we started editing. + RemoveEditorControllers(aWindow); + RemoveWebProgressListener(aWindow); + RestoreJSAndPlugins(aWindow->GetCurrentInnerWindow()); + RestoreAnimationMode(aWindow); + + // Kill our weak reference to our original window, in case + // it changes on restore, or otherwise dies. + mDocShell = nullptr; + + return NS_OK; +} + +nsresult nsEditingSession::ReattachToWindow(nsPIDOMWindowOuter* aWindow) { + NS_ENSURE_TRUE(mDoneSetup, NS_OK); + NS_ENSURE_TRUE(aWindow, NS_ERROR_FAILURE); + + NS_ASSERTION(mComposerCommandsUpdater, + "mComposerCommandsUpdater should exist."); + + // Imitate nsEditorDocShell::MakeEditable() to reattach the + // old editor to the window. + nsresult rv; + + nsIDocShell* docShell = aWindow->GetDocShell(); + NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE); + mDocShell = do_GetWeakReference(docShell); + + // Disable plugins. + if (!mInteractive) { + rv = DisableJSAndPlugins(aWindow->GetCurrentInnerWindow()); + NS_ENSURE_SUCCESS(rv, rv); + } + + // Tells embedder that startup is in progress. + mEditorStatus = eEditorCreationInProgress; + + // Adds back web progress listener. + rv = PrepareForEditing(aWindow); + NS_ENSURE_SUCCESS(rv, rv); + + // Setup the command controllers again. + rv = SetupEditorCommandController( + nsBaseCommandController::CreateEditingController, aWindow, + static_cast(this), &mBaseCommandControllerId); + NS_ENSURE_SUCCESS(rv, rv); + + rv = SetupEditorCommandController( + nsBaseCommandController::CreateHTMLEditorDocStateController, aWindow, + static_cast(this), &mDocStateControllerId); + NS_ENSURE_SUCCESS(rv, rv); + + if (mComposerCommandsUpdater) { + mComposerCommandsUpdater->Init(*aWindow); + } + + // Get editor + RefPtr htmlEditor = GetHTMLEditorForWindow(aWindow); + if (NS_WARN_IF(!htmlEditor)) { + return NS_ERROR_FAILURE; + } + + if (!mInteractive) { + // Disable animation of images in this document: + RefPtr presShell = docShell->GetPresShell(); + if (NS_WARN_IF(!presShell)) { + return NS_ERROR_FAILURE; + } + nsPresContext* presContext = presShell->GetPresContext(); + NS_ENSURE_TRUE(presContext, NS_ERROR_FAILURE); + + mImageAnimationMode = presContext->ImageAnimationMode(); + presContext->SetImageAnimationMode(imgIContainer::kDontAnimMode); + } + + // The third controller takes an nsIEditor as the context + rv = SetupEditorCommandController( + nsBaseCommandController::CreateHTMLEditorController, aWindow, + static_cast(htmlEditor.get()), &mHTMLCommandControllerId); + NS_ENSURE_SUCCESS(rv, rv); + + // Set context on all controllers to be the editor + rv = SetEditorOnControllers(*aWindow, htmlEditor); + NS_ENSURE_SUCCESS(rv, rv); + +#ifdef DEBUG + { + bool isEditable; + rv = WindowIsEditable(aWindow, &isEditable); + NS_ENSURE_SUCCESS(rv, rv); + NS_ASSERTION(isEditable, + "Window is not editable after reattaching editor."); + } +#endif // DEBUG + + return NS_OK; +} + +HTMLEditor* nsIEditingSession::GetHTMLEditorForWindow( + mozIDOMWindowProxy* aWindow) { + if (NS_WARN_IF(!aWindow)) { + return nullptr; + } + + nsCOMPtr docShell = + nsPIDOMWindowOuter::From(aWindow)->GetDocShell(); + if (NS_WARN_IF(!docShell)) { + return nullptr; + } + + return docShell->GetHTMLEditor(); +} diff --git a/editor/composer/nsEditingSession.h b/editor/composer/nsEditingSession.h new file mode 100644 index 0000000000..c808c71c79 --- /dev/null +++ b/editor/composer/nsEditingSession.h @@ -0,0 +1,172 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef nsEditingSession_h__ +#define nsEditingSession_h__ + +#include "nsCOMPtr.h" // for nsCOMPtr +#include "nsISupportsImpl.h" // for NS_DECL_ISUPPORTS +#include "nsIWeakReferenceUtils.h" // for nsWeakPtr +#include "nsWeakReference.h" // for nsSupportsWeakReference, etc +#include "nscore.h" // for nsresult + +#ifndef __gen_nsIWebProgressListener_h__ +# include "nsIWebProgressListener.h" +#endif + +#ifndef __gen_nsIEditingSession_h__ +# include "nsIEditingSession.h" // for NS_DECL_NSIEDITINGSESSION, etc +#endif + +#include "nsString.h" // for nsCString + +class mozIDOMWindowProxy; +class nsBaseCommandController; +class nsIDOMWindow; +class nsISupports; +class nsITimer; +class nsIChannel; +class nsIControllers; +class nsIDocShell; +class nsIWebProgress; +class nsIPIDOMWindowOuter; +class nsIPIDOMWindowInner; + +namespace mozilla { +class ComposerCommandsUpdater; +class HTMLEditor; +} // namespace mozilla + +class nsEditingSession final : public nsIEditingSession, + public nsIWebProgressListener, + public nsSupportsWeakReference { + public: + nsEditingSession(); + + // nsISupports + NS_DECL_ISUPPORTS + + // nsIWebProgressListener + NS_DECL_NSIWEBPROGRESSLISTENER + + // nsIEditingSession + NS_DECL_NSIEDITINGSESSION + + /** + * Removes all the editor's controllers/listeners etc and makes the window + * uneditable. + */ + nsresult DetachFromWindow(nsPIDOMWindowOuter* aWindow); + + /** + * Undos DetachFromWindow(), reattaches this editing session/editor + * to the window. + */ + nsresult ReattachToWindow(nsPIDOMWindowOuter* aWindow); + + protected: + virtual ~nsEditingSession(); + + typedef already_AddRefed (*ControllerCreatorFn)(); + + nsresult SetupEditorCommandController( + ControllerCreatorFn aControllerCreatorFn, mozIDOMWindowProxy* aWindow, + nsISupports* aContext, uint32_t* aControllerId); + + nsresult SetContextOnControllerById(nsIControllers* aControllers, + nsISupports* aContext, uint32_t aID); + + /** + * Set the editor on the controller(s) for this window + */ + nsresult SetEditorOnControllers(nsPIDOMWindowOuter& aWindow, + mozilla::HTMLEditor* aEditor); + + /** + * Setup editor and related support objects + */ + MOZ_CAN_RUN_SCRIPT nsresult SetupEditorOnWindow(nsPIDOMWindowOuter& aWindow); + + nsresult PrepareForEditing(nsPIDOMWindowOuter* aWindow); + + static void TimerCallback(nsITimer* aTimer, void* aClosure); + nsCOMPtr mLoadBlankDocTimer; + + // progress load stuff + nsresult StartDocumentLoad(nsIWebProgress* aWebProgress, + bool isToBeMadeEditable); + MOZ_CAN_RUN_SCRIPT_BOUNDARY + nsresult EndDocumentLoad(nsIWebProgress* aWebProgress, nsIChannel* aChannel, + nsresult aStatus, bool isToBeMadeEditable); + nsresult StartPageLoad(nsIChannel* aChannel); + nsresult EndPageLoad(nsIWebProgress* aWebProgress, nsIChannel* aChannel, + nsresult aStatus); + + bool IsProgressForTargetDocument(nsIWebProgress* aWebProgress); + + void RemoveEditorControllers(nsPIDOMWindowOuter* aWindow); + void RemoveWebProgressListener(nsPIDOMWindowOuter* aWindow); + void RestoreAnimationMode(nsPIDOMWindowOuter* aWindow); + void RemoveListenersAndControllers(nsPIDOMWindowOuter* aWindow, + mozilla::HTMLEditor* aHTMLEditor); + + /** + * Disable scripts and plugins in aDocShell. + */ + nsresult DisableJSAndPlugins(nsPIDOMWindowInner* aWindow); + + /** + * Restore JS and plugins (enable/disable them) according to the state they + * were before the last call to disableJSAndPlugins. + */ + nsresult RestoreJSAndPlugins(nsPIDOMWindowInner* aWindow); + + protected: + bool mDoneSetup; // have we prepared for editing yet? + + // Used to prevent double creation of editor because nsIWebProgressListener + // receives a STATE_STOP notification before the STATE_START + // for our document, so we wait for the STATE_START, then STATE_STOP + // before creating an editor + bool mCanCreateEditor; + + bool mInteractive; + bool mMakeWholeDocumentEditable; + + bool mDisabledJSAndPlugins; + + // True if scripts were enabled before the editor turned scripts + // off, otherwise false. + bool mScriptsEnabled; + + // True if plugins were enabled before the editor turned plugins + // off, otherwise false. + bool mPluginsEnabled; + + bool mProgressListenerRegistered; + + // The image animation mode before it was turned off. + uint16_t mImageAnimationMode; + + // THE REMAINING MEMBER VARIABLES WILL BECOME A SET WHEN WE EDIT + // MORE THAN ONE EDITOR PER EDITING SESSION + RefPtr mComposerCommandsUpdater; + + // Save the editor type so we can create the editor after loading uri + nsCString mEditorType; + uint32_t mEditorFlags; + uint32_t mEditorStatus; + uint32_t mBaseCommandControllerId; + uint32_t mDocStateControllerId; + uint32_t mHTMLCommandControllerId; + + // Make sure the docshell we use is safe + nsWeakPtr mDocShell; + + // See if we can reuse an existing editor + nsWeakPtr mExistingEditor; +}; + +#endif // nsEditingSession_h__ diff --git a/editor/composer/nsIEditingSession.idl b/editor/composer/nsIEditingSession.idl new file mode 100644 index 0000000000..9691092ce8 --- /dev/null +++ b/editor/composer/nsIEditingSession.idl @@ -0,0 +1,84 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" +#include "domstubs.idl" + +interface mozIDOMWindowProxy; +interface nsIEditor; + +%{ C++ +class mozIDOMWindowProxy; +namespace mozilla { +class HTMLEditor; +} // namespace mozilla +%} + +[scriptable, builtinclass, uuid(24f963d1-e6fc-43ea-a206-99ac5fcc5265)] +interface nsIEditingSession : nsISupports +{ + /** + * Error codes when we fail to create an editor + * is placed in attribute editorStatus + */ + const long eEditorOK = 0; + const long eEditorCreationInProgress = 1; + const long eEditorErrorCantEditMimeType = 2; + const long eEditorErrorFileNotFound = 3; + const long eEditorErrorCantEditFramesets = 8; + const long eEditorErrorUnknown = 9; + + /** + * Status after editor creation and document loading + * Value is one of the above error codes + */ + readonly attribute unsigned long editorStatus; + + /** + * Make this window editable + * @param aWindow nsIDOMWindow, the window the embedder needs to make editable + * @param aEditorType string, "html" "htmlsimple" "text" "textsimple" + * @param aMakeWholeDocumentEditable if PR_TRUE make the whole document in + * aWindow editable, otherwise it's the + * embedder who should make the document + * (or part of it) editable. + * @param aInteractive if PR_FALSE turn off scripting and plugins + */ + [can_run_script] + void makeWindowEditable(in mozIDOMWindowProxy window, + in string aEditorType, + in boolean doAfterUriLoad, + in boolean aMakeWholeDocumentEditable, + in boolean aInteractive); + + /** + * Test whether a specific window has had its editable flag set; it may have an editor + * now, or will get one after the uri load. + * + * Use this, passing the content root window, to test if we've set up editing + * for this content. + */ + boolean windowIsEditable(in mozIDOMWindowProxy window); + + /** + * Get the editor for this window. May return null + */ + nsIEditor getEditorForWindow(in mozIDOMWindowProxy window); + + /** + * Destroy editor and related support objects + */ + [noscript] void tearDownEditorOnWindow(in mozIDOMWindowProxy window); + +%{C++ + /** + * This method is implemented with nsIDocShell::GetHTMLEditor(). I.e., + * This method doesn't depend on nsEditingSession. Therefore, even if + * there were some implementation of nsIEditingSession interface, this + * would be safe to use. + */ + mozilla::HTMLEditor* GetHTMLEditorForWindow(mozIDOMWindowProxy* aWindow); +%} +}; diff --git a/editor/composer/res/EditorOverride.css b/editor/composer/res/EditorOverride.css new file mode 100644 index 0000000000..373ed869a1 --- /dev/null +++ b/editor/composer/res/EditorOverride.css @@ -0,0 +1,322 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +*|* { + -moz-user-modify: read-write; +} + +/* Styles to alter look of things in the Editor content window + * that should NOT be removed when we display in completely WYSIWYG + * "Browser Preview" mode. + * Anything that should change, like appearance of table borders + * and Named Anchors, should be placed in EditorContent.css instead of here. +*/ + +/* Primary cursor is text I-beam */ + +::-moz-canvas, a:link { + cursor: text; +} + +/* Use default arrow over objects with size that + are selected when clicked on. + Override the browser's pointer cursor over links +*/ + +img, img[usemap], area, +object, object[usemap], +applet, hr, button, input, textarea, select, +a:link img, a:visited img, a:active img, +a[name]:-moz-only-whitespace { + cursor: default; +} + +a:visited, a:active { + cursor: text; +} + +/* Prevent clicking on links from going to link */ +a:link img, a:visited img { + -moz-user-input: none; +} + +/* We suppress user/author's prefs for link underline, + so we must set explicitly. This isn't good! +*/ +a:link { + color: -moz-hyperlinktext; +} + +/* Allow double-clicks on these widgets to open properties dialogs + XXX except when the widget has disabled attribute */ +input, button, textarea { + user-select: all !important; + -moz-user-input: auto !important; + -moz-user-focus: none !important; +} + +/* XXX Still need a better way of blocking other events to these widgets */ +select, input[disabled], input[type="checkbox"], input[type="radio"], input[type="file"] { + user-select: all !important; + -moz-user-input: none !important; + -moz-user-focus: none !important; +} + +input[type="hidden"] { + border: 1px solid black !important; + visibility: visible !important; +} + +label { + user-select: all !important; +} + +::-moz-display-comboboxcontrol-frame { + user-select: text !important; +} + +option { + user-select: text !important; +} + +#mozToc.readonly { + user-select: all !important; + -moz-user-input: none !important; +} + +/* the following rules are for Image Resizing */ + +span[\_moz_anonclass="mozResizer"] { + width: 5px; + height: 5px; + position: absolute; + border: 1px black solid; + background-color: white; + user-select: none; + z-index: 2147483646; /* max value -1 for this property */ +} + +/* we can't use :active below */ +span[\_moz_anonclass="mozResizer"][\_moz_activated], +span[\_moz_anonclass="mozResizer"]:hover { + background-color: black; +} + +span[\_moz_anonclass="mozResizer"].hidden, +span[\_moz_anonclass="mozResizingShadow"].hidden, +img[\_moz_anonclass="mozResizingShadow"].hidden, +span[\_moz_anonclass="mozGrabber"].hidden, +span[\_moz_anonclass="mozResizingInfo"].hidden, +a[\_moz_anonclass="mozTableRemoveRow"].hidden, +a[\_moz_anonclass="mozTableRemoveColumn"].hidden { + display: none !important; +} + +span[\_moz_anonclass="mozResizer"][anonlocation="nw"] { + cursor: nw-resize; +} +span[\_moz_anonclass="mozResizer"][anonlocation="n"] { + cursor: n-resize; +} +span[\_moz_anonclass="mozResizer"][anonlocation="ne"] { + cursor: ne-resize; +} +span[\_moz_anonclass="mozResizer"][anonlocation="w"] { + cursor: w-resize; +} +span[\_moz_anonclass="mozResizer"][anonlocation="e"] { + cursor: e-resize; +} +span[\_moz_anonclass="mozResizer"][anonlocation="sw"] { + cursor: sw-resize; +} +span[\_moz_anonclass="mozResizer"][anonlocation="s"] { + cursor: s-resize; +} +span[\_moz_anonclass="mozResizer"][anonlocation="se"] { + cursor: se-resize; +} + +span[\_moz_anonclass="mozResizingShadow"], +img[\_moz_anonclass="mozResizingShadow"] { + outline: thin dashed black; + user-select: none; + opacity: 0.5; + position: absolute; + z-index: 2147483647; /* max value for this property */ +} + +span[\_moz_anonclass="mozResizingInfo"] { + font-family: sans-serif; + font-size: x-small; + color: black; + background-color: #d0d0d0; + border: ridge 2px #d0d0d0; + padding: 2px; + position: absolute; + z-index: 2147483647; /* max value for this property */ +} + +img[\_moz_resizing] { + outline: thin solid black; +} + +*[\_moz_abspos] { + outline: silver ridge 2px; + z-index: 2147483645 !important; /* max value -2 for this property */ +} +*[\_moz_abspos="white"] { + background-color: white !important; +} +*[\_moz_abspos="black"] { + background-color: black !important; +} + +span[\_moz_anonclass="mozGrabber"] { + outline: ridge 2px silver; + padding: 2px; + position: absolute; + width: 12px; + height: 12px; + background-image: url("resource://gre/res/grabber.gif"); + background-repeat: no-repeat; + background-position: center center; + user-select: none; + cursor: move; + z-index: 2147483647; /* max value for this property */ +} + +/* INLINE TABLE EDITING */ + +a[\_moz_anonclass="mozTableAddColumnBefore"] { + position: absolute; + z-index: 2147483647; /* max value for this property */ + text-decoration: none !important; + border: none 0px !important; + width: 4px; + height: 8px; + background-image: url("resource://gre/res/table-add-column-before.gif"); + background-repeat: no-repeat; + background-position: center center; + user-select: none !important; + -moz-user-focus: none !important; +} + +a[\_moz_anonclass="mozTableAddColumnBefore"]:hover { + background-image: url("resource://gre/res/table-add-column-before-hover.gif"); +} + +a[\_moz_anonclass="mozTableAddColumnBefore"]:active { + background-image: url("resource://gre/res/table-add-column-before-active.gif"); +} + +a[\_moz_anonclass="mozTableAddColumnAfter"] { + position: absolute; + z-index: 2147483647; /* max value for this property */ + text-decoration: none !important; + border: none 0px !important; + width: 4px; + height: 8px; + background-image: url("resource://gre/res/table-add-column-after.gif"); + background-repeat: no-repeat; + background-position: center center; + user-select: none !important; + -moz-user-focus: none !important; +} + +a[\_moz_anonclass="mozTableAddColumnAfter"]:hover { + background-image: url("resource://gre/res/table-add-column-after-hover.gif"); +} + +a[\_moz_anonclass="mozTableAddColumnAfter"]:active { + background-image: url("resource://gre/res/table-add-column-after-active.gif"); +} + +a[\_moz_anonclass="mozTableRemoveColumn"] { + position: absolute; + z-index: 2147483647; /* max value for this property */ + text-decoration: none !important; + border: none 0px !important; + width: 8px; + height: 8px; + background-image: url("resource://gre/res/table-remove-column.gif"); + background-repeat: no-repeat; + background-position: center center; + user-select: none !important; + -moz-user-focus: none !important; +} + +a[\_moz_anonclass="mozTableRemoveColumn"]:hover { + background-image: url("resource://gre/res/table-remove-column-hover.gif"); +} + +a[\_moz_anonclass="mozTableRemoveColumn"]:active { + background-image: url("resource://gre/res/table-remove-column-active.gif"); +} + +a[\_moz_anonclass="mozTableAddRowBefore"] { + position: absolute; + z-index: 2147483647; /* max value for this property */ + text-decoration: none !important; + border: none 0px !important; + width: 8px; + height: 4px; + background-image: url("resource://gre/res/table-add-row-before.gif"); + background-repeat: no-repeat; + background-position: center center; + user-select: none !important; + -moz-user-focus: none !important; +} + +a[\_moz_anonclass="mozTableAddRowBefore"]:hover { + background-image: url("resource://gre/res/table-add-row-before-hover.gif"); +} + +a[\_moz_anonclass="mozTableAddRowBefore"]:active { + background-image: url("resource://gre/res/table-add-row-before-active.gif"); +} + +a[\_moz_anonclass="mozTableAddRowAfter"] { + position: absolute; + z-index: 2147483647; /* max value for this property */ + text-decoration: none !important; + border: none 0px !important; + width: 8px; + height: 4px; + background-image: url("resource://gre/res/table-add-row-after.gif"); + background-repeat: no-repeat; + background-position: center center; + user-select: none !important; + -moz-user-focus: none !important; +} + +a[\_moz_anonclass="mozTableAddRowAfter"]:hover { + background-image: url("resource://gre/res/table-add-row-after-hover.gif"); +} + +a[\_moz_anonclass="mozTableAddRowAfter"]:active { + background-image: url("resource://gre/res/table-add-row-after-active.gif"); +} + +a[\_moz_anonclass="mozTableRemoveRow"] { + position: absolute; + z-index: 2147483647; /* max value for this property */ + text-decoration: none !important; + border: none 0px !important; + width: 8px; + height: 8px; + background-image: url("resource://gre/res/table-remove-row.gif"); + background-repeat: no-repeat; + background-position: center center; + user-select: none !important; + -moz-user-focus: none !important; +} + +a[\_moz_anonclass="mozTableRemoveRow"]:hover { + background-image: url("resource://gre/res/table-remove-row-hover.gif"); +} + +a[\_moz_anonclass="mozTableRemoveRow"]:active { + background-image: url("resource://gre/res/table-remove-row-active.gif"); +} diff --git a/editor/composer/res/grabber.gif b/editor/composer/res/grabber.gif new file mode 100644 index 0000000000..06749a64fc Binary files /dev/null and b/editor/composer/res/grabber.gif differ diff --git a/editor/composer/res/table-add-column-after-active.gif b/editor/composer/res/table-add-column-after-active.gif new file mode 100644 index 0000000000..3ec50b82ee Binary files /dev/null and b/editor/composer/res/table-add-column-after-active.gif differ diff --git a/editor/composer/res/table-add-column-after-hover.gif b/editor/composer/res/table-add-column-after-hover.gif new file mode 100644 index 0000000000..29679f9812 Binary files /dev/null and b/editor/composer/res/table-add-column-after-hover.gif differ diff --git a/editor/composer/res/table-add-column-after.gif b/editor/composer/res/table-add-column-after.gif new file mode 100644 index 0000000000..8891be969c Binary files /dev/null and b/editor/composer/res/table-add-column-after.gif differ diff --git a/editor/composer/res/table-add-column-before-active.gif b/editor/composer/res/table-add-column-before-active.gif new file mode 100644 index 0000000000..1e205291e1 Binary files /dev/null and b/editor/composer/res/table-add-column-before-active.gif differ diff --git a/editor/composer/res/table-add-column-before-hover.gif b/editor/composer/res/table-add-column-before-hover.gif new file mode 100644 index 0000000000..7b54537e40 Binary files /dev/null and b/editor/composer/res/table-add-column-before-hover.gif differ diff --git a/editor/composer/res/table-add-column-before.gif b/editor/composer/res/table-add-column-before.gif new file mode 100644 index 0000000000..d4a3ffe5e9 Binary files /dev/null and b/editor/composer/res/table-add-column-before.gif differ diff --git a/editor/composer/res/table-add-row-after-active.gif b/editor/composer/res/table-add-row-after-active.gif new file mode 100644 index 0000000000..cc01da2c9e Binary files /dev/null and b/editor/composer/res/table-add-row-after-active.gif differ diff --git a/editor/composer/res/table-add-row-after-hover.gif b/editor/composer/res/table-add-row-after-hover.gif new file mode 100644 index 0000000000..a829351b64 Binary files /dev/null and b/editor/composer/res/table-add-row-after-hover.gif differ diff --git a/editor/composer/res/table-add-row-after.gif b/editor/composer/res/table-add-row-after.gif new file mode 100644 index 0000000000..3f1a39d981 Binary files /dev/null and b/editor/composer/res/table-add-row-after.gif differ diff --git a/editor/composer/res/table-add-row-before-active.gif b/editor/composer/res/table-add-row-before-active.gif new file mode 100644 index 0000000000..34f1e0adec Binary files /dev/null and b/editor/composer/res/table-add-row-before-active.gif differ diff --git a/editor/composer/res/table-add-row-before-hover.gif b/editor/composer/res/table-add-row-before-hover.gif new file mode 100644 index 0000000000..e8f1d10b0c Binary files /dev/null and b/editor/composer/res/table-add-row-before-hover.gif differ diff --git a/editor/composer/res/table-add-row-before.gif b/editor/composer/res/table-add-row-before.gif new file mode 100644 index 0000000000..1682170cb3 Binary files /dev/null and b/editor/composer/res/table-add-row-before.gif differ diff --git a/editor/composer/res/table-remove-column-active.gif b/editor/composer/res/table-remove-column-active.gif new file mode 100644 index 0000000000..4dfbde4ce2 Binary files /dev/null and b/editor/composer/res/table-remove-column-active.gif differ diff --git a/editor/composer/res/table-remove-column-hover.gif b/editor/composer/res/table-remove-column-hover.gif new file mode 100644 index 0000000000..fd11bb52c3 Binary files /dev/null and b/editor/composer/res/table-remove-column-hover.gif differ diff --git a/editor/composer/res/table-remove-column.gif b/editor/composer/res/table-remove-column.gif new file mode 100644 index 0000000000..d8071da0a9 Binary files /dev/null and b/editor/composer/res/table-remove-column.gif differ diff --git a/editor/composer/res/table-remove-row-active.gif b/editor/composer/res/table-remove-row-active.gif new file mode 100644 index 0000000000..4dfbde4ce2 Binary files /dev/null and b/editor/composer/res/table-remove-row-active.gif differ diff --git a/editor/composer/res/table-remove-row-hover.gif b/editor/composer/res/table-remove-row-hover.gif new file mode 100644 index 0000000000..fd11bb52c3 Binary files /dev/null and b/editor/composer/res/table-remove-row-hover.gif differ diff --git a/editor/composer/res/table-remove-row.gif b/editor/composer/res/table-remove-row.gif new file mode 100644 index 0000000000..d8071da0a9 Binary files /dev/null and b/editor/composer/res/table-remove-row.gif differ diff --git a/editor/composer/test/chrome.ini b/editor/composer/test/chrome.ini new file mode 100644 index 0000000000..8b4d9c3333 --- /dev/null +++ b/editor/composer/test/chrome.ini @@ -0,0 +1,5 @@ +[DEFAULT] +skip-if = os == 'android' + +[test_bug1266815.html] +[test_bug434998.xhtml] diff --git a/editor/composer/test/file_bug1453190.html b/editor/composer/test/file_bug1453190.html new file mode 100644 index 0000000000..74b13bb0ec --- /dev/null +++ b/editor/composer/test/file_bug1453190.html @@ -0,0 +1,12 @@ + +
+
  • diff --git a/editor/composer/test/mochitest.ini b/editor/composer/test/mochitest.ini new file mode 100644 index 0000000000..eb364a4a50 --- /dev/null +++ b/editor/composer/test/mochitest.ini @@ -0,0 +1,9 @@ +[test_bug1453190.html] +skip-if = os == "android" +support-files = + file_bug1453190.html +[test_bug348497.html] +[test_bug384147.html] +[test_bug389350.html] +[test_bug519928.html] +[test_bug738440.html] diff --git a/editor/composer/test/test_bug1266815.html b/editor/composer/test/test_bug1266815.html new file mode 100644 index 0000000000..1c565fb2c1 --- /dev/null +++ b/editor/composer/test/test_bug1266815.html @@ -0,0 +1,97 @@ + + + + + + + +

    + + + diff --git a/editor/composer/test/test_bug1453190.html b/editor/composer/test/test_bug1453190.html new file mode 100644 index 0000000000..cf6b0d888a --- /dev/null +++ b/editor/composer/test/test_bug1453190.html @@ -0,0 +1,36 @@ + + + + + Test for Bug 1453190 + + + + +Mozilla Bug 1453190 +

    + +
    +
    +
    + + diff --git a/editor/composer/test/test_bug348497.html b/editor/composer/test/test_bug348497.html new file mode 100644 index 0000000000..898fb49ae1 --- /dev/null +++ b/editor/composer/test/test_bug348497.html @@ -0,0 +1,36 @@ + + + + + Test for Bug 348497 + + + + +Mozilla Bug 348497 +

    +
    + This page should not crash Mozilla
    + +
    +
    +
    +
    + + + diff --git a/editor/composer/test/test_bug384147.html b/editor/composer/test/test_bug384147.html new file mode 100644 index 0000000000..6feb8b4ad4 --- /dev/null +++ b/editor/composer/test/test_bug384147.html @@ -0,0 +1,203 @@ + + + + + Test for Bug 384147 + + + + + +Mozilla Bug 384147 +

    +
    +
    +
    +
    +
    +
    + + + diff --git a/editor/composer/test/test_bug389350.html b/editor/composer/test/test_bug389350.html new file mode 100644 index 0000000000..9b9aecd1e7 --- /dev/null +++ b/editor/composer/test/test_bug389350.html @@ -0,0 +1,33 @@ + + + +Test for Bug 389350 + + + + + + + + + +
  • +
    +
    +
    + + diff --git a/editor/composer/test/test_bug738440.html b/editor/composer/test/test_bug738440.html new file mode 100644 index 0000000000..a021906cfc --- /dev/null +++ b/editor/composer/test/test_bug738440.html @@ -0,0 +1,37 @@ + + +Test for Bug 738440 + + +Mozilla Bug 738440 +
    + diff --git a/editor/docs/ChangJie.png b/editor/docs/ChangJie.png new file mode 100644 index 0000000000..04d872e258 Binary files /dev/null and b/editor/docs/ChangJie.png differ diff --git a/editor/docs/EditorModuleSpecificRules.rst b/editor/docs/EditorModuleSpecificRules.rst new file mode 100644 index 0000000000..dbe4a2b12f --- /dev/null +++ b/editor/docs/EditorModuleSpecificRules.rst @@ -0,0 +1,215 @@ +############################ +Editor module specific rules +############################ + +The editor module has not been maintained aggressively about a decade. Therefore, this module needs +to be treated as a young module or in a transition period to align the behavior to the other +browsers and take modern C++ style. + +Undoubtedly, this editor module is under rewritten for modern and optimized for current specs. +Additionally, this module does really complicated things which may cause security issues. +Therefore, there are specific rules: + +Treat other browsers behavior as standard if the behavior is reasonable +======================================================================= + +The editing behavior is not standardized since as you see too many lines in the editor classes, the +number of cases which need to handle edge cases is crazy and that makes it impossible to standardize. +Additionally, our editor behavior is not so stable. Some behaviors were aligned to Internet Explorer, +some other behaviors were not for making "better" UX for users of email composer and HTML composer +which were in SeaMonkey, and the other browser engines (Blink and WebKit) have same roots but the +behavior is different from both IE and Gecko. + +Therefore, there were no reference behavior. + +In these days, compatibility between browsers becomes more important, and fortunately, the behavior +of Blink (Chrome/Chromium) which has the biggest market share is more reasonable than ours in a lot +of cases. Therefore, if we get web-compat issue reports, we should align the behavior to Blink in +theory. + +However, if Blink's behavior is also odd, this is the worst case. In this case, we should try to +align the behavior to WebKit if and only if WebKit's behavior is different from Blink and +reasonable, or doing something "better" for hiding the issue from web-apps and file an issue to the +Editing Working Group with creating a "tentative" web-platform test. + +Don't make methods of editor classes public if they are used only by helper classes +=================================================================================== + +Although this is a silly rule. Of course, APIs of editor classes need to be public for the other +modules. However, the other methods which are used only by helper classes in the editor module --the +methods may be crashed if called by the other modules because editor classes store and guarantee the +colleagues (e.g., ``Selection``) when it starts to handle an edit action (edit command or +operation)-- does not want to do it for the performance reason. Therefore, such methods are now +declared as protected methods and the caller classes are registered as friends. + +For solving this issue, we could split the editor classes one is exported and the other is not +exposed, and make the former to proxies and own the latter. However, this approach might cause +performance regressions and requires a lot of line changes (at least each method definition and +warning messages at the caller sides). Tracked in +`bug 1555916 `__. + +Steps to handle one editor command or operation +=============================================== + +One edit command or operation is called "edit action" in the editor module. Handling it starts +when an XPCOM method or a public method which is named as ``*AsAction``. Those methods create +``AutoEditActionDataSetter`` in the stack first, then, call one of ``CanHandle()``, +``CanHandleAndMaybeDispatchBeforeInputEvent()`` or ``CanHandleAndFlushPendingNotifications()``. +If ``CanHandleAndMaybeDispatchBeforeInputEvent()`` causes dispatching ``beforeinput`` event and if +the event is consumed by the web app, it returns ``NS_ERROR_EDITOR_ACTION_CANCELED``. In this case, +the method can do anything due to the ``beforeinput`` event definition. + +At this time, ``AutoEditActionDataSetter`` stores ``Selection`` etc which are required for handling +the edit action in it and set ``EditorBase::mEditActionData`` to its address. Then all methods of +editor can access the objects via the pointer (typically wrapped in inline methods) and the lifetime +of the objects are guaranteed. + +Then, the methods call one or more edit-sub action handlers. E.g., when user types a character +with a non-collapsed selection range, editor needs to delete the selected content first and insert +the character there. For implementing this behavior, "insert text" edit action handler needs to call +"delete selection" sub-action handler and "insert text" sub-action handler. The sub-edit action +handlers are named as ``*AsSubAction``. + +The callers of edit sub-action handlers or the handlers themselves create ``AutoPlaceholderBatch`` +in the stack. This creates a placeholder transaction to make all transactions undoable with one +"undo" command. + +Then, each edit sub-action handler creates ``AutoEditSubActionNotifier`` in the stack and if it's +the topmost edit sub-action handling, ``OnStartToHandleTopLevelEditSubAction()`` is called at the +creation and ``OnEndHandlingTopLevelEditSubAction()`` is called at the destruction. The latter will +clean up the modified range, e.g., remove unnecessary empty nodes. + +Finally, the edit sub-actions does something while ``AutoEditSubActionNotifier`` is alive. Helper +methods of edit sub-action handlers are typically named as ``*WithTransaction`` because they are +done with transaction classes for making everything undoable. + +Don't update Selection immediately +================================== + +Changing the ranges of ``Selection`` is expensive (due ot validating new range, notifying new +selected or unselected frames, notifying selection listeners, etc), and retrieving current +``Selection`` ranges at staring to handle something makes the code statefull which is harder to +debug when you investigate a bug. Therefore, each method should return new caret position or +update ranges given as in/out parameter of ``AutoRangeArray``. ``Result`` +is a good result type for the former, and the latter is useful style if the method needs to keep +``Selection`` similar to given ranges, e.g., when paragraphs around selection are changed to +different type of blocks. Finally, edit sub-action handler methods should update ``Selection`` +before destroying ``AutoEditSubActionNotifier`` whose post-processing requires ``Selection``. + +Don't add new things into OnEndHandlingTopLevelEditSubAction() +============================================================== + +When the topmost edit sub-action is handled, ``OnEndHandlingTopLevelEditSubAction`` is called and +it cleans up something in (or around) the modified range. However, this "post-processing" approach +makes it harder to change the behavior for fixing web-compat issues. For example, it deletes empty +nodes in the range, but if only some empty nodes are inserted intentionally, it doesn't have the +details and may unexpectedly delete necessary empty nodes. + +Instead, new things should be done immediately at or after modifying the DOM tree, and if it +requires to disable the post-processing, add new ``bool`` flag to +``EditorBase::TopLevelEditSubActionData`` and when it's set, make +``OnEndHandlingTopLevelEditSubAction`` stop doing something. + +Don't use NS_WARN_IF for checking NS_FAILED, isErr() and Failed() +================================================================= + +The warning messages like ``NS_FAILED(rv)`` does not help except the line number, and in the cases +of that we get web-compat reports, somewhere in the editor modules may get unexpected result. For +saving the investigation time of web-compat issues, each failure should warn which method call +failed, for example: + +.. code:: cpp + + nsresult rv = DoSomething(); + if (NS_FAILED(rv)) { + NS_WARNING("HTMLEditor::DoSomething() failed"); + return rv; + } + +These warnings will let you know the stack of failure in debug build. In other words, when you +investigate a web-compat issue in editor, you should do the steps to reproduce in debug build first. +Then, you'd see failure point stack in the terminal. + +Return NS_ERROR_EDITOR_DESTROYED when editor gets destroyed +=========================================================== + +The most critical error while an editor class method is running is what the editor instance is +destroyed by the web app. This can be checked with a call of ``EditorBase::Destroyed()`` and +if it returns ``true``, methods should return ``NS_ERROR_EDITOR_DESTROYED`` with stopping handling +anything. Then, all callers which handle the error result properly will stop handling too. +Finally, public methods should return ``EditorBase::ToGenericNSResult(rv)`` instead of exposing +an internal error of the editor module. + +Note that destroying the editor is intentional thing for the web app. Thus we should not throw +exception for this failure reason. Therefore, the public methods shouldn't return error. + +When you make a method return ``NS_ERROR_EDITOR_DESTROYED`` properly, you should mark the method +as ``[[nodiscard]]``. In other words, if you see ``[[nodiscard]]`` in method definition and it +returns ``nsresult`` or ``Result<*, nsresult>``, the method callers do not need to check +``Destroyed()`` by themselves. + +Use reference instead of pointer as far as possible +=================================================== + +When you create or redesign a method, it should take references instead of pointers if they take. +This rule forces that the caller to do null-check and this avoids a maybe unexpected case like: + +.. code:: cpp + + inline bool IsBRElement(const nsINode* aNode) { + return aNode && aNode->IsHTMLElement(nsGkAtoms::br); + } + + void DoSomethingExceptIfBRElement(const nsINode* aNode) { + if (IsBRElement(aNode)) { + return; + } + // Do something for non-BR element node. + } + +In this case, ``DoSomethingExceptIfBRElement`` expects that ``aNode`` is never ``nullptr`` but it +could be at least in build time. Using reference fixes this mistake at build time. + +Use ``EditorUtils`` or ``HTMLEditUtils`` for stateless methods +============================================================== + +When you create a new static method to the editor classes or a new inline method in cpp file which +defines the editor classes, please check if it's a common method which may be used from other +places in the editor module. If it's possible to be used only in ``HTMLEditor`` or its helper +classes, the method should be in ``HTMLEditUtils``. If it's possible be used in ``EditorBase`` or +``TextEditor`` or their helper classes, it should be in ``EditorUtils``. + +Don't use bool argument +======================= + +If you create a new method which take one or more ``bool`` arguments, use ``enum class`` instead +since ``true`` or ``false`` in the caller side is not easy to read. For example, you must not +be able to understand what this example mean: + +.. code:: cpp + + if (IsEmpty(aNode, true)) { + +For avoiding this issue, you should create new ``enum class`` for each. E.g., + +.. code:: cpp + + if (IsEmpty(aNode, TreatSingleBR::AsVisible)) { + +Basically, both ``enum class`` name and its value names explains what it means fluently. However, if +it's impossible, use ``No`` and ``Yes`` for the value like: + +.. code:: cpp + + if (DoSomething(aNode, OnlyIfEmpty::Yes)) { + +Don't use out parameters +======================== + +In most cases, editor methods meet error of low level APIs, thus editor methods usually return error +code. On the other hand, a lot of code need to return computed things, e.g., new caret position, +whether it's handled, ignored or canceled, a target node looked for, etc. We used ``nsresult`` for +the return value type and out parameters for the other results, but it makes callers scattering a +lot of auto variables and reusing them makes the code harder to understand. + +Now we can use ``mozilla::Result`` instead. diff --git a/editor/docs/EditorModuleStructure.rst b/editor/docs/EditorModuleStructure.rst new file mode 100644 index 0000000000..e179145a0d --- /dev/null +++ b/editor/docs/EditorModuleStructure.rst @@ -0,0 +1,219 @@ +####################### +Editor module structure +####################### + +This document explains the structure of the editor module and overview of classes. + +Introduction +============ + +This module implements the builtin editors of editable elements or documents, and this does **not** +implement the interface with DOM API and visual feedback of the editing UI. In other words, this +module implements DOM tree editors. + +Directories +=========== + +composer +-------- + +Previously, this directory contained "Composer" UI related code. However, currently, this +directory contains ``nsEditingSession`` and ``ComposerCommandsUpdater``. + +libeditor +--------- + +This is the main directory which contains "core" implementation of editors. + +spellchecker +------------ + +Despite of the directory name, implementation of the spellchecker is **not** here. This directory +contains only a bridge between editor classes and the spellchecker and serialized text of editable +content for spellchecking. + +txmgr +----- + +This directory contains transaction items and transaction classes. They were designed for generic +use cases, e.g., managing undo/redo of bookmarks/history of browser, etc, but they are used only by +the editor. + +Main classes +============ + +EditorBase +---------- + +``EditorBase`` class is an abstract class of editors. This inherits ``nsIEditor`` XPCOM interface, +implement common features which work with instance of classes, and exposed by +``mozilla/EditorBase.h``. + +TextEditor +---------- + +``TextEditor`` class is the implementation of plaintext editor which works with ```` and +`` + diff --git a/editor/libeditor/crashtests/1402196.html b/editor/libeditor/crashtests/1402196.html new file mode 100644 index 0000000000..8e0a7be0fe --- /dev/null +++ b/editor/libeditor/crashtests/1402196.html @@ -0,0 +1,29 @@ + + + + + + +
    + + +

    + + diff --git a/editor/libeditor/crashtests/1402469.html b/editor/libeditor/crashtests/1402469.html new file mode 100644 index 0000000000..06583acb8b --- /dev/null +++ b/editor/libeditor/crashtests/1402469.html @@ -0,0 +1,22 @@ + + + + + + + +
    +
      +
    + + diff --git a/editor/libeditor/crashtests/1402526.html b/editor/libeditor/crashtests/1402526.html new file mode 100644 index 0000000000..fd75a30eca --- /dev/null +++ b/editor/libeditor/crashtests/1402526.html @@ -0,0 +1,24 @@ + + +
    + diff --git a/editor/libeditor/crashtests/1402904.html b/editor/libeditor/crashtests/1402904.html new file mode 100644 index 0000000000..544d01208a --- /dev/null +++ b/editor/libeditor/crashtests/1402904.html @@ -0,0 +1,38 @@ + + + +
  • +
      +
    • +a;#2 diff --git a/editor/libeditor/crashtests/1405747.html b/editor/libeditor/crashtests/1405747.html new file mode 100644 index 0000000000..dae3a130f0 --- /dev/null +++ b/editor/libeditor/crashtests/1405747.html @@ -0,0 +1,40 @@ + + + + + diff --git a/editor/libeditor/crashtests/1405897.html b/editor/libeditor/crashtests/1405897.html new file mode 100644 index 0000000000..60118628b5 --- /dev/null +++ b/editor/libeditor/crashtests/1405897.html @@ -0,0 +1,23 @@ + + + + + + + diff --git a/editor/libeditor/crashtests/1425091.html b/editor/libeditor/crashtests/1425091.html new file mode 100644 index 0000000000..be8f051931 --- /dev/null +++ b/editor/libeditor/crashtests/1425091.html @@ -0,0 +1,25 @@ + + + + + + + + diff --git a/editor/libeditor/crashtests/1426709.html b/editor/libeditor/crashtests/1426709.html new file mode 100644 index 0000000000..0026176e98 --- /dev/null +++ b/editor/libeditor/crashtests/1426709.html @@ -0,0 +1,27 @@ + + +
    • +A +
      +
      +
    • diff --git a/editor/libeditor/crashtests/1429523.html b/editor/libeditor/crashtests/1429523.html new file mode 100644 index 0000000000..67b227d20b --- /dev/null +++ b/editor/libeditor/crashtests/1429523.html @@ -0,0 +1,18 @@ + + + + + + diff --git a/editor/libeditor/crashtests/1429523.xhtml b/editor/libeditor/crashtests/1429523.xhtml new file mode 100644 index 0000000000..da2fe16b30 --- /dev/null +++ b/editor/libeditor/crashtests/1429523.xhtml @@ -0,0 +1,18 @@ + + + + + + diff --git a/editor/libeditor/crashtests/1441619.html b/editor/libeditor/crashtests/1441619.html new file mode 100644 index 0000000000..08343feeed --- /dev/null +++ b/editor/libeditor/crashtests/1441619.html @@ -0,0 +1,12 @@ + + + + + diff --git a/editor/libeditor/crashtests/1443664.html b/editor/libeditor/crashtests/1443664.html new file mode 100644 index 0000000000..b197d3cd49 --- /dev/null +++ b/editor/libeditor/crashtests/1443664.html @@ -0,0 +1,15 @@ + + + + + diff --git a/editor/libeditor/crashtests/1444630.html b/editor/libeditor/crashtests/1444630.html new file mode 100644 index 0000000000..72ce9afced --- /dev/null +++ b/editor/libeditor/crashtests/1444630.html @@ -0,0 +1,29 @@ + + + + + + + + + diff --git a/editor/libeditor/crashtests/1446451.html b/editor/libeditor/crashtests/1446451.html new file mode 100644 index 0000000000..56c887dc3b --- /dev/null +++ b/editor/libeditor/crashtests/1446451.html @@ -0,0 +1,13 @@ + + + + + diff --git a/editor/libeditor/crashtests/1464251.html b/editor/libeditor/crashtests/1464251.html new file mode 100644 index 0000000000..afe7e87561 --- /dev/null +++ b/editor/libeditor/crashtests/1464251.html @@ -0,0 +1,25 @@ + + +
        + + + diff --git a/editor/libeditor/crashtests/1470926.html b/editor/libeditor/crashtests/1470926.html new file mode 100644 index 0000000000..9c39710a97 --- /dev/null +++ b/editor/libeditor/crashtests/1470926.html @@ -0,0 +1,9 @@ + + + diff --git a/editor/libeditor/crashtests/1474978.html b/editor/libeditor/crashtests/1474978.html new file mode 100644 index 0000000000..d7eb01e03b --- /dev/null +++ b/editor/libeditor/crashtests/1474978.html @@ -0,0 +1,21 @@ + + +
        + +
        diff --git a/editor/libeditor/crashtests/1517028.html b/editor/libeditor/crashtests/1517028.html new file mode 100644 index 0000000000..cbc3b71c0a --- /dev/null +++ b/editor/libeditor/crashtests/1517028.html @@ -0,0 +1,23 @@ + +abc + + + +

        + + + +

        diff --git a/editor/libeditor/crashtests/1525481.html b/editor/libeditor/crashtests/1525481.html new file mode 100644 index 0000000000..d96e1c2d0d --- /dev/null +++ b/editor/libeditor/crashtests/1525481.html @@ -0,0 +1,23 @@ + + +
          +
          +
          +>
        diff --git a/editor/libeditor/crashtests/1533913.html b/editor/libeditor/crashtests/1533913.html new file mode 100644 index 0000000000..3009bbb660 --- /dev/null +++ b/editor/libeditor/crashtests/1533913.html @@ -0,0 +1,19 @@ + + +
        A + +
        diff --git a/editor/libeditor/crashtests/1534394.html b/editor/libeditor/crashtests/1534394.html new file mode 100644 index 0000000000..c254aa5f52 --- /dev/null +++ b/editor/libeditor/crashtests/1534394.html @@ -0,0 +1,29 @@ + + + + + + + +
      +
      +
      diff --git a/editor/libeditor/crashtests/1578916.html b/editor/libeditor/crashtests/1578916.html new file mode 100644 index 0000000000..f1d79be804 --- /dev/null +++ b/editor/libeditor/crashtests/1578916.html @@ -0,0 +1,28 @@ + + +