Lecture Notes in Computer Science Commenced Publication in 1973 Founding and Former Series Editors: Gerhard Goos, Juris Hartmanis, and Jan van Leeuwen
Editorial Board David Hutchison Lancaster University, UK Takeo Kanade Carnegie Mellon University, Pittsburgh, PA, USA Josef Kittler University of Surrey, Guildford, UK Jon M. Kleinberg Cornell University, Ithaca, NY, USA Alfred Kobsa University of California, Irvine, CA, USA Friedemann Mattern ETH Zurich, Switzerland John C. Mitchell Stanford University, CA, USA Moni Naor Weizmann Institute of Science, Rehovot, Israel Oscar Nierstrasz University of Bern, Switzerland C. Pandu Rangan Indian Institute of Technology, Madras, India Bernhard Steffen TU Dortmund University, Germany Madhu Sudan Microsoft Research, Cambridge, MA, USA Demetri Terzopoulos University of California, Los Angeles, CA, USA Doug Tygar University of California, Berkeley, CA, USA Gerhard Weikum Max Planck Institute for Informatics, Saarbruecken, Germany
7321
John Derrick Stefania Gnesi Diego Latella Helen Treharne (Eds.)
Integrated Formal Methods 9th International Conference, IFM 2012 Pisa, Italy, June 18-21, 2012 Proceedings
13
Volume Editors John Derrick University of Sheffield Department of Computer Science Regent Court, 211 Portobello Street Sheffield S1 4DP, UK E-mail:
[email protected] Stefania Gnesi Diego Latella Consiglio Nazionale delle Ricerche Istituto di Scienza e Tecnologie dell’Informazione “A. Faedo” Via Moruzzi 1 56124 Pisa, Italy E-mail: {stefania.gnesi;
[email protected]} Helen Treharne University of Surrey Department of Computing Surrey GU2 7XH, UK E-mail:
[email protected]
ISSN 0302-9743 e-ISSN 1611-3349 ISBN 978-3-642-30728-7 e-ISBN 978-3-642-30729-4 DOI 10.1007/978-3-642-30729-4 Springer Heidelberg Dordrecht London New York Library of Congress Control Number: 2012939244 CR Subject Classification (1998): D.2, F.3, D.3, D.2.4, F.4.1, D.1 LNCS Sublibrary: SL 2 – Programming and Software Engineering
© Springer-Verlag Berlin Heidelberg 2012 This work is subject to copyright. All rights are reserved, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, re-use of illustrations, recitation, broadcasting, reproduction on microfilms or in any other way, and storage in data banks. Duplication of this publication or parts thereof is permitted only under the provisions of the German Copyright Law of September 9, 1965, in its current version, and permission for use must always be obtained from Springer. Violations are liable to prosecution under the German Copyright Law. The use of general descriptive names, registered names, trademarks, etc. in this publication does not imply, even in the absence of a specific statement, that such names are exempt from the relevant protective laws and regulations and therefore free for general use. Typesetting: Camera-ready by author, data conversion by Scientific Publishing Services, Chennai, India Printed on acid-free paper Springer is part of Springer Science+Business Media (www.springer.com)
Foreword
iFM 2012, the 9th International Conference on Integrated Formal Methods, and ABZ 2012, the 3rd International Conference on Abstract State Machines, Alloy, B, VDM, and Z, were joined in a single event, iFM&ABZ 2012, to celebrate Egon B¨orger’s 65th birthday and his contribution to state-based formal methods. This colocation of iFM&ABZ 2012 was hosted by the Institute of Scienza e Tecnologie dell’Informazione “A. Faedo” of the National Research Council (ISTI-CNR) of Italy and took place at the Area della Ricerca del CNR in Pisa, during June 18–21, 2012. We would like to thank everyone in Pisa for making us feel very welcome during our time there. It was a pleasure to run an event to honor Egon. Professor Egon B¨ orger was born in Bad Laer, Lower Saxony, Germany. Between 1965 and 1971 he studied at the Sorbonne, Paris (France), Universit´e Catholique de Louvain and Institut Sup´erieur de Philosophie de Louvain (in Louvain-la-Neuve, Belgium), and the University of M¨ unster (Germany). Since 1985 he has held a Chair in computer science at the University of Pisa, Italy. In September 2010 he was elected as member of the Academia Europaea. Throughout his work he has been a pioneer of applying logical methods in computer science. Particularly notable is his contribution as one of the founders of the Abstract State Machine (ASM) method. Egon B¨ orger has been cofounder and Managing Director of the Abstract State Machines Research Center (see www.asmcenter.org). Building on his work on ASM, he was a cofounder of the series of international ASM workshops, which were part of this year’s conference under the ABZ banner. He contributed to the theoretical foundations of the method and initiated its industrial applications in a variety of fields, in particular programming languages, system architecture, requirements and software (re-)engineering, control systems, protocols and Web services. In 2007, he received the Humboldt Research Award. He has been coauthor of several books and over 150 research papers; he has organized over 30 international conferences, workshops, schools in logic and computer science. As one can see, his influence has been broad as well as deep. It is an influence that ones finds in all of the notations covered in the ABZ conference, as well as in the iFM event and the various integrations and combinations of formal methods seen therein. Neither iFM or ABZ have been here before, and it is thus especially fitting that we held such an event in Pisa, where Egon has held a Chair for many years.
VI
Foreword
In addition to contributed papers, the conference programme included two tutorials and three keynote speakers. The tutorials were offered by: Eric C.R. Hehner on “Practical Predicative Programming Primer” and Joost-Pieter Katoen, Thomas Noll, Alessandro Cimatti and Marco Bozzano on “Safety, Dependability and Performance Analysis of Extended AADL Models.” We are grateful to Egon B¨orger, Muffy Calder and Ian J. Hayes for accepting our invitation to address the conference. Each conference, ABZ and iFM, had its own Programme Committee Chairs and Programme Committees, and we leave it to them to describe their particular conference. We shared invited speakers, so all conference attendees had the opportunity to hear Egon, Muffy and Ian. We also shared some technical sessions so that all participants could see some of the best technical work from each conference. We would like to thank the Programme Committee Chairs, Diego Latella, CNR/ ISTI, Italy and Helen Treharne, University of Surrey, UK for iFM 2012; Steve Reeves, University of Waikato, New Zealand and Elvinia Riccobene, University of Milan, Italy for ABZ 2012 for their efforts in setting up two highquality conferences. We also would like to thank the members of the Organizing Committee as well as several other people whose efforts contributed to making the conference a success and particular thanks go to the Organizing Committee Chair Maurice ter Beek. June 2012
John Derrick Stefania Gnesi
Preface
This volume contains the proceedings of iFM 2012, the 9th International Conference on Integrated Formal Methods, held during June 18–21, 2012, in Pisa, Italy, jointly with ABZ 2012, the 3rd International Conference on Abstract State Machines, Alloy, B, VDM, and Z, in honor of Egon B¨ orger’s 65th birthday. The ABZ proceedings appear as a separate LNCS volume, number 7316. The invited talk of Egon B¨ orger appears in both proceedings. The iFM conference programme also included an invited talk by Muffy Calder and the ABZ conference programme included an invited talk by Ian Hayes. Previous iFM conferences were held in York, Dagstuhl, Turku, Canterbury, Eindhoven, Oxford, D¨ usserldorf and Nancy. The iFM conference series seeks to further research into the combination of different formal methods for modelling and analysis. However, the work of iFM goes beyond that, covering all aspects from language design, verification techniques, tools and the integration of formal methods into software engineering practice. iFM 2012 received 59 submissions, covering the spectrum of integrated formal methods, ranging across formal and semi-formal modelling notations, semantics, proof frameworks, refinement, verification, timed systems, tools and case studies. Each submission was reviewed by at least three Programme Committee members. The committee decided to accept 22 papers. The conference was preceded by a day dedicated to tutorials on “Practical Predicative Programming Primer” by Eric C. R. Hehner and “Safety, Dependability and Performance Analysis of Extended AADL Models” by Joost-Pieter Katoen, Thomas Noll, Alessandro Cimatti and Marco Bozzano. We are grateful to the members of the Programme Committee and the external reviewers for their diligence and thoroughness. We also appreciate the support of EasyChair for managing the reviewing process and the preparation of the proceedings. We thank all those involved in organizing the conference and an important note of thanks must be extended to the members of CNR who helped locally. June 2012
Diego Latella Helen Treharne
Organization
General Chairs John Derrick Stefania Gnesi
University of Sheffield, UK CNR/ISTI, Italy
Conference Chairs Diego Latella Helen Treharne
CNR/ISTI, Italy University of Surrey, UK
Programme Committee Marc Benveniste Eerke Boiten Jonathan P. Bowen Jim Davies John Derrick Jin Song Dong Kerstin Eder Alessandro Fantechi John Fitzgerald Andy Galloway Einar Broch Johnsen Rajeev Joshi Michael Leuschel Michele Loreti Silvia Mazzini Dominique Mery Stephan Merz Alexandre Mota Flemming Nielson Luigia Petre David Pichardie Thomas Santen Steve Schneider Kaisa Sere Graeme Smith Kenji Taguchi
STMicroelectronics, France University of Kent, UK Museophile Limited, UK University of Oxford, UK Unversity of Sheffield, UK National University of Singapore, Singapore University of Bristol, UK University of Florence and CNR/ISTI, Italy Newcastle University, UK University of York, UK University of Oslo, Norway NASA Jet Propulsion Laboratory (JPL), USA University of D¨ usseldorf, Germany University of Florence, Italy Intecs S.p.A, Italy LORIA and Universit´e de Lorraine, France INRIA Nancy and LORIA, France Centre of Informatics (CIn-UFPE), Brazil Technical University of Denmark and MT-LAB, Denmark ˚ Abo Akademi University, Finland INRIA Rennes, France European Microsoft Innovation Center, Germany University of Surrey, UK ˚ Abo Akademi University, Finland University of Queensland, Australia National Institute of Advanced Industrial Science and Technology, Japan
X
Organization
Mirco Tribastone Marina Wald´en Heike Wehrheim Kirsten Winter
Ludwig-Maximilians-Universit¨ at, Germany ˚bo Akademi University, Finland A University of Paderborn, Germany University of Queensland, Australia
Additional Reviewers Islam Abdel Halim ´ Etienne Andr´e Emilie Balland Sebastien Bardin Cristiano Bertolini Lorenzo Bettini Irene Bicchierai Jean-Paul Bodeviex Carl Friedrich Bolz Pontus Bostr¨ om Jeremy W. Bryans Laura Carnevali M´ arcio Corn´elio Fredrik Degerlund Delphine Demange Andre Didier Johan Dovland Neil Evans Marc Fontaine
Carl Gamble Juliano Iyoda Mohammad Mahdi Jaghoori Maryam Kamali Weiqiang Kong Linas Laibinis Shang-Wei Lin Alberto Lluch Lafuente Acciai Lucia Toby Murray Keishi Okamoto Richard Payne Stefano Pepi Ken Pierce Steve Riddle Petter Sandvik Rudolf Schlatte Alexander Schremmer
Ling Shi Mihaela Sighireanu Tarciana Silva Neeraj-Kumar Singh Songzheng Song Dominik Steenken Volker Stolz Anton Tarasyuk Maurice ter Beek Francesco Tiezzi Max Tschaikowski Leonidas Tsiopoulos Sven Walther Daniel Wonisch Yoriyuki Yamagata Shaojie Zhang Manchun Zheng Steffen Ziegert
Sponsoring Institutions A final note of appreciation to our sponsors:
INTECS
Formal Methods
Banca Nazionale del Lavoro
EATCS
S.p.A.
Europe
S.p.A.
Italian Chapter
We particularly would like to thank Formal Methods Europe (FME), since it is due to their generous support that were able to invite Muffy Calder for a keynote presentation.
Table of Contents
Contribution to a Rigorous Analysis of Web Application Frameworks . . . Egon B¨ orger, Antonio Cisternino, and Vincenzo Gervasi
1
Process Algebra for Event-Driven Runtime Verification: A Case Study of Wireless Network Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Muffy Calder and Michele Sevegnani
21
Translating TLA+ to B for Validation with ProB . . . . . . . . . . . . . . . . . . . . Dominik Hansen and Michael Leuschel
24
Rely/Guarantee Reasoning for Teleo-reactive Programs over Multiple Time Bands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Brijesh Dongol and Ian J. Hayes
39
Safety and Line Capacity in Railways – An Approach in Timed CSP . . . Yoshinao Isobe, Faron Moller, Hoang Nga Nguyen, and Markus Roggenbach
54
Refinement-Based Development of Timed Systems . . . . . . . . . . . . . . . . . . . Jesper Berthing, Pontus Bostr¨ om, Kaisa Sere, Leonidas Tsiopoulos, and J¨ uri Vain
69
Analysing and Closing Simulation Coverage by Automatic Generation and Verification of Formal Properties from Coverage Reports . . . . . . . . . . Tim Blackmore, David Halliwell, Philip Barker, Kerstin Eder, and Naresh Ramaram Model Checking as Static Analysis: Revisited . . . . . . . . . . . . . . . . . . . . . . . . Fuyuan Zhang, Flemming Nielson, and Hanne Riis Nielson Formal Verification of Compiler Transformations on Polychronous Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Van Chan Ngo, Jean-Pierre Talpin, Thierry Gautier, Paul Le Guernic, and Lo¨ıc Besnard Understanding Programming Bugs in ANSI-C Software Using Bounded Model Checking Counter-Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Herbert Rocha, Raimundo Barreto, Lucas Cordeiro, and Arilo Dias Neto MULE-Based Wireless Sensor Networks: Probabilistic Modeling and Quantitative Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fatemeh Kazemeyni, Einar Broch Johnsen, Olaf Owe, and Ilangko Balasingham
84
99
113
128
143
XII
Table of Contents
Mechanized Extraction of Topology Anti-patterns in Wireless Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Matthias Woehrle, Rena Bakhshi, and Mohammad Reza Mousavi
158
A Proof Framework for Concurrent Programs . . . . . . . . . . . . . . . . . . . . . . . . Leonard Lensink, Sjaak Smetsers, and Marko van Eekelen
174
A UTP Semantics of pGCL as a Homogeneous Relation . . . . . . . . . . . . . . . Riccardo Bresciani and Andrew Butterfield
191
Behaviour-Based Cheat Detection in Multiplayer Games with Event-B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . HaiYun Tian, Phillip J. Brooke, and Anne-Gwenn Bosser
206
Refinement-Preserving Translation from Event-B to Register-Voice Interactive Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Denisa Diaconescu, Ioana Leustean, Luigia Petre, Kaisa Sere, and Gheorghe Stefanescu
221
Formal Modelling and Verification of Service-Oriented Systems in Probabilistic Event-B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Anton Tarasyuk, Elena Troubitsyna, and Linas Laibinis
237
Partially-Supervised Plants: Embedding Control Requirements in Plant Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Jasen Markovski, Dirk A. van Beek, and Jos Baeten
253
Early Fault Detection in Industry Using Models at Various Abstraction Levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Jozef Hooman, Arjan J. Mooij, and Hans van Wezep
268
PE-KeY: A Partial Evaluator for Java Programs . . . . . . . . . . . . . . . . . . . . . Ran Ji and Richard Bubel
283
Specification-Driven Unit Test Generation for Java Generic Classes . . . . . Francisco Rebello de Andrade, Jo˜ ao P. Faria, Ant´ onia Lopes, and Ana C.R. Paiva
296
Specifying UML Protocol State Machines in Alloy . . . . . . . . . . . . . . . . . . . . Ana Garis, Ana C.R. Paiva, Alcino Cunha, and Daniel Riesco
312
Patterns for a Log-Based Strengthening of Declarative Compliance Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Dennis M.M. Schunselaar, Fabrizio Maria Maggi, and Natalia Sidorova
327
A Formal Interactive Verification Environment for the Plan Execution Interchange Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Camilo Rocha, H´ector Cadavid, C´esar Mu˜ noz, and Radu Siminiceanu
343
Author Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
359
Contribution to a Rigorous Analysis of Web Application Frameworks Egon B¨orger, Antonio Cisternino, and Vincenzo Gervasi Universit` a di Pisa, Dipartimento di Informatica, I-56125 Pisa, Italy {boerger,cisterni,gervasi}@di.unipi.it
Abstract. We suggest an approach for accurate modeling and analysis of web application frameworks.
1
Introduction
In software engineering the term ‘application’ traditionally refers to a specific program or process users can invoke on a computer. The emergence of distributed systems and in particular of web applications has significantly changed this meaning of the term. Here functionality is provided by a set of indipendent cooperating modules with a distributed state, in web applications all offering a unified interface to their user—to the point that the user may have no way to distinguish whether a single application or a set of distributed web applications is used. Also recent non-web systems, like mobile apps, follow the same paradigm allowing the state of an application to be persistent and distributed, no longer tied to the traditional notion of operating system process and memory. There is still no precise general definition or model of what a web application is. What is there is a variety of (often vague and partly incompatible) standards, web service description languages at different levels of abstraction (like BPEL, BPMN, workflow patterns, see [9] for a critical evaluation of the latter two) and difficult to compare techniques, architectures and frameworks offered for implementations of web applications, ranging from CGI (Common Gateway Interface [23]) scripts to PHP (Personal Home Page) and ASP (Application Server Page) applications and to frameworks such as ASP.NET [19] and Java Server Faces (JSF [1]). All of them seem to share that a web application consists of a dynamically changing network of systems that send and receive through the HTTP protocol data to and from other components and provide services of all kinds which are subject to continuous change (as services may become temporarily or permanently unavailable), to dynamic interference with other services (competing for resources, suffering from overload, etc.) and to all sorts of failures and attacks. The challenge we see is to discover and formulate the pattern underlying such client-server architectures for (programming and executing concurrent distributed) web applications. We want to make their common structural aspects J. Derrick et al. (Eds.): IFM 2012, LNCS 7321, pp. 1–20, 2012. c Springer-Verlag Berlin Heidelberg 2012
2
E. B¨ orger, A. Cisternino, and V. Gervasi
explicit by defining precise high-level (read: code, platform and framework independent) models for the main components of current web application systems such that the major currently existing implementations can be described as refinements of the abstract models. The goal of such a rational reconstruction is to make a rigorous mathematical analysis of web applications possible, including to precisely state and analyze the similarities and differences among existing frameworks, e.g. the similarities between PHP and ASP and the differences between PHP/ASP and JSP/ASP.NET. This has three beneficial consequences: a) it helps web application analysts to better understand different technologies before integrating them to make them cooperate; b) it builds a foundation for content-based certifiability of properties one would like to guarantee for web applications; c) it supports teachers and book authors to provide an accurate organic birds’ perspective of a significant area of current computer technology. For the present state of the art, given the lack of rigorous abstract models of (at least the core components of) web application frameworks, it is still a theoretical challenge to analyze, evaluate and classify web application systems along the lines of fundamental behavioral model properties which can be accurately stated and verified and be instantiated and checked for implementations. The modeling concepts one needs to work on the challenge become clear if we consider the above mentioned feature all web applications have in common, namely to be an application whose interface is presented to the user via a web browser, whose state is split between a client and a server and where the only interaction between client and server is through the HTTP protocol. This implies that an attempt to abstractly model web application frameworks must define at least the following two major client-server architecture components with their subcomponents and the communication network supporting their interaction: the browser with all its subcomponents: launcher, netreader, (html, script, image) parsers, script interpreter, renderer, etc. the server with its modules providing runtimes of various programming languages (e.g. PHP, Python [2], ASP, ASP.NET, JSF), the asynchronous network which supports the interaction (in particular the communication) between the components. This calls for a modeling framework with the following features: A notion of agents which execute each their (possibly dynamically changing) program concurrently, possibly at different sites. A notion of abstract state covering design and analysis at different levels of abstraction (to cope with heterogeneous data structures of the involved components) and the distributed character of the state of a web application. A sufficiently general refinement method to controllably link (using validation and/or verification) the different levels of abstraction, specifically to formulate different existing systems as instances of one general model. A flexible mechanism to express forms of non-determinism which can be restricted by a variety of constraints, e.g. by different degrees of transmission
Contribution to a Rigorous Analysis of Web Application Frameworks
3
reliability ranging from completely unreliable (over the internet) to safe and secure (like for components running on one isolated single machine). A flexible environment adaptation mechanism to uniformly describe web application executions modulo their dependence on run-time contexts. A smooth support for traceable model change and refinement changes due to changing requirements in the underlying (often de facto) standards. 1.1
Concrete Goals and Results So Far
As a first step towards the goal outlined above we started to model the clientserver architecture of a browser interacting with a web server. In [17] the transport and stream levels of an abstract web browser model are defined. To this we add here models for the main components of the context level layer (Sect. 2) which together with the web server model defined in Sect. 3 allow one to describe one complete round of the Request-Reply pattern [18,8] that characterizes browser/server interactions (see Fig. 1).1 In Sect. 3.1 a high-level functional Request-Reply web server view is defined which is then detailed (by refinement steps) for the two main approaches to module execution: the CGI-approach where the server delegates the execution of an external process to another agent (Sect. 3.3), the script-approach where the server itself executes script code (Sect. 3.4). We explain how one can view existing implementations as instantiations of these models. We use the ASM (Abstract State Machines) method [12] as modeling framework because it offers all the features listed above which are needed for our endeavor2 and because various ASM models in the literature contribute specifically to the work undertaken here. For example both the browser and the server model use a third group of basic components, namely ScriptInterpreters for various Script languages, which can be specified by an ASM model adopting the method used in [22] to define an interpreter for Java (and reused in [11,15,16] to rigorously define the semantics of C# and the CLR). These models provide a significant part of the infrastructure web applications typically use. For example applets which run inside a browser, or the Tomcat application server [3], are written in Java. Furthermore, the method developed for modeling Java/JVM can be reused to define a model for the JavaScript interpreter (see [14] for some details) corresponding to the ECMAScript standard ECMA-262 [4], a standard that serves as glue to link various technologies together. In Sect. 4 we list some verification goals we suggest to pursue on the basis of (appropriately completed) precise abstract models of web application framework components, i.e. to rigorously formulate and check (verify or falsify) properties of interest for the models and/or their implementations. 1
2
In the Request-Reply pattern of two-way conversations the requestor (one application) sends a request to the provider (another application) and the provider returns a reply to the requestor. See [10] for the recent definition of a simple flexible ambient ASM concept.
4
E. B¨ orger, A. Cisternino, and V. Gervasi
The models we define and their properties we discuss come without any completeness claim and are intended to suggest an approach we consider to be promising for future FM research in a core area of computer technology.
2
Modeling Browser Components
Our browser models focus on those parts of the browser behaviour that are most relevant for the deployement and execution of web applications. The models are developed at four layers. The main components of the transport layer (expressing the TCP/IP communication via HTTP) and the stream layer (describing how information coming from the network is received and interpreted) are defined in [17]. In this section we add models for characteristic components of the context layer, which deals with the user interaction with the document represented by the Document Object Model (DOM). Without loss of generality we omit in this paper the browser layer where the behaviour of a web browser seen as an application of the host operating system is described. In practice, most web applications are entirely contained in a single browsing context; in fact an important issue in the development of web standards is how to ensure for security reasons that multiple browsing contexts in the same browser are sufficiently isolated from each other (a security property that we leave to future work). 2.1
Browsing Context
A browsing context is an environment in which documents are shown to the user, and where interaction with the user occurs. In web browsers, browsing contexts are usually associated with windows or tabs, but certain deprecated HTML structures (namely, frames) also introduce separate browsing contexts. In our model, a browsing context is characterized primarily by five elements: a document (i.e. a DOM as described in [17]), which is the currently active document presented to the user; a session history, which is a navigable stack of documents the user has visited in this browsing context; a window, which is a designated operating system-dependent area where the Document is presented and where any user interaction takes place; a renderer, which is a component that produces a user-visible graphical rendering of the current Document (Section 2.2); an event loop, which is a component that receives and processes in an ordered way the various operating system-supplied events (such as user interaction or timer expiration) that serve as local input to the browser (Section 2.3). We keep the window abstract, as its behaviour can be conveniently hidden by keeping the actual rendering abstract and by assuming that user interaction with the window is handled by the operating system. Thus we deal with events that have been already pre-processed by a window manager. We also omit the rather straightforward modeling of the session history.
Contribution to a Rigorous Analysis of Web Application Frameworks
5
When STARTing a newly created B rowsing C ontext k , DOM (k ) is initialized by a pre-defined implementation-dependent initial document initialDOM ; it is usually referred to through the URL about:blank and may represent an empty page or a “welcome page” of some sort. Two agents are equipped with programs to execute the Renderer and the EventLoop for k . StartBC(k ) = let a =new Agent , b =new Agent in program(a) := Renderer(k ) program(b) := EventLoop(k ) DOM (k ) := initialDOM The Renderer and EventLoop macros are specified below. 2.2
Renderer
The Renderer produces the user interface of the current DOM in the (implicit) given window. It is kept abstract by specifying only that it works when it is (a) supposed to perform (at system dependent RenderingTime) and (b) allowed to perform because no other agent has a lock on the DOM (e.g., while adding new nodes to the DOM during the stream-level loading of an HTML page). Renderer(k ) = if renderingTime(k ) and ¬locked (DOM (k )) then GenerateUi(DOM (k ), k ) 2.3
Event Loop
We assume that events are communicated by the host environment (i.e., the specific operating system and UI toolkit of the client machine where the browser is executed) to the browser by means of an event queue. These UI events are merged and put in sequential order with other events that are generated in the course of the computation, e.g. DOM manipulation events (fired whenever an operation on the DOM, caused by user actions or by Javascript operations, leads to the execution of a Javascript handler or similar processing) or History traversal events (fired whenever a user operates on the Back and Forward buttons offered by most browsers to navigate through the page stack). Here we detail the basic mechanism used in (the simplest form of) web applications to prepare a Request to be sent to the server (with the understanding that when a Response is received, it will replace the current page in the same browsing context). HTML forms are used to collect related data items, usually entered by the user, and to package them in a single Request. Figure 1 shows when the macros defined below and in [17] are invoked; lifelines represent agents executing a rule. Remember that ASM agents can change their program dynamically (e.g., when Receive becomes HTMLProc) and that operations by an agent in the same activation, albeit shown in sequence, happen in parallel.
6
E. B¨ orger, A. Cisternino, and V. Gervasi
! "# $
% $ ! &
! "#
Fig. 1. A diagram depicting the behaviour of our browser model for a user who opens a new window in a browser, manually loads the first page of a web application, interacts locally with a form, and then sends the data back to the server, receiving a new or updated page in response
Contribution to a Rigorous Analysis of Web Application Frameworks
7
An HTML form is introduced by a