CSC/ECE 517 Fall 2015 M1502 Improve HTTP monitoring devtool support

From Expertiza_Wiki
Revision as of 23:19, 13 November 2015 by Akumar21 (talk | contribs)
Jump to navigation Jump to search

Extending Developer Tools for Servo

Introduction

Rust

Rust is a general purpose, multi-paradigm, compiled programming language developed by Mozilla Research. It is designed to be a "safe, concurrent, practical language", supporting pure-functional, concurrent-actor, imperative-procedural, and object-oriented styles.<ref>http://en.wikipedia.org/wiki/Rust_%28programming_language%29</ref> Being a modern systems programming language focusing on safety and speed, it accomplishes these goals by being memory safe without using garbage collection.<ref>http://doc.rust-lang.org/nightly/intro.html</ref>

Servo

Servo is an experimental project to build a Web browser engine for a new generation of hardware: mobile devices, multi-core processors and high-performance GPUs. With Servo, we are rethinking the browser at every level of the technology stack — from input parsing to page layout to graphics rendering — to optimize for power efficiency and maximum parallelism. Servo builds on top of Rust to provide a secure and reliable foundation. Memory safety at the core of the platform ensures a high degree of assurance in the browser’s trusted computing base. Rust’s lightweight task mechanism also promises to allow fine-grained isolation between browser components, such as tabs and extensions, without the need for expensive runtime protection schemes, like operating system process isolation.<ref>https://www.mozilla.org/en-US/research/projects/</ref>

Background

Remote Developer Tools

Firefox supports remote developer tools - ie. communicating with an arbitrary server that implements a protocol for exposing information about web content. You can use the Firefox developer tools on your desktop to debug Web sites and Web apps running in other browsers or runtimes. The other browser might be on the same device as the tools themselves or on a different device, such as a phone connected over USB. There are two types of runtime supported. a. Gecko-based runtimes- like Firefox Desktop, Firefox for Android, Firefox OS, and Thunderbird and b. Other runtimes- like Google Chrome Desktop, Chrome on Android, and Safari on iOS

Build Process

Following commands need to be entered for a normal build:

Tests

There will be new unit tests added for all the new functionalities. To test use the following command:

*./mach test unit

To check the tidiness of the project(eg. extra whitespaces and tabs) use the following command:

*./mach test-tidy

Run

  • ./mach run [url] where [url] is the web address you want to run Servo for.

Project Description

Servo implements a very basic developer tools server that currently supports executing JS remotely and investigating the DOM tree in the document inspector. We want to expand these capabilities by completing previous work that enables remote logging from web content, and add new capabilities to log HTTP requests and responses to allow for easier debugging of network-related problems in Servo.

Requirement Analysis

Below are the requirements that will addressed in the final semester project.

  • Implement the getRequestHeaders/getRequestPostData message handlers in components/devtools/actors/network_event.rs based on the values in theHttpReqest struct
  • Add support for more flavours of the networkEventUpdate message than justresponseStart, by building the NetworkEventUpdateMsg` from a freeform JSON object instead of a serialized struct declaration
  • Send real values for the fields of ResponseStartMsg (requires obtaining those values inhttp_loader.rs and sending them in send_response_to_devtools)
  • Implement the getRequestCookies and getResponseCookies message handlers incomponents/devtools/actors/network_event.rs based on the Cookie/Set-Cookieheaders in the HttpRequest/HttpResponse structs
  • Implement the getResponseContent/getResponseHeaders message handlers based on the data obtained in add_http_response
  • Implement remaining flavours of networkEventUpdate message
  • Address the TODO for event_actor in network_event.rs by providing the missing information as part of the original message transmitted by send_request_to_devtools

Approach

For task 1 -we would use the ‘self’ variable (of type NetworkEvent) to extract the headers information.

For task 2 – Modify handle_network_event such that NetworkEventUpdateMsg is created using a JSON object instead of a struct.(inside lib.rs)

For task 3 – Change response_start in network_event.rs file to include real values instead of the fake ones that is being sent till now.

For task 4 – Similar to task 1(located in the same file – network_event.rs), we will use the cookie information from the HttpRequest, HttpResponse structs.

For task 5 – Similar changes have to be made as in task 4 for this task.

For task 6 – This task will make use of the information added in the initial steps for our project.

Design Patterns

No design pattern required for this project.

Reference

<references/> https://github.com/servo/servo/wiki/Expand-HTTP-request-response-monitoring https://developer.mozilla.org/en-US/docs/Tools/Remote_Debugging http://www-archive.mozilla.org/roadmap/app-architecture-diagram.png