12019-09-20 Yury Semikhatsky <yurys@chromium.org>
2
3 Web Inspector: tests under LayoutTests/inspector/debugger are flaky
4 https://bugs.webkit.org/show_bug.cgi?id=137131
5 <rdar://problem/18461335>
6
7 Reviewed by NOBODY (OOPS!).
8
9 Fix debugger tests on GTK. All tests that pause on breakpoint didn't work because
10 in layout tests InspectorFrontendClientLocal was using Timer to dispatch commands
11 sent from the local front-end page to the inspected one. When paused inside a script
12 triggered by the front-end nested timer event would be scheduled but never fired
13 because in glib implementation of RunLoop::TimerBase uses event source which doesn't
14 allow recursion (g_source_set_can_recurse is not called on the source), so dispatching
15 Debugger.resume command didn't work when paused inside another inspector command (e.g.
16 eval). RunLoop itself uses event source which does allow recursion. So instead of using
17 a timer for asynchronous command dispatching with delay=0 we now schedule a task in
18 RunLoop's queue.
19
20 * inspector/InspectorFrontendClientLocal.cpp:
21 (WebCore::InspectorBackendDispatchTask::dispatch):
22 (WebCore::InspectorBackendDispatchTask::reset):
23 (WebCore::InspectorBackendDispatchTask::InspectorBackendDispatchTask):
24 (WebCore::InspectorBackendDispatchTask::scheduleOneShot): ensures that there is one inspector
25 dispatch task in the queue.
26 (WebCore::InspectorBackendDispatchTask::dispatchOneMessage): this is mostly the same behavior
27 as was with timerFired, we should be able to dispatch all accumulated messages from the queue
28 in one batched but for now I'd like to keep it one per iteration.
29