TreatJS: Higher-Order Contracts for JavaScript
by Matthias Keil and Peter Thiemann
TreatJS is a language embedded, higher-order contract system for JavaScript which enforces contracts by run-time monitoring. Beyond providing the standard abstractions for building higher-order contracts (base, function, and object contracts), TreatJS's novel contributions are its guarantee of non-interfering contract execution, its systematic approach to blame assignment, its support for contracts in the style of union and intersection types, and its notion of a parameterized contract scope, which is the building block for composable run-time generated contracts that generalize dependent function contracts.
TreatJS is implemented as a library so that all aspects of a contract can be specified using the full JavaScript language. The library relies on JavaScript proxies to guarantee full interposition for contracts. It further exploits JavaScript¿s reflective features to run contracts in a sandbox environment, which guarantees that the execution of contract code does not modify the application state. No source code transformation or change in the JavaScript run-time system is required. The impact of contracts on execution speed is evaluated using the Google Octane benchmark.
Software Download
Publications
Research Paper
-
Matthias Keil, Peter Thiemann
Blame Assignment for Higher-Order Contracts with Intersection and Union
The 20th ACM SIGPLAN International Conference on Functional Programming, ICFP 2015
Vancouver, British Columbia, Canada, August 31 - September 2, 2015
-
Matthias Keil, Peter Thiemann
TreatJS: Higher-Order Contracts for JavaScript
The European Conference on Object-Oriented Programming, ECOOP 2015
Prague, Czech Republic, July 5-10, 2015
-
Matthias Keil, Peter Thiemann
TreatJS: Higher-Order Contracts for JavaScripts (Technical Report)
Institute for Computer Science, University of Freiburg
Talks
-
Matthias Keil
On Contracts, Sandboxes, and Proxies for JavaScript
18. Kolloquium Programmiersprachen und Grundlagen der Programmierung, KPS 2015
Pörtschach am Wörthersee, Österreich, October 5, 2015
-
Matthias Keil
Blame Assignment for Higher-Order Contracts with Intersection and Union
The 20th ACM SIGPLAN International Conference on Functional Programming, ICFP 2015
Vancouver, British Columbia, Canada, August 31 - September 2, 2015
-
Matthias Keil
On Contracts and Sandboxes for JavaScript
Invited talk at the Software Lab, TU Darmstadt
Darmstadt, Germany, August 2015
-
Matthias Keil
TreatJS: Higher-Order Contracts for JavaScript
The European Conference on Object-Oriented Programming, ECOOP 2015
Prague, Czech Republic, July 5-10, 2015
-
Matthias Keil
TreatJS: Higher-Order Contracts for JavaScript
Dagstuhl Seminar on Scripting Languages and Frameworks: Analysis and Verification
Wadern, Germany, June 2014.
Artifacts
-
Matthias Keil, Peter Thiemann
TreatJS: Higher-Order Contracts for JavaScript (Artifact)
The European Conference on Object-Oriented Programming, ECOOP 2015
Prague, Czech Republic, July 5-10, 2015
Related Work
-
Matthias Keil, Peter Thiemann
Efficient Dynamic Access Analysis Using JavaScript Proxies
Dynamic Languages Symposium 2013, DLS'13
Indianapolis, Indiana, USA, October 28, 2013
-
Matthias Keil, Peter Thiemann
Efficient Dynamic Access Analysis Using JavaScript Proxies (Technical Report)
Institute for Computer Science, University of Freiburg
-
Matthias Keil, Peter Thiemann
Transaction-based Sandboxing for JavaScript (Technical Report)
Institute for Computer Science, University of Freiburg