Interaction Between Web Browsers and Script Engines

Interaction Between Web Browsers and Script Engines

IT 12 058 Examensarbete 45 hp November 2012 Interaction between web browsers and script engines Xiaoyu Zhuang Institutionen för informationsteknologi Department of Information Technology Abstract Interaction between web browser and the script engine Xiaoyu Zhuang Teknisk- naturvetenskaplig fakultet UTH-enheten Web browser plays an important part of internet experience and JavaScript is the most popular programming language as a client side script to build an active and Besöksadress: advance end user experience. The script engine which executes JavaScript needs to Ångströmlaboratoriet Lägerhyddsvägen 1 interact with web browser to get access to its DOM elements and other host objects. Hus 4, Plan 0 Browser from host side needs to initialize the script engine and dispatch script source code to the engine side. Postadress: This thesis studies the interaction between the script engine and its host browser. Box 536 751 21 Uppsala The shell where the engine address to make calls towards outside is called hosting layer. This report mainly discussed what operations could appear in this layer and Telefon: designed testing cases to validate if the browser is robust and reliable regarding 018 – 471 30 03 hosting operations. Telefax: 018 – 471 30 00 Hemsida: http://www.teknat.uu.se/student Handledare: Elena Boris Ämnesgranskare: Justin Pearson Examinator: Lisa Kaati IT 12 058 Tryckt av: Reprocentralen ITC Contents 1. Introduction................................................................................................................................. 7 1.1 Tasks of the thesis ............................................................................................................. 7 1.2 JavaScript and its engine .......................................................................................... 9 1.3 Browser and Hosting .................................................................................................... 10 1.4 Hosting layer feature .................................................................................................... 11 2. Testing Approach ................................................................................................................... 13 2.1 Software cycle .................................................................................................................. 13 2.1.1 Why testing ............................................................................................................... 13 2.1.2 Life cycle of software development ............................................................... 13 2.2 Testing Angles .................................................................................................................. 15 2.2.1 Functional tests ....................................................................................................... 15 2.2.2 Boundary tests ......................................................................................................... 15 2.2.3 Performance tests .................................................................................................. 16 2.2.4 Security tests ............................................................................................................ 16 2.2.5 Stress tests ................................................................................................................. 16 2.3 Testing Method ................................................................................................................ 17 2.3.1 Black Box .................................................................................................................... 17 2.3.2 White Box ................................................................................................................... 17 3. Functional Tests ..................................................................................................................... 19 3.1 COM ....................................................................................................................................... 19 3.1.1 Key interface – IDispatch .................................................................................... 19 3.1.2 Variant marshal....................................................................................................... 20 3.2 DOM ....................................................................................................................................... 24 3.2.1 Name lookup............................................................................................................. 24 3.2.2 Event Handler .......................................................................................................... 25 Inline ........................................................................................................................................ 26 Function pointer ................................................................................................................ 26 Script block ........................................................................................................................... 27 Naming convention ........................................................................................................... 27 Automagic ............................................................................................................................. 28 3.3 Other Process – GetObject .......................................................................................... 34 5 Object ....................................................................................................................................... 34 Feature Interactions ......................................................................................................... 35 Security ................................................................................................................................... 35 3.4 Legacy Engine ................................................................................................................... 35 3.5 VBScript Engine ............................................................................................................... 37 3.6 Other Jscript engine ....................................................................................................... 39 3.6.1 Foundation of Cross Context ............................................................................ 40 3.6.2 Create Iframe and window at runtime ........................................................ 40 3.6.3 Object marshaling .................................................................................................. 42 3.6.4 Object lifetime on freed pages ......................................................................... 43 3.7 Query Continue ................................................................................................................ 44 3.7.1 Notify users ............................................................................................................... 45 3.7.2 Functional Testing ................................................................................................. 46 3.7.4 Live site ....................................................................................................................... 48 4. Mutation Test ........................................................................................................................... 50 4.1 What is Mutation Tests ................................................................................................ 50 4.2 Example of mutator ....................................................................................................... 50 4.3 How it mutates ................................................................................................................. 52 5. Build a JavaScript engine host ......................................................................................... 53 5.1 Customized script host ................................................................................................ 53 5.2 Fist Step – get interface reference .......................................................................... 54 5.3 .NET – As simple as few lines .................................................................................... 55 5.4 Scripts running ................................................................................................................ 56 5.5 Inject host functions to engine ................................................................................. 58 5.6 Running a script file ...................................................................................................... 59 5.7 QueryContinue interfaces ........................................................................................... 60 6. Summary .................................................................................................................................... 61 7. Further Work ........................................................................................................................... 62 8. Reference ................................................................................................................................... 63 6 1. Introduction With the rapid developing of computer network, Internet becomes an important tool of everyday life. As one of the fundamental applications used on internet, web browser is used by millions of customers browsing World Wide Web

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    63 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us