Nothing Special   »   [go: up one dir, main page]

skip to main content
10.1007/978-3-642-39038-8_4guideproceedingsArticle/Chapter ViewAbstractPublication PagesConference Proceedingsacm-pubtype
Article

Combining form and function: static types for JQuery programs

Published: 01 July 2013 Publication History

Abstract

The jQuery library defines a powerful query language for web applications' scripts to interact with Web page content. This language is exposed as jQuery's api, which is implemented to fail silently so that incorrect queries will not cause the program to halt. Since the correctness of a query depends on the structure of a page, discrepancies between the page's actual structure and what the query expects will also result in failure, but with no error traces to indicate where the mismatch occurred.
This work proposes a novel type system to statically detect jQuery errors. The type system extends Typed JavaScript with local structure about the page and with multiplicities about the structure of containers. Together, these two extensions allow us to track precisely which nodes are active in a jQuery object, with minimal programmer annotation effort. We evaluate this work by applying it to sample real-world jQuery programs.

References

[1]
Abel, A.: Polarized subtyping for sized types. Mathematical Structures in Computer Science 18(5), 797-822 (2008)
[2]
Benzaken, V., Castagna, G., Frisch, A.: CDuce: an XML-centric general-purpose language. In: ACM SIGPLAN International Conference on Functional Programming (ICFP), pp. 51-63. ACM, New York (2003)
[3]
Bohannon, A., Pierce, B.C.: Featherweight Firefox: formalizing the core of a web browser. In: USENIX Conference on Web Application Development (WebApps), pp. 123-134 USENIX Association, Berkeley (2010)
[4]
BuiltWith. JQuery usage statistics, http://trends.builtwith.com/javascript/JQuery (retrieved November 2012)
[5]
Castagna, G., Colazzo, D., Frisch, A.: Error mining for regular expression patterns. In: Coppo, M., Lodi, E., Pinna, G. M. (eds.) ICTCS 2005. LNCS, vol. 3701, pp. 160-172. Springer, Heidelberg (2005)
[6]
Chaffer, J., Swedberg, K.: Learning JQuery, 3rd edn. Packt Publishing Ltd., Birmingham (2011)
[7]
Gardner, P., Wheelhouse, M.: Small specifications for tree update. In: Laneve, C., Su, J. (eds.) WS-FM 2009. LNCS, vol. 6194, pp. 178-195. Springer, Heidelberg (2010)
[8]
Gardner, P. A., Smith, G. D., Wheelhouse, M. J., Zarfaty, U. D.: Local Hoare reasoning about DOM. In: ACM SIGMOD Symposium on Principles of Database Systems (PODS), pp. 261-270. ACM Press, New York (2008)
[9]
Guha, A., Saftoiu, C., Krishnamurthi, S.: The essence of JavaScript. In: D'Hondt, T. (ed.) ECOOP 2010. LNCS, vol. 6183, pp. 126-150. Springer, Heidelberg (2010)
[10]
Guha, A., Saftoiu, C., Krishnamurthi, S.: Typing local control and state using flow analysis. In: Barthe, G. (ed.) ESOP 2011. LNCS, vol. 6602, pp. 256-275. Springer, Heidelberg (2011)
[11]
Hosoya, H., Pierce, B.C.: XDuce: A statically typed XML processing language. ACM Transactions on Internet Technology (TOIT) 3(2), 117-148 (2003)
[12]
Lerner, B. S.: Designing for Extensibility and Planning for Conflict: Experiments in Web-Browser Design. Ph. D. thesis, University of Washington Computer Science & Engineering (August 2011)
[13]
Lerner, B. S., Carroll, M. J., Kimmel, D. P., de la Vallee, H. Q., Krishnamurthi, S.: Modeling and reasoning about DOM events. In: USENIX Conference on Web Application Development (WebApps). USENIX Association, Berkeley (2012)
[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)
[15]
Politz, J. G., Carroll, M., Lerner, B. S., Pombrio, J., Krishnamurthi, S.: A tested semantics for getters, setters, and eval in JavaScript. In: Dynamic Languages Symposium, (DLS) (2012)
[16]
Politz, J. G., Eliopoulos, S. A., Guha, A., Krishnamurthi, S.: ADsafety: type-based verification of JavaScript sandboxing. In: USENIX Security Symposium, p. 12. USENIX Association, Berkeley (2011)
[17]
Politz, J. G., Guha, A., Krishnamurthi, S.: Semantics and types for objects with first-class member names. In: Workshop on Foundations of Object-Oriented Languages, (FOOL) (2012)
[18]
St-Amour, V., Tobin-Hochstadt, S., Flatt, M., Felleisen, M.: Typing the numeric tower. In: Russo, C., Zhou, N.-F. (eds.) PADL 2012. LNCS, vol. 7149, pp. 289-303. Springer, Heidelberg (2012)
[19]
Sulzmann, M., Lu, K. Z. M.: A type-safe embedding of XDuce into ML. In: Workshop on ML, pp. 229-253. ACM Press, New York (2005)
[20]
Swedberg, K.: How to get anything you want - part 1, http://www.learningjquery.com/2006/11/how-to-get-anything-you-want-part-1 (written November 2006)
[21]
Swedberg, K.: How to get anything you want - part 2, http://www.learningjquery.com/2006/12/how-to-get-anything-you-want-part-2 (written December 2006)
[22]
Tobin-Hochstadt, S., Felleisen, M.: The design and implementation of Typed Scheme. In: ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL), pp. 395-406. ACM Press, New York (2008)
[23]
W3C. XML path language (XPath) 2.0, http://www.w3.org/TR/xpath20/ (written December 2010)
[24]
W3C. XQuery 1.0: An XML query language, http://www.w3.org/TR/xquery/ (written December 2010)
[25]
W3C. Selectors level 3, http://www.w3.org/TR/selectors/ (written September 2010)
[26]
Zenger, C.: Indexed types. Theoretical Computer Science 187(1-2), 147-165 (1997)

