gecko-dev/widget/tests
Jim Chen 8b160783a8 Bug 1319660 - Fix possible crash when editing contentEditable; r=esawin r=masayuki r=smaug
Bug 1319660 - 1. Don't take shortcut if old replacement ranges don't match; r=esawin

The block at [1] is a shortcut we take when we reconcile Java text
changes with Gecko text changes. However, we only checked that the new
ranges are the same, i.e. that the new Gecko text is the same as the new
Java text. We should also be checking that the old ranges are the same,
i.e. that the replaced Gecko text is the same as the replaced Java text.

[1] https://dxr.mozilla.org/mozilla-central/rev/bbbd2f7539f224a482cc6d2dd10e6a5f31c8baf3/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoEditable.java#1233

Bug 1319660 - 2. Use previous node instead of sibling when adjusting last node; r=masayuki r=smaug

nsContentIterator in pre mode adjusts its last node if the node is a
childless node like <br>. However, right now it's using GetPrevSibling,
which can lead to error in some edge cases such as:

<p></p><div><br></div>

In this case, if the last node is <br> with offset 0, GetPrevSibling
will return <p> because <p> is <br>'s parent's previous sibling, and the
last node will be set to <p>. However, the correct last node in this
case is <div>, because <br> with offset 0 refers to the position to the
left of <br>, which is <div> with offset 0. In this case, PrevNode
returns the correct <div> value, so we should set the last node to the
result of PrevNode.

For the first node, for a childless node in pre mode, GetNextSibling and
NextNode are the same, so there is no bug in this case. Nevertheless,
this patch changes the call to NextNode to be consistent with calling
PrevNode for the last node.

Bug 1319660 - 3. Add test for correctly adjusting last node in content iterator; r=masayuki

Add a test for the previous patch that makes sure querying selected text
in an edge case works correctly.

Bug 1319660 - 4. Add test for start node regression; r=me

Add a new test case for the NextNode() regression. r=me for trivial
test-only patch.

Bug 1319660 - 5. Restore GetNextSibling call for first node of pre-content-iterator; r=smaug

The last patch changed the `GetNextSibling()` call to `NextNode()`
because I assumed they're equivalent in this case. That turned out to
not be the case because we can reach this line even if the node has
children -- the index just has to be after the last child. So this patch
restores the `GetNextSibling` call to restore the correct behavior.

I also added some comment to clarify that we can reach this line due to
one of two conditions: 1) the node has no children; 2) the node has
children but the index is after the last child.

This patch also replaces the `HasChildren()` check when setting
`cChild`.  If the index is after the last child (i.e. index ==
childCount), `GetChildAt()` fails and we erroneously log an assertion
warning, even though the input was valid. The new check handles all
cases whether start node has children or not.
2017-01-23 14:35:04 -05:00
..
unit Bug 503613 - Remove old 'tail =' lines from xpcshell.ini files; r=gps 2017-01-18 10:30:39 +00:00
bug586713_window.xul Bug 1207499 - Part 12: Remove use of expression closure from widget/. r=roc 2015-09-23 18:42:20 +09:00
chrome_context_menus_win.xul Bug 1016240 - Exterminate CR+LF line endings. r=briansmith,cpearce,ehsan,gavin 2014-06-18 17:56:02 -07:00
chrome.ini Backed out changeset 27f8d8e9c4dc (bug 1149966) for frequent timeouts in test_form_submission.html 2017-01-09 18:42:17 -08:00
empty_window.xul
mochitest.ini Backed out changeset 27f8d8e9c4dc (bug 1149966) for frequent timeouts in test_form_submission.html 2017-01-09 18:42:17 -08:00
moz.build Bug 1274484 Removing TestWinTSF.cpp r=masayuki 2016-08-31 09:31:51 +09:00
native_menus_window.xul Bug 1043421 - Make native Mac menus observe mutations from the observed elements directly. r=smichaud 2014-09-09 17:14:46 +02:00
native_mouse_mac_window.xul
standalone_native_menu_window.xul Bug 1043421 - Make native Mac menus observe mutations from the observed elements directly. r=smichaud 2014-09-09 17:14:46 +02:00
taskbar_previews.xul
test_assign_event_data.html Bug 1253479 - [e10s] Make widget/tests/test_assign_event_data.html work under e10s. r=masayuki 2016-03-10 16:56:13 -08:00
test_bug343416.xul
test_bug413277.html
test_bug428405.xul Bug 1146349 - Update some widget tests to deal with async native key event synthesization. r=smaug,masayuki 2015-04-14 11:36:36 -04:00
test_bug429954.xul
test_bug444800.xul
test_bug466599.xul
test_bug478536.xul
test_bug485118.xul
test_bug517396.xul
test_bug522217.xul
test_bug538242.xul
test_bug565392.html Backed out changeset 27f8d8e9c4dc (bug 1149966) for frequent timeouts in test_form_submission.html 2017-01-09 18:42:17 -08:00
test_bug586713.xul
test_bug593307.xul
test_bug596600.xul Bug 1048780 - Call the standard matches() rather than the proprietary mozMatchesSelector(); r=jst 2014-08-12 14:30:59 +02:00
test_bug673301.xul Bug 1251361 - "Assertion failure: cache->PreservingWrapper()" with <marquee>, navigation, adoptNode. r=smaug. 2016-03-04 17:54:10 +01:00
test_bug760802.xul Backed out 2 changesets (bug 1202902) to recking bug 1202902 to be able to reopen inbound on a CLOSED TREE 2015-10-07 14:03:21 +02:00
test_bug1123480.xul Bug 1123480 - Component: widget nsTransferable private browsing correction. r=jdm 2015-02-18 06:52:00 -05:00
test_bug1151186.html Bug 1151186 part.1 Don't reset IME enabled state after focus is changed by JS during setting focus r=enndeakin 2015-04-08 11:50:12 +09:00
test_chrome_context_menus_win.xul Bug 1016240 - Exterminate CR+LF line endings. r=briansmith,cpearce,ehsan,gavin 2014-06-18 17:56:02 -07:00
test_clipboard.xul Bug 1166840 - Remove unused document argument in uses of nsIClipboardHelper.copyString. r=ehsan 2015-05-21 21:49:30 +01:00
test_composition_text_querycontent.xul Bug 1218032 part.3 IMEContentObserver should notify IME of anything without script runner r=smaug 2015-11-10 11:49:05 +09:00
test_imestate.html Bug 1331081 - script generated patch to omit addEventListener/removeEventListener's third parameter when it's false, r=jaws. 2017-01-17 11:50:25 +01:00
test_input_events_on_deactive_window.xul Bug 1271115 - Merge ChromeUtils.js into EventUtils.js; r=jmaher 2016-08-25 16:57:09 +03:00
test_key_event_counts.xul Bug 1146349 - Update some widget tests to deal with async native key event synthesization. r=smaug,masayuki 2015-04-14 11:36:36 -04:00
test_keycodes.xul Bug 1310565 TextInputHandler shouldn't dispatch a composition events when a key press causes 2 or more characters r=m_kato 2016-10-18 15:26:54 +09:00
test_mouse_scroll.xul
test_native_key_bindings_mac.html Bug 1287655 - place textarea/input cursor at end of text when initialized; r=smaug 2016-07-21 14:52:49 -04:00
test_native_menus.xul
test_native_mouse_mac.xul
test_panel_mouse_coords.xul Backed out 2 changesets (bug 1202902) to recking bug 1202902 to be able to reopen inbound on a CLOSED TREE 2015-10-07 14:03:21 +02:00
test_picker_no_crash.html Bug 649012 - Fail mochitest-plains which use flaky timeouts (setTimeout(x) for x > 0); r=ted 2014-12-11 13:34:40 -05:00
test_platform_colors.xul Bug 1134111 - Update test_platform_colors.xul to include new 10.10 color for -moz-cellhighlight 2015-02-20 20:14:48 -08:00
test_plugin_input_event.html Bug 1146349 - Update some widget tests to deal with async native key event synthesization. r=smaug,masayuki 2015-04-14 11:36:36 -04:00
test_plugin_scroll_consistency.html
test_position_on_resize.xul
test_secure_input.html Bug 1271115 - Merge ChromeUtils.js into EventUtils.js; r=jmaher 2016-08-25 16:57:09 +03:00
test_sizemode_events.xul
test_standalone_native_menu.xul
test_system_status_bar.xul Bug 1041571 - Add some basic leak testing for nsSystemStatusBarCocoa. r=smichaud 2014-08-07 13:23:08 +02:00
test_taskbar_progress.xul Bug 605813 - Re-enable test_taskbar_progress.xul on Windows. r=me 2015-10-15 18:39:28 -03:00
test_wheeltransaction.xul
TestAppShellSteadyState.cpp Bug 1293603 (part 2) - Make Run() declarations consistent. r=erahm. 2016-08-08 12:18:10 +10:00
TestChromeMargin.cpp
utils.js
window_bug429954.xul
window_bug478536.xul Fix tests that depend on synchronous scrolling. (bug 1140293, r=mstange,masayuki,kgilbert) 2015-04-13 00:51:43 -04:00
window_bug522217.xul
window_bug538242.xul
window_bug593307_centerscreen.xul
window_bug593307_offscreen.xul
window_composition_text_querycontent.xul Bug 1319660 - Fix possible crash when editing contentEditable; r=esawin r=masayuki r=smaug 2017-01-23 14:35:04 -05:00
window_imestate_iframes.html
window_mouse_scroll_win.html Bug 1271115 - Merge ChromeUtils.js into EventUtils.js; r=jmaher 2016-08-25 16:57:09 +03:00
window_picker_no_crash_child.html
window_state_windows.xul
window_wheeltransaction.xul Bug 1209970 - Fire scroll events early in the refresh tick. r=mats 2015-12-17 17:19:30 -05:00