Skip to main content
Log in

Exposing bugs in JavaScript engines through test transplantation and differential testing

  • Published:
Software Quality Journal Aims and scope Submit manuscript

Abstract

JavaScript is a popular programming language today with several implementations competing for market dominance. Although a specification document and a conformance test suite exist to guide engine development, bugs occur and have important practical consequences. Implementing correct engines is challenging because the spec is intentionally incomplete and evolves frequently. This paper investigates the use of test transplantation and differential testing for revealing functional bugs in JavaScript engines. The former technique runs the regression test suite of a given engine on another engine. The latter technique fuzzes existing inputs and then compares the output produced by different engines with a differential oracle. We conducted experiments with engines from five major players—Apple, Facebook, Google, Microsoft, and Mozilla—to assess the effectiveness of test transplantation and differential testing. Our results indicate that both techniques revealed several bugs, many of which are confirmed by developers. We reported 35 bugs with test transplantation (23 of these bugs confirmed and 19 fixed) and reported 24 bugs with differential testing (17 of these confirmed and 10 fixed). Results indicate that most of these bugs affected two engines—Apple’s JSC and Microsoft’s ChakraCore (24 and 26 bugs, respectively). To summarize, our results show that test transplantation and differential testing are easy to apply and very effective in finding bugs in complex software, such as JavaScript engines.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3

Similar content being viewed by others

Data availability

The scripts to run the experiments for this study will be available upon request. The data is publicly available https://github.com/STAR-RG/entente.

Notes

  1. These files are created with the grammar-based fuzzer jsfunfuzz (Mozilla 2007a). Look for option “compare_jit” from funfuzz.

  2. Microsoft announced in December 2018 that the Edge browser will be based on Chromium and ChakraCore development would be discontinued (Joe 2018).

  3. https://zenodo.org/record/4116092

  4. The name JavaScript still prevails today, certainly for historical reasons.

  5. There are options in the clang toolchain to build programs with fuzzing instrumentation (Libfuzzer 2020a). clang provides several sanitizers for property checking (LLVM 2020).

  6. 6 ome is for out of memory error.

  7. See https://github.com/facebook/hermes/blob/master/doc/Features.md

  8. https://github.com/facebook/hermes/issues/<id>, with id 265, 266, 267.

  9. We interpreted as a violation of an undocumented precondition

References

Download references

Funding

Igor is supported by the FACEPE fellowship IBPG-0123-1.03/17. This research was partially funded by INES 2.0, FACEPE grants PRONEX APQ 0388-1.03/14 and APQ-0399-1.03/17, and CNPq grant 465614/2014-0.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Breno Miranda.

Additional information

Publisher’s note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Lima, I., Silva, J., Miranda, B. et al. Exposing bugs in JavaScript engines through test transplantation and differential testing. Software Qual J 29, 129–158 (2021). https://doi.org/10.1007/s11219-020-09537-8

Download citation

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s11219-020-09537-8

Keywords

Navigation