Cited By

View all

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image Guide Proceedings
ECOOP'13: Proceedings of the 27th European conference on Object-Oriented Programming
July 2013
731 pages
ISBN:9783642390371
  • Editor:
  • Giuseppe Castagna

Sponsors

  • Typesafe: Typesafe
  • BTelecom: Bouygues Telecom
  • IBMR: IBM Research
  • Microsoft Research: Microsoft Research
  • ORACLE: ORACLE

Publisher

Springer-Verlag

Berlin, Heidelberg

Publication History

Published: 01 July 2013

Qualifiers

  • Article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)0
  • Downloads (Last 6 weeks)0
Reflects downloads up to 27 Jan 2025

Other Metrics

Citations

Cited By

View all
  • (2022)Containerless Plurals: Separating Number from Type in Object-Oriented ProgrammingACM Transactions on Programming Languages and Systems10.1145/352763544:4(1-56)Online publication date: 21-Sep-2022
  • (2017)Analysis of JavaScript ProgramsACM Computing Surveys10.1145/310674150:4(1-34)Online publication date: 25-Aug-2017
  • (2016)A vision for online verification-validationACM SIGPLAN Notices10.1145/3093335.299325552:3(190-201)Online publication date: 20-Oct-2016
  • (2016)Precise and scalable static analysis of jQuery using a regular expression domainACM SIGPLAN Notices10.1145/3093334.298922852:2(25-36)Online publication date: 1-Nov-2016
  • (2016)A vision for online verification-validationProceedings of the 2016 ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences10.1145/2993236.2993255(190-201)Online publication date: 20-Oct-2016
  • (2016)Precise and scalable static analysis of jQuery using a regular expression domainProceedings of the 12th Symposium on Dynamic Languages10.1145/2989225.2989228(25-36)Online publication date: 1-Nov-2016
  • (2016)Just-in-time static type checking for dynamic languagesACM SIGPLAN Notices10.1145/2980983.290812751:6(462-476)Online publication date: 2-Jun-2016
  • (2016)Just-in-time static type checking for dynamic languagesProceedings of the 37th ACM SIGPLAN Conference on Programming Language Design and Implementation10.1145/2908080.2908127(462-476)Online publication date: 2-Jun-2016
  • (2015)Detecting redundant CSS rules in HTML5 applications: a tree rewriting approachACM SIGPLAN Notices10.1145/2858965.281428850:10(1-19)Online publication date: 23-Oct-2015
  • (2015)Detecting redundant CSS rules in HTML5 applications: a tree rewriting approachProceedings of the 2015 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications10.1145/2814270.2814288(1-19)Online publication date: 23-Oct-2015
  • Show More Cited By

View Options

View options

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media