Content area
JavaScript is a highly dynamic language that imposes few constraints on types. For example, the shape of any object can be changed during program execution, and functions can be called with any number of arguments, regardless how many are declared. Similarly, event-driven programming in JavaScript is intrinsically dynamic and untyped: events are identified by free-form strings, and listener functions for these events can be added or removed dynamically. JavaScript applications also rarely crash: for example, accessing a non-existent property evaluates to undefined rather than causing a runtime error. All of these features limit the facts that can be learned by applying a traditional program analysis to a single application.
In this thesis, we explore the question: it is possible to leverage the size of the JavaScript open source ecosystem to data mine and then statistically analyze program patterns, to compensate for the limitations of a traditional analysis over a single codebase and more effectively determine API usages? Through the various works presented here, we develop lightweight static analyses, run them over over a large amount of code to mine application-independent code patterns and then amalgamate the results. In particular, we show that we can mine API usages and use this data to both identify bug patterns and model intended API usage, in the context of event-based programming and the more general problem of object-property accesses. We also use API usage patterns as seed input to a feedback-directed test generator and explore how this set of real-world argument values improves the effectiveness of the generated tests.