Affiliation:
1. Northeastern University, USA
2. Aalborg University, Denmark
Abstract
Recently, promises were added to ECMAScript 6, the JavaScript standard, in order to provide better support for the asynchrony that arises in user interfaces, network communication, and non-blocking I/O. Using promises, programmers can avoid common pitfalls of event-driven programming such as event races and the deeply nested counterintuitive control ow referred to as “callback hell”. Unfortunately, promises have complex semantics and the intricate control– and data- ow present in promise-based code hinders program comprehension and can easily lead to bugs. The promise graph was proposed as a graphical aid for understanding and debugging promise-based code. However, it did not cover all promise-related features in ECMAScript 6, and did not present or evaluate any technique for constructing the promise graphs. In this paper, we extend the notion of promise graphs to include all promise-related features in ECMAScript 6, including default reactions, exceptions, and the synchronization operations race and all. Furthermore, we report on the construction and evaluation of PromiseKeeper, which performs a dynamic analysis to create promise graphs and infer common promise anti-patterns. We evaluate PromiseKeeper by applying it to 12 open source promise-based Node.js applications. Our results suggest that the promise graphs constructed by PromiseKeeper can provide developers with valuable information about occurrences of common anti-patterns in their promise-based code, and that promise graphs can be constructed with acceptable run-time overhead.
Funder
National Science Foundation
Publisher
Association for Computing Machinery (ACM)
Subject
Safety, Risk, Reliability and Quality,Software
Cited by
12 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Code Coverage Criteria for Asynchronous Programs;Proceedings of the 31st ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering;2023-11-30
2. HODOR: Shrinking Attack Surface on Node.js via System Call Limitation;Proceedings of the 2023 ACM SIGSAC Conference on Computer and Communications Security;2023-11-15
3. Learning How to Listen: Automatically Finding Bug Patterns in Event-Driven JavaScript APIs;IEEE Transactions on Software Engineering;2023-01-01
4. An asynchronous call graph for JavaScript;Proceedings of the 44th International Conference on Software Engineering: Software Engineering in Practice;2022-05-21
5. Nessie;Proceedings of the 44th International Conference on Software Engineering;2022-05-21