Transparent Object Proxies in JavaScript

Authors Matthias Keil, Sankha Narayan Guria, Andreas Schlegel, Manuel Geffken, Peter Thiemann



PDF
Thumbnail PDF

File

LIPIcs.ECOOP.2015.149.pdf
  • Filesize: 0.56 MB
  • 25 pages

Document Identifiers

Author Details

Matthias Keil
Sankha Narayan Guria
Andreas Schlegel
Manuel Geffken
Peter Thiemann

Cite AsGet BibTex

Matthias Keil, Sankha Narayan Guria, Andreas Schlegel, Manuel Geffken, and Peter Thiemann. Transparent Object Proxies in JavaScript. In 29th European Conference on Object-Oriented Programming (ECOOP 2015). Leibniz International Proceedings in Informatics (LIPIcs), Volume 37, pp. 149-173, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2015)
https://doi.org/10.4230/LIPIcs.ECOOP.2015.149

Abstract

Proxies are the swiss army knives of object adaptation. They introduce a level of indirection to intercept select operations on a target object and divert them as method calls to a handler. Proxies have many uses like implementing access control, enforcing contracts, virtualizing resources. One important question in the design of a proxy API is whether a proxy object should inherit the identity of its target. Apparently proxies should have their own identity for security-related applications whereas other applications, in particular contract systems, require transparent proxies that compare equal to their target objects. We examine the issue with transparency in various use cases for proxies, discuss different approaches to obtain transparency, and propose two designs that require modest modifications in the JavaScript engine and cannot be bypassed by the programmer. We implement our designs in the SpiderMonkey JavaScript interpreter and bytecode compiler. Our evaluation shows that these modifications of have no statistically significant impact on the benchmark performance of the JavaScript engine. Furthermore, we demonstrate that contract systems based on wrappers require transparent proxies to avoid interference with program execution in realistic settings.
Keywords
  • JavaScript
  • Proxies
  • Equality
  • Contracts

Metrics

  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    0
    PDF Downloads

References

  1. Michael D. Adams and R. Kent Dybvig. Efficient nondestructive equality checking for trees and graphs. In Peter Thiemann, editor, Proceedings International Conference on Functional Programming 2008, pages 179-188, Victoria, BC, Canada, September 2008. ACM Press, New York. Google Scholar
  2. Thomas H. Austin, Tim Disney, and Cormac Flanagan. Virtual values for language extension. In Cristina Videira Lopes and Kathleen Fisher, editors, OOPSLA, pages 921-938, Portland, OR, USA, 2011. ACM. Google Scholar
  3. Gerald Baumgartner, Martin Jansche, and Konstantin Läufer. Half & half: Multiple dispatch and retroactive abstraction for Java. Technical Report OSU-CISRC-5/01-TR08, Revised 3/02, Ohio State University, March 2002. Google Scholar
  4. Gilad Bracha and David Ungar. Mirrors: Design principles for meta-level facilities of object-oriented programming languages. In John M. Vlissides and Douglas C. Schmidt, editors, OOPSLA, pages 331-344. ACM, 2004. Google Scholar
  5. Tim Disney. contracts.js. https://github.com/disnet/contracts.js, April 2013.
  6. Tim Disney, Nathan Faubion, David Herman, and Cormac Flanagan. Sweeten your JavaScript: Hygienic macros for ES5. In Andrew P. Black and Laurence Tratt, editors, DLS, pages 35-44, Portland, OR, USA, October 2014. ACM. Google Scholar
  7. Tim Disney, Cormac Flanagan, and Jay McCarthy. Temporal higher-order contracts. In Olivier Danvy, editor, Proceedings International Conference on Functional Programming 2011, pages 176-188, Tokyo, Japan, September 2011. ACM Press, New York. Google Scholar
  8. ECMAScript Language Specification, December 2009. ECMA International, ECMA-262, 5th edition. Google Scholar
  9. ECMAScript Language Specification. http://wiki.ecmascript.org/lib/exe/fetch.php?id=harmony:specification_drafts&cache=cache&media=harmony:ecma-262_6th_edition_final_draft_-04-14-15.pdf, April 2015. ECMA International, ECMA-262, 6th edition (draft).
  10. Robert Bruce Findler and Matthias Felleisen. Contracts for higher-order functions. In Simon Peyton-Jones, editor, Proceedings International Conference on Functional Programming 2002, pages 48-59, Pittsburgh, PA, USA, October 2002. ACM Press, New York. Google Scholar
  11. Matthew Flatt, Robert Bruce Findler, and PLT. The Racket Guide, v.6.0 edition, March 2014. URL: http://docs.racket-lang.org/guide/index.html.
  12. Matthias Keil, Sankha Narayan Guria, Andreas Schlegel, Manuel Geffken, and Peter Thiemann. Transparent object proxies for JavaScript. Technical report, Institute for Computer Science, University of Freiburg, 2015. Google Scholar
  13. Matthias Keil and Peter Thiemann. Efficient dynamic access analysis using JavaScript proxies. In Proceedings of the 9th Symposium on Dynamic Languages, DLS'13, pages 49-60, New York, NY, USA, 2013. ACM. Google Scholar
  14. Matthias Keil and Peter Thiemann. TreatJS: Higher-order contracts for JavaScript. http://proglang.informatik.uni-freiburg.de/treatjs/, 2014.
  15. Bertrand Meyer. Object-Oriented Software Construction. Prentice-Hall, 1988. Google Scholar
  16. Mark S. Miller, Tom Van Cutsem, and Bill Tulloh. Distributed electronic rights in JavaScript. In Matthias Felleisen and Philippa Gardner, editors, ESOP, volume 7792 of Lecture Notes in Computer Science, pages 1-20, Rome, Italy, March 2013. Springer. Google Scholar
  17. Mark Samuel Miller. Robust Composition: Towards a Unified Approach to Access Control and Concurrency Control. PhD thesis, Johns Hopkins University, Baltimore, MD, USA, 2006. AAI3245526. Google Scholar
  18. Michael Sperber, R. Kent Dybvig, Matthew Flatt, and Anton van Straaten, editors. Revised[6] Report on the Algorithmic Language Scheme. Cambridge University Press, 2010. Google Scholar
  19. T. Stephen Strickland, Sam Tobin-Hochstadt, Robert Bruce Findler, and Matthew Flatt. Chaperones and impersonators: Run-time support for reasonable interposition. In Gary T. Leavens and Matthew B. Dwyer, editors, OOPSLA, pages 943-962. ACM, 2012. Google Scholar
  20. Tom Van Cutsem and Mark S. Miller. Proxies: Design principles for robust object-oriented intercession APIs. In William D. Clinger, editor, DLS, pages 59-72. ACM, 2010. Google Scholar
  21. Tom Van Cutsem and Mark S. Miller. Trustworthy proxies - virtualizing objects with invariants. In Giuseppe Castagna, editor, ECOOP, volume 7920 of Lecture Notes in Computer Science, pages 154-178, Montpellier, France, July 2013. Springer. Google Scholar
  22. Alessandro Warth, Milan Stanojevic, and Todd Millstein. Statically scoped object adaptation with expanders. In Proceedings of the 21th ACM SIGPLAN Conference on Object Oriented Programming, Systems, Languages, and Applications, pages 37-56, Portland, OR, USA, 2006. ACM Press, New York. Google Scholar
Questions / Remarks / Feedback
X

Feedback for Dagstuhl Publishing


Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail