gecko-dev/widget/tests
Kyle Huey 76e3009ab8 Bug 1179909: Refactor stable state handling. r=smaug
This is motivated by three separate but related problems:

1. Our concept of recursion depth is broken for things that run from AfterProcessNextEvent observers (e.g. Promises). We decrement the recursionDepth counter before firing observers, so a Promise callback running at the lowest event loop depth has a recursion depth of 0 (whereas a regular nsIRunnable would be 1). This is a problem because it's impossible to distinguish a Promise running after a sync XHR's onreadystatechange handler from a top-level event (since the former runs with depth 2 - 1 = 1, and the latter runs with just 1).

2. The nsIThreadObserver mechanism that is used by a lot of code to run "after" the current event is a poor fit for anything that runs script. First, the order the observers fire in is the order they were added, not anything fixed by spec. Additionally, running script can cause the event loop to spin, which is a big source of pain here (bholley has some nasty bug caused by this).

3. We run Promises from different points in the code for workers and main thread. The latter runs from XPConnect's nsIThreadObserver callbacks, while the former runs from a hardcoded call to run Promises in the worker event loop. What workers do is particularly problematic because it means we can't get the right recursion depth no matter what we do to nsThread.

The solve this, this patch does the following:

1. Consolidate some handling of microtasks and all handling of stable state from appshell and WorkerPrivate into CycleCollectedJSRuntime.
2. Make the recursionDepth counter only available to CycleCollectedJSRuntime (and its consumers) and remove it from the nsIThreadInternal and nsIThreadObserver APIs.
3. Adjust the recursionDepth counter so that microtasks run with the recursionDepth of the task they are associated with.
4. Introduce the concept of metastable state to replace appshell's RunBeforeNextEvent. Metastable state is reached after every microtask or task is completed. This provides the semantics that bent and I want for IndexedDB, where transactions autocommit at the end of a microtask and do not "spill" from one microtask into a subsequent microtask. This differs from appshell's RunBeforeNextEvent in two ways:
a) It fires between microtasks, which was the motivation for starting this.
b) It no longer ensures that we're at the same event loop depth in the native event queue. bent decided we don't care about this.
5. Reorder stable state to happen after microtasks such as Promises, per HTML. Right now we call the regular thread observers, including appshell, before the main thread observer (XPConnect), so stable state tasks happen before microtasks.
2015-08-11 06:10:46 -07:00
..
unit Bug 1066735 - Remove root b2g and android specific xpcshell manifests, r=chmanchester 2014-10-07 18:18:28 -04:00
TestAppShellSteadyState.cpp Bug 1146349 - Make the native event synthesization functions in DOMWindowUtils async. r=smaug 2015-04-14 11:36:36 -04:00
TestChromeMargin.cpp
TestWinTSF.cpp Bug 960871 part.4 Rename NS_TEXT_TEXT to NS_COMPOSITION_CHANGE and fix comments which mention text events r=smaug 2014-10-07 19:01:47 +09:00
bug586713_window.xul
chrome.ini Bug 1026290 - Update mochitest-chrome manifests for android; r=jgriffin 2015-07-10 14:41:59 -06: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
empty_window.xul
mochitest.ini Bug 1153248, re-enable a bunch of tests that now work with e10s, r=billm 2015-04-16 15:38:12 -04:00
moz.build Bug 1179909: Refactor stable state handling. r=smaug 2015-08-11 06:10:46 -07: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
plugin_scroll_invalidation.html
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 974305 - Add a test for WidgetPointerEvent::AssignPointerEventData(). r=smaug 2015-04-22 16:09:10 +09: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
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
test_bug760802.xul
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 1028485 Don't set caret position over actual inserted string at commiting composition r=ehsan 2014-06-24 10:06:20 +09:00
test_imestate.html Bug 1167022 part.4 Get rid of MozIMEFocus(In|Out) events r=smaug 2015-05-26 16:45:26 +09:00
test_input_events_on_deactive_window.xul Bug 1119609 part.14 Reimplement/redesign EventUtils.synthesizeKey() with nsITextInputProcessor r=smaug 2015-02-19 15:50:20 +09: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 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_mouse_scroll.xul
test_native_key_bindings_mac.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_native_menus.xul
test_native_mouse_mac.xul
test_panel_mouse_coords.xul mochitest for bug 835044 2014-05-14 12:12:27 +12: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_plugin_scroll_invalidation.html
test_position_on_resize.xul
test_secure_input.html
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
test_wheeltransaction.xul
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 549674 part.1 Commit composition string at setting value of <input> or <textarea> r=smaug 2015-06-18 23:56:20 +09:00
window_imestate_iframes.html
window_mouse_scroll_win.html
window_picker_no_crash_child.html
window_state_windows.xul
window_wheeltransaction.xul Make test_wheeltransaction.xul work with asynchronous scrolling. (bug 1140293, r=mstange) 2015-04-16 21:38:19 -04:00