CSC/ECE 517 Fall 2016/M1653 Implement HTML form validation: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 10: Line 10:
[http://doc.rust-lang.org/book/README.html Rust] is an open source systems programming language developed by Mozilla. Rust is a language suited for creating a highly concurrent and safe systems. In performance and syntax, rust is similar to C++ but semantically it is very different. Rust emphasis is on speed, safety and control of memory layout<ref>https://en.wikipedia.org/wiki/Rust_(programming_language)</ref>.
[http://doc.rust-lang.org/book/README.html Rust] is an open source systems programming language developed by Mozilla. Rust is a language suited for creating a highly concurrent and safe systems. In performance and syntax, rust is similar to C++ but semantically it is very different. Rust emphasis is on speed, safety and control of memory layout<ref>https://en.wikipedia.org/wiki/Rust_(programming_language)</ref>.


=='''Project Description<ref>https://github.com/servo/servo/wiki/Form-validation-student-project</ref>'''==
=='''Project Description'''==
* The project begin with installing and compiling the servo browser. For different Operating systems the dependencies are different. We installed it on Ubuntu 14.04 using the following commands.
===Build Process===
* The project <ref>https://github.com/servo/servo/wiki/Form-validation-student-project</ref> begin with installing and compiling the servo browser. For different Operating systems the dependencies are different. We installed it on Ubuntu 14.04 using the following commands.




Line 27: Line 28:
     ./mach run tests/html/about-mozilla.html
     ./mach run tests/html/about-mozilla.html


 
===Initial Implementation===


*Add new enum that represents each possible validity check in <code>ValidityState</code>.
*Add new enum that represents each possible validity check in <code>ValidityState</code>.
Line 36: Line 37:


*Use <code>JS<Element></code> member to call these new methods in <code>ValidityState</code>.
*Use <code>JS<Element></code> member to call these new methods in <code>ValidityState</code>.
* We pushed the code to the servo and the pull request is [https://github.com/servo/servo/pull/13969 13969].
===Challenges Faced===
===Challenges Faced===
* While building the servo as shown above we were getting GLSL 1.50 is not supported error. We investigated this issue and found that there was an open issue [https://github.com/servo/servo/issues/13515 #13515]. We found that the error was because the rendering was done with Nvidia graphics card and so we changed it to the intel graphics card by <code>./mach run tests/html/about-mozilla.html -c</code> and were able to run the browser. We even updated the open thread so that other people can take advantage of that.
* While building the servo as shown above we were getting GLSL 1.50 is not supported error. We investigated this issue and found that there was an open issue [https://github.com/servo/servo/issues/13515 #13515]. We found that the error was because the rendering was done with Nvidia graphics card and so we changed it to the intel graphics card by <code>./mach run tests/html/about-mozilla.html -c</code> and were able to run the browser. We even updated the open thread so that other people can take advantage of that.
Line 43: Line 45:


=='''Testing'''==
=='''Testing'''==
===Testing with Tidy===
Servo has its own code standard. We managed to meet its code standard. We use following command to run code style check.
Servo has its own code standard. We managed to meet its code standard. We use following command to run code style check.


Line 48: Line 51:
     ./mach test-tidy
     ./mach test-tidy


When we ran tidy  we got 20 syntactic errors and we fixed all the errors.
===Testing with UI===
We created a test form to check whether the validation was working or not.
=='''References'''==
=='''References'''==
<references />
<references />

Revision as of 01:27, 29 October 2016

Servo is a modern high performance web browser developed by Mozilla with Samsung porting it on android and arm processors<ref>https://en.wikipedia.org/wiki/Servo_(layout_engine)</ref>. The source code is written in the rust programming language, which is a new developed system level programming language. The major advantage of rust language is that it is thread-safe<ref>https://www.rust-lang.org/en-US/</ref>. This project implements html form validation on servo browser.

Introduction

The HTML5is a markup language used for content organizing and showing on the World Wide Web<ref>https://en.wikipedia.org/wiki/HTML5</ref>. It defines set of specification which users needs to follow to make web pages HTML5 compliant. In HTML 5 there is a major type of element which is form element. When user trying to submit their form, the system should be able to check the validation status of this form and decide whether accept this form or reject the request. HTML provides such mechanism. Using this mechanism will allow the system to check whether the contents of forms are validated before it is allowed to submit. Servo currently implements validation check for some of the form element types. The objective of this project is to define and implement validation check function and implement validate step for these HTML5 form elements.

Servo

Servo is an open source prototype web browser layout engine that is being developed by Mozilla Research. Its source code can be found here. Current browser engines are mostly based on single-threaded model. Motivation behind building servo web browser is to build a highly parallel and reliable environment, where different components (such as rendering, layout, HTML parsing, image decoding, etc.) can be handled by fine-grained, isolated tasks.

Rust

Rust is an open source systems programming language developed by Mozilla. Rust is a language suited for creating a highly concurrent and safe systems. In performance and syntax, rust is similar to C++ but semantically it is very different. Rust emphasis is on speed, safety and control of memory layout<ref>https://en.wikipedia.org/wiki/Rust_(programming_language)</ref>.

Project Description

Build Process


On Debian-based Linuxes:

   sudo apt-get install curl freeglut3-dev \
   libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev \
   msttcorefonts gperf g++ cmake python-virtualenv \
   libssl-dev libglfw-dev
  • We then forked the original repository from servo and cloned the forked repository on our local machines and then compiled and ran the servo browser.
   cd servo
   ./mach build --dev
   ./mach run tests/html/about-mozilla.html

Initial Implementation

  • Add new enum that represents each possible validity check in ValidityState.
  • Define a Validatable trait that contains a method which accepts this enum as an argument.
  • Implement this trait for different form element types (HTMLInputElement, HTMLButtonElement, etc.), and define an as_maybe_validatable method on Element which returns an &Validatable value if the element implements the trait.
  • Use JS<Element> member to call these new methods in ValidityState.
  • We pushed the code to the servo and the pull request is 13969.

Challenges Faced

  • While building the servo as shown above we were getting GLSL 1.50 is not supported error. We investigated this issue and found that there was an open issue #13515. We found that the error was because the rendering was done with Nvidia graphics card and so we changed it to the intel graphics card by ./mach run tests/html/about-mozilla.html -c and were able to run the browser. We even updated the open thread so that other people can take advantage of that.

Design Patterns & OO Practices

This project is to add some feature to servo, so we were not supposed to change the design of original servo project. We used Enum and tried to follow good OO practices in the process of development.

Testing

Testing with Tidy

Servo has its own code standard. We managed to meet its code standard. We use following command to run code style check.

   cd servo
   ./mach test-tidy

When we ran tidy we got 20 syntactic errors and we fixed all the errors.

Testing with UI

We created a test form to check whether the validation was working or not.

References

<references />