Automatic Fault Localization for Client-Side JavaScript

Frolin Ocariza, Guanpeng Li, Karthik Pattabiraman and Ali Mesbah, Journal of Software Testing, Verification and Reliability (STVR). [ PDF ]

This is an expanded version of the following conference paper.

JAVASCRIPT is a scripting language that plays a prominent role in web applications today. It is dynamic, loosely typed, asynchronous, and is extensively used to interact with the DOM at runtime. All these characteristics make JAVASCRIPT code error-prone; unfortunately, JAVASCRIPT fault localization remains a tedious and mainly manual task. Despite these challenges, the problem has received very limited research attention. This paper proposes an automated technique to localize JAVASCRIPT faults based on dynamic analysis, tracing, and backward slicing of JAVASCRIPT code. This technique is capable of handling features of JAVASCRIPT code that have traditionally been difficult to analyze, including eval, anonymous functions, and minified code. The approach is implemented in an open source tool called AUTOFLOX, and evaluation results indicate that it is capable of (1) automatically localizing DOM-related JAVASCRIPT faults with high accuracy (over 96%) and no false-positives, and (2) isolating JAVASCRIPT faults in production websites, as well as actual bugs from real-world web applications.