Bug 131193 - Web Replay: detect possible replay divergence from unexpected DOM event dispatches
Summary: Web Replay: detect possible replay divergence from unexpected DOM event dispa...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Brian Burg
URL:
Keywords:
Depends on: 131281
Blocks:
  Show dependency treegraph
 
Reported: 2014-04-03 17:02 PDT by Brian Burg
Modified: 2014-04-07 12:58 PDT (History)
4 users (show)

See Also:


Attachments
the patch (26.05 KB, patch)
2014-04-06 18:58 PDT, Brian Burg
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brian Burg 2014-04-03 17:02:20 PDT
We can assert the following invariant to find divergences:

If a DOM event is dispatched and the page's EventLoopInputDispatcher::dispatching() is false, then replay divergence is possible.

Let's unpack that:

1. For a web page's JS to execute deterministically, the engine must execute code blocks in the same order.
2. To run JS in the same order, DOM events must be dispatched in the same order.
3. For DOM events to be dispatched in the same order, the relevant run loops must be dispatched in the same order.
4. If we are not controlling the dispatch of a run loop that fired a DOM event, then it could potentially execute script in any order with respect to other run loops.

In practice, this assertion finds more nondeterminism (and provides useful stack traces) than any other technique.
In the short term, it will make it really hard to do replay in debug mode without asserting, so it should probably be put behind a guard that is normally compiled out. Once an error reporting mechanism is implemented, it could show a warning in the inspector UI.
Comment 1 Brian Burg 2014-04-06 18:58:07 PDT
Created attachment 228713 [details]
the patch
Comment 2 Andreas Kling 2014-04-07 10:14:38 PDT
Comment on attachment 228713 [details]
the patch

r=me
Comment 3 WebKit Commit Bot 2014-04-07 12:58:33 PDT
Comment on attachment 228713 [details]
the patch

Clearing flags on attachment: 228713

Committed r166880: <http://trac.webkit.org/changeset/166880>
Comment 4 WebKit Commit Bot 2014-04-07 12:58:36 PDT
All reviewed patches have been landed.  Closing bug.