Skip to main content

DOM: Specification and Client Reasoning

  • Conference paper
  • First Online:
Programming Languages and Systems (APLAS 2016)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 10017))

Included in the following conference series:

Abstract

We present an axiomatic specification of a key fragment of DOM using structural separation logic. This specification allows us to develop modular reasoning about client programs that call the DOM.

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    It is possible to combine multiple cases into one by rewriting the pre- and postconditions as a disjunction of the cases and using logical variables to track each case. For clarity, we opt to write each case separately.

  2. 2.

    Since DOM may be called by different client programs written in different languages, \(\mathsf {store} \) denotes a black-box predicate that can be instantiated to describe a variable store in the client language. Here, we instantiate it as the JavaScript variable store.

  3. 3.

    All free logical variables on the right-hand side are parameters of the predicate on the left. We omit them for readability as they do not change throughout the execution. By contrast, the iteration number i, and the tag listeners \(\textsc {e}\) of node \(\textsc {n}\) may change (the latter may grow by getElementsByTagName) and are explicitly parameterised.

References

  1. W3C DOM standard. www.w3.org/TR/REC-DOM-Level-1/level-one-core.html

  2. Biri, N., Galmiche, D.: A separation logic for resource distribution. In: Pandya, P.K., Radhakrishnan, J. (eds.) FSTTCS 2003. LNCS, vol. 2914, pp. 23–37. Springer, Heidelberg (2003)

    Chapter  Google Scholar 

  3. Biri, N., Galmiche, D.: Models and separation logics for resource trees. J. Logic Comput. 17, 687–726 (2007)

    Article  MathSciNet  MATH  Google Scholar 

  4. Bodin, M., Chargueraud, A., Filaretti, D., Gardner, P., Maffeis, S., Naudz̆iūnienė, D., Schmitt, A., Smith, G.: A mechanised JavaScript specification. In: POPL (2014)

    Google Scholar 

  5. Calcagno, C., Dinsdale-Young, T., Gardner, P.: Adjunct elimination in context logic for trees. In: Shao, Z. (ed.) APLAS 2007. LNCS, vol. 4807, pp. 255–270. Springer, Heidelberg (2007)

    Chapter  Google Scholar 

  6. Calcagno, C., Gardner, P., Zarfaty, U.: Context logic and tree update. In: POPL (2005)

    Google Scholar 

  7. Gardner, P., Maffeis, S., Smith, G.: Towards a program logic for JavaScript. In: POPL (2012)

    Google Scholar 

  8. Gardner, P., Raad, A., Wheelhouse, M., Wright, A.: Local reasoning for concurrent libraries: mind the gap. In: MFPS (2014)

    Google Scholar 

  9. Gardner, P., Smith, G., Wheelhouse, M., Zarfaty, U.: Local Hoare reasoning about DOM. In: PODS (2008)

    Google Scholar 

  10. Igarashi, A., Pierce, B.C., Wadler, P.: Featherweight Java: a minimal core calculus for Java and GJ. In: OOPSLA (1999)

    Google Scholar 

  11. Jensen, S.H., Møller, A., Thiemann, P.: Type analysis for JavaScript. In: Palsberg, J., Su, Z. (eds.) SAS 2009. LNCS, vol. 5673, pp. 238–255. Springer, Heidelberg (2009). doi:10.1007/978-3-642-03237-0_17

    Chapter  Google Scholar 

  12. Jensen, S.H., Madsen, M., Møller, A.: Modeling the HTML DOM and browser API in static analysis of JavaScript Web applications. In: ESEC/FSE 2011 (2013)

    Google Scholar 

  13. Lerner, B.S., Carroll, M., Kimmel, D.P., La Vallee, H.Q., Krishnamurthi, S.: Modeling and reasoning about DOM events. In: WebApps (2012)

    Google Scholar 

  14. Maffeis, S., Mitchell, J.C., Taly, A.: An operational semantics for JavaScript. In: Ramalingam, G. (ed.) APLAS 2008. LNCS, vol. 5356, pp. 307–325. Springer, Heidelberg (2008). doi:10.1007/978-3-540-89330-1_22

    Chapter  Google Scholar 

  15. Park, C., Won, S., Jin, J., Ryu, S.: A static analysis of JavaScript web applications in the wild via practical DOM modeling (T). In: ASE (2015)

    Google Scholar 

  16. Parkinson, M.: Local reasoning for Java. Ph.D. thesis, Cambridge University (2006)

    Google Scholar 

  17. Raad, A.: Ph.D. thesis, Imperial College (2016, to appear)

    Google Scholar 

  18. Rajani, V., Bichhawat, A., Garg, D., Hammer, C.: Information flow control for event handling and the DOM in web browsers. In: CSF (2015)

    Google Scholar 

  19. Reynolds, J.C.: Separation logic: a logic for shared mutable data structures. In: LICS (2002)

    Google Scholar 

  20. Russo, A., Sabelfeld, A., Chudnov, A.: Tracking information flow in dynamic tree structures. In: Backes, M., Ning, P. (eds.) ESORICS 2009. LNCS, vol. 5789, pp. 86–103. Springer, Heidelberg (2009). doi:10.1007/978-3-642-04444-1_6

    Chapter  Google Scholar 

  21. Møller, A., Jensen, S.H., Madsen, M.: Modeling the HTML DOM and browser API in static analysis of JavaScript web applications. In: FSE (2011)

    Google Scholar 

  22. Smith, G.: Local reasoning for web programs. Ph.D. thesis, Imperial College (2010)

    Google Scholar 

  23. Swamy, N., Weinberger, J., Schlesinger, C., Chen, J., Livshits, B.: Verifying higher-order programs with the Dijkstra Monad. In: PLDI (2013)

    Google Scholar 

  24. Thiemann, P.: A type safe DOM API. In: Bierman, G., Koch, C. (eds.) DBPL 2005. LNCS, vol. 3774, pp. 169–183. Springer, Heidelberg (2005). doi:10.1007/11601524_11

    Chapter  Google Scholar 

  25. Wright, A.: Structural separation logic. Ph.D. thesis, Imperial College (2013)

    Google Scholar 

Download references

Acknowledgements

This research was supported by EPSRC programme grants EP/H008373/1, EP/K008528/1 and EP/K032089/1.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Azalea Raad .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2016 Springer International Publishing AG

About this paper

Cite this paper

Raad, A., Santos, J.F., Gardner, P. (2016). DOM: Specification and Client Reasoning. In: Igarashi, A. (eds) Programming Languages and Systems. APLAS 2016. Lecture Notes in Computer Science(), vol 10017. Springer, Cham. https://doi.org/10.1007/978-3-319-47958-3_21

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-47958-3_21

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-47957-6

  • Online ISBN: 978-3-319-47958-3

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics