Finding broken promises in asynchronous JavaScript programs

Finding broken promises in asynchronous JavaScript programs
复制标题

DOI:
10.1145/3276532
复制
发表时间:
2018-10
影响因子:
--
通讯作者:
Saba Alimadadi;Di Zhong;Magnus Madsen;F. Tip
Saba Alimadadi;Di Zhong;Magnus Madsen;F. Tip
中科院分区:
--
文献类型:
--
作者:
Saba Alimadadi;Di Zhong;Magnus Madsen;F. Tip

文献摘要

被引文献

相似文献

最近,将承诺添加到JavaScript标准的Ecmascript 6中,以便为在用户界面,网络通信和非封锁I/O中提供的异步提供更好的支持。不幸的是,驱动的编程(例如事件竞赛和深层嵌套的违反直觉控制)被称为“回调地狱”。错误的图形是理解和基于承诺的代码的图形辅助工具本文,我们将承诺图的通知扩展到Ecmascript 6中的所有与承诺相关的功能,包括默认反应,异常和同步操作竞赛,我们报告了P​​romisekeeper的构建和评估动态分析以创建承诺图和推断通向抗模式。在其基于承诺的代码中,可以使用可接受的运行时开销来构建普通反式图案。
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.