<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jmehta2</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jmehta2"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Jmehta2"/>
	<updated>2026-06-06T17:47:39Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=100398</id>
		<title>CSC/ECE 517 Fall 2015 M1504 Implement support for missing XMLHttpRequest APIs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=100398"/>
		<updated>2015-12-08T21:03:54Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: /* Test Cases */ updated the passing tests&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt; is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]&amp;lt;ref&amp;gt;https://github.com/rust-lang/rust&amp;lt;/ref&amp;gt; and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla Research]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo is built on top of Rust to provide a secure and reliable foundation and is focused on creating a reliable and fast browser engine.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language.&lt;br /&gt;
&lt;br /&gt;
Rust is a modern, fast, memory safe and multithreaded programming language that focuses on speed and safety for developing reliable and efficient systems. It eliminates all data races by having numerous compile-time safety checks that adds no runtime overhead.&amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/book/README.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Servo task Architecture==&lt;br /&gt;
&lt;br /&gt;
[[Image:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref group=&amp;quot;image&amp;quot;&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Description===&lt;br /&gt;
&lt;br /&gt;
* Each box corresponds to a Rust task.&lt;br /&gt;
* The primary tasks in the browser pipeline are represented by Blue boxes.&lt;br /&gt;
* Dashed lines indicate supervisor relationships.&lt;br /&gt;
* Gray boxes indicate tasks auxiliary to the browser pipeline.&lt;br /&gt;
* Communication channels are represented as solid lines.&lt;br /&gt;
* White boxes are represented as worker tasks. Each such box represents several tasks which varies with the workload.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
===XMLHttpRequest===&lt;br /&gt;
&amp;quot;[https://xhr.spec.whatwg.org/ XMLHttpRequest] is a specification which defines [https://en.wikipedia.org/wiki/Application_programming_interface APIs] that provides scripted client functionality for transferring data between a client and a server.&amp;quot;&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/&amp;lt;/ref&amp;gt; XMLHttpRequest provides a way for data to be retrieved from a URL without having to retrieve the entire page. It supports protocols other than HTTP and can be used to retrieve any type of data.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some of the APIs and properties present in XMLHttpRequest specification are '''overrideMimeType()''' , '''responseXML''' and '''withCredentials'''. The following javascript code snippets briefly explain about each of these APIs.&lt;br /&gt;
&lt;br /&gt;
;overrideMimeType&amp;lt;ref&amp;gt;https://github.com/servo/servo/blob/master/tests/wpt/web-platform-tests/XMLHttpRequest/overridemimetype-open-state-force-xml.htm&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
//override the Mime type to retrieve the response as an XML Object&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 var client = new XMLHttpRequest();&lt;br /&gt;
 client.onreadystatechange = function() {&lt;br /&gt;
          ... //read the response as XML object&lt;br /&gt;
        };&lt;br /&gt;
        client.open(&amp;quot;GET&amp;quot;, &amp;quot;resources/status.py?type=&amp;quot;&lt;br /&gt;
                    +encodeURIComponent('text/plain;charset=Shift-JIS')&lt;br /&gt;
                    +'&amp;amp;content='+ encodeURIComponent('&amp;lt;test&amp;gt;&amp;lt;message&amp;gt;Hello World！&amp;lt;/message&amp;gt;&amp;lt;/test&amp;gt;'));&lt;br /&gt;
        client.overrideMimeType('application/xml;charset=UTF-8');&lt;br /&gt;
        client.send();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;responseXML property&amp;lt;ref&amp;gt;https://msdn.microsoft.com/en-us/library/ms534370(v=vs.85).aspx&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//read the response from the server as an XML Object&lt;br /&gt;
&lt;br /&gt;
var oReq = new XMLHttpRequest();&lt;br /&gt;
oReq.open(&amp;quot;GET&amp;quot;, &amp;quot;http://localhost/books.xml&amp;quot;, false);&lt;br /&gt;
oReq.send();&lt;br /&gt;
console.log(oReq.responseXML.xml);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;withCredentials property&amp;lt;ref&amp;gt;http://arunranga.com/examples/access-control/credentialedRequest.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
//create cross site requests using cookies as credentials&lt;br /&gt;
 &lt;br /&gt;
var invocation = new XMLHttpRequest();&lt;br /&gt;
var url = 'http://crossoriginurl.com/resources/access-control-with-credentials/';&lt;br /&gt;
invocation.open('GET', url, true);&lt;br /&gt;
invocation.withCredentials = &amp;quot;true&amp;quot;;&lt;br /&gt;
invocation.onreadystatechange = handler;&lt;br /&gt;
invocation.send(); &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The above mentioned APIs and properties for XMLHttpRequest are currently unimplemented in servo.&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
Our project aim is to implement few of the missing XMLHttpRequest APIs.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs&amp;lt;/ref&amp;gt; The [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2015/oss_M1504_JJD OSS project] included implementing initial steps of the [https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs specifications]. It basically incorporated implementing overrideMimeType method and adjusting related test expectations. &lt;br /&gt;
&lt;br /&gt;
The implementation of the final project is described in a [[#Implementation_Details|section below]].&lt;br /&gt;
&lt;br /&gt;
==Requirement Analysis==&lt;br /&gt;
&lt;br /&gt;
Below is an overview of the various steps identified as a part of the requirement analysis and corresponding places in code in which these steps would be implemented:&lt;br /&gt;
&lt;br /&gt;
''' XMLHttpRequest Interface '''&lt;br /&gt;
* We have to uncomment the responseXML API&lt;br /&gt;
* A webpage can make use of this API to read the document response &lt;br /&gt;
&lt;br /&gt;
'''XMLHttpRequest DOM '''&lt;br /&gt;
&lt;br /&gt;
# Create helper methods final_mime_type and final_charset&lt;br /&gt;
#* Implement the two methods as per the behavior mentioned in the [https://xhr.spec.whatwg.org/#final-mime-type specification]&lt;br /&gt;
# Implement correct behavior for the text_response method&lt;br /&gt;
#* Make use of the final_charset and final_mime_type helper methods to determine the correct encoding for the response and decode the response using this encoding&lt;br /&gt;
# Create and implement a new method &amp;quot;document_response&amp;quot; according to the [https://xhr.spec.whatwg.org/#document-response xhr specification]&lt;br /&gt;
# Implement the correct behavior for the responseXML API to handle exceptions and return the document response using the method implemented above &amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#dom-xmlhttprequest-responsexml&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Implement the withCredentials APIs (setter and getter) as per the [https://xhr.spec.whatwg.org/#dom-xmlhttprequest-withcredentials specification]&lt;br /&gt;
# Add support to the send() and open() API to test the value of the withCredentials attribute where necessary&lt;br /&gt;
&lt;br /&gt;
''' net_traits '''&lt;br /&gt;
* Add a new member to the LoadData Structure in [https://github.com/servo/servo/blob/master/components/net_traits/lib.rs#L130 lib.rs file] which will be used by the http_loader to conditionally exclude cookies from the XHR request based on the value of the member.&lt;br /&gt;
&lt;br /&gt;
''' XHR Tests '''&lt;br /&gt;
* We need to pass [[#Proposed_Test_Cases | most tests]] related to overrideMimeType, responseXML and withCredentials present in the [https://github.com/servo/servo/tree/master/tests/wpt/web-platform-tests/XMLHttpRequest XHR test-suite]&lt;br /&gt;
&lt;br /&gt;
==Component Flow Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:component_flow_f15_m1504.png]]&lt;br /&gt;
&lt;br /&gt;
The XMLHttpRequest API receives request from the web server, the implementation then checks the response type, if it is a text response then we use the charset from final_charset else we use the default charset that was received with the request. The same applies to document response.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&lt;br /&gt;
Note :- UML diagram is not included because we do not have much class interaction in this project.&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Design Patterns ==&lt;br /&gt;
We have used &amp;quot;State Pattern&amp;quot; for our final project implementation. Our implementation stores the new CHARSET and MIME type based on what user has requested. So once user has requested for override in this value, the design pattern ensures the system behaves as per this new value.&lt;br /&gt;
&lt;br /&gt;
[[File: design_pattern_f15_m1504.png]]&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
The implementation for the final project involved following tasks:&lt;br /&gt;
* '''Implement the specified behavior for the override MIME type/final MIME type and override charset/final charset :''' We created two helper methods in xmlhttprequest.rs file: final_mime_type() and final_charset()&lt;br /&gt;
** final_mime_type() method returns the final MIME type&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#final-mime-type&amp;lt;/ref&amp;gt; depending on override MIME type and response MIME type&lt;br /&gt;
** final_charset() method returns the final charset&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#final-charset&amp;lt;/ref&amp;gt; depending on override charset and response charset &lt;br /&gt;
** We have also determined encoding of text_response by calling the final_charset() helper method. But if final charset is not set (i.e. it is None) then UTF-8 is set as the default encoding. The step 4 mentioned in the [https://xhr.spec.whatwg.org/#text-response text response] documentation in order to add support for XML encoding guess stuff using XML spec was not to be implemented and hence FIXME was added in the code.&lt;br /&gt;
&lt;br /&gt;
* '''Support the withCredentials API :''' We have implemented basic network level support to conditionally exclude cookies from the HTTP request by adding a boolean member: credentials_flag to LoadData structure in lib.rs file. &lt;br /&gt;
** The default value of credentials_flag is set to true. credentials_flag is assigned value for cross-origin requests in Send() method of xmlhttprequest.rs file using the withCredentials attribute of XMLHttpRequest.&lt;br /&gt;
** If the credentials_flag is false then cookies will not be set from the cookie jar for the HTTP request for which the code is added in http_loader.rs file. Also if the credentials_flag is false, then the cookies are not set in the cookie jar from HTTP response. As suggested by the Servo focal for this project, we have not implemented the [https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs first sub-task] for withCredentials API.&lt;br /&gt;
&lt;br /&gt;
* '''Support for document response in responseXML API :''' Added Document to the list of response type checks. New methods were created which contain handling for different mime types. A document object is created and its JS value is returned. The document object is stored in response_xml member of XHR, on subsequent calls to the method this object is returned if it has already been set previously.&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#response-document-object&amp;lt;/ref&amp;gt;.For mime type text/html if any of the charset is NONE the requirement was to scan the first 1024 bytes of the header to identify the charset, this part has not been implemented in this project. The following new methods were added to file XMLHttprequest.rs as part of this task -&lt;br /&gt;
**document_response - This method creates a document as per mime type returned by the final_mime_type() method created as part of OSS project. It internally calls other methods listed below.  &lt;br /&gt;
**document_text_html - This method creates a document flagged as an HTML document. This method is called by document_response in case the mime type is text/html. It calls the new_doc helper method.&lt;br /&gt;
**handle_xml - This method creates a document flagged as a non HTML document. This method is called by document_response in case the mime type subtype is XML. It calls the new_doc helper method.  &lt;br /&gt;
**new_doc - This method creates a new document which is the final response based on the input received from document_text_response and handle_xml methods.&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
The tests have already been written for the XMLHttpRequest(XHR) APIs related to our project. So the test cases that pass after our changes to the code are as follows:&lt;br /&gt;
&lt;br /&gt;
* If XHR is in unsent state, then overrideMimeType() is able to enforce Shift-JIS charset encoding (overridemimetype-unsent-state-force-shiftjis.htm)&lt;br /&gt;
* If XHR is in open state, then overrideMimeType() is able to enforce UTF-8 charset encoding (overridemimetype-open-state-force-utf-8.htm)&lt;br /&gt;
* If XHR with XML MIME type is in open state, then overrideMimeType() is able to enforce UTF-8 charset encoding (overridemimetype-open-state-force-xml.htm)&lt;br /&gt;
* If XHR is in HEADERS RECEIVED state, then overrideMimeType() is able to enforce Shift-JIS charset encoding (overridemimetype-headers-received-state-force-shiftjis.htm)&lt;br /&gt;
* The various responseXML document properties like title, contentType, doctype, cookie, etc. are correctly initialized (responsexml-document-properties.htm)&lt;br /&gt;
* In XHR, parsing of different responseXML MIME type is successful (responsexml-media-type.htm)&lt;br /&gt;
* In XHR, parsing of document received from responseXML is successful (send-redirect-no-location.htm, status-async.htm, status-basic.htm)&lt;br /&gt;
* In XHR, throw InvalidStateError if response type is not null or document (responsexml-non-document-types.htm)&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
* Steps for installing [https://github.com/rust-lang/rust rust]&lt;br /&gt;
* Building [https://github.com/servo/servo Servo]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
===Images===&lt;br /&gt;
&amp;lt;references group=&amp;quot;image&amp;quot;/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=100390</id>
		<title>CSC/ECE 517 Fall 2015 M1504 Implement support for missing XMLHttpRequest APIs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=100390"/>
		<updated>2015-12-07T00:20:29Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: /* Implementation Details */ restructuring sub task&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt; is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]&amp;lt;ref&amp;gt;https://github.com/rust-lang/rust&amp;lt;/ref&amp;gt; and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla Research]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo is built on top of Rust to provide a secure and reliable foundation and is focused on creating a reliable and fast browser engine.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language.&lt;br /&gt;
&lt;br /&gt;
Rust is a modern, fast, memory safe and multithreaded programming language that focuses on speed and safety for developing reliable and efficient systems. It eliminates all data races by having numerous compile-time safety checks that adds no runtime overhead.&amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/book/README.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Servo task Architecture==&lt;br /&gt;
&lt;br /&gt;
[[Image:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref group=&amp;quot;image&amp;quot;&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Description===&lt;br /&gt;
&lt;br /&gt;
* Each box corresponds to a Rust task.&lt;br /&gt;
* The primary tasks in the browser pipeline are represented by Blue boxes.&lt;br /&gt;
* Dashed lines indicate supervisor relationships.&lt;br /&gt;
* Gray boxes indicate tasks auxiliary to the browser pipeline.&lt;br /&gt;
* Communication channels are represented as solid lines.&lt;br /&gt;
* White boxes are represented as worker tasks. Each such box represents several tasks which varies with the workload.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
===XMLHttpRequest===&lt;br /&gt;
&amp;quot;[https://xhr.spec.whatwg.org/ XMLHttpRequest] is a specification which defines [https://en.wikipedia.org/wiki/Application_programming_interface APIs] that provides scripted client functionality for transferring data between a client and a server.&amp;quot;&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/&amp;lt;/ref&amp;gt; XMLHttpRequest provides a way for data to be retrieved from a URL without having to retrieve the entire page. It supports protocols other than HTTP and can be used to retrieve any type of data.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some of the APIs and properties present in XMLHttpRequest specification are '''overrideMimeType()''' , '''responseXML''' and '''withCredentials'''. The following javascript code snippets briefly explain about each of these APIs.&lt;br /&gt;
&lt;br /&gt;
;overrideMimeType&amp;lt;ref&amp;gt;https://github.com/servo/servo/blob/master/tests/wpt/web-platform-tests/XMLHttpRequest/overridemimetype-open-state-force-xml.htm&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
//override the Mime type to retrieve the response as an XML Object&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 var client = new XMLHttpRequest();&lt;br /&gt;
 client.onreadystatechange = function() {&lt;br /&gt;
          ... //read the response as XML object&lt;br /&gt;
        };&lt;br /&gt;
        client.open(&amp;quot;GET&amp;quot;, &amp;quot;resources/status.py?type=&amp;quot;&lt;br /&gt;
                    +encodeURIComponent('text/plain;charset=Shift-JIS')&lt;br /&gt;
                    +'&amp;amp;content='+ encodeURIComponent('&amp;lt;test&amp;gt;&amp;lt;message&amp;gt;Hello World！&amp;lt;/message&amp;gt;&amp;lt;/test&amp;gt;'));&lt;br /&gt;
        client.overrideMimeType('application/xml;charset=UTF-8');&lt;br /&gt;
        client.send();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;responseXML property&amp;lt;ref&amp;gt;https://msdn.microsoft.com/en-us/library/ms534370(v=vs.85).aspx&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//read the response from the server as an XML Object&lt;br /&gt;
&lt;br /&gt;
var oReq = new XMLHttpRequest();&lt;br /&gt;
oReq.open(&amp;quot;GET&amp;quot;, &amp;quot;http://localhost/books.xml&amp;quot;, false);&lt;br /&gt;
oReq.send();&lt;br /&gt;
console.log(oReq.responseXML.xml);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;withCredentials property&amp;lt;ref&amp;gt;http://arunranga.com/examples/access-control/credentialedRequest.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
//create cross site requests using cookies as credentials&lt;br /&gt;
 &lt;br /&gt;
var invocation = new XMLHttpRequest();&lt;br /&gt;
var url = 'http://crossoriginurl.com/resources/access-control-with-credentials/';&lt;br /&gt;
invocation.open('GET', url, true);&lt;br /&gt;
invocation.withCredentials = &amp;quot;true&amp;quot;;&lt;br /&gt;
invocation.onreadystatechange = handler;&lt;br /&gt;
invocation.send(); &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The above mentioned APIs and properties for XMLHttpRequest are currently unimplemented in servo.&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
Our project aim is to implement few of the missing XMLHttpRequest APIs.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs&amp;lt;/ref&amp;gt; The [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2015/oss_M1504_JJD OSS project] included implementing initial steps of the [https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs specifications]. It basically incorporated implementing overrideMimeType method and adjusting related test expectations. &lt;br /&gt;
&lt;br /&gt;
The implementation of the final project is described in a [[#Implementation_Details|section below]].&lt;br /&gt;
&lt;br /&gt;
==Requirement Analysis==&lt;br /&gt;
&lt;br /&gt;
Below is an overview of the various steps identified as a part of the requirement analysis and corresponding places in code in which these steps would be implemented:&lt;br /&gt;
&lt;br /&gt;
''' XMLHttpRequest Interface '''&lt;br /&gt;
* We have to uncomment the responseXML API&lt;br /&gt;
* A webpage can make use of this API to read the document response &lt;br /&gt;
&lt;br /&gt;
'''XMLHttpRequest DOM '''&lt;br /&gt;
&lt;br /&gt;
# Create helper methods final_mime_type and final_charset&lt;br /&gt;
#* Implement the two methods as per the behavior mentioned in the [https://xhr.spec.whatwg.org/#final-mime-type specification]&lt;br /&gt;
# Implement correct behavior for the text_response method&lt;br /&gt;
#* Make use of the final_charset and final_mime_type helper methods to determine the correct encoding for the response and decode the response using this encoding&lt;br /&gt;
# Create and implement a new method &amp;quot;document_response&amp;quot; according to the [https://xhr.spec.whatwg.org/#document-response xhr specification]&lt;br /&gt;
# Implement the correct behavior for the responseXML API to handle exceptions and return the document response using the method implemented above &amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#dom-xmlhttprequest-responsexml&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Implement the withCredentials APIs (setter and getter) as per the [https://xhr.spec.whatwg.org/#dom-xmlhttprequest-withcredentials specification]&lt;br /&gt;
# Add support to the send() and open() API to test the value of the withCredentials attribute where necessary&lt;br /&gt;
&lt;br /&gt;
''' net_traits '''&lt;br /&gt;
* Add a new member to the LoadData Structure in [https://github.com/servo/servo/blob/master/components/net_traits/lib.rs#L130 lib.rs file] which will be used by the http_loader to conditionally exclude cookies from the XHR request based on the value of the member.&lt;br /&gt;
&lt;br /&gt;
''' XHR Tests '''&lt;br /&gt;
* We need to pass [[#Proposed_Test_Cases | most tests]] related to overrideMimeType, responseXML and withCredentials present in the [https://github.com/servo/servo/tree/master/tests/wpt/web-platform-tests/XMLHttpRequest XHR test-suite]&lt;br /&gt;
&lt;br /&gt;
==Component Flow Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:component_flow_f15_m1504.png]]&lt;br /&gt;
&lt;br /&gt;
The XMLHttpRequest API receives request from the web server, the implementation then checks the response type, if it is a text response then we use the charset from final_charset else we use the default charset that was received with the request. The same applies to document response.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&lt;br /&gt;
Note :- UML diagram is not included because we do not have much class interaction in this project.&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Design Patterns ==&lt;br /&gt;
We have used &amp;quot;State Pattern&amp;quot; for our final project implementation. Our implementation stores the new CHARSET and MIME type based on what user has requested. So once user has requested for override in this value, the design pattern ensures the system behaves as per this new value.&lt;br /&gt;
&lt;br /&gt;
[[File: design_pattern_f15_m1504.png]]&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
The implementation for the final project involved following tasks:&lt;br /&gt;
* '''Implement the specified behavior for the override MIME type/final MIME type and override charset/final charset :''' We created two helper methods in xmlhttprequest.rs file: final_mime_type() and final_charset()&lt;br /&gt;
** final_mime_type() method returns the final MIME type&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#final-mime-type&amp;lt;/ref&amp;gt; depending on override MIME type and response MIME type&lt;br /&gt;
** final_charset() method returns the final charset&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#final-charset&amp;lt;/ref&amp;gt; depending on override charset and response charset &lt;br /&gt;
** We have also determined encoding of text_response by calling the final_charset() helper method. But if final charset is not set (i.e. it is None) then UTF-8 is set as the default encoding. The step 4 mentioned in the [https://xhr.spec.whatwg.org/#text-response text response] documentation in order to add support for XML encoding guess stuff using XML spec was not to be implemented and hence FIXME was added in the code.&lt;br /&gt;
&lt;br /&gt;
* '''Support the withCredentials API :''' We have implemented basic network level support to conditionally exclude cookies from the HTTP request by adding a boolean member: credentials_flag to LoadData structure in lib.rs file. &lt;br /&gt;
** The default value of credentials_flag is set to true. credentials_flag is assigned value for cross-origin requests in Send() method of xmlhttprequest.rs file using the withCredentials attribute of XMLHttpRequest.&lt;br /&gt;
** If the credentials_flag is false then cookies will not be set from the cookie jar for the HTTP request for which the code is added in http_loader.rs file. Also if the credentials_flag is false, then the cookies are not set in the cookie jar from HTTP response. As suggested by the Servo focal for this project, we have not implemented the [https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs first sub-task] for withCredentials API.&lt;br /&gt;
&lt;br /&gt;
* '''Support for document response in responseXML API :''' Added Document to the list of response type checks. New methods were created which contain handling for different mime types. A document object is created and its JS value is returned. The document object is stored in response_xml member of XHR, on subsequent calls to the method this object is returned if it has already been set previously.&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#response-document-object&amp;lt;/ref&amp;gt;.For mime type text/html if any of the charset is NONE the requirement was to scan the first 1024 bytes of the header to identify the charset, this part has not been implemented in this project. The following new methods were added to file XMLHttprequest.rs as part of this task -&lt;br /&gt;
**document_response - This method creates a document as per mime type returned by the final_mime_type() method created as part of OSS project. It internally calls other methods listed below.  &lt;br /&gt;
**document_text_html - This method creates a document flagged as an HTML document. This method is called by document_response in case the mime type is text/html. It calls the new_doc helper method.&lt;br /&gt;
**handle_xml - This method creates a document flagged as a non HTML document. This method is called by document_response in case the mime type subtype is XML. It calls the new_doc helper method.  &lt;br /&gt;
**new_doc - This method creates a new document which is the final response based on the input received from document_text_response and handle_xml methods.&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
The tests have already been written for the XMLHttpRequest APIs related to our project. So the test cases that pass after our changes to the code are as follows:&lt;br /&gt;
&lt;br /&gt;
* If XMLHttpRequest is in unsent state, then overrideMimeType() should be able to enforce Shift-JIS charset encoding&lt;br /&gt;
* If XMLHttpRequest is in open state, then overrideMimeType() should be able to enforce UTF-8 charset encoding&lt;br /&gt;
* If XMLHttpRequest is in HEADERS RECEIVED state, then overrideMimeType() will be able to enforce Shift-JIS charset encoding&lt;br /&gt;
* responseXML attribute should throw InvalidStateError if response type is not null or document&lt;br /&gt;
* The various responseXML document properties like domain, URL, title, body, images, etc. must be correctly initialized&lt;br /&gt;
* If the state of XMLHttpRequest is not done then responseXML must be null&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
* Steps for installing [https://github.com/rust-lang/rust rust]&lt;br /&gt;
* Building [https://github.com/servo/servo Servo]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
===Images===&lt;br /&gt;
&amp;lt;references group=&amp;quot;image&amp;quot;/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=100388</id>
		<title>CSC/ECE 517 Fall 2015 M1504 Implement support for missing XMLHttpRequest APIs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=100388"/>
		<updated>2015-12-06T23:55:45Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: /* Implementation Details */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt; is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]&amp;lt;ref&amp;gt;https://github.com/rust-lang/rust&amp;lt;/ref&amp;gt; and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla Research]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo is built on top of Rust to provide a secure and reliable foundation and is focused on creating a reliable and fast browser engine.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language.&lt;br /&gt;
&lt;br /&gt;
Rust is a modern, fast, memory safe and multithreaded programming language that focuses on speed and safety for developing reliable and efficient systems. It eliminates all data races by having numerous compile-time safety checks that adds no runtime overhead.&amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/book/README.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Servo task Architecture==&lt;br /&gt;
&lt;br /&gt;
[[Image:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref group=&amp;quot;image&amp;quot;&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Description===&lt;br /&gt;
&lt;br /&gt;
* Each box corresponds to a Rust task.&lt;br /&gt;
* The primary tasks in the browser pipeline are represented by Blue boxes.&lt;br /&gt;
* Dashed lines indicate supervisor relationships.&lt;br /&gt;
* Gray boxes indicate tasks auxiliary to the browser pipeline.&lt;br /&gt;
* Communication channels are represented as solid lines.&lt;br /&gt;
* White boxes are represented as worker tasks. Each such box represents several tasks which varies with the workload.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
===XMLHttpRequest===&lt;br /&gt;
&amp;quot;[https://xhr.spec.whatwg.org/ XMLHttpRequest] is a specification which defines [https://en.wikipedia.org/wiki/Application_programming_interface APIs] that provides scripted client functionality for transferring data between a client and a server.&amp;quot;&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/&amp;lt;/ref&amp;gt; XMLHttpRequest provides a way for data to be retrieved from a URL without having to retrieve the entire page. It supports protocols other than HTTP and can be used to retrieve any type of data.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some of the APIs and properties present in XMLHttpRequest specification are '''overrideMimeType()''' , '''responseXML''' and '''withCredentials'''. The following javascript code snippets briefly explain about each of these APIs.&lt;br /&gt;
&lt;br /&gt;
;overrideMimeType&amp;lt;ref&amp;gt;https://github.com/servo/servo/blob/master/tests/wpt/web-platform-tests/XMLHttpRequest/overridemimetype-open-state-force-xml.htm&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
//override the Mime type to retrieve the response as an XML Object&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 var client = new XMLHttpRequest();&lt;br /&gt;
 client.onreadystatechange = function() {&lt;br /&gt;
          ... //read the response as XML object&lt;br /&gt;
        };&lt;br /&gt;
        client.open(&amp;quot;GET&amp;quot;, &amp;quot;resources/status.py?type=&amp;quot;&lt;br /&gt;
                    +encodeURIComponent('text/plain;charset=Shift-JIS')&lt;br /&gt;
                    +'&amp;amp;content='+ encodeURIComponent('&amp;lt;test&amp;gt;&amp;lt;message&amp;gt;Hello World！&amp;lt;/message&amp;gt;&amp;lt;/test&amp;gt;'));&lt;br /&gt;
        client.overrideMimeType('application/xml;charset=UTF-8');&lt;br /&gt;
        client.send();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;responseXML property&amp;lt;ref&amp;gt;https://msdn.microsoft.com/en-us/library/ms534370(v=vs.85).aspx&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//read the response from the server as an XML Object&lt;br /&gt;
&lt;br /&gt;
var oReq = new XMLHttpRequest();&lt;br /&gt;
oReq.open(&amp;quot;GET&amp;quot;, &amp;quot;http://localhost/books.xml&amp;quot;, false);&lt;br /&gt;
oReq.send();&lt;br /&gt;
console.log(oReq.responseXML.xml);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;withCredentials property&amp;lt;ref&amp;gt;http://arunranga.com/examples/access-control/credentialedRequest.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
//create cross site requests using cookies as credentials&lt;br /&gt;
 &lt;br /&gt;
var invocation = new XMLHttpRequest();&lt;br /&gt;
var url = 'http://crossoriginurl.com/resources/access-control-with-credentials/';&lt;br /&gt;
invocation.open('GET', url, true);&lt;br /&gt;
invocation.withCredentials = &amp;quot;true&amp;quot;;&lt;br /&gt;
invocation.onreadystatechange = handler;&lt;br /&gt;
invocation.send(); &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The above mentioned APIs and properties for XMLHttpRequest are currently unimplemented in servo.&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
Our project aim is to implement few of the missing XMLHttpRequest APIs.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs&amp;lt;/ref&amp;gt; The [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2015/oss_M1504_JJD OSS project] included implementing initial steps of the [https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs specifications]. It basically incorporated implementing overrideMimeType method and adjusting related test expectations. &lt;br /&gt;
&lt;br /&gt;
The implementation of the final project is described in a [[#Implementation_Details|section below]].&lt;br /&gt;
&lt;br /&gt;
==Requirement Analysis==&lt;br /&gt;
&lt;br /&gt;
Below is an overview of the various steps identified as a part of the requirement analysis and corresponding places in code in which these steps would be implemented:&lt;br /&gt;
&lt;br /&gt;
''' XMLHttpRequest Interface '''&lt;br /&gt;
* We have to uncomment the responseXML API&lt;br /&gt;
* A webpage can make use of this API to read the document response &lt;br /&gt;
&lt;br /&gt;
'''XMLHttpRequest DOM '''&lt;br /&gt;
&lt;br /&gt;
# Create helper methods final_mime_type and final_charset&lt;br /&gt;
#* Implement the two methods as per the behavior mentioned in the [https://xhr.spec.whatwg.org/#final-mime-type specification]&lt;br /&gt;
# Implement correct behavior for the text_response method&lt;br /&gt;
#* Make use of the final_charset and final_mime_type helper methods to determine the correct encoding for the response and decode the response using this encoding&lt;br /&gt;
# Create and implement a new method &amp;quot;document_response&amp;quot; according to the [https://xhr.spec.whatwg.org/#document-response xhr specification]&lt;br /&gt;
# Implement the correct behavior for the responseXML API to handle exceptions and return the document response using the method implemented above &amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#dom-xmlhttprequest-responsexml&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Implement the withCredentials APIs (setter and getter) as per the [https://xhr.spec.whatwg.org/#dom-xmlhttprequest-withcredentials specification]&lt;br /&gt;
# Add support to the send() and open() API to test the value of the withCredentials attribute where necessary&lt;br /&gt;
&lt;br /&gt;
''' net_traits '''&lt;br /&gt;
* Add a new member to the LoadData Structure in [https://github.com/servo/servo/blob/master/components/net_traits/lib.rs#L130 lib.rs file] which will be used by the http_loader to conditionally exclude cookies from the XHR request based on the value of the member.&lt;br /&gt;
&lt;br /&gt;
''' XHR Tests '''&lt;br /&gt;
* We need to pass [[#Proposed_Test_Cases | most tests]] related to overrideMimeType, responseXML and withCredentials present in the [https://github.com/servo/servo/tree/master/tests/wpt/web-platform-tests/XMLHttpRequest XHR test-suite]&lt;br /&gt;
&lt;br /&gt;
==Component Flow Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:component_flow_f15_m1504.png]]&lt;br /&gt;
&lt;br /&gt;
The XMLHttpRequest API receives request from the web server, the implementation then checks the response type, if it is a text response then we use the charset from final_charset else we use the default charset that was received with the request. The same applies to document response.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&lt;br /&gt;
Note :- UML diagram is not included because we do not have much class interaction in this project.&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Design Patterns ==&lt;br /&gt;
We have used &amp;quot;State Pattern&amp;quot; for our final project implementation. Our implementation stores the new CHARSET and MIME type based on what user has requested. So once user has requested for override in this value, the design pattern ensures the system behaves as per this new value.&lt;br /&gt;
&lt;br /&gt;
[[File: design_pattern_f15_m1504.png]]&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
The implementation for the final project involved following tasks:&lt;br /&gt;
*'''Implement the specified behavior for the override MIME type/final MIME type and override charset/final charset :''' We created two helper methods in xmlhttprequest.rs file: final_mime_type() and final_charset()&lt;br /&gt;
**final_mime_type() method returns the final MIME type&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#final-mime-type&amp;lt;/ref&amp;gt; depending on override MIME type and response MIME type&lt;br /&gt;
**final_charset() method returns the final charset&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#final-charset&amp;lt;/ref&amp;gt; depending on override charset and response charset &lt;br /&gt;
**We have also determined encoding of text_response by calling the final_charset() helper method. But if final charset is not set (i.e. it is None) then UTF-8 is set as the default encoding. The step 4 mentioned in the [https://xhr.spec.whatwg.org/#text-response text response] documentation in order to add support for XML encoding guess stuff using XML spec was not to be implemented and hence FIXME was added in the code.&lt;br /&gt;
&lt;br /&gt;
* '''Support the withCredentials API :''' We have implemented basic network level support to conditionally exclude cookies from the HTTP request by adding a boolean member: credentials_flag to LoadData structure in lib.rs file. The default value of credentials_flag is set to true. credentials_flag is assigned value for cross-origin requests in Send() method of xmlhttprequest.rs file using the withCredentials attribute of XMLHttpRequest. If the credentials_flag is false then cookies will not be set from the cookie jar for the HTTP request for which the code is added in http_loader.rs file. Also if the credentials_flag is false, then the cookies are not set in the cookie jar from HTTP response.&lt;br /&gt;
&lt;br /&gt;
* '''Support for document response in responseXML API :''' Added Document to the list of response type checks. New methods were created which contain handling for different mime types. A document object is created and its JS value is returned. The document object is stored in response_xml member of XHR, on subsequent calls to the method this object is returned if it has already been set previously.&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#response-document-object&amp;lt;/ref&amp;gt;.For mime type text/html if any of the charset is NONE the requirement was to scan the first 1024 bytes of the header to identify the charset, this part has not been implemented in this project. The following new methods were added to file XMLHttprequest.rs as part of this task -&lt;br /&gt;
**document_response - This method creates a document as per mime type returned by the final_mime_type() method created as part of OSS project. It internally calls other methods listed below.  &lt;br /&gt;
**document_text_html - This method creates a document flagged as an HTML document. This method is called by document_response in case the mime type is text/html. It calls the new_doc helper method.&lt;br /&gt;
**handle_xml - This method creates a document flagged as a non HTML document. This method is called by document_response in case the mime type subtype is XML. It calls the new_doc helper method.  &lt;br /&gt;
**new_doc - This method creates a new document which is the final response based on the input received from document_text_response and handle_xml methods.&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
The tests have already been written for the XMLHttpRequest APIs related to our project. So the test cases that pass after our changes to the code are as follows:&lt;br /&gt;
&lt;br /&gt;
* If XMLHttpRequest is in unsent state, then overrideMimeType() should be able to enforce Shift-JIS charset encoding&lt;br /&gt;
* If XMLHttpRequest is in open state, then overrideMimeType() should be able to enforce UTF-8 charset encoding&lt;br /&gt;
* If XMLHttpRequest is in HEADERS RECEIVED state, then overrideMimeType() will be able to enforce Shift-JIS charset encoding&lt;br /&gt;
* responseXML attribute should throw InvalidStateError if response type is not null or document&lt;br /&gt;
* The various responseXML document properties like domain, URL, title, body, images, etc. must be correctly initialized&lt;br /&gt;
* If the state of XMLHttpRequest is not done then responseXML must be null&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
* Steps for installing [https://github.com/rust-lang/rust rust]&lt;br /&gt;
* Building [https://github.com/servo/servo Servo]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
===Images===&lt;br /&gt;
&amp;lt;references group=&amp;quot;image&amp;quot;/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=100387</id>
		<title>CSC/ECE 517 Fall 2015 M1504 Implement support for missing XMLHttpRequest APIs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=100387"/>
		<updated>2015-12-06T23:55:04Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: /* Implementation Details */  updated 1st task&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt; is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]&amp;lt;ref&amp;gt;https://github.com/rust-lang/rust&amp;lt;/ref&amp;gt; and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla Research]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo is built on top of Rust to provide a secure and reliable foundation and is focused on creating a reliable and fast browser engine.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language.&lt;br /&gt;
&lt;br /&gt;
Rust is a modern, fast, memory safe and multithreaded programming language that focuses on speed and safety for developing reliable and efficient systems. It eliminates all data races by having numerous compile-time safety checks that adds no runtime overhead.&amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/book/README.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Servo task Architecture==&lt;br /&gt;
&lt;br /&gt;
[[Image:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref group=&amp;quot;image&amp;quot;&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Description===&lt;br /&gt;
&lt;br /&gt;
* Each box corresponds to a Rust task.&lt;br /&gt;
* The primary tasks in the browser pipeline are represented by Blue boxes.&lt;br /&gt;
* Dashed lines indicate supervisor relationships.&lt;br /&gt;
* Gray boxes indicate tasks auxiliary to the browser pipeline.&lt;br /&gt;
* Communication channels are represented as solid lines.&lt;br /&gt;
* White boxes are represented as worker tasks. Each such box represents several tasks which varies with the workload.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
===XMLHttpRequest===&lt;br /&gt;
&amp;quot;[https://xhr.spec.whatwg.org/ XMLHttpRequest] is a specification which defines [https://en.wikipedia.org/wiki/Application_programming_interface APIs] that provides scripted client functionality for transferring data between a client and a server.&amp;quot;&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/&amp;lt;/ref&amp;gt; XMLHttpRequest provides a way for data to be retrieved from a URL without having to retrieve the entire page. It supports protocols other than HTTP and can be used to retrieve any type of data.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some of the APIs and properties present in XMLHttpRequest specification are '''overrideMimeType()''' , '''responseXML''' and '''withCredentials'''. The following javascript code snippets briefly explain about each of these APIs.&lt;br /&gt;
&lt;br /&gt;
;overrideMimeType&amp;lt;ref&amp;gt;https://github.com/servo/servo/blob/master/tests/wpt/web-platform-tests/XMLHttpRequest/overridemimetype-open-state-force-xml.htm&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
//override the Mime type to retrieve the response as an XML Object&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 var client = new XMLHttpRequest();&lt;br /&gt;
 client.onreadystatechange = function() {&lt;br /&gt;
          ... //read the response as XML object&lt;br /&gt;
        };&lt;br /&gt;
        client.open(&amp;quot;GET&amp;quot;, &amp;quot;resources/status.py?type=&amp;quot;&lt;br /&gt;
                    +encodeURIComponent('text/plain;charset=Shift-JIS')&lt;br /&gt;
                    +'&amp;amp;content='+ encodeURIComponent('&amp;lt;test&amp;gt;&amp;lt;message&amp;gt;Hello World！&amp;lt;/message&amp;gt;&amp;lt;/test&amp;gt;'));&lt;br /&gt;
        client.overrideMimeType('application/xml;charset=UTF-8');&lt;br /&gt;
        client.send();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;responseXML property&amp;lt;ref&amp;gt;https://msdn.microsoft.com/en-us/library/ms534370(v=vs.85).aspx&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//read the response from the server as an XML Object&lt;br /&gt;
&lt;br /&gt;
var oReq = new XMLHttpRequest();&lt;br /&gt;
oReq.open(&amp;quot;GET&amp;quot;, &amp;quot;http://localhost/books.xml&amp;quot;, false);&lt;br /&gt;
oReq.send();&lt;br /&gt;
console.log(oReq.responseXML.xml);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;withCredentials property&amp;lt;ref&amp;gt;http://arunranga.com/examples/access-control/credentialedRequest.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
//create cross site requests using cookies as credentials&lt;br /&gt;
 &lt;br /&gt;
var invocation = new XMLHttpRequest();&lt;br /&gt;
var url = 'http://crossoriginurl.com/resources/access-control-with-credentials/';&lt;br /&gt;
invocation.open('GET', url, true);&lt;br /&gt;
invocation.withCredentials = &amp;quot;true&amp;quot;;&lt;br /&gt;
invocation.onreadystatechange = handler;&lt;br /&gt;
invocation.send(); &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The above mentioned APIs and properties for XMLHttpRequest are currently unimplemented in servo.&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
Our project aim is to implement few of the missing XMLHttpRequest APIs.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs&amp;lt;/ref&amp;gt; The [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2015/oss_M1504_JJD OSS project] included implementing initial steps of the [https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs specifications]. It basically incorporated implementing overrideMimeType method and adjusting related test expectations. &lt;br /&gt;
&lt;br /&gt;
The implementation of the final project is described in a [[#Implementation_Details|section below]].&lt;br /&gt;
&lt;br /&gt;
==Requirement Analysis==&lt;br /&gt;
&lt;br /&gt;
Below is an overview of the various steps identified as a part of the requirement analysis and corresponding places in code in which these steps would be implemented:&lt;br /&gt;
&lt;br /&gt;
''' XMLHttpRequest Interface '''&lt;br /&gt;
* We have to uncomment the responseXML API&lt;br /&gt;
* A webpage can make use of this API to read the document response &lt;br /&gt;
&lt;br /&gt;
'''XMLHttpRequest DOM '''&lt;br /&gt;
&lt;br /&gt;
# Create helper methods final_mime_type and final_charset&lt;br /&gt;
#* Implement the two methods as per the behavior mentioned in the [https://xhr.spec.whatwg.org/#final-mime-type specification]&lt;br /&gt;
# Implement correct behavior for the text_response method&lt;br /&gt;
#* Make use of the final_charset and final_mime_type helper methods to determine the correct encoding for the response and decode the response using this encoding&lt;br /&gt;
# Create and implement a new method &amp;quot;document_response&amp;quot; according to the [https://xhr.spec.whatwg.org/#document-response xhr specification]&lt;br /&gt;
# Implement the correct behavior for the responseXML API to handle exceptions and return the document response using the method implemented above &amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#dom-xmlhttprequest-responsexml&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Implement the withCredentials APIs (setter and getter) as per the [https://xhr.spec.whatwg.org/#dom-xmlhttprequest-withcredentials specification]&lt;br /&gt;
# Add support to the send() and open() API to test the value of the withCredentials attribute where necessary&lt;br /&gt;
&lt;br /&gt;
''' net_traits '''&lt;br /&gt;
* Add a new member to the LoadData Structure in [https://github.com/servo/servo/blob/master/components/net_traits/lib.rs#L130 lib.rs file] which will be used by the http_loader to conditionally exclude cookies from the XHR request based on the value of the member.&lt;br /&gt;
&lt;br /&gt;
''' XHR Tests '''&lt;br /&gt;
* We need to pass [[#Proposed_Test_Cases | most tests]] related to overrideMimeType, responseXML and withCredentials present in the [https://github.com/servo/servo/tree/master/tests/wpt/web-platform-tests/XMLHttpRequest XHR test-suite]&lt;br /&gt;
&lt;br /&gt;
==Component Flow Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:component_flow_f15_m1504.png]]&lt;br /&gt;
&lt;br /&gt;
The XMLHttpRequest API receives request from the web server, the implementation then checks the response type, if it is a text response then we use the charset from final_charset else we use the default charset that was received with the request. The same applies to document response.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&lt;br /&gt;
Note :- UML diagram is not included because we do not have much class interaction in this project.&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Design Patterns ==&lt;br /&gt;
We have used &amp;quot;State Pattern&amp;quot; for our final project implementation. Our implementation stores the new CHARSET and MIME type based on what user has requested. So once user has requested for override in this value, the design pattern ensures the system behaves as per this new value.&lt;br /&gt;
&lt;br /&gt;
[[File: design_pattern_f15_m1504.png]]&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
The implementation for the final project involved following tasks:&lt;br /&gt;
*'''Implement the specified behavior for the override MIME type/final MIME type and override charset/final charset :''' We created two helper methods in xmlhttprequest.rs file: final_mime_type() and final_charset()&lt;br /&gt;
**final_mime_type() method which returns the final MIME type&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#final-mime-type&amp;lt;/ref&amp;gt; depending on override MIME type and response MIME type&lt;br /&gt;
**final_charset() method which returns the final charset&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#final-charset&amp;lt;/ref&amp;gt; depending on override charset and response charset &lt;br /&gt;
**We have also determined encoding of text_response by calling the final_charset() helper method. But if final charset is not set (i.e. it is None) then UTF-8 is set as the default encoding. The step 4 mentioned in the [https://xhr.spec.whatwg.org/#text-response text response] documentation in order to add support for XML encoding guess stuff using XML spec was not to be implemented and hence FIXME was added in the code.&lt;br /&gt;
&lt;br /&gt;
* '''Support the withCredentials API :''' We have implemented basic network level support to conditionally exclude cookies from the HTTP request by adding a boolean member: credentials_flag to LoadData structure in lib.rs file. The default value of credentials_flag is set to true. credentials_flag is assigned value for cross-origin requests in Send() method of xmlhttprequest.rs file using the withCredentials attribute of XMLHttpRequest. If the credentials_flag is false then cookies will not be set from the cookie jar for the HTTP request for which the code is added in http_loader.rs file. Also if the credentials_flag is false, then the cookies are not set in the cookie jar from HTTP response.&lt;br /&gt;
&lt;br /&gt;
* '''Support for document response in responseXML API :''' Added Document to the list of response type checks. New methods were created which contain handling for different mime types. A document object is created and its JS value is returned. The document object is stored in response_xml member of XHR, on subsequent calls to the method this object is returned if it has already been set previously.&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#response-document-object&amp;lt;/ref&amp;gt;.For mime type text/html if any of the charset is NONE the requirement was to scan the first 1024 bytes of the header to identify the charset, this part has not been implemented in this project. The following new methods were added to file XMLHttprequest.rs as part of this task -&lt;br /&gt;
**document_response - This method creates a document as per mime type returned by the final_mime_type() method created as part of OSS project. It internally calls other methods listed below.  &lt;br /&gt;
**document_text_html - This method creates a document flagged as an HTML document. This method is called by document_response in case the mime type is text/html. It calls the new_doc helper method.&lt;br /&gt;
**handle_xml - This method creates a document flagged as a non HTML document. This method is called by document_response in case the mime type subtype is XML. It calls the new_doc helper method.  &lt;br /&gt;
**new_doc - This method creates a new document which is the final response based on the input received from document_text_response and handle_xml methods.&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
The tests have already been written for the XMLHttpRequest APIs related to our project. So the test cases that pass after our changes to the code are as follows:&lt;br /&gt;
&lt;br /&gt;
* If XMLHttpRequest is in unsent state, then overrideMimeType() should be able to enforce Shift-JIS charset encoding&lt;br /&gt;
* If XMLHttpRequest is in open state, then overrideMimeType() should be able to enforce UTF-8 charset encoding&lt;br /&gt;
* If XMLHttpRequest is in HEADERS RECEIVED state, then overrideMimeType() will be able to enforce Shift-JIS charset encoding&lt;br /&gt;
* responseXML attribute should throw InvalidStateError if response type is not null or document&lt;br /&gt;
* The various responseXML document properties like domain, URL, title, body, images, etc. must be correctly initialized&lt;br /&gt;
* If the state of XMLHttpRequest is not done then responseXML must be null&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
* Steps for installing [https://github.com/rust-lang/rust rust]&lt;br /&gt;
* Building [https://github.com/servo/servo Servo]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
===Images===&lt;br /&gt;
&amp;lt;references group=&amp;quot;image&amp;quot;/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=100381</id>
		<title>CSC/ECE 517 Fall 2015 M1504 Implement support for missing XMLHttpRequest APIs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=100381"/>
		<updated>2015-12-06T19:47:05Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: /* Implementation Details */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt; is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]&amp;lt;ref&amp;gt;https://github.com/rust-lang/rust&amp;lt;/ref&amp;gt; and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla Research]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo is built on top of Rust to provide a secure and reliable foundation and is focused on creating a reliable and fast browser engine.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language.&lt;br /&gt;
&lt;br /&gt;
Rust is a modern, fast, memory safe and multithreaded programming language that focuses on speed and safety for developing reliable and efficient systems. It eliminates all data races by having numerous compile-time safety checks that adds no runtime overhead.&amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/book/README.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Servo task Architecture==&lt;br /&gt;
&lt;br /&gt;
[[Image:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref group=&amp;quot;image&amp;quot;&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Description===&lt;br /&gt;
&lt;br /&gt;
* Each box corresponds to a Rust task.&lt;br /&gt;
* The primary tasks in the browser pipeline are represented by Blue boxes.&lt;br /&gt;
* Dashed lines indicate supervisor relationships.&lt;br /&gt;
* Gray boxes indicate tasks auxiliary to the browser pipeline.&lt;br /&gt;
* Communication channels are represented as solid lines.&lt;br /&gt;
* White boxes are represented as worker tasks. Each such box represents several tasks which varies with the workload.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
===XMLHttpRequest===&lt;br /&gt;
&amp;quot;[https://xhr.spec.whatwg.org/ XMLHttpRequest] is a specification which defines [https://en.wikipedia.org/wiki/Application_programming_interface APIs] that provides scripted client functionality for transferring data between a client and a server.&amp;quot;&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/&amp;lt;/ref&amp;gt; XMLHttpRequest provides a way for data to be retrieved from a URL without having to retrieve the entire page. It supports protocols other than HTTP and can be used to retrieve any type of data.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some of the APIs and properties present in XMLHttpRequest specification are '''overrideMimeType()''' , '''responseXML''' and '''withCredentials'''. The following javascript code snippets briefly explain about each of these APIs.&lt;br /&gt;
&lt;br /&gt;
;overrideMimeType&amp;lt;ref&amp;gt;https://github.com/servo/servo/blob/master/tests/wpt/web-platform-tests/XMLHttpRequest/overridemimetype-open-state-force-xml.htm&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
//override the Mime type to retrieve the response as an XML Object&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 var client = new XMLHttpRequest();&lt;br /&gt;
 client.onreadystatechange = function() {&lt;br /&gt;
          ... //read the response as XML object&lt;br /&gt;
        };&lt;br /&gt;
        client.open(&amp;quot;GET&amp;quot;, &amp;quot;resources/status.py?type=&amp;quot;&lt;br /&gt;
                    +encodeURIComponent('text/plain;charset=Shift-JIS')&lt;br /&gt;
                    +'&amp;amp;content='+ encodeURIComponent('&amp;lt;test&amp;gt;&amp;lt;message&amp;gt;Hello World！&amp;lt;/message&amp;gt;&amp;lt;/test&amp;gt;'));&lt;br /&gt;
        client.overrideMimeType('application/xml;charset=UTF-8');&lt;br /&gt;
        client.send();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;responseXML property&amp;lt;ref&amp;gt;https://msdn.microsoft.com/en-us/library/ms534370(v=vs.85).aspx&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//read the response from the server as an XML Object&lt;br /&gt;
&lt;br /&gt;
var oReq = new XMLHttpRequest();&lt;br /&gt;
oReq.open(&amp;quot;GET&amp;quot;, &amp;quot;http://localhost/books.xml&amp;quot;, false);&lt;br /&gt;
oReq.send();&lt;br /&gt;
console.log(oReq.responseXML.xml);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;withCredentials property&amp;lt;ref&amp;gt;http://arunranga.com/examples/access-control/credentialedRequest.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
//create cross site requests using cookies as credentials&lt;br /&gt;
 &lt;br /&gt;
var invocation = new XMLHttpRequest();&lt;br /&gt;
var url = 'http://crossoriginurl.com/resources/access-control-with-credentials/';&lt;br /&gt;
invocation.open('GET', url, true);&lt;br /&gt;
invocation.withCredentials = &amp;quot;true&amp;quot;;&lt;br /&gt;
invocation.onreadystatechange = handler;&lt;br /&gt;
invocation.send(); &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The above mentioned APIs and properties for XMLHttpRequest are currently unimplemented in servo.&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
Our project aim is to implement few of the missing XMLHttpRequest APIs.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs&amp;lt;/ref&amp;gt; The [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2015/oss_M1504_JJD OSS project] included implementing initial steps of the [https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs specifications]. It basically incorporated implementing overrideMimeType method and adjusting related test expectations. &lt;br /&gt;
&lt;br /&gt;
The implementation of the final project is described in a [[#Implementation_Details|section below]].&lt;br /&gt;
&lt;br /&gt;
==Requirement Analysis==&lt;br /&gt;
&lt;br /&gt;
Below is an overview of the various steps identified as a part of the requirement analysis and corresponding places in code in which these steps would be implemented:&lt;br /&gt;
&lt;br /&gt;
''' XMLHttpRequest Interface '''&lt;br /&gt;
* We have to uncomment the responseXML API&lt;br /&gt;
* A webpage can make use of this API to read the document response &lt;br /&gt;
&lt;br /&gt;
'''XMLHttpRequest DOM '''&lt;br /&gt;
&lt;br /&gt;
# Create helper methods final_mime_type and final_charset&lt;br /&gt;
#* Implement the two methods as per the behavior mentioned in the [https://xhr.spec.whatwg.org/#final-mime-type specification]&lt;br /&gt;
# Implement correct behavior for the text_response method&lt;br /&gt;
#* Make use of the final_charset and final_mime_type helper methods to determine the correct encoding for the response and decode the response using this encoding&lt;br /&gt;
# Create and implement a new method &amp;quot;document_response&amp;quot; according to the [https://xhr.spec.whatwg.org/#document-response xhr specification]&lt;br /&gt;
# Implement the correct behavior for the responseXML API to handle exceptions and return the document response using the method implemented above &amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#dom-xmlhttprequest-responsexml&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Implement the withCredentials APIs (setter and getter) as per the [https://xhr.spec.whatwg.org/#dom-xmlhttprequest-withcredentials specification]&lt;br /&gt;
# Add support to the send() and open() API to test the value of the withCredentials attribute where necessary&lt;br /&gt;
&lt;br /&gt;
''' net_traits '''&lt;br /&gt;
* Add a new member to the LoadData Structure in [https://github.com/servo/servo/blob/master/components/net_traits/lib.rs#L130 lib.rs file] which will be used by the http_loader to conditionally exclude cookies from the XHR request based on the value of the member.&lt;br /&gt;
&lt;br /&gt;
''' XHR Tests '''&lt;br /&gt;
* We need to pass [[#Proposed_Test_Cases | most tests]] related to overrideMimeType, responseXML and withCredentials present in the [https://github.com/servo/servo/tree/master/tests/wpt/web-platform-tests/XMLHttpRequest XHR test-suite]&lt;br /&gt;
&lt;br /&gt;
==Component Flow Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:component_flow_f15_m1504.png]]&lt;br /&gt;
&lt;br /&gt;
The XMLHttpRequest API receives request from the web server, the implementation then checks the response type, if it is a text response then we use the charset from final_charset else we use the default charset that was received with the request. The same applies to document response.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&lt;br /&gt;
Note :- UML diagram is not included because we do not have much class interaction in this project.&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Design Patterns ==&lt;br /&gt;
We have used &amp;quot;State Pattern&amp;quot; for our final project implementation. Our implementation stores the new CHARSET and MIME type based on what user has requested. So once user has requested for override in this value, the design pattern ensures the system behaves as per this new value.&lt;br /&gt;
&lt;br /&gt;
[[File: design_pattern_f15_m1504.png]]&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
The implementation for the final project involved following tasks:&lt;br /&gt;
* '''Implement the specified behavior for the override MIME type/final MIME type and override charset/final charset :''' We created two helper methods in xmlhttprequest.rs file: final_mime_type() method which returns the final MIME type&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#final-mime-type&amp;lt;/ref&amp;gt; depending on override MIME type and response MIME type and final_charset() method which returns the final charset.&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#final-charset&amp;lt;/ref&amp;gt; We have also determined encoding of text_response by calling this final_charset() helper method. But if final charset is not set (i.e. it is None) then UTF-8 is set as the default encoding.&lt;br /&gt;
&lt;br /&gt;
* '''Support the withCredentials API :''' We have implemented basic network level support to conditionally exclude cookies from the HTTP request by adding a boolean member: credentials_flag to LoadData structure in lib.rs file. The default value of credentials_flag is set to true. credentials_flag is assigned value for cross-origin requests in Send() method of xmlhttprequest.rs file using the withCredentials attribute of XMLHttpRequest. If the credentials_flag is false then cookies will not be set from the cookie jar for the HTTP request for which the code is added in http_loader.rs file. Also if the credentials_flag is false, then the cookies are not set in the cookie jar from HTTP response.&lt;br /&gt;
&lt;br /&gt;
* '''Support for document response in responseXML API :''' Added Document to the list of response type checks. A new method document_response() is called which contains handling for different mime types based on value returned by the final_mime_type() method. A document object is created and its JS value is returned by the method. The document object is stored in response_xml member of XHR, on subsequent calls to the method this object is returned if it has already been set previously.&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#response-document-object&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
The tests have already been written for the XMLHttpRequest APIs related to our project. So the test cases that pass after our changes to the code are as follows:&lt;br /&gt;
&lt;br /&gt;
* If XMLHttpRequest is in unsent state, then overrideMimeType() should be able to enforce Shift-JIS charset encoding&lt;br /&gt;
* If XMLHttpRequest is in open state, then overrideMimeType() should be able to enforce UTF-8 charset encoding&lt;br /&gt;
* If XMLHttpRequest is in HEADERS RECEIVED state, then overrideMimeType() will be able to enforce Shift-JIS charset encoding&lt;br /&gt;
* responseXML attribute should throw InvalidStateError if response type is not null or document&lt;br /&gt;
* The various responseXML document properties like domain, URL, title, body, images, etc. must be correctly initialized&lt;br /&gt;
* If the state of XMLHttpRequest is not done then responseXML must be null&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
* Steps for installing [https://github.com/rust-lang/rust rust]&lt;br /&gt;
* Building [https://github.com/servo/servo Servo]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
===Images===&lt;br /&gt;
&amp;lt;references group=&amp;quot;image&amp;quot;/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=100380</id>
		<title>CSC/ECE 517 Fall 2015 M1504 Implement support for missing XMLHttpRequest APIs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=100380"/>
		<updated>2015-12-06T19:31:56Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: /* Implementation Details */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt; is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]&amp;lt;ref&amp;gt;https://github.com/rust-lang/rust&amp;lt;/ref&amp;gt; and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla Research]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo is built on top of Rust to provide a secure and reliable foundation and is focused on creating a reliable and fast browser engine.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language.&lt;br /&gt;
&lt;br /&gt;
Rust is a modern, fast, memory safe and multithreaded programming language that focuses on speed and safety for developing reliable and efficient systems. It eliminates all data races by having numerous compile-time safety checks that adds no runtime overhead.&amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/book/README.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Servo task Architecture==&lt;br /&gt;
&lt;br /&gt;
[[Image:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref group=&amp;quot;image&amp;quot;&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Description===&lt;br /&gt;
&lt;br /&gt;
* Each box corresponds to a Rust task.&lt;br /&gt;
* The primary tasks in the browser pipeline are represented by Blue boxes.&lt;br /&gt;
* Dashed lines indicate supervisor relationships.&lt;br /&gt;
* Gray boxes indicate tasks auxiliary to the browser pipeline.&lt;br /&gt;
* Communication channels are represented as solid lines.&lt;br /&gt;
* White boxes are represented as worker tasks. Each such box represents several tasks which varies with the workload.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
===XMLHttpRequest===&lt;br /&gt;
&amp;quot;[https://xhr.spec.whatwg.org/ XMLHttpRequest] is a specification which defines [https://en.wikipedia.org/wiki/Application_programming_interface APIs] that provides scripted client functionality for transferring data between a client and a server.&amp;quot;&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/&amp;lt;/ref&amp;gt; XMLHttpRequest provides a way for data to be retrieved from a URL without having to retrieve the entire page. It supports protocols other than HTTP and can be used to retrieve any type of data.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some of the APIs and properties present in XMLHttpRequest specification are '''overrideMimeType()''' , '''responseXML''' and '''withCredentials'''. The following javascript code snippets briefly explain about each of these APIs.&lt;br /&gt;
&lt;br /&gt;
;overrideMimeType&amp;lt;ref&amp;gt;https://github.com/servo/servo/blob/master/tests/wpt/web-platform-tests/XMLHttpRequest/overridemimetype-open-state-force-xml.htm&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
//override the Mime type to retrieve the response as an XML Object&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 var client = new XMLHttpRequest();&lt;br /&gt;
 client.onreadystatechange = function() {&lt;br /&gt;
          ... //read the response as XML object&lt;br /&gt;
        };&lt;br /&gt;
        client.open(&amp;quot;GET&amp;quot;, &amp;quot;resources/status.py?type=&amp;quot;&lt;br /&gt;
                    +encodeURIComponent('text/plain;charset=Shift-JIS')&lt;br /&gt;
                    +'&amp;amp;content='+ encodeURIComponent('&amp;lt;test&amp;gt;&amp;lt;message&amp;gt;Hello World！&amp;lt;/message&amp;gt;&amp;lt;/test&amp;gt;'));&lt;br /&gt;
        client.overrideMimeType('application/xml;charset=UTF-8');&lt;br /&gt;
        client.send();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;responseXML property&amp;lt;ref&amp;gt;https://msdn.microsoft.com/en-us/library/ms534370(v=vs.85).aspx&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//read the response from the server as an XML Object&lt;br /&gt;
&lt;br /&gt;
var oReq = new XMLHttpRequest();&lt;br /&gt;
oReq.open(&amp;quot;GET&amp;quot;, &amp;quot;http://localhost/books.xml&amp;quot;, false);&lt;br /&gt;
oReq.send();&lt;br /&gt;
console.log(oReq.responseXML.xml);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;withCredentials property&amp;lt;ref&amp;gt;http://arunranga.com/examples/access-control/credentialedRequest.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
//create cross site requests using cookies as credentials&lt;br /&gt;
 &lt;br /&gt;
var invocation = new XMLHttpRequest();&lt;br /&gt;
var url = 'http://crossoriginurl.com/resources/access-control-with-credentials/';&lt;br /&gt;
invocation.open('GET', url, true);&lt;br /&gt;
invocation.withCredentials = &amp;quot;true&amp;quot;;&lt;br /&gt;
invocation.onreadystatechange = handler;&lt;br /&gt;
invocation.send(); &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The above mentioned APIs and properties for XMLHttpRequest are currently unimplemented in servo.&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
Our project aim is to implement few of the missing XMLHttpRequest APIs.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs&amp;lt;/ref&amp;gt; The [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2015/oss_M1504_JJD OSS project] included implementing initial steps of the [https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs specifications]. It basically incorporated implementing overrideMimeType method and adjusting related test expectations. &lt;br /&gt;
&lt;br /&gt;
The implementation of the final project is described in a [[#Implementation_Details|section below]].&lt;br /&gt;
&lt;br /&gt;
==Requirement Analysis==&lt;br /&gt;
&lt;br /&gt;
Below is an overview of the various steps identified as a part of the requirement analysis and corresponding places in code in which these steps would be implemented:&lt;br /&gt;
&lt;br /&gt;
''' XMLHttpRequest Interface '''&lt;br /&gt;
* We have to uncomment the responseXML API&lt;br /&gt;
* A webpage can make use of this API to read the document response &lt;br /&gt;
&lt;br /&gt;
'''XMLHttpRequest DOM '''&lt;br /&gt;
&lt;br /&gt;
# Create helper methods final_mime_type and final_charset&lt;br /&gt;
#* Implement the two methods as per the behavior mentioned in the [https://xhr.spec.whatwg.org/#final-mime-type specification]&lt;br /&gt;
# Implement correct behavior for the text_response method&lt;br /&gt;
#* Make use of the final_charset and final_mime_type helper methods to determine the correct encoding for the response and decode the response using this encoding&lt;br /&gt;
# Create and implement a new method &amp;quot;document_response&amp;quot; according to the [https://xhr.spec.whatwg.org/#document-response xhr specification]&lt;br /&gt;
# Implement the correct behavior for the responseXML API to handle exceptions and return the document response using the method implemented above &amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#dom-xmlhttprequest-responsexml&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Implement the withCredentials APIs (setter and getter) as per the [https://xhr.spec.whatwg.org/#dom-xmlhttprequest-withcredentials specification]&lt;br /&gt;
# Add support to the send() and open() API to test the value of the withCredentials attribute where necessary&lt;br /&gt;
&lt;br /&gt;
''' net_traits '''&lt;br /&gt;
* Add a new member to the LoadData Structure in [https://github.com/servo/servo/blob/master/components/net_traits/lib.rs#L130 lib.rs file] which will be used by the http_loader to conditionally exclude cookies from the XHR request based on the value of the member.&lt;br /&gt;
&lt;br /&gt;
''' XHR Tests '''&lt;br /&gt;
* We need to pass [[#Proposed_Test_Cases | most tests]] related to overrideMimeType, responseXML and withCredentials present in the [https://github.com/servo/servo/tree/master/tests/wpt/web-platform-tests/XMLHttpRequest XHR test-suite]&lt;br /&gt;
&lt;br /&gt;
==Component Flow Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:component_flow_f15_m1504.png]]&lt;br /&gt;
&lt;br /&gt;
The XMLHttpRequest API receives request from the web server, the implementation then checks the response type, if it is a text response then we use the charset from final_charset else we use the default charset that was received with the request. The same applies to document response.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&lt;br /&gt;
Note :- UML diagram is not included because we do not have much class interaction in this project.&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Design Patterns ==&lt;br /&gt;
We have used &amp;quot;State Pattern&amp;quot; for our final project implementation. Our implementation stores the new CHARSET and MIME type based on what user has requested. So once user has requested for override in this value, the design pattern ensures the system behaves as per this new value.&lt;br /&gt;
&lt;br /&gt;
[[File: design_pattern_f15_m1504.png]]&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
The implementation for the final project involved following tasks:&lt;br /&gt;
* '''Implement the specified behavior for the override MIME type/final MIME type and override charset/final charset :''' We created two helper methods in xmlhttprequest.rs file: final_mime_type() method which returns the final MIME type&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#final-mime-type&amp;lt;/ref&amp;gt; depending on override MIME type and response MIME type and final_charset() method which returns the final charset.&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#final-charset&amp;lt;/ref&amp;gt; We also added final charset support for text_response by calling this final_charset() helper method.&lt;br /&gt;
* '''Support the withCredentials API :''' We have implemented basic network level support to conditionally exclude cookies from the HTTP request by adding a boolean member: credentials_flag to LoadData structure in lib.rs file. The default value of credentials_flag is set to true. credentials_flag is assigned value for cross-origin requests in Send() method of xmlhttprequest.rs file using the withCredentials attribute of XMLHttpRequest. If the credentials_flag is false then cookies will not be set from the cookie jar for the HTTP request for which the code is added in http_loader.rs file. Also if the credentials_flag is false, then the cookies are not set in the cookie jar from HTTP response.&lt;br /&gt;
&lt;br /&gt;
* '''Support for document response in responseXML API :''' Added Document to the list of response type checks. A new method document_response() is called which contains handling for different mime types based on value returned by the final_mime_type() method. A document object is created and its JS value is returned by the method. The document object is stored in response_xml member of XHR, on subsequent calls to the method this object is returned if it has already been set previously.&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#response-document-object&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
The tests have already been written for the XMLHttpRequest APIs related to our project. So the test cases that pass after our changes to the code are as follows:&lt;br /&gt;
&lt;br /&gt;
* If XMLHttpRequest is in unsent state, then overrideMimeType() should be able to enforce Shift-JIS charset encoding&lt;br /&gt;
* If XMLHttpRequest is in open state, then overrideMimeType() should be able to enforce UTF-8 charset encoding&lt;br /&gt;
* If XMLHttpRequest is in HEADERS RECEIVED state, then overrideMimeType() will be able to enforce Shift-JIS charset encoding&lt;br /&gt;
* responseXML attribute should throw InvalidStateError if response type is not null or document&lt;br /&gt;
* The various responseXML document properties like domain, URL, title, body, images, etc. must be correctly initialized&lt;br /&gt;
* If the state of XMLHttpRequest is not done then responseXML must be null&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
* Steps for installing [https://github.com/rust-lang/rust rust]&lt;br /&gt;
* Building [https://github.com/servo/servo Servo]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
===Images===&lt;br /&gt;
&amp;lt;references group=&amp;quot;image&amp;quot;/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=100379</id>
		<title>CSC/ECE 517 Fall 2015 M1504 Implement support for missing XMLHttpRequest APIs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=100379"/>
		<updated>2015-12-06T19:24:52Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: /* Implementation Details */  edited few lines&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt; is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]&amp;lt;ref&amp;gt;https://github.com/rust-lang/rust&amp;lt;/ref&amp;gt; and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla Research]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo is built on top of Rust to provide a secure and reliable foundation and is focused on creating a reliable and fast browser engine.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language.&lt;br /&gt;
&lt;br /&gt;
Rust is a modern, fast, memory safe and multithreaded programming language that focuses on speed and safety for developing reliable and efficient systems. It eliminates all data races by having numerous compile-time safety checks that adds no runtime overhead.&amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/book/README.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Servo task Architecture==&lt;br /&gt;
&lt;br /&gt;
[[Image:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref group=&amp;quot;image&amp;quot;&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Description===&lt;br /&gt;
&lt;br /&gt;
* Each box corresponds to a Rust task.&lt;br /&gt;
* The primary tasks in the browser pipeline are represented by Blue boxes.&lt;br /&gt;
* Dashed lines indicate supervisor relationships.&lt;br /&gt;
* Gray boxes indicate tasks auxiliary to the browser pipeline.&lt;br /&gt;
* Communication channels are represented as solid lines.&lt;br /&gt;
* White boxes are represented as worker tasks. Each such box represents several tasks which varies with the workload.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
===XMLHttpRequest===&lt;br /&gt;
&amp;quot;[https://xhr.spec.whatwg.org/ XMLHttpRequest] is a specification which defines [https://en.wikipedia.org/wiki/Application_programming_interface APIs] that provides scripted client functionality for transferring data between a client and a server.&amp;quot;&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/&amp;lt;/ref&amp;gt; XMLHttpRequest provides a way for data to be retrieved from a URL without having to retrieve the entire page. It supports protocols other than HTTP and can be used to retrieve any type of data.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some of the APIs and properties present in XMLHttpRequest specification are '''overrideMimeType()''' , '''responseXML''' and '''withCredentials'''. The following javascript code snippets briefly explain about each of these APIs.&lt;br /&gt;
&lt;br /&gt;
;overrideMimeType&amp;lt;ref&amp;gt;https://github.com/servo/servo/blob/master/tests/wpt/web-platform-tests/XMLHttpRequest/overridemimetype-open-state-force-xml.htm&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
//override the Mime type to retrieve the response as an XML Object&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 var client = new XMLHttpRequest();&lt;br /&gt;
 client.onreadystatechange = function() {&lt;br /&gt;
          ... //read the response as XML object&lt;br /&gt;
        };&lt;br /&gt;
        client.open(&amp;quot;GET&amp;quot;, &amp;quot;resources/status.py?type=&amp;quot;&lt;br /&gt;
                    +encodeURIComponent('text/plain;charset=Shift-JIS')&lt;br /&gt;
                    +'&amp;amp;content='+ encodeURIComponent('&amp;lt;test&amp;gt;&amp;lt;message&amp;gt;Hello World！&amp;lt;/message&amp;gt;&amp;lt;/test&amp;gt;'));&lt;br /&gt;
        client.overrideMimeType('application/xml;charset=UTF-8');&lt;br /&gt;
        client.send();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;responseXML property&amp;lt;ref&amp;gt;https://msdn.microsoft.com/en-us/library/ms534370(v=vs.85).aspx&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//read the response from the server as an XML Object&lt;br /&gt;
&lt;br /&gt;
var oReq = new XMLHttpRequest();&lt;br /&gt;
oReq.open(&amp;quot;GET&amp;quot;, &amp;quot;http://localhost/books.xml&amp;quot;, false);&lt;br /&gt;
oReq.send();&lt;br /&gt;
console.log(oReq.responseXML.xml);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;withCredentials property&amp;lt;ref&amp;gt;http://arunranga.com/examples/access-control/credentialedRequest.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
//create cross site requests using cookies as credentials&lt;br /&gt;
 &lt;br /&gt;
var invocation = new XMLHttpRequest();&lt;br /&gt;
var url = 'http://crossoriginurl.com/resources/access-control-with-credentials/';&lt;br /&gt;
invocation.open('GET', url, true);&lt;br /&gt;
invocation.withCredentials = &amp;quot;true&amp;quot;;&lt;br /&gt;
invocation.onreadystatechange = handler;&lt;br /&gt;
invocation.send(); &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The above mentioned APIs and properties for XMLHttpRequest are currently unimplemented in servo.&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
Our project aim is to implement few of the missing XMLHttpRequest APIs.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs&amp;lt;/ref&amp;gt; The [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2015/oss_M1504_JJD OSS project] included implementing initial steps of the [https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs specifications]. It basically incorporated implementing overrideMimeType method and adjusting related test expectations. &lt;br /&gt;
&lt;br /&gt;
The implementation of the final project is described in a [[#Implementation_Details|section below]].&lt;br /&gt;
&lt;br /&gt;
==Requirement Analysis==&lt;br /&gt;
&lt;br /&gt;
Below is an overview of the various steps identified as a part of the requirement analysis and corresponding places in code in which these steps would be implemented:&lt;br /&gt;
&lt;br /&gt;
''' XMLHttpRequest Interface '''&lt;br /&gt;
* We have to uncomment the responseXML API&lt;br /&gt;
* A webpage can make use of this API to read the document response &lt;br /&gt;
&lt;br /&gt;
'''XMLHttpRequest DOM '''&lt;br /&gt;
&lt;br /&gt;
# Create helper methods final_mime_type and final_charset&lt;br /&gt;
#* Implement the two methods as per the behavior mentioned in the [https://xhr.spec.whatwg.org/#final-mime-type specification]&lt;br /&gt;
# Implement correct behavior for the text_response method&lt;br /&gt;
#* Make use of the final_charset and final_mime_type helper methods to determine the correct encoding for the response and decode the response using this encoding&lt;br /&gt;
# Create and implement a new method &amp;quot;document_response&amp;quot; according to the [https://xhr.spec.whatwg.org/#document-response xhr specification]&lt;br /&gt;
# Implement the correct behavior for the responseXML API to handle exceptions and return the document response using the method implemented above &amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#dom-xmlhttprequest-responsexml&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Implement the withCredentials APIs (setter and getter) as per the [https://xhr.spec.whatwg.org/#dom-xmlhttprequest-withcredentials specification]&lt;br /&gt;
# Add support to the send() and open() API to test the value of the withCredentials attribute where necessary&lt;br /&gt;
&lt;br /&gt;
''' net_traits '''&lt;br /&gt;
* Add a new member to the LoadData Structure in [https://github.com/servo/servo/blob/master/components/net_traits/lib.rs#L130 lib.rs file] which will be used by the http_loader to conditionally exclude cookies from the XHR request based on the value of the member.&lt;br /&gt;
&lt;br /&gt;
''' XHR Tests '''&lt;br /&gt;
* We need to pass [[#Proposed_Test_Cases | most tests]] related to overrideMimeType, responseXML and withCredentials present in the [https://github.com/servo/servo/tree/master/tests/wpt/web-platform-tests/XMLHttpRequest XHR test-suite]&lt;br /&gt;
&lt;br /&gt;
==Component Flow Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:component_flow_f15_m1504.png]]&lt;br /&gt;
&lt;br /&gt;
The XMLHttpRequest API receives request from the web server, the implementation then checks the response type, if it is a text response then we use the charset from final_charset else we use the default charset that was received with the request. The same applies to document response.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&lt;br /&gt;
Note :- UML diagram is not included because we do not have much class interaction in this project.&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Design Patterns ==&lt;br /&gt;
We have used &amp;quot;State Pattern&amp;quot; for our final project implementation. Our implementation stores the new CHARSET and MIME type based on what user has requested. So once user has requested for override in this value, the design pattern ensures the system behaves as per this new value.&lt;br /&gt;
&lt;br /&gt;
[[File: design_pattern_f15_m1504.png]]&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
The implementation for the final project involved following tasks:&lt;br /&gt;
* '''Implement the specified behavior for the override MIME type/final MIME type and override charset/final charset :''' We created two helper methods in xmlhttprequest.rs file: final_mime_type() method which returns the final MIME type&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#final-mime-type&amp;lt;/ref&amp;gt; depending on override MIME type and response MIME type and final_charset() method which returns the final charset.&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#final-charset&amp;lt;/ref&amp;gt; We also added final charset support for text_response by calling this final_charset() helper method.&lt;br /&gt;
* '''Support the withCredentials API :''' We have implemented basic network level support to conditionally exclude cookies from the HTTP request by adding a boolean member: credentials_flag to LoadData structure in lib.rs file. The default value given for it is true. credentials_flag is set for cross-origin requests in Send() method of xmlhttprequest.rs file using the WithCredentials() attribute of XMLHttpRequest. If the credentials_flag is false then cookies will not be set from the cookie jar for the HTTP request for which the code is added in http_loader.rs file. Also if the credentials_flag is false, then the cookies are not set in the cookie jar from HTTP response.&lt;br /&gt;
&lt;br /&gt;
* '''Support for document response in responseXML API :''' Added Document to the list of response type checks. A new method document_response() is called which contains handling for different mime types based on value returned by the final_mime_type() method. A document object is created and its JS value is returned by the method. The document object is stored in response_xml member of XHR, on subsequent calls to the method this object is returned if it has already been set previously.&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#response-document-object&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
The tests have already been written for the XMLHttpRequest APIs related to our project. So the test cases that pass after our changes to the code are as follows:&lt;br /&gt;
&lt;br /&gt;
* If XMLHttpRequest is in unsent state, then overrideMimeType() should be able to enforce Shift-JIS charset encoding&lt;br /&gt;
* If XMLHttpRequest is in open state, then overrideMimeType() should be able to enforce UTF-8 charset encoding&lt;br /&gt;
* If XMLHttpRequest is in HEADERS RECEIVED state, then overrideMimeType() will be able to enforce Shift-JIS charset encoding&lt;br /&gt;
* responseXML attribute should throw InvalidStateError if response type is not null or document&lt;br /&gt;
* The various responseXML document properties like domain, URL, title, body, images, etc. must be correctly initialized&lt;br /&gt;
* If the state of XMLHttpRequest is not done then responseXML must be null&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
* Steps for installing [https://github.com/rust-lang/rust rust]&lt;br /&gt;
* Building [https://github.com/servo/servo Servo]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
===Images===&lt;br /&gt;
&amp;lt;references group=&amp;quot;image&amp;quot;/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=100215</id>
		<title>CSC/ECE 517 Fall 2015 M1504 Implement support for missing XMLHttpRequest APIs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=100215"/>
		<updated>2015-12-05T01:30:17Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: /* Project Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt; is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]&amp;lt;ref&amp;gt;https://github.com/rust-lang/rust&amp;lt;/ref&amp;gt; and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla Research]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo is built on top of Rust to provide a secure and reliable foundation and is focused on creating a reliable and fast browser engine.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language.&lt;br /&gt;
&lt;br /&gt;
Rust is a modern, fast, memory safe and multithreaded programming language that focuses on speed and safety for developing reliable and efficient systems. It eliminates all data races by having numerous compile-time safety checks that adds no runtime overhead.&amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/book/README.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Servo task Architecture==&lt;br /&gt;
&lt;br /&gt;
[[Image:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref group=&amp;quot;image&amp;quot;&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Description===&lt;br /&gt;
&lt;br /&gt;
* Each box corresponds to a Rust task.&lt;br /&gt;
* The primary tasks in the browser pipeline are represented by Blue boxes.&lt;br /&gt;
* Dashed lines indicate supervisor relationships.&lt;br /&gt;
* Gray boxes indicate tasks auxiliary to the browser pipeline.&lt;br /&gt;
* Communication channels are represented as solid lines.&lt;br /&gt;
* White boxes are represented as worker tasks. Each such box represents several tasks which varies with the workload.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
===XMLHttpRequest===&lt;br /&gt;
&amp;quot;[https://xhr.spec.whatwg.org/ XMLHttpRequest] is a specification which defines [https://en.wikipedia.org/wiki/Application_programming_interface APIs] that provides scripted client functionality for transferring data between a client and a server.&amp;quot;&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/&amp;lt;/ref&amp;gt; XMLHttpRequest provides a way for data to be retrieved from a URL without having to retrieve the entire page. It supports protocols other than HTTP and can be used to retrieve any type of data.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some of the APIs and properties present in XMLHttpRequest specification are '''overrideMimeType()''' , '''responseXML''' and '''withCredentials'''. The following javascript code snippets briefly explain about each of these APIs.&lt;br /&gt;
&lt;br /&gt;
;overrideMimeType&amp;lt;ref&amp;gt;https://github.com/servo/servo/blob/master/tests/wpt/web-platform-tests/XMLHttpRequest/overridemimetype-open-state-force-xml.htm&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
//override the Mime type to retrieve the response as an XML Object&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 var client = new XMLHttpRequest();&lt;br /&gt;
 client.onreadystatechange = function() {&lt;br /&gt;
          ... //read the response as XML object&lt;br /&gt;
        };&lt;br /&gt;
        client.open(&amp;quot;GET&amp;quot;, &amp;quot;resources/status.py?type=&amp;quot;&lt;br /&gt;
                    +encodeURIComponent('text/plain;charset=Shift-JIS')&lt;br /&gt;
                    +'&amp;amp;content='+ encodeURIComponent('&amp;lt;test&amp;gt;&amp;lt;message&amp;gt;Hello World！&amp;lt;/message&amp;gt;&amp;lt;/test&amp;gt;'));&lt;br /&gt;
        client.overrideMimeType('application/xml;charset=UTF-8');&lt;br /&gt;
        client.send();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;responseXML property&amp;lt;ref&amp;gt;https://msdn.microsoft.com/en-us/library/ms534370(v=vs.85).aspx&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//read the response from the server as an XML Object&lt;br /&gt;
&lt;br /&gt;
var oReq = new XMLHttpRequest();&lt;br /&gt;
oReq.open(&amp;quot;GET&amp;quot;, &amp;quot;http://localhost/books.xml&amp;quot;, false);&lt;br /&gt;
oReq.send();&lt;br /&gt;
console.log(oReq.responseXML.xml);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;withCredentials property&amp;lt;ref&amp;gt;http://arunranga.com/examples/access-control/credentialedRequest.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
//create cross site requests using cookies as credentials&lt;br /&gt;
 &lt;br /&gt;
var invocation = new XMLHttpRequest();&lt;br /&gt;
var url = 'http://crossoriginurl.com/resources/access-control-with-credentials/';&lt;br /&gt;
invocation.open('GET', url, true);&lt;br /&gt;
invocation.withCredentials = &amp;quot;true&amp;quot;;&lt;br /&gt;
invocation.onreadystatechange = handler;&lt;br /&gt;
invocation.send(); &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The above mentioned APIs and properties for XMLHttpRequest are currently unimplemented in servo.&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
Our project aim is to implement few of the missing XMLHttpRequest APIs.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs&amp;lt;/ref&amp;gt; The [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2015/oss_M1504_JJD OSS project] included implementing initial steps of the [https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs specifications]. It basically incorporated implementing overrideMimeType method and adjusting related test expectations. &lt;br /&gt;
&lt;br /&gt;
The implementation of the final project is described in a [[#Implementation_Details|section below]].&lt;br /&gt;
&lt;br /&gt;
==Requirement Analysis==&lt;br /&gt;
&lt;br /&gt;
Below is an overview of the various steps identified as a part of the requirement analysis and corresponding places in code in which these steps would be implemented:&lt;br /&gt;
&lt;br /&gt;
''' XMLHttpRequest Interface '''&lt;br /&gt;
* We have to uncomment the responseXML API&lt;br /&gt;
* A webpage can make use of this API to read the document response &lt;br /&gt;
&lt;br /&gt;
'''XMLHttpRequest DOM '''&lt;br /&gt;
&lt;br /&gt;
# Create helper methods final_mime_type and final_charset&lt;br /&gt;
#* Implement the two methods as per the behavior mentioned in the [https://xhr.spec.whatwg.org/#final-mime-type specification]&lt;br /&gt;
# Implement correct behavior for the text_response method&lt;br /&gt;
#* Make use of the final_charset and final_mime_type helper methods to determine the correct encoding for the response and decode the response using this encoding&lt;br /&gt;
# Create and implement a new method &amp;quot;document_response&amp;quot; according to the [https://xhr.spec.whatwg.org/#document-response xhr specification]&lt;br /&gt;
# Implement the correct behavior for the responseXML API to handle exceptions and return the document response using the method implemented above &amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#dom-xmlhttprequest-responsexml&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Implement the withCredentials APIs (setter and getter) as per the [https://xhr.spec.whatwg.org/#dom-xmlhttprequest-withcredentials specification]&lt;br /&gt;
# Add support to the send() and open() API to test the value of the withCredentials attribute where necessary&lt;br /&gt;
&lt;br /&gt;
''' net_traits '''&lt;br /&gt;
* Add a new member to the LoadData Structure in [https://github.com/servo/servo/blob/master/components/net_traits/lib.rs#L130 lib.rs file] which will be used by the http_loader to conditionally exclude cookies from the XHR request based on the value of the member.&lt;br /&gt;
&lt;br /&gt;
''' XHR Tests '''&lt;br /&gt;
* We need to pass [[#Proposed_Test_Cases | most tests]] related to overrideMimeType, responseXML and withCredentials present in the [https://github.com/servo/servo/tree/master/tests/wpt/web-platform-tests/XMLHttpRequest XHR test-suite]&lt;br /&gt;
&lt;br /&gt;
==Component Flow Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:component_flow_f15_m1504.png]]&lt;br /&gt;
&lt;br /&gt;
The XMLHttpRequest API receives request from the web server, the implementation then checks the response type, if it is a text response then we use the charset from final_charset else we use the default charset that was received with the request. The same applies to document response.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&lt;br /&gt;
Note :- UML diagram is not included because we do not have much class interaction in this project.&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Design Patterns ==&lt;br /&gt;
We have used &amp;quot;State Pattern&amp;quot; for our final project implementation. Our implementation stores the new CHARSET and MIME type based on what user has requested. So once user has requested for override in this value, the design pattern ensures the system behaves as per this new value.&lt;br /&gt;
&lt;br /&gt;
[[File: design_pattern_f15_m1504.png]]&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
The implementation for the final project involved following tasks:&lt;br /&gt;
* '''Implement the specified behavior for the override MIME type/final MIME type and override charset/final charset :''' We created two helper methods in xmlhttprequest.rs file: final_mime_type() method which returns the final MIME type&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#final-mime-type&amp;lt;/ref&amp;gt; depending on override MIME type and response MIME type and final_charset() method which returns the final charset.&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#final-charset&amp;lt;/ref&amp;gt; We also added final charset support for text_response by calling this final_charset() helper method.&lt;br /&gt;
* '''Support the withCredentials API :''' We have implemented basic network level support to conditionally exclude cookies from the HTTP request by adding a boolean member: credentials_flag to LoadData structure in lib.rs file. credentials_flag is set in Send() method of xmlhttprequest.rs file. If the credentials_flag is false then cookies will not be set for the HTTP request for which the code is added in http_loader.rs file.&lt;br /&gt;
&lt;br /&gt;
* '''Support for document response in responseXML API :''' Added Document to the list of response type checks. A new method document_response() is called which contains handling for different mime types based on value returned by the final_mime_type() method. A document object is created and its JS value is returned by the method. The document object is stored in response_xml member of XHR, on subsequent calls to the method this object is returned if it has already been set previously.&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#response-document-object&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
The tests have already been written for the XMLHttpRequest APIs related to our project. So the test cases that pass after our changes to the code are as follows:&lt;br /&gt;
&lt;br /&gt;
* If XMLHttpRequest is in unsent state, then overrideMimeType() should be able to enforce Shift-JIS charset encoding&lt;br /&gt;
* If XMLHttpRequest is in open state, then overrideMimeType() should be able to enforce UTF-8 charset encoding&lt;br /&gt;
* If XMLHttpRequest is in HEADERS RECEIVED state, then overrideMimeType() will be able to enforce Shift-JIS charset encoding&lt;br /&gt;
* responseXML attribute should throw InvalidStateError if response type is not null or document&lt;br /&gt;
* The various responseXML document properties like domain, URL, title, body, images, etc. must be correctly initialized&lt;br /&gt;
* If the state of XMLHttpRequest is not done then responseXML must be null&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
* Steps for installing [https://github.com/rust-lang/rust rust]&lt;br /&gt;
* Building [https://github.com/servo/servo Servo]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
===Images===&lt;br /&gt;
&amp;lt;references group=&amp;quot;image&amp;quot;/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=100214</id>
		<title>CSC/ECE 517 Fall 2015 M1504 Implement support for missing XMLHttpRequest APIs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=100214"/>
		<updated>2015-12-05T01:29:22Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: Updated project description&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt; is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]&amp;lt;ref&amp;gt;https://github.com/rust-lang/rust&amp;lt;/ref&amp;gt; and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla Research]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo is built on top of Rust to provide a secure and reliable foundation and is focused on creating a reliable and fast browser engine.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language.&lt;br /&gt;
&lt;br /&gt;
Rust is a modern, fast, memory safe and multithreaded programming language that focuses on speed and safety for developing reliable and efficient systems. It eliminates all data races by having numerous compile-time safety checks that adds no runtime overhead.&amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/book/README.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Servo task Architecture==&lt;br /&gt;
&lt;br /&gt;
[[Image:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref group=&amp;quot;image&amp;quot;&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Description===&lt;br /&gt;
&lt;br /&gt;
* Each box corresponds to a Rust task.&lt;br /&gt;
* The primary tasks in the browser pipeline are represented by Blue boxes.&lt;br /&gt;
* Dashed lines indicate supervisor relationships.&lt;br /&gt;
* Gray boxes indicate tasks auxiliary to the browser pipeline.&lt;br /&gt;
* Communication channels are represented as solid lines.&lt;br /&gt;
* White boxes are represented as worker tasks. Each such box represents several tasks which varies with the workload.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
===XMLHttpRequest===&lt;br /&gt;
&amp;quot;[https://xhr.spec.whatwg.org/ XMLHttpRequest] is a specification which defines [https://en.wikipedia.org/wiki/Application_programming_interface APIs] that provides scripted client functionality for transferring data between a client and a server.&amp;quot;&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/&amp;lt;/ref&amp;gt; XMLHttpRequest provides a way for data to be retrieved from a URL without having to retrieve the entire page. It supports protocols other than HTTP and can be used to retrieve any type of data.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some of the APIs and properties present in XMLHttpRequest specification are '''overrideMimeType()''' , '''responseXML''' and '''withCredentials'''. The following javascript code snippets briefly explain about each of these APIs.&lt;br /&gt;
&lt;br /&gt;
;overrideMimeType&amp;lt;ref&amp;gt;https://github.com/servo/servo/blob/master/tests/wpt/web-platform-tests/XMLHttpRequest/overridemimetype-open-state-force-xml.htm&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
//override the Mime type to retrieve the response as an XML Object&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 var client = new XMLHttpRequest();&lt;br /&gt;
 client.onreadystatechange = function() {&lt;br /&gt;
          ... //read the response as XML object&lt;br /&gt;
        };&lt;br /&gt;
        client.open(&amp;quot;GET&amp;quot;, &amp;quot;resources/status.py?type=&amp;quot;&lt;br /&gt;
                    +encodeURIComponent('text/plain;charset=Shift-JIS')&lt;br /&gt;
                    +'&amp;amp;content='+ encodeURIComponent('&amp;lt;test&amp;gt;&amp;lt;message&amp;gt;Hello World！&amp;lt;/message&amp;gt;&amp;lt;/test&amp;gt;'));&lt;br /&gt;
        client.overrideMimeType('application/xml;charset=UTF-8');&lt;br /&gt;
        client.send();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;responseXML property&amp;lt;ref&amp;gt;https://msdn.microsoft.com/en-us/library/ms534370(v=vs.85).aspx&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//read the response from the server as an XML Object&lt;br /&gt;
&lt;br /&gt;
var oReq = new XMLHttpRequest();&lt;br /&gt;
oReq.open(&amp;quot;GET&amp;quot;, &amp;quot;http://localhost/books.xml&amp;quot;, false);&lt;br /&gt;
oReq.send();&lt;br /&gt;
console.log(oReq.responseXML.xml);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;withCredentials property&amp;lt;ref&amp;gt;http://arunranga.com/examples/access-control/credentialedRequest.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
//create cross site requests using cookies as credentials&lt;br /&gt;
 &lt;br /&gt;
var invocation = new XMLHttpRequest();&lt;br /&gt;
var url = 'http://crossoriginurl.com/resources/access-control-with-credentials/';&lt;br /&gt;
invocation.open('GET', url, true);&lt;br /&gt;
invocation.withCredentials = &amp;quot;true&amp;quot;;&lt;br /&gt;
invocation.onreadystatechange = handler;&lt;br /&gt;
invocation.send(); &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The above mentioned APIs and properties for XMLHttpRequest are currently unimplemented in servo.&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
Our project aim is to implement few of the missing XMLHttpRequest APIs.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs&amp;lt;/ref&amp;gt; The [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2015/oss_M1504_JJD OSS project] included implementing initial steps of the [https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs specifications]. It basically incorporated implementing overrideMimeType method and adjusting related test expectations. &lt;br /&gt;
&lt;br /&gt;
The implementation of the final project is described in a [[#Implementation_details|section below]].&lt;br /&gt;
&lt;br /&gt;
==Requirement Analysis==&lt;br /&gt;
&lt;br /&gt;
Below is an overview of the various steps identified as a part of the requirement analysis and corresponding places in code in which these steps would be implemented:&lt;br /&gt;
&lt;br /&gt;
''' XMLHttpRequest Interface '''&lt;br /&gt;
* We have to uncomment the responseXML API&lt;br /&gt;
* A webpage can make use of this API to read the document response &lt;br /&gt;
&lt;br /&gt;
'''XMLHttpRequest DOM '''&lt;br /&gt;
&lt;br /&gt;
# Create helper methods final_mime_type and final_charset&lt;br /&gt;
#* Implement the two methods as per the behavior mentioned in the [https://xhr.spec.whatwg.org/#final-mime-type specification]&lt;br /&gt;
# Implement correct behavior for the text_response method&lt;br /&gt;
#* Make use of the final_charset and final_mime_type helper methods to determine the correct encoding for the response and decode the response using this encoding&lt;br /&gt;
# Create and implement a new method &amp;quot;document_response&amp;quot; according to the [https://xhr.spec.whatwg.org/#document-response xhr specification]&lt;br /&gt;
# Implement the correct behavior for the responseXML API to handle exceptions and return the document response using the method implemented above &amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#dom-xmlhttprequest-responsexml&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Implement the withCredentials APIs (setter and getter) as per the [https://xhr.spec.whatwg.org/#dom-xmlhttprequest-withcredentials specification]&lt;br /&gt;
# Add support to the send() and open() API to test the value of the withCredentials attribute where necessary&lt;br /&gt;
&lt;br /&gt;
''' net_traits '''&lt;br /&gt;
* Add a new member to the LoadData Structure in [https://github.com/servo/servo/blob/master/components/net_traits/lib.rs#L130 lib.rs file] which will be used by the http_loader to conditionally exclude cookies from the XHR request based on the value of the member.&lt;br /&gt;
&lt;br /&gt;
''' XHR Tests '''&lt;br /&gt;
* We need to pass [[#Proposed_Test_Cases | most tests]] related to overrideMimeType, responseXML and withCredentials present in the [https://github.com/servo/servo/tree/master/tests/wpt/web-platform-tests/XMLHttpRequest XHR test-suite]&lt;br /&gt;
&lt;br /&gt;
==Component Flow Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:component_flow_f15_m1504.png]]&lt;br /&gt;
&lt;br /&gt;
The XMLHttpRequest API receives request from the web server, the implementation then checks the response type, if it is a text response then we use the charset from final_charset else we use the default charset that was received with the request. The same applies to document response.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&lt;br /&gt;
Note :- UML diagram is not included because we do not have much class interaction in this project.&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Design Patterns ==&lt;br /&gt;
We have used &amp;quot;State Pattern&amp;quot; for our final project implementation. Our implementation stores the new CHARSET and MIME type based on what user has requested. So once user has requested for override in this value, the design pattern ensures the system behaves as per this new value.&lt;br /&gt;
&lt;br /&gt;
[[File: design_pattern_f15_m1504.png]]&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
The implementation for the final project involved following tasks:&lt;br /&gt;
* '''Implement the specified behavior for the override MIME type/final MIME type and override charset/final charset :''' We created two helper methods in xmlhttprequest.rs file: final_mime_type() method which returns the final MIME type&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#final-mime-type&amp;lt;/ref&amp;gt; depending on override MIME type and response MIME type and final_charset() method which returns the final charset.&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#final-charset&amp;lt;/ref&amp;gt; We also added final charset support for text_response by calling this final_charset() helper method.&lt;br /&gt;
* '''Support the withCredentials API :''' We have implemented basic network level support to conditionally exclude cookies from the HTTP request by adding a boolean member: credentials_flag to LoadData structure in lib.rs file. credentials_flag is set in Send() method of xmlhttprequest.rs file. If the credentials_flag is false then cookies will not be set for the HTTP request for which the code is added in http_loader.rs file.&lt;br /&gt;
&lt;br /&gt;
* '''Support for document response in responseXML API :''' Added Document to the list of response type checks. A new method document_response() is called which contains handling for different mime types based on value returned by the final_mime_type() method. A document object is created and its JS value is returned by the method. The document object is stored in response_xml member of XHR, on subsequent calls to the method this object is returned if it has already been set previously.&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#response-document-object&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
The tests have already been written for the XMLHttpRequest APIs related to our project. So the test cases that pass after our changes to the code are as follows:&lt;br /&gt;
&lt;br /&gt;
* If XMLHttpRequest is in unsent state, then overrideMimeType() should be able to enforce Shift-JIS charset encoding&lt;br /&gt;
* If XMLHttpRequest is in open state, then overrideMimeType() should be able to enforce UTF-8 charset encoding&lt;br /&gt;
* If XMLHttpRequest is in HEADERS RECEIVED state, then overrideMimeType() will be able to enforce Shift-JIS charset encoding&lt;br /&gt;
* responseXML attribute should throw InvalidStateError if response type is not null or document&lt;br /&gt;
* The various responseXML document properties like domain, URL, title, body, images, etc. must be correctly initialized&lt;br /&gt;
* If the state of XMLHttpRequest is not done then responseXML must be null&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
* Steps for installing [https://github.com/rust-lang/rust rust]&lt;br /&gt;
* Building [https://github.com/servo/servo Servo]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
===Images===&lt;br /&gt;
&amp;lt;references group=&amp;quot;image&amp;quot;/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=100188</id>
		<title>CSC/ECE 517 Fall 2015 M1504 Implement support for missing XMLHttpRequest APIs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=100188"/>
		<updated>2015-12-05T01:16:22Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: /* Project Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt; is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]&amp;lt;ref&amp;gt;https://github.com/rust-lang/rust&amp;lt;/ref&amp;gt; and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla Research]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo is built on top of Rust to provide a secure and reliable foundation and is focused on creating a reliable and fast browser engine.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language.&lt;br /&gt;
&lt;br /&gt;
Rust is a modern, fast, memory safe and multithreaded programming language that focuses on speed and safety for developing reliable and efficient systems. It eliminates all data races by having numerous compile-time safety checks that adds no runtime overhead.&amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/book/README.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Servo task Architecture==&lt;br /&gt;
&lt;br /&gt;
[[Image:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref group=&amp;quot;image&amp;quot;&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Description===&lt;br /&gt;
&lt;br /&gt;
* Each box corresponds to a Rust task.&lt;br /&gt;
* The primary tasks in the browser pipeline are represented by Blue boxes.&lt;br /&gt;
* Dashed lines indicate supervisor relationships.&lt;br /&gt;
* Gray boxes indicate tasks auxiliary to the browser pipeline.&lt;br /&gt;
* Communication channels are represented as solid lines.&lt;br /&gt;
* White boxes are represented as worker tasks. Each such box represents several tasks which varies with the workload.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
===XMLHttpRequest===&lt;br /&gt;
&amp;quot;[https://xhr.spec.whatwg.org/ XMLHttpRequest] is a specification which defines [https://en.wikipedia.org/wiki/Application_programming_interface APIs] that provides scripted client functionality for transferring data between a client and a server.&amp;quot;&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/&amp;lt;/ref&amp;gt; XMLHttpRequest provides a way for data to be retrieved from a URL without having to retrieve the entire page. It supports protocols other than HTTP and can be used to retrieve any type of data.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some of the APIs and properties present in XMLHttpRequest specification are '''overrideMimeType()''' , '''responseXML''' and '''withCredentials'''. The following javascript code snippets briefly explain about each of these APIs.&lt;br /&gt;
&lt;br /&gt;
;overrideMimeType&amp;lt;ref&amp;gt;https://github.com/servo/servo/blob/master/tests/wpt/web-platform-tests/XMLHttpRequest/overridemimetype-open-state-force-xml.htm&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
//override the Mime type to retrieve the response as an XML Object&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 var client = new XMLHttpRequest();&lt;br /&gt;
 client.onreadystatechange = function() {&lt;br /&gt;
          ... //read the response as XML object&lt;br /&gt;
        };&lt;br /&gt;
        client.open(&amp;quot;GET&amp;quot;, &amp;quot;resources/status.py?type=&amp;quot;&lt;br /&gt;
                    +encodeURIComponent('text/plain;charset=Shift-JIS')&lt;br /&gt;
                    +'&amp;amp;content='+ encodeURIComponent('&amp;lt;test&amp;gt;&amp;lt;message&amp;gt;Hello World！&amp;lt;/message&amp;gt;&amp;lt;/test&amp;gt;'));&lt;br /&gt;
        client.overrideMimeType('application/xml;charset=UTF-8');&lt;br /&gt;
        client.send();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;responseXML property&amp;lt;ref&amp;gt;https://msdn.microsoft.com/en-us/library/ms534370(v=vs.85).aspx&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//read the response from the server as an XML Object&lt;br /&gt;
&lt;br /&gt;
var oReq = new XMLHttpRequest();&lt;br /&gt;
oReq.open(&amp;quot;GET&amp;quot;, &amp;quot;http://localhost/books.xml&amp;quot;, false);&lt;br /&gt;
oReq.send();&lt;br /&gt;
console.log(oReq.responseXML.xml);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;withCredentials property&amp;lt;ref&amp;gt;http://arunranga.com/examples/access-control/credentialedRequest.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
//create cross site requests using cookies as credentials&lt;br /&gt;
 &lt;br /&gt;
var invocation = new XMLHttpRequest();&lt;br /&gt;
var url = 'http://crossoriginurl.com/resources/access-control-with-credentials/';&lt;br /&gt;
invocation.open('GET', url, true);&lt;br /&gt;
invocation.withCredentials = &amp;quot;true&amp;quot;;&lt;br /&gt;
invocation.onreadystatechange = handler;&lt;br /&gt;
invocation.send(); &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The above mentioned APIs and properties for XMLHttpRequest are currently unimplemented in servo.&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
Our project aim is to implement few of the missing XMLHttpRequest APIs. The [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2015/oss_M1504_JJD OSS project] included implementing initial steps of the [https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs specifications]. It basically incorporated implementing overrideMimeType method and adjusting related test expectations. &lt;br /&gt;
&lt;br /&gt;
The current scope of the project comprises:&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Implementing the specified behavior of the final MIME type and final charset based on the implemented override_mime_type() method in the initial steps&lt;br /&gt;
* Implementing responseXML API and document response type according to the XHR specifications&lt;br /&gt;
* Implementing support for withCredentials API&lt;br /&gt;
&lt;br /&gt;
==Requirement Analysis==&lt;br /&gt;
&lt;br /&gt;
Below is an overview of the various steps identified as a part of the requirement analysis and corresponding places in code in which these steps would be implemented:&lt;br /&gt;
&lt;br /&gt;
''' XMLHttpRequest Interface '''&lt;br /&gt;
* We have to uncomment the responseXML API&lt;br /&gt;
* A webpage can make use of this API to read the document response &lt;br /&gt;
&lt;br /&gt;
'''XMLHttpRequest DOM '''&lt;br /&gt;
&lt;br /&gt;
# Create helper methods final_mime_type and final_charset&lt;br /&gt;
#* Implement the two methods as per the behavior mentioned in the [https://xhr.spec.whatwg.org/#final-mime-type specification]&lt;br /&gt;
# Implement correct behavior for the text_response method&lt;br /&gt;
#* Make use of the final_charset and final_mime_type helper methods to determine the correct encoding for the response and decode the response using this encoding&lt;br /&gt;
# Create and implement a new method &amp;quot;document_response&amp;quot; according to the [https://xhr.spec.whatwg.org/#document-response xhr specification]&lt;br /&gt;
# Implement the correct behavior for the responseXML API to handle exceptions and return the document response using the method implemented above &amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#dom-xmlhttprequest-responsexml&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Implement the withCredentials APIs (setter and getter) as per the [https://xhr.spec.whatwg.org/#dom-xmlhttprequest-withcredentials specification]&lt;br /&gt;
# Add support to the send() and open() API to test the value of the withCredentials attribute where necessary&lt;br /&gt;
&lt;br /&gt;
''' net_traits '''&lt;br /&gt;
* Add a new member to the LoadData Structure in [https://github.com/servo/servo/blob/master/components/net_traits/lib.rs#L130 lib.rs file] which will be used by the http_loader to conditionally exclude cookies from the XHR request based on the value of the member.&lt;br /&gt;
&lt;br /&gt;
''' XHR Tests '''&lt;br /&gt;
* We need to pass [[#Proposed_Test_Cases | most tests]] related to overrideMimeType, responseXML and withCredentials present in the [https://github.com/servo/servo/tree/master/tests/wpt/web-platform-tests/XMLHttpRequest XHR test-suite]&lt;br /&gt;
&lt;br /&gt;
==Component Flow Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:component_flow_f15_m1504.png]]&lt;br /&gt;
&lt;br /&gt;
The XMLHttpRequest API receives request from the web server, the implementation then checks the response type, if it is a text response then we use the charset from final_charset else we use the default charset that was received with the request. The same applies to document response.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&lt;br /&gt;
Note :- UML diagram is not included because we do not have much class interaction in this project.&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Design Patterns ==&lt;br /&gt;
We have used &amp;quot;State Pattern&amp;quot; for our final project implementation. Our implementation stores the new CHARSET and MIME type based on what user has requested. So once user has requested for override in this value, the design pattern ensures the system behaves as per this new value.&lt;br /&gt;
&lt;br /&gt;
[[File: design_pattern_f15_m1504.png]]&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
The implementation for the final project involved following tasks:&lt;br /&gt;
* '''Implement the specified behavior for the override MIME type/final MIME type and override charset/final charset :''' We created two helper methods in xmlhttprequest.rs file: final_mime_type() method which returns the final MIME type&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#final-mime-type&amp;lt;/ref&amp;gt; depending on override MIME type and response MIME type and final_charset() method which returns the final charset.&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#final-charset&amp;lt;/ref&amp;gt; We also added final charset support for text_response by calling this final_charset() helper method.&lt;br /&gt;
* '''Support the withCredentials API :''' We have implemented basic network level support to conditionally exclude cookies from the HTTP request by adding a boolean member: credentials_flag to LoadData structure in lib.rs file. credentials_flag is set in Send() method of xmlhttprequest.rs file. If the credentials_flag is false then cookies will not be set for the HTTP request for which the code is added in http_loader.rs file.&lt;br /&gt;
&lt;br /&gt;
* '''Support for document response in responseXML API :''' Added Document to the list of response type checks. A new method document_response() is called which contains handling for different mime types based on value returned by the final_mime_type() method. A document object is created and its JS value is returned by the method. The document object is stored in response_xml member of XHR, on subsequent calls to the method this object is returned if it has already been set previously.&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#response-document-object&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
The tests have already been written for the XMLHttpRequest APIs related to our project. So the test cases that pass after our changes to the code are as follows:&lt;br /&gt;
&lt;br /&gt;
* If XMLHttpRequest is in unsent state, then overrideMimeType() should be able to enforce Shift-JIS charset encoding&lt;br /&gt;
* If XMLHttpRequest is in open state, then overrideMimeType() should be able to enforce UTF-8 charset encoding&lt;br /&gt;
* If XMLHttpRequest is in HEADERS RECEIVED state, then overrideMimeType() will be able to enforce Shift-JIS charset encoding&lt;br /&gt;
* responseXML attribute should throw InvalidStateError if response type is not null or document&lt;br /&gt;
* The various responseXML document properties like domain, URL, title, body, images, etc. must be correctly initialized&lt;br /&gt;
* If the state of XMLHttpRequest is not done then responseXML must be null&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
* Steps for installing [https://github.com/rust-lang/rust rust]&lt;br /&gt;
* Building [https://github.com/servo/servo Servo]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
===Images===&lt;br /&gt;
&amp;lt;references group=&amp;quot;image&amp;quot;/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=100168</id>
		<title>CSC/ECE 517 Fall 2015 M1504 Implement support for missing XMLHttpRequest APIs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=100168"/>
		<updated>2015-12-05T00:58:57Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: Test Cases Updated&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt; is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]&amp;lt;ref&amp;gt;https://github.com/rust-lang/rust&amp;lt;/ref&amp;gt; and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla Research]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo is built on top of Rust to provide a secure and reliable foundation and is focused on creating a reliable and fast browser engine.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language.&lt;br /&gt;
&lt;br /&gt;
Rust is a modern, fast, memory safe and multithreaded programming language that focuses on speed and safety for developing reliable and efficient systems. It eliminates all data races by having numerous compile-time safety checks that adds no runtime overhead.&amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/book/README.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Servo task Architecture==&lt;br /&gt;
&lt;br /&gt;
[[Image:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref group=&amp;quot;image&amp;quot;&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Description===&lt;br /&gt;
&lt;br /&gt;
* Each box corresponds to a Rust task.&lt;br /&gt;
* The primary tasks in the browser pipeline are represented by Blue boxes.&lt;br /&gt;
* Dashed lines indicate supervisor relationships.&lt;br /&gt;
* Gray boxes indicate tasks auxiliary to the browser pipeline.&lt;br /&gt;
* Communication channels are represented as solid lines.&lt;br /&gt;
* White boxes are represented as worker tasks. Each such box represents several tasks which varies with the workload.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
===XMLHttpRequest===&lt;br /&gt;
&amp;quot;[https://xhr.spec.whatwg.org/ XMLHttpRequest] is a specification which defines [https://en.wikipedia.org/wiki/Application_programming_interface APIs] that provides scripted client functionality for transferring data between a client and a server.&amp;quot;&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/&amp;lt;/ref&amp;gt; XMLHttpRequest provides a way for data to be retrieved from a URL without having to retrieve the entire page. It supports protocols other than HTTP and can be used to retrieve any type of data.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some of the APIs and properties present in XMLHttpRequest specification are '''overrideMimeType()''' , '''responseXML''' and '''withCredentials'''. The following javascript code snippets briefly explain about each of these APIs.&lt;br /&gt;
&lt;br /&gt;
;overrideMimeType&amp;lt;ref&amp;gt;https://github.com/servo/servo/blob/master/tests/wpt/web-platform-tests/XMLHttpRequest/overridemimetype-open-state-force-xml.htm&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
//override the Mime type to retrieve the response as an XML Object&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 var client = new XMLHttpRequest();&lt;br /&gt;
 client.onreadystatechange = function() {&lt;br /&gt;
          ... //read the response as XML object&lt;br /&gt;
        };&lt;br /&gt;
        client.open(&amp;quot;GET&amp;quot;, &amp;quot;resources/status.py?type=&amp;quot;&lt;br /&gt;
                    +encodeURIComponent('text/plain;charset=Shift-JIS')&lt;br /&gt;
                    +'&amp;amp;content='+ encodeURIComponent('&amp;lt;test&amp;gt;&amp;lt;message&amp;gt;Hello World！&amp;lt;/message&amp;gt;&amp;lt;/test&amp;gt;'));&lt;br /&gt;
        client.overrideMimeType('application/xml;charset=UTF-8');&lt;br /&gt;
        client.send();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;responseXML property&amp;lt;ref&amp;gt;https://msdn.microsoft.com/en-us/library/ms534370(v=vs.85).aspx&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//read the response from the server as an XML Object&lt;br /&gt;
&lt;br /&gt;
var oReq = new XMLHttpRequest();&lt;br /&gt;
oReq.open(&amp;quot;GET&amp;quot;, &amp;quot;http://localhost/books.xml&amp;quot;, false);&lt;br /&gt;
oReq.send();&lt;br /&gt;
console.log(oReq.responseXML.xml);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;withCredentials property&amp;lt;ref&amp;gt;http://arunranga.com/examples/access-control/credentialedRequest.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
//create cross site requests using cookies as credentials&lt;br /&gt;
 &lt;br /&gt;
var invocation = new XMLHttpRequest();&lt;br /&gt;
var url = 'http://crossoriginurl.com/resources/access-control-with-credentials/';&lt;br /&gt;
invocation.open('GET', url, true);&lt;br /&gt;
invocation.withCredentials = &amp;quot;true&amp;quot;;&lt;br /&gt;
invocation.onreadystatechange = handler;&lt;br /&gt;
invocation.send(); &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The above mentioned APIs and properties for XMLHttpRequest are currently unimplemented in servo.&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
Our project aim is to implement few of the missing XMLHttpRequest APIs. The [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2015/oss_M1504_JJD OSS project] included implementing initial steps of the [https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs specifications]. It basically incorporated implementing overrideMimeType method and adjusting related test expectations. &lt;br /&gt;
&lt;br /&gt;
The current scope of the project comprises:&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Implementing the specified behavior of the final MIME type and final charset based on the implemented override_mime_type() method in the initial steps&lt;br /&gt;
* Implementing responseXML API and document response type according to the XHR specifications&lt;br /&gt;
* Implementing withCredentials API&lt;br /&gt;
&lt;br /&gt;
==Requirement Analysis==&lt;br /&gt;
&lt;br /&gt;
Below is an overview of the various steps identified as a part of the requirement analysis and corresponding places in code in which these steps would be implemented:&lt;br /&gt;
&lt;br /&gt;
''' XMLHttpRequest Interface '''&lt;br /&gt;
* We have to uncomment the responseXML API&lt;br /&gt;
* A webpage can make use of this API to read the document response &lt;br /&gt;
&lt;br /&gt;
'''XMLHttpRequest DOM '''&lt;br /&gt;
&lt;br /&gt;
# Create helper methods final_mime_type and final_charset&lt;br /&gt;
#* Implement the two methods as per the behavior mentioned in the [https://xhr.spec.whatwg.org/#final-mime-type specification]&lt;br /&gt;
# Implement correct behavior for the text_response method&lt;br /&gt;
#* Make use of the final_charset and final_mime_type helper methods to determine the correct encoding for the response and decode the response using this encoding&lt;br /&gt;
# Create and implement a new method &amp;quot;document_response&amp;quot; according to the [https://xhr.spec.whatwg.org/#document-response xhr specification]&lt;br /&gt;
# Implement the correct behavior for the responseXML API to handle exceptions and return the document response using the method implemented above &amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#dom-xmlhttprequest-responsexml&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Implement the withCredentials APIs (setter and getter) as per the [https://xhr.spec.whatwg.org/#dom-xmlhttprequest-withcredentials specification]&lt;br /&gt;
# Add support to the send() and open() API to test the value of the withCredentials attribute where necessary&lt;br /&gt;
&lt;br /&gt;
''' net_traits '''&lt;br /&gt;
* Add a new member to the LoadData Structure in [https://github.com/servo/servo/blob/master/components/net_traits/lib.rs#L130 lib.rs file] which will be used by the http_loader to conditionally exclude cookies from the XHR request based on the value of the member.&lt;br /&gt;
&lt;br /&gt;
''' XHR Tests '''&lt;br /&gt;
* We need to pass [[#Proposed_Test_Cases | most tests]] related to overrideMimeType, responseXML and withCredentials present in the [https://github.com/servo/servo/tree/master/tests/wpt/web-platform-tests/XMLHttpRequest XHR test-suite]&lt;br /&gt;
&lt;br /&gt;
==Component Flow Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:component_flow_f15_m1504.png]]&lt;br /&gt;
&lt;br /&gt;
The XMLHttpRequest API receives request from the web server, the implementation then checks the response type, if it is a text response then we use the charset from final_charset else we use the default charset that was received with the request. The same applies to document response.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&lt;br /&gt;
Note :- UML diagram is not included because we do not have much class interaction in this project.&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Design Patterns ==&lt;br /&gt;
We have used &amp;quot;State Pattern&amp;quot; for our final project implementation. Our implementation stores the new CHARSET and MIME type based on what user has requested. So once user has requested for override in this value, the design pattern ensures the system behaves as per this new value.&lt;br /&gt;
&lt;br /&gt;
[[File: design_pattern_f15_m1504.png]]&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
The implementation for the final project involved following tasks:&lt;br /&gt;
* '''Implement the specified behavior for the override MIME type/final MIME type and override charset/final charset :''' We created two helper methods in xmlhttprequest.rs file: final_mime_type() method which returns the final MIME type&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#final-mime-type&amp;lt;/ref&amp;gt; depending on override MIME type and response MIME type and final_charset() method which returns the final charset.&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#final-charset&amp;lt;/ref&amp;gt; We also added final charset support for text_response by calling this final_charset() helper method.&lt;br /&gt;
* '''Support the withCredentials API :''' We have implemented basic network level support to conditionally exclude cookies from the HTTP request by adding a boolean member: credentials_flag to LoadData structure in lib.rs file. credentials_flag is set in Send() method of xmlhttprequest.rs file. If the credentials_flag is false then cookies will not be set for the HTTP request for which the code is added in http_loader.rs file.&lt;br /&gt;
&lt;br /&gt;
* '''Support for document response in responseXML API :''' Added Document to the list of response type checks. A new method document_response() is called which contains handling for different mime types based on value returned by the final_mime_type() method. A document object is created and its JS value is returned by the method. The document object is stored in response_xml member of XHR, on subsequent calls to the method this object is returned if it has already been set previously.&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#response-document-object&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
The tests have already been written for the XMLHttpRequest APIs related to our project. So the test cases that pass after our changes to the code are as follows:&lt;br /&gt;
&lt;br /&gt;
* If XMLHttpRequest is in unsent state, then overrideMimeType() should be able to enforce Shift-JIS charset encoding&lt;br /&gt;
* If XMLHttpRequest is in open state, then overrideMimeType() should be able to enforce UTF-8 charset encoding&lt;br /&gt;
* If XMLHttpRequest is in HEADERS RECEIVED state, then overrideMimeType() will be able to enforce Shift-JIS charset encoding&lt;br /&gt;
* responseXML attribute should throw InvalidStateError if response type is not null or document&lt;br /&gt;
* The various responseXML document properties like domain, URL, title, body, images, etc. must be correctly initialized&lt;br /&gt;
* If the state of XMLHttpRequest is not done then responseXML must be null&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
* Steps for installing [https://github.com/rust-lang/rust rust]&lt;br /&gt;
* Building [https://github.com/servo/servo Servo]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
===Images===&lt;br /&gt;
&amp;lt;references group=&amp;quot;image&amp;quot;/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=100149</id>
		<title>CSC/ECE 517 Fall 2015 M1504 Implement support for missing XMLHttpRequest APIs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=100149"/>
		<updated>2015-12-05T00:20:26Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: Added Implementation details section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt; is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]&amp;lt;ref&amp;gt;https://github.com/rust-lang/rust&amp;lt;/ref&amp;gt; and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla Research]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo is built on top of Rust to provide a secure and reliable foundation and is focused on creating a reliable and fast browser engine.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language.&lt;br /&gt;
&lt;br /&gt;
Rust is a modern, fast, memory safe and multithreaded programming language that focuses on speed and safety for developing reliable and efficient systems. It eliminates all data races by having numerous compile-time safety checks that adds no runtime overhead.&amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/book/README.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Servo task Architecture==&lt;br /&gt;
&lt;br /&gt;
[[Image:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref group=&amp;quot;image&amp;quot;&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Description===&lt;br /&gt;
&lt;br /&gt;
* Each box corresponds to a Rust task.&lt;br /&gt;
* The primary tasks in the browser pipeline are represented by Blue boxes.&lt;br /&gt;
* Dashed lines indicate supervisor relationships.&lt;br /&gt;
* Gray boxes indicate tasks auxiliary to the browser pipeline.&lt;br /&gt;
* Communication channels are represented as solid lines.&lt;br /&gt;
* White boxes are represented as worker tasks. Each such box represents several tasks which varies with the workload.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
===XMLHttpRequest===&lt;br /&gt;
&amp;quot;[https://xhr.spec.whatwg.org/ XMLHttpRequest] is a specification which defines [https://en.wikipedia.org/wiki/Application_programming_interface APIs] that provides scripted client functionality for transferring data between a client and a server.&amp;quot;&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/&amp;lt;/ref&amp;gt; XMLHttpRequest provides a way for data to be retrieved from a URL without having to retrieve the entire page. It supports protocols other than HTTP and can be used to retrieve any type of data.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some of the APIs and properties present in XMLHttpRequest specification are '''overrideMimeType()''' , '''responseXML''' and '''withCredentials'''. The following javascript code snippets briefly explain about each of these APIs.&lt;br /&gt;
&lt;br /&gt;
;overrideMimeType&amp;lt;ref&amp;gt;https://github.com/servo/servo/blob/master/tests/wpt/web-platform-tests/XMLHttpRequest/overridemimetype-open-state-force-xml.htm&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
//override the Mime type to retrieve the response as an XML Object&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 var client = new XMLHttpRequest();&lt;br /&gt;
 client.onreadystatechange = function() {&lt;br /&gt;
          ... //read the response as XML object&lt;br /&gt;
        };&lt;br /&gt;
        client.open(&amp;quot;GET&amp;quot;, &amp;quot;resources/status.py?type=&amp;quot;&lt;br /&gt;
                    +encodeURIComponent('text/plain;charset=Shift-JIS')&lt;br /&gt;
                    +'&amp;amp;content='+ encodeURIComponent('&amp;lt;test&amp;gt;&amp;lt;message&amp;gt;Hello World！&amp;lt;/message&amp;gt;&amp;lt;/test&amp;gt;'));&lt;br /&gt;
        client.overrideMimeType('application/xml;charset=UTF-8');&lt;br /&gt;
        client.send();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;responseXML property&amp;lt;ref&amp;gt;https://msdn.microsoft.com/en-us/library/ms534370(v=vs.85).aspx&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//read the response from the server as an XML Object&lt;br /&gt;
&lt;br /&gt;
var oReq = new XMLHttpRequest();&lt;br /&gt;
oReq.open(&amp;quot;GET&amp;quot;, &amp;quot;http://localhost/books.xml&amp;quot;, false);&lt;br /&gt;
oReq.send();&lt;br /&gt;
console.log(oReq.responseXML.xml);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;withCredentials property&amp;lt;ref&amp;gt;http://arunranga.com/examples/access-control/credentialedRequest.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
//create cross site requests using cookies as credentials&lt;br /&gt;
 &lt;br /&gt;
var invocation = new XMLHttpRequest();&lt;br /&gt;
var url = 'http://crossoriginurl.com/resources/access-control-with-credentials/';&lt;br /&gt;
invocation.open('GET', url, true);&lt;br /&gt;
invocation.withCredentials = &amp;quot;true&amp;quot;;&lt;br /&gt;
invocation.onreadystatechange = handler;&lt;br /&gt;
invocation.send(); &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The above mentioned APIs and properties for XMLHttpRequest are currently unimplemented in servo.&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
Our project aim is to implement few of the missing XMLHttpRequest APIs. The [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2015/oss_M1504_JJD OSS project] included implementing initial steps of the [https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs specifications]. It basically incorporated implementing overrideMimeType method and adjusting related test expectations. &lt;br /&gt;
&lt;br /&gt;
The current scope of the project comprises:&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Implementing the specified behavior of the final MIME type and final charset based on the implemented override_mime_type() method in the initial steps&lt;br /&gt;
* Implementing responseXML API and document response type according to the XHR specifications&lt;br /&gt;
* Implementing withCredentials API&lt;br /&gt;
&lt;br /&gt;
==Requirement Analysis==&lt;br /&gt;
&lt;br /&gt;
Below is an overview of the various steps identified as a part of the requirement analysis and corresponding places in code in which these steps would be implemented:&lt;br /&gt;
&lt;br /&gt;
''' XMLHttpRequest Interface '''&lt;br /&gt;
* We have to uncomment the responseXML API&lt;br /&gt;
* A webpage can make use of this API to read the document response &lt;br /&gt;
&lt;br /&gt;
'''XMLHttpRequest DOM '''&lt;br /&gt;
&lt;br /&gt;
# Create helper methods final_mime_type and final_charset&lt;br /&gt;
#* Implement the two methods as per the behavior mentioned in the [https://xhr.spec.whatwg.org/#final-mime-type specification]&lt;br /&gt;
# Implement correct behavior for the text_response method&lt;br /&gt;
#* Make use of the final_charset and final_mime_type helper methods to determine the correct encoding for the response and decode the response using this encoding&lt;br /&gt;
# Create and implement a new method &amp;quot;document_response&amp;quot; according to the [https://xhr.spec.whatwg.org/#document-response xhr specification]&lt;br /&gt;
# Implement the correct behavior for the responseXML API to handle exceptions and return the document response using the method implemented above &amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#dom-xmlhttprequest-responsexml&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Implement the withCredentials APIs (setter and getter) as per the [https://xhr.spec.whatwg.org/#dom-xmlhttprequest-withcredentials specification]&lt;br /&gt;
# Add support to the send() and open() API to test the value of the withCredentials attribute where necessary&lt;br /&gt;
&lt;br /&gt;
''' net_traits '''&lt;br /&gt;
* Add a new member to the LoadData Structure in [https://github.com/servo/servo/blob/master/components/net_traits/lib.rs#L130 lib.rs file] which will be used by the http_loader to conditionally exclude cookies from the XHR request based on the value of the member.&lt;br /&gt;
&lt;br /&gt;
''' XHR Tests '''&lt;br /&gt;
* We need to pass [[#Proposed_Test_Cases | most tests]] related to overrideMimeType, responseXML and withCredentials present in the [https://github.com/servo/servo/tree/master/tests/wpt/web-platform-tests/XMLHttpRequest XHR test-suite]&lt;br /&gt;
&lt;br /&gt;
==Component Flow Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:component_flow_f15_m1504.png]]&lt;br /&gt;
&lt;br /&gt;
The XMLHttpRequest API receives request from the web server, the implementation then checks the response type, if it is a text response then we use the charset from final_charset else we use the default charset that was received with the request. The same applies to document response.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&lt;br /&gt;
Note :- UML diagram is not included because we do not have much class interaction in this project.&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Design Patterns ==&lt;br /&gt;
We have used &amp;quot;State Pattern&amp;quot; for our final project implementation. Our implementation stores the new CHARSET and MIME type based on what user has requested. So once user has requested for override in this value, the design pattern ensures the system behaves as per this new value.&lt;br /&gt;
&lt;br /&gt;
[[File: design_pattern_f15_m1504.png]]&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
The implementation for the final project involved following tasks:&lt;br /&gt;
* '''Implement the specified behavior for the override MIME type/final MIME type and override charset/final charset :''' We created two helper methods in xmlhttprequest.rs file: final_mime_type() method which returns the final MIME type&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#final-mime-type&amp;lt;/ref&amp;gt; depending on override MIME type and response MIME type and final_charset() method which returns the final charset.&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#final-charset&amp;lt;/ref&amp;gt; We also added final charset support for text_response by calling this final_charset() helper method.&lt;br /&gt;
* '''Support the withCredentials API :''' We have implemented basic network level support to conditionally exclude cookies from the HTTP request by adding a boolean member: credentials_flag to LoadData structure in lib.rs file. credentials_flag is set in Send() method of xmlhttprequest.rs file. If the credentials_flag is false then cookies will not be set for the HTTP request for which the code is added in http_loader.rs file.&lt;br /&gt;
&lt;br /&gt;
==Test Cases==&lt;br /&gt;
The tests have already been written for the XMLHttpRequest APIs related to our project. So the test cases that could validate our changes to the code are as follows:&lt;br /&gt;
&lt;br /&gt;
* If XMLHttpRequest is in unsent state, then overrideMimeType() should be able to enforce Shift-JIS charset encoding&lt;br /&gt;
* If XMLHttpRequest is in open state, then overrideMimeType() should be able to enforce UTF-8 charset encoding&lt;br /&gt;
* If XMLHttpRequest is in open state with XML MIME type, then overrideMimeType() should be able to enforce UTF-8 charset encoding&lt;br /&gt;
* If XMLHttpRequest is in HEADERS RECEIVED state, then overrideMimeType() will be able to enforce Shift-JIS charset encoding&lt;br /&gt;
* responseXML attribute should throw InvalidStateError if response type is not null or document&lt;br /&gt;
* The various responseXML document properties like domain, URL, title, body, images, etc. must be correctly initialized&lt;br /&gt;
* If the state of XMLHttpRequest is not done then responseXML must be null&lt;br /&gt;
* withCredentials must have a default value of false and after setting the variable it is correctly set as true&lt;br /&gt;
* When XMLHttpRequest is not in UNSENT or OPENED state setting withCredentials variable should throw InvalidStateError exception&lt;br /&gt;
* When synchronous flag is set, trying to set withCredentials variable must throw an InvalidAccessError exception&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
* Steps for installing [https://github.com/rust-lang/rust rust]&lt;br /&gt;
* Building [https://github.com/servo/servo Servo]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
===Images===&lt;br /&gt;
&amp;lt;references group=&amp;quot;image&amp;quot;/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=99795</id>
		<title>CSC/ECE 517 Fall 2015 M1504 Implement support for missing XMLHttpRequest APIs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=99795"/>
		<updated>2015-11-14T01:25:02Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: Add image citation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt; is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]&amp;lt;ref&amp;gt;https://github.com/rust-lang/rust&amp;lt;/ref&amp;gt; and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla Research]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo is built on top of Rust to provide a secure and reliable foundation and is focused on creating a reliable and fast browser engine.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language.&lt;br /&gt;
&lt;br /&gt;
Rust is a modern, fast, memory safe and multithreaded programming language that focuses on speed and safety for developing reliable and efficient systems. It eliminates all data races by having numerous compile-time safety checks that adds no runtime overhead.&amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/book/README.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Servo task Architecture==&lt;br /&gt;
&lt;br /&gt;
[[Image:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref group=&amp;quot;image&amp;quot;&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Description===&lt;br /&gt;
&lt;br /&gt;
* Each box corresponds to a Rust task.&lt;br /&gt;
* The primary tasks in the browser pipeline are represented by Blue boxes.&lt;br /&gt;
* Dashed lines indicate supervisor relationships.&lt;br /&gt;
* Gray boxes indicate tasks auxiliary to the browser pipeline.&lt;br /&gt;
* Communication channels are represented as solid lines.&lt;br /&gt;
* White boxes are represented as worker tasks. Each such box represents several tasks which varies with the workload.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
===XMLHttpRequest===&lt;br /&gt;
&amp;quot;[https://xhr.spec.whatwg.org/ XMLHttpRequest] is a specification which defines [https://en.wikipedia.org/wiki/Application_programming_interface APIs] that provides scripted client functionality for transferring data between a client and a server.&amp;quot;&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/&amp;lt;/ref&amp;gt; XMLHttpRequest provides a way for data to be retrieved from a URL without having to retrieve the entire page. It supports protocols other than HTTP and can be used to retrieve any type of data.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some of the APIs and properties present in XMLHttpRequest specification are '''overrideMimeType()''' , '''responseXML''' and '''withCredentials'''. The following javascript code snippets briefly explain about each of these APIs.&lt;br /&gt;
&lt;br /&gt;
;overrideMimeType&amp;lt;ref&amp;gt;https://github.com/servo/servo/blob/master/tests/wpt/web-platform-tests/XMLHttpRequest/overridemimetype-open-state-force-xml.htm&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
//override the Mime type to retrieve the response as an XML Object&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 var client = new XMLHttpRequest();&lt;br /&gt;
 client.onreadystatechange = function() {&lt;br /&gt;
          ... //read the response as XML object&lt;br /&gt;
        };&lt;br /&gt;
        client.open(&amp;quot;GET&amp;quot;, &amp;quot;resources/status.py?type=&amp;quot;&lt;br /&gt;
                    +encodeURIComponent('text/plain;charset=Shift-JIS')&lt;br /&gt;
                    +'&amp;amp;content='+ encodeURIComponent('&amp;lt;test&amp;gt;&amp;lt;message&amp;gt;Hello World！&amp;lt;/message&amp;gt;&amp;lt;/test&amp;gt;'));&lt;br /&gt;
        client.overrideMimeType('application/xml;charset=UTF-8');&lt;br /&gt;
        client.send();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;responseXML property&amp;lt;ref&amp;gt;https://msdn.microsoft.com/en-us/library/ms534370(v=vs.85).aspx&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//read the response from the server as an XML Object&lt;br /&gt;
&lt;br /&gt;
var oReq = new XMLHttpRequest();&lt;br /&gt;
oReq.open(&amp;quot;GET&amp;quot;, &amp;quot;http://localhost/books.xml&amp;quot;, false);&lt;br /&gt;
oReq.send();&lt;br /&gt;
console.log(oReq.responseXML.xml);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;withCredentials property&amp;lt;ref&amp;gt;http://arunranga.com/examples/access-control/credentialedRequest.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
//create cross site requests using cookies as credentials&lt;br /&gt;
 &lt;br /&gt;
var invocation = new XMLHttpRequest();&lt;br /&gt;
var url = 'http://crossoriginurl.com/resources/access-control-with-credentials/';&lt;br /&gt;
invocation.open('GET', url, true);&lt;br /&gt;
invocation.withCredentials = &amp;quot;true&amp;quot;;&lt;br /&gt;
invocation.onreadystatechange = handler;&lt;br /&gt;
invocation.send(); &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The above mentioned APIs and properties for XMLHttpRequest are currently unimplemented in servo.&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
Our project aim is to implement few of the missing XMLHttpRequest APIs. The [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2015/oss_M1504_JJD OSS project] included implementing initial steps of the [https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs specifications]. It basically incorporated implementing overrideMimeType method and adjusting related test expectations. &lt;br /&gt;
&lt;br /&gt;
The current scope of the project comprises:&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Implementing the specified behavior of the final MIME type and final charset based on the implemented override_mime_type() method in the initial steps&lt;br /&gt;
* Implementing responseXML API and document response type according to the XHR specifications&lt;br /&gt;
* Implementing withCredentials API&lt;br /&gt;
&lt;br /&gt;
==Requirement Analysis==&lt;br /&gt;
&lt;br /&gt;
Below is an overview of the various steps identified as a part of the requirement analysis and corresponding places in code in which these steps would be implemented:&lt;br /&gt;
&lt;br /&gt;
''' XMLHttpRequest Interface '''&lt;br /&gt;
* We have to uncomment the responseXML API&lt;br /&gt;
* A webpage can make use of this API to read the document response &lt;br /&gt;
&lt;br /&gt;
'''XMLHttpRequest DOM '''&lt;br /&gt;
&lt;br /&gt;
# Create helper methods final_mime_type and final_charset&lt;br /&gt;
#* Implement the two methods as per the behavior mentioned in the [https://xhr.spec.whatwg.org/#final-mime-type specification]&lt;br /&gt;
# Implement correct behavior for the text_response method&lt;br /&gt;
#* Make use of the final_charset and final_mime_type helper methods to determine the correct encoding for the response and decode the response using this encoding&lt;br /&gt;
# Create and implement a new method &amp;quot;document_response&amp;quot; according to the [https://xhr.spec.whatwg.org/#document-response xhr specification]&lt;br /&gt;
# Implement the correct behavior for the responseXML API to handle exceptions and return the document response using the method implemented above &amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#dom-xmlhttprequest-responsexml&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Implement the withCredentials APIs (setter and getter) as per the [https://xhr.spec.whatwg.org/#dom-xmlhttprequest-withcredentials specification]&lt;br /&gt;
# Add support to the send() and open() API to test the value of the withCredentials attribute where necessary&lt;br /&gt;
&lt;br /&gt;
''' net_traits '''&lt;br /&gt;
* Add a new member to the LoadData Structure in [https://github.com/servo/servo/blob/master/components/net_traits/lib.rs#L130 lib.rs file] which will be used by the http_loader to conditionally exclude cookies from the XHR request based on the value of the member.&lt;br /&gt;
&lt;br /&gt;
''' XHR Tests '''&lt;br /&gt;
* We need to pass [[#Proposed_Test_Cases | most tests]] related to overrideMimeType, responseXML and withCredentials present in the [https://github.com/servo/servo/tree/master/tests/wpt/web-platform-tests/XMLHttpRequest XHR test-suite]&lt;br /&gt;
&lt;br /&gt;
==Component Flow Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:flow_f15_m1504.png]]&lt;br /&gt;
&lt;br /&gt;
==Design Patterns ==&lt;br /&gt;
We will be using &amp;quot;State Pattern&amp;quot; for our final project implementation. Our implementation will store the new CHARSET and MIME type based on what user has requested. So once user has requested for override in this value which in turns ensures the system behaves as per this new value.&lt;br /&gt;
&lt;br /&gt;
[[File: Component flow diagram.png]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Test Cases==&lt;br /&gt;
The tests have already been written for the XMLHttpRequest APIs related to our project. So the test cases that could validate our changes to the code are as follows:&lt;br /&gt;
&lt;br /&gt;
* If XMLHttpRequest is in unsent state, then overrideMimeType() should be able to enforce Shift-JIS charset encoding&lt;br /&gt;
* If XMLHttpRequest is in open state, then overrideMimeType() should be able to enforce UTF-8 charset encoding&lt;br /&gt;
* If XMLHttpRequest is in open state with XML MIME type, then overrideMimeType() should be able to enforce UTF-8 charset encoding&lt;br /&gt;
* If XMLHttpRequest is in HEADERS RECEIVED state, then overrideMimeType() will be able to enforce Shift-JIS charset encoding&lt;br /&gt;
* responseXML attribute should throw InvalidStateError if response type is not null or document&lt;br /&gt;
* The various responseXML document properties like domain, URL, title, body, images, etc. must be correctly initialized&lt;br /&gt;
* If the state of XMLHttpRequest is not done then responseXML must be null&lt;br /&gt;
* withCredentials must have a default value of false and after setting the variable it is correctly set as true&lt;br /&gt;
* When XMLHttpRequest is not in UNSENT or OPENED state setting withCredentials variable should throw InvalidStateError exception&lt;br /&gt;
* When synchronous flag is set, trying to set withCredentials variable must throw an InvalidAccessError exception&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
* Steps for installing [https://github.com/rust-lang/rust rust]&lt;br /&gt;
* Building [https://github.com/servo/servo Servo]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
===Images===&lt;br /&gt;
&amp;lt;references group=&amp;quot;image&amp;quot;/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=99770</id>
		<title>CSC/ECE 517 Fall 2015 M1504 Implement support for missing XMLHttpRequest APIs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=99770"/>
		<updated>2015-11-14T00:58:30Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: /* Project Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt; is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]&amp;lt;ref&amp;gt;https://github.com/rust-lang/rust&amp;lt;/ref&amp;gt; and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla Research]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo is built on top of Rust to provide a secure and reliable foundation and is focused on creating a reliable and fast browser engine.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language.&lt;br /&gt;
&lt;br /&gt;
Rust is a modern, fast, memory safe and multithreaded programming language that focuses on speed and safety for developing reliable and efficient systems. It eliminates all data races by having numerous compile-time safety checks that adds no runtime overhead.&amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/book/README.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Servo task Architecture==&lt;br /&gt;
&lt;br /&gt;
[[File:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Description===&lt;br /&gt;
&lt;br /&gt;
* Each box corresponds to a Rust task.&lt;br /&gt;
* The primary tasks in the browser pipeline are represented by Blue boxes.&lt;br /&gt;
* Dashed lines indicate supervisor relationships.&lt;br /&gt;
* Gray boxes indicate tasks auxiliary to the browser pipeline.&lt;br /&gt;
* Communication channels are represented as solid lines.&lt;br /&gt;
* White boxes are represented as worker tasks. Each such box represents several tasks which varies with the workload.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
===XMLHttpRequest===&lt;br /&gt;
&amp;quot;[https://xhr.spec.whatwg.org/ XMLHttpRequest] is a specification which defines [https://en.wikipedia.org/wiki/Application_programming_interface APIs] that provides scripted client functionality for transferring data between a client and a server.&amp;quot;&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/&amp;lt;/ref&amp;gt; XMLHttpRequest provides a way for data to be retrieved from a URL without having to retrieve the entire page. It supports protocols other than HTTP and can be used to retrieve any type of data.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some of the APIs and properties present in XMLHttpRequest specification are '''overrideMimeType()''' , '''responseXML''' and '''withCredentials'''. The following javascript code snippets briefly explain about each of these APIs.&lt;br /&gt;
&lt;br /&gt;
;overrideMimeType&amp;lt;ref&amp;gt;https://github.com/servo/servo/blob/master/tests/wpt/web-platform-tests/XMLHttpRequest/overridemimetype-open-state-force-xml.htm&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
//override the Mime type to retrieve the response as an XML Object&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 var client = new XMLHttpRequest();&lt;br /&gt;
 client.onreadystatechange = function() {&lt;br /&gt;
          ... //read the response as XML object&lt;br /&gt;
        };&lt;br /&gt;
        client.open(&amp;quot;GET&amp;quot;, &amp;quot;resources/status.py?type=&amp;quot;&lt;br /&gt;
                    +encodeURIComponent('text/plain;charset=Shift-JIS')&lt;br /&gt;
                    +'&amp;amp;content='+ encodeURIComponent('&amp;lt;test&amp;gt;&amp;lt;message&amp;gt;Hello World！&amp;lt;/message&amp;gt;&amp;lt;/test&amp;gt;'));&lt;br /&gt;
        client.overrideMimeType('application/xml;charset=UTF-8');&lt;br /&gt;
        client.send();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;responseXML property&amp;lt;ref&amp;gt;https://msdn.microsoft.com/en-us/library/ms534370(v=vs.85).aspx&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//read the response from the server as an XML Object&lt;br /&gt;
&lt;br /&gt;
var oReq = new XMLHttpRequest();&lt;br /&gt;
oReq.open(&amp;quot;GET&amp;quot;, &amp;quot;http://localhost/books.xml&amp;quot;, false);&lt;br /&gt;
oReq.send();&lt;br /&gt;
console.log(oReq.responseXML.xml);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;withCredentials property&amp;lt;ref&amp;gt;http://arunranga.com/examples/access-control/credentialedRequest.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
//create cross site requests using cookies as credentials&lt;br /&gt;
 &lt;br /&gt;
var invocation = new XMLHttpRequest();&lt;br /&gt;
var url = 'http://crossoriginurl.com/resources/access-control-with-credentials/';&lt;br /&gt;
invocation.open('GET', url, true);&lt;br /&gt;
invocation.withCredentials = &amp;quot;true&amp;quot;;&lt;br /&gt;
invocation.onreadystatechange = handler;&lt;br /&gt;
invocation.send(); &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The above mentioned APIs and properties for XMLHttpRequest are currently unimplemented in servo.&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
Our project aim is to implement few of the missing XMLHttpRequest APIs. The [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2015/oss_M1504_JJD OSS project] included implementing initial steps of the [https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs specifications]. It basically incorporated implementing overrideMimeType method and adjusting related test expectations. &lt;br /&gt;
&lt;br /&gt;
The current scope of the project comprises:&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Implementing the specified behavior of the final MIME type and final charset based on the implemented override_mime_type() method in the initial steps&lt;br /&gt;
* Implementing responseXML API and document response type according to the XHR specifications&lt;br /&gt;
* Implementing withCredentials API&lt;br /&gt;
&lt;br /&gt;
==Requirement Analysis==&lt;br /&gt;
&lt;br /&gt;
Below is an overview of the various steps identified as a part of the requirement analysis and corresponding places in code in which these steps would be implemented:&lt;br /&gt;
&lt;br /&gt;
''' XMLHttpRequest Interface '''&lt;br /&gt;
* We have to uncomment the responseXML API&lt;br /&gt;
* A webpage can make use of this API to read the document response &lt;br /&gt;
&lt;br /&gt;
'''XMLHttpRequest DOM '''&lt;br /&gt;
&lt;br /&gt;
# Create helper methods final_mime_type and final_charset&lt;br /&gt;
#* Implement the two methods as per the behavior mentioned in the [https://xhr.spec.whatwg.org/#final-mime-type specification]&lt;br /&gt;
# Implement correct behavior for the text_response method&lt;br /&gt;
#* Make use of the final_charset and final_mime_type helper methods to determine the correct encoding for the response and decode the response using this encoding&lt;br /&gt;
# Create and implement a new method &amp;quot;document_response&amp;quot; according to the [https://xhr.spec.whatwg.org/#document-response xhr specification]&lt;br /&gt;
# Implement the correct behavior for the responseXML API to handle exceptions and return the document response using the method implemented above &amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#dom-xmlhttprequest-responsexml&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Implement the withCredentials APIs (setter and getter) as per the [https://xhr.spec.whatwg.org/#dom-xmlhttprequest-withcredentials specification]&lt;br /&gt;
# Add support to the send() and open() API to test the value of the withCredentials attribute where necessary&lt;br /&gt;
&lt;br /&gt;
''' net_traits '''&lt;br /&gt;
* Add a new member to the LoadData Structure in [https://github.com/servo/servo/blob/master/components/net_traits/lib.rs#L130 lib.rs file] which will be used by the http_loader to conditionally exclude cookies from the XHR request based on the value of the member.&lt;br /&gt;
&lt;br /&gt;
''' XHR Tests '''&lt;br /&gt;
* We need to pass [[#Proposed_Test_Cases | most tests]] related to overrideMimeType, responseXML and withCredentials present in the [https://github.com/servo/servo/tree/master/tests/wpt/web-platform-tests/XMLHttpRequest XHR test-suite]&lt;br /&gt;
&lt;br /&gt;
==Component Flow Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:flow_f15_m1504.png]]&lt;br /&gt;
&lt;br /&gt;
==Design Patterns ==&lt;br /&gt;
We will be using &amp;quot;State Pattern&amp;quot; for our final project implementation. Our implementation will store the new CHARSET and MIME type based on what user has requested. So once user has requested for override in this value which in turns ensures the system behaves as per this new value.&lt;br /&gt;
&lt;br /&gt;
[[File: Component flow diagram.png]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Test Cases==&lt;br /&gt;
The tests have already been written for the XMLHttpRequest APIs related to our project. So the test cases that could validate our changes to the code are as follows:&lt;br /&gt;
&lt;br /&gt;
* If XMLHttpRequest is in unsent state, then overrideMimeType() should be able to enforce Shift-JIS charset encoding&lt;br /&gt;
* If XMLHttpRequest is in open state, then overrideMimeType() should be able to enforce UTF-8 charset encoding&lt;br /&gt;
* If XMLHttpRequest is in open state with XML MIME type, then overrideMimeType() should be able to enforce UTF-8 charset encoding&lt;br /&gt;
* If XMLHttpRequest is in HEADERS RECEIVED state, then overrideMimeType() will be able to enforce Shift-JIS charset encoding&lt;br /&gt;
* responseXML attribute should throw InvalidStateError if response type is not null or document&lt;br /&gt;
* The various responseXML document properties like domain, URL, title, body, images, etc. must be correctly initialized&lt;br /&gt;
* If the state of XMLHttpRequest is not done then responseXML must be null&lt;br /&gt;
* withCredentials must have a default value of false and after setting the variable it is correctly set as true&lt;br /&gt;
* When XMLHttpRequest is not in UNSENT or OPENED state setting withCredentials variable should throw InvalidStateError exception&lt;br /&gt;
* When synchronous flag is set, trying to set withCredentials variable must throw an InvalidAccessError exception&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
* Steps for installing [https://github.com/rust-lang/rust rust]&lt;br /&gt;
* Building [https://github.com/servo/servo Servo]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=99696</id>
		<title>CSC/ECE 517 Fall 2015 M1504 Implement support for missing XMLHttpRequest APIs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=99696"/>
		<updated>2015-11-13T22:57:31Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: /* XMLHttpRequest */  Reduced code in overrideMimeType&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt; is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]&amp;lt;ref&amp;gt;https://github.com/rust-lang/rust&amp;lt;/ref&amp;gt; and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla Research]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo is built on top of Rust to provide a secure and reliable foundation and is focused on creating a reliable and fast browser engine.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language.&lt;br /&gt;
&lt;br /&gt;
Rust is a modern, fast, memory safe and multithreaded programming language that focuses on speed and safety for developing reliable and efficient systems. It eliminates all data races by having numerous compile-time safety checks that adds no runtime overhead.&amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/book/README.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Servo task Architecture==&lt;br /&gt;
&lt;br /&gt;
[[File:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Description===&lt;br /&gt;
&lt;br /&gt;
* Each box corresponds to a Rust task.&lt;br /&gt;
* The primary tasks in the browser pipeline are represented by Blue boxes.&lt;br /&gt;
* Dashed lines indicate supervisor relationships.&lt;br /&gt;
* Gray boxes indicate tasks auxiliary to the browser pipeline.&lt;br /&gt;
* Communication channels are represented as solid lines.&lt;br /&gt;
* White boxes are represented as worker tasks. Each such box represents several tasks which varies with the workload.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
===XMLHttpRequest===&lt;br /&gt;
&amp;quot;[https://xhr.spec.whatwg.org/ XMLHttpRequest] is a specification which defines [https://en.wikipedia.org/wiki/Application_programming_interface APIs] that provides scripted client functionality for transferring data between a client and a server.&amp;quot;&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/&amp;lt;/ref&amp;gt; XMLHttpRequest provides a way for data to be retrieved from a URL without having to retrieve the entire page. It supports protocols other than HTTP and can be used to retrieve any type of data.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some of the APIs and properties present in XMLHttpRequest specification are '''overrideMimeType()''' , '''responseXML''' and '''withCredentials'''. The following javascript code snippets briefly explain about each of these APIs.&lt;br /&gt;
&lt;br /&gt;
;overrideMimeType&amp;lt;ref&amp;gt;https://github.com/servo/servo/blob/master/tests/wpt/web-platform-tests/XMLHttpRequest/overridemimetype-open-state-force-xml.htm&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
//override the Mime type to retrieve the response as an XML Object&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 var client = new XMLHttpRequest();&lt;br /&gt;
 client.onreadystatechange = function() {&lt;br /&gt;
          ... //read the response as XML object&lt;br /&gt;
        };&lt;br /&gt;
        client.open(&amp;quot;GET&amp;quot;, &amp;quot;resources/status.py?type=&amp;quot;&lt;br /&gt;
                    +encodeURIComponent('text/plain;charset=Shift-JIS')&lt;br /&gt;
                    +'&amp;amp;content='+ encodeURIComponent('&amp;lt;test&amp;gt;&amp;lt;message&amp;gt;Hello World！&amp;lt;/message&amp;gt;&amp;lt;/test&amp;gt;'));&lt;br /&gt;
        client.overrideMimeType('application/xml;charset=UTF-8');&lt;br /&gt;
        client.send();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;responseXML property&amp;lt;ref&amp;gt;https://msdn.microsoft.com/en-us/library/ms534370(v=vs.85).aspx&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//read the response from the server as an XML Object&lt;br /&gt;
&lt;br /&gt;
var oReq = new XMLHttpRequest();&lt;br /&gt;
oReq.open(&amp;quot;GET&amp;quot;, &amp;quot;http://localhost/books.xml&amp;quot;, false);&lt;br /&gt;
oReq.send();&lt;br /&gt;
console.log(oReq.responseXML.xml);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;withCredentials property&amp;lt;ref&amp;gt;http://arunranga.com/examples/access-control/credentialedRequest.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
//create cross site requests using cookies as credentials&lt;br /&gt;
 &lt;br /&gt;
var invocation = new XMLHttpRequest();&lt;br /&gt;
var url = 'http://crossoriginurl.com/resources/access-control-with-credentials/';&lt;br /&gt;
invocation.open('GET', url, true);&lt;br /&gt;
invocation.withCredentials = &amp;quot;true&amp;quot;;&lt;br /&gt;
invocation.onreadystatechange = handler;&lt;br /&gt;
invocation.send(); &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The above mentioned APIs and properties for XMLHttpRequest are currently unimplemented in servo.&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
Our project aim is to implement few of the missing XMLHttpRequest APIs. The [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2015/oss_M1504_JJD OSS project] involved implementing initial steps of the [https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs specifications]. It basically involved implementing overrideMimeType method and adjusting related test expectations. &lt;br /&gt;
&lt;br /&gt;
The current scope of the project involves:&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Implementing the specified behavior of the final MIME type and final charset based on the implemented override_mime_type() method in the initial steps&lt;br /&gt;
* Implementing responseXML API and document response type according to the XHR specifications&lt;br /&gt;
* Implementing withCredentials API&lt;br /&gt;
&lt;br /&gt;
==Requirement Analysis==&lt;br /&gt;
&lt;br /&gt;
Below is an overview of the various steps identified as a part of the requirement analysis and corresponding places in code in which these steps would be implemented:&lt;br /&gt;
&lt;br /&gt;
''' XMLHttpRequest Interface '''&lt;br /&gt;
* We have to uncomment the responseXML API&lt;br /&gt;
* A webpage can make use of this API to read the document response &lt;br /&gt;
&lt;br /&gt;
'''XMLHttpRequest DOM '''&lt;br /&gt;
&lt;br /&gt;
# Create helper methods final_mime_type and final_charset&lt;br /&gt;
#* Implement the two methods as per the behavior mentioned in the [https://xhr.spec.whatwg.org/#final-mime-type specification]&lt;br /&gt;
# Implement correct behavior for the text_response method&lt;br /&gt;
#* Make use of the final_charset and final_mime_type helper methods to determine the correct encoding for the response and decode the response using this encoding&lt;br /&gt;
# Create and implement a new method &amp;quot;document_response&amp;quot; according to the [https://xhr.spec.whatwg.org/#document-response xhr specification]&lt;br /&gt;
# Implement the correct behavior for the responseXML API to handle exceptions and return the document response using the method implemented above &amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#dom-xmlhttprequest-responsexml&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Implement the withCredentials APIs (setter and getter) as per the [https://xhr.spec.whatwg.org/#dom-xmlhttprequest-withcredentials specification]&lt;br /&gt;
# Add support to the send() and open() API to test the value of the withCredentials attribute where necessary&lt;br /&gt;
&lt;br /&gt;
''' net_traits '''&lt;br /&gt;
* Add a new member to the LoadData Structure in [https://github.com/servo/servo/blob/master/components/net_traits/lib.rs#L130 lib.rs file] which will be used by the http_loader to conditionally exclude cookies from the XHR request based on the value of the member.&lt;br /&gt;
&lt;br /&gt;
''' XHR Tests '''&lt;br /&gt;
* We need to pass [[#Proposed_Test_Cases | most tests]] related to overrideMimeType, responseXML and withCredentials present in the [https://github.com/servo/servo/tree/master/tests/wpt/web-platform-tests/XMLHttpRequest XHR test-suite]&lt;br /&gt;
&lt;br /&gt;
==Component Flow Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:flow_f15_m1504.png]]&lt;br /&gt;
&lt;br /&gt;
==Design Patterns ==&lt;br /&gt;
We will be using &amp;quot;State Pattern&amp;quot; for our final project implementation. Our implementation will store the new CHARSET and MIME type based on what user has requested. So once user has requested for override in this value which in turns ensures the system behaves as per this new value.&lt;br /&gt;
&lt;br /&gt;
[[File: Component flow diagram.png]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Test Cases==&lt;br /&gt;
The tests have already been written for the XMLHttpRequest APIs related to our project. So the test cases that could validate our changes to the code are as follows:&lt;br /&gt;
&lt;br /&gt;
* If XMLHttpRequest is in unsent state, then overrideMimeType() should be able to enforce Shift-JIS charset encoding&lt;br /&gt;
* If XMLHttpRequest is in open state, then overrideMimeType() should be able to enforce UTF-8 charset encoding&lt;br /&gt;
* If XMLHttpRequest is in open state with XML MIME type, then overrideMimeType() should be able to enforce UTF-8 charset encoding&lt;br /&gt;
* If XMLHttpRequest is in HEADERS RECEIVED state, then overrideMimeType() will be able to enforce Shift-JIS charset encoding&lt;br /&gt;
* responseXML attribute should throw InvalidStateError if response type is not null or document&lt;br /&gt;
* The various responseXML document properties like domain, URL, title, body, images, etc. must be correctly initialized&lt;br /&gt;
* If the state of XMLHttpRequest is not done then responseXML must be null&lt;br /&gt;
* withCredentials must have a default value of false and after setting the variable it is correctly set as true&lt;br /&gt;
* When XMLHttpRequest is not in UNSENT or OPENED state setting withCredentials variable should throw InvalidStateError exception&lt;br /&gt;
* When synchronous flag is set, trying to set withCredentials variable must throw an InvalidAccessError exception&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
* Steps for installing [https://github.com/rust-lang/rust rust]&lt;br /&gt;
* Building [https://github.com/servo/servo Servo]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=99694</id>
		<title>CSC/ECE 517 Fall 2015 M1504 Implement support for missing XMLHttpRequest APIs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=99694"/>
		<updated>2015-11-13T22:52:12Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: /* Requirement Analysis */ Reformatting of few sentences&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt; is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]&amp;lt;ref&amp;gt;https://github.com/rust-lang/rust&amp;lt;/ref&amp;gt; and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla Research]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo is built on top of Rust to provide a secure and reliable foundation and is focused on creating a reliable and fast browser engine.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language.&lt;br /&gt;
&lt;br /&gt;
Rust is a modern, fast, memory safe and multithreaded programming language that focuses on speed and safety for developing reliable and efficient systems. It eliminates all data races by having numerous compile-time safety checks that adds no runtime overhead.&amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/book/README.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Servo task Architecture==&lt;br /&gt;
&lt;br /&gt;
[[File:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Description===&lt;br /&gt;
&lt;br /&gt;
* Each box corresponds to a Rust task.&lt;br /&gt;
* The primary tasks in the browser pipeline are represented by Blue boxes.&lt;br /&gt;
* Dashed lines indicate supervisor relationships.&lt;br /&gt;
* Gray boxes indicate tasks auxiliary to the browser pipeline.&lt;br /&gt;
* Communication channels are represented as solid lines.&lt;br /&gt;
* White boxes are represented as worker tasks. Each such box represents several tasks which varies with the workload.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
===XMLHttpRequest===&lt;br /&gt;
&amp;quot;[https://xhr.spec.whatwg.org/ XMLHttpRequest] is a specification which defines [https://en.wikipedia.org/wiki/Application_programming_interface APIs] that provides scripted client functionality for transferring data between a client and a server.&amp;quot;&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/&amp;lt;/ref&amp;gt; XMLHttpRequest provides a way for data to be retrieved from a URL without having to retrieve the entire page. It supports protocols other than HTTP and can be used to retrieve any type of data.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some of the APIs and properties present in XMLHttpRequest specification are '''overrideMimeType()''' , '''responseXML''' and '''withCredentials'''. The following javascript code snippets briefly explain about each of these APIs.&lt;br /&gt;
&lt;br /&gt;
;overrideMimeType&amp;lt;ref&amp;gt;https://github.com/servo/servo/blob/master/tests/wpt/web-platform-tests/XMLHttpRequest/overridemimetype-open-state-force-xml.htm&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
//override the Mime type to retrieve the response as an XML Object&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 var client = new XMLHttpRequest();&lt;br /&gt;
 client.onreadystatechange = function() {&lt;br /&gt;
          if (client.readyState !== 4) return;&lt;br /&gt;
					try{&lt;br /&gt;
            var str = client.responseXML.documentElement.tagName+&lt;br /&gt;
                      client.responseXML.documentElement.firstChild.tagName+&lt;br /&gt;
                      client.responseXML.documentElement.firstChild.textContent;&lt;br /&gt;
					}catch(e){&lt;br /&gt;
						assert_unreached('Exception when reading responseXML');&lt;br /&gt;
					}&lt;br /&gt;
          assert_equals( client.responseXML.documentElement.tagName,  'test' );&lt;br /&gt;
          assert_equals( client.responseXML.documentElement.firstChild.tagName,  'message' );&lt;br /&gt;
          assert_equals( client.responseXML.documentElement.firstChild.textContent,  'Hello World！' );&lt;br /&gt;
          test.done();&lt;br /&gt;
        };&lt;br /&gt;
        client.open(&amp;quot;GET&amp;quot;, &amp;quot;resources/status.py?type=&amp;quot;&lt;br /&gt;
                    +encodeURIComponent('text/plain;charset=Shift-JIS')&lt;br /&gt;
                    +'&amp;amp;content='+ encodeURIComponent('&amp;lt;test&amp;gt;&amp;lt;message&amp;gt;Hello World！&amp;lt;/message&amp;gt;&amp;lt;/test&amp;gt;'));&lt;br /&gt;
        client.overrideMimeType('application/xml;charset=UTF-8');&lt;br /&gt;
        client.send();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;responseXML property&amp;lt;ref&amp;gt;https://msdn.microsoft.com/en-us/library/ms534370(v=vs.85).aspx&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//read the response from the server as an XML Object&lt;br /&gt;
&lt;br /&gt;
var oReq = new XMLHttpRequest();&lt;br /&gt;
oReq.open(&amp;quot;GET&amp;quot;, &amp;quot;http://localhost/books.xml&amp;quot;, false);&lt;br /&gt;
oReq.send();&lt;br /&gt;
console.log(oReq.responseXML.xml);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;withCredentials property&amp;lt;ref&amp;gt;http://arunranga.com/examples/access-control/credentialedRequest.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
//create cross site requests using cookies as credentials&lt;br /&gt;
 &lt;br /&gt;
var invocation = new XMLHttpRequest();&lt;br /&gt;
var url = 'http://crossoriginurl.com/resources/access-control-with-credentials/';&lt;br /&gt;
invocation.open('GET', url, true);&lt;br /&gt;
invocation.withCredentials = &amp;quot;true&amp;quot;;&lt;br /&gt;
invocation.onreadystatechange = handler;&lt;br /&gt;
invocation.send(); &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The above mentioned APIs and properties for XMLHttpRequest are currently unimplemented in servo.&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
Our project aim is to implement few of the missing XMLHttpRequest APIs. The [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2015/oss_M1504_JJD OSS project] involved implementing initial steps of the [https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs specifications]. It basically involved implementing overrideMimeType method and adjusting related test expectations. &lt;br /&gt;
&lt;br /&gt;
The current scope of the project involves:&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Implementing the specified behavior of the final MIME type and final charset based on the implemented override_mime_type() method in the initial steps&lt;br /&gt;
* Implementing responseXML API and document response type according to the XHR specifications&lt;br /&gt;
* Implementing withCredentials API&lt;br /&gt;
&lt;br /&gt;
==Requirement Analysis==&lt;br /&gt;
&lt;br /&gt;
Below is an overview of the various steps identified as a part of the requirement analysis and corresponding places in code in which these steps would be implemented:&lt;br /&gt;
&lt;br /&gt;
''' XMLHttpRequest Interface '''&lt;br /&gt;
* We have to uncomment the responseXML API&lt;br /&gt;
* A webpage can make use of this API to read the document response &lt;br /&gt;
&lt;br /&gt;
'''XMLHttpRequest DOM '''&lt;br /&gt;
&lt;br /&gt;
# Create helper methods final_mime_type and final_charset&lt;br /&gt;
#* Implement the two methods as per the behavior mentioned in the [https://xhr.spec.whatwg.org/#final-mime-type specification]&lt;br /&gt;
# Implement correct behavior for the text_response method&lt;br /&gt;
#* Make use of the final_charset and final_mime_type helper methods to determine the correct encoding for the response and decode the response using this encoding&lt;br /&gt;
# Create and implement a new method &amp;quot;document_response&amp;quot; according to the [https://xhr.spec.whatwg.org/#document-response xhr specification]&lt;br /&gt;
# Implement the correct behavior for the responseXML API to handle exceptions and return the document response using the method implemented above &amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#dom-xmlhttprequest-responsexml&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Implement the withCredentials APIs (setter and getter) as per the [https://xhr.spec.whatwg.org/#dom-xmlhttprequest-withcredentials specification]&lt;br /&gt;
# Add support to the send() and open() API to test the value of the withCredentials attribute where necessary&lt;br /&gt;
&lt;br /&gt;
''' net_traits '''&lt;br /&gt;
* Add a new member to the LoadData Structure in [https://github.com/servo/servo/blob/master/components/net_traits/lib.rs#L130 lib.rs file] which will be used by the http_loader to conditionally exclude cookies from the XHR request based on the value of the member.&lt;br /&gt;
&lt;br /&gt;
''' XHR Tests '''&lt;br /&gt;
* We need to pass [[#Proposed_Test_Cases | most tests]] related to overrideMimeType, responseXML and withCredentials present in the [https://github.com/servo/servo/tree/master/tests/wpt/web-platform-tests/XMLHttpRequest XHR test-suite]&lt;br /&gt;
&lt;br /&gt;
==Component Flow Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:flow_f15_m1504.png]]&lt;br /&gt;
&lt;br /&gt;
==Design Patterns ==&lt;br /&gt;
We will be using &amp;quot;State Pattern&amp;quot; for our final project implementation. Our implementation will store the new CHARSET and MIME type based on what user has requested. So once user has requested for override in this value which in turns ensures the system behaves as per this new value.&lt;br /&gt;
&lt;br /&gt;
[[File: Component flow diagram.png]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Test Cases==&lt;br /&gt;
The tests have already been written for the XMLHttpRequest APIs related to our project. So the test cases that could validate our changes to the code are as follows:&lt;br /&gt;
&lt;br /&gt;
* If XMLHttpRequest is in unsent state, then overrideMimeType() should be able to enforce Shift-JIS charset encoding&lt;br /&gt;
* If XMLHttpRequest is in open state, then overrideMimeType() should be able to enforce UTF-8 charset encoding&lt;br /&gt;
* If XMLHttpRequest is in open state with XML MIME type, then overrideMimeType() should be able to enforce UTF-8 charset encoding&lt;br /&gt;
* If XMLHttpRequest is in HEADERS RECEIVED state, then overrideMimeType() will be able to enforce Shift-JIS charset encoding&lt;br /&gt;
* responseXML attribute should throw InvalidStateError if response type is not null or document&lt;br /&gt;
* The various responseXML document properties like domain, URL, title, body, images, etc. must be correctly initialized&lt;br /&gt;
* If the state of XMLHttpRequest is not done then responseXML must be null&lt;br /&gt;
* withCredentials must have a default value of false and after setting the variable it is correctly set as true&lt;br /&gt;
* When XMLHttpRequest is not in UNSENT or OPENED state setting withCredentials variable should throw InvalidStateError exception&lt;br /&gt;
* When synchronous flag is set, trying to set withCredentials variable must throw an InvalidAccessError exception&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
* Steps for installing [https://github.com/rust-lang/rust rust]&lt;br /&gt;
* Building [https://github.com/servo/servo Servo]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=99678</id>
		<title>CSC/ECE 517 Fall 2015 M1504 Implement support for missing XMLHttpRequest APIs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=99678"/>
		<updated>2015-11-13T22:24:05Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: Restructured Proposed Test Cases section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt; is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]&amp;lt;ref&amp;gt;https://github.com/rust-lang/rust&amp;lt;/ref&amp;gt; and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla Research]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo is built on top of Rust to provide a secure and reliable foundation and is focused on creating a reliable and fast browser engine.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language.&lt;br /&gt;
&lt;br /&gt;
Rust is a modern, fast, memory safe and multithreaded programming language that focuses on speed and safety for developing reliable and efficient systems. It eliminates all data races by having numerous compile-time safety checks that adds no runtime overhead.&amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/book/README.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Servo task Architecture==&lt;br /&gt;
&lt;br /&gt;
[[File:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Description===&lt;br /&gt;
&lt;br /&gt;
* Each box corresponds to a Rust task.&lt;br /&gt;
* The primary tasks in the browser pipeline are represented by Blue boxes.&lt;br /&gt;
* Dashed lines indicate supervisor relationships.&lt;br /&gt;
* Gray boxes indicate tasks auxiliary to the browser pipeline.&lt;br /&gt;
* Communication channels are represented as solid lines.&lt;br /&gt;
* White boxes are represented as worker tasks. Each such box represents several tasks which varies with the workload.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
===XMLHttpRequest===&lt;br /&gt;
&amp;quot;[https://xhr.spec.whatwg.org/ XMLHttpRequest] is a specification which defines [https://en.wikipedia.org/wiki/Application_programming_interface APIs] that provides scripted client functionality for transferring data between a client and a server.&amp;quot;&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/&amp;lt;/ref&amp;gt; XMLHttpRequest provides a way for data to be retrieved from a URL without having to retrieve the entire page. It supports protocols other than HTTP and can be used to retrieve any type of data.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some of the APIs and properties present in XMLHttpRequest specification are '''overrideMimeType()''' , '''responseXML''' and '''withCredentials'''. The following javascript code snippets briefly explain about each of these APIs.&lt;br /&gt;
&lt;br /&gt;
;overrideMimeType&amp;lt;ref&amp;gt;https://github.com/servo/servo/blob/master/tests/wpt/web-platform-tests/XMLHttpRequest/overridemimetype-open-state-force-xml.htm&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
//override the Mime type to retrieve the response as an XML Object&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 var client = new XMLHttpRequest();&lt;br /&gt;
 client.onreadystatechange = function() {&lt;br /&gt;
          if (client.readyState !== 4) return;&lt;br /&gt;
					try{&lt;br /&gt;
            var str = client.responseXML.documentElement.tagName+&lt;br /&gt;
                      client.responseXML.documentElement.firstChild.tagName+&lt;br /&gt;
                      client.responseXML.documentElement.firstChild.textContent;&lt;br /&gt;
					}catch(e){&lt;br /&gt;
						assert_unreached('Exception when reading responseXML');&lt;br /&gt;
					}&lt;br /&gt;
          assert_equals( client.responseXML.documentElement.tagName,  'test' );&lt;br /&gt;
          assert_equals( client.responseXML.documentElement.firstChild.tagName,  'message' );&lt;br /&gt;
          assert_equals( client.responseXML.documentElement.firstChild.textContent,  'Hello World！' );&lt;br /&gt;
          test.done();&lt;br /&gt;
        };&lt;br /&gt;
        client.open(&amp;quot;GET&amp;quot;, &amp;quot;resources/status.py?type=&amp;quot;&lt;br /&gt;
                    +encodeURIComponent('text/plain;charset=Shift-JIS')&lt;br /&gt;
                    +'&amp;amp;content='+ encodeURIComponent('&amp;lt;test&amp;gt;&amp;lt;message&amp;gt;Hello World！&amp;lt;/message&amp;gt;&amp;lt;/test&amp;gt;'));&lt;br /&gt;
        client.overrideMimeType('application/xml;charset=UTF-8');&lt;br /&gt;
        client.send();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;responseXML property&amp;lt;ref&amp;gt;https://msdn.microsoft.com/en-us/library/ms534370(v=vs.85).aspx&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//read the response from the server as an XML Object&lt;br /&gt;
&lt;br /&gt;
var oReq = new XMLHttpRequest();&lt;br /&gt;
oReq.open(&amp;quot;GET&amp;quot;, &amp;quot;http://localhost/books.xml&amp;quot;, false);&lt;br /&gt;
oReq.send();&lt;br /&gt;
console.log(oReq.responseXML.xml);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;withCredentials property&amp;lt;ref&amp;gt;http://arunranga.com/examples/access-control/credentialedRequest.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
//create cross site requests using cookies as credentials&lt;br /&gt;
 &lt;br /&gt;
var invocation = new XMLHttpRequest();&lt;br /&gt;
var url = 'http://crossoriginurl.com/resources/access-control-with-credentials/';&lt;br /&gt;
invocation.open('GET', url, true);&lt;br /&gt;
invocation.withCredentials = &amp;quot;true&amp;quot;;&lt;br /&gt;
invocation.onreadystatechange = handler;&lt;br /&gt;
invocation.send(); &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The above mentioned APIs and properties for XMLHttpRequest are currently unimplemented in servo.&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
Our project aim is to implement few of the missing XMLHttpRequest APIs. The [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2015/oss_M1504_JJD OSS project] involved implementing initial steps of the [https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs specifications]. It basically involved implementing overrideMimeType method and adjusting related test expectations. &lt;br /&gt;
&lt;br /&gt;
The current scope of the project involves:&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Implementing the specified behavior of the final MIME type and final charset based on the implemented override_mime_type() method in the initial steps&lt;br /&gt;
* Implementing responseXML API and document response type according to the XHR specifications&lt;br /&gt;
* Implementing withCredentials API&lt;br /&gt;
&lt;br /&gt;
==Requirement Analysis==&lt;br /&gt;
&lt;br /&gt;
Below is an overview of the various steps identified as a part of the requirement analysis:&lt;br /&gt;
&lt;br /&gt;
''' XMLHttpRequest Interface '''&lt;br /&gt;
* We have to uncomment the responseXML API&lt;br /&gt;
* A webpage can make use of this API to read the document response &lt;br /&gt;
&lt;br /&gt;
'''XMLHttpRequest DOM '''&lt;br /&gt;
&lt;br /&gt;
# Create helper methods for final_mime_type and final_charset&lt;br /&gt;
#* Implement the two methods as per the behavior mentioned in the [https://xhr.spec.whatwg.org/#final-mime-type specification]&lt;br /&gt;
# Implement correct behavior for the text_response method&lt;br /&gt;
#* Make use of the final_charset and final_mime_type helper methods to determine the correct encoding for the response and decode the response using this encoding&lt;br /&gt;
# Create and implement a new method &amp;quot;document_response&amp;quot; according to the [https://xhr.spec.whatwg.org/#document-response xhr specification]&lt;br /&gt;
# Implement the correct behavior for the responseXML API to handle exceptions and return the document response using the method implemented above &amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#dom-xmlhttprequest-responsexml&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Implement the withCredentials APIs (setter and getter) as per the [https://xhr.spec.whatwg.org/#dom-xmlhttprequest-withcredentials specification]&lt;br /&gt;
# Add support to the send() and open() API to test the value of the withCredentials attribute where necessary&lt;br /&gt;
&lt;br /&gt;
''' net_traits '''&lt;br /&gt;
* Add a new member to the LoadData Structure which will be used by the http_loader to conditionally exclude cookies from the XHR request based on the value of the member.&lt;br /&gt;
&lt;br /&gt;
''' XHR Tests '''&lt;br /&gt;
* We need to pass [[#Proposed_Test_Cases | most tests]] related to overrideMimeType, responseXML and withCredentials present in the [https://github.com/servo/servo/tree/master/tests/wpt/web-platform-tests/XMLHttpRequest XHR test-suite]&lt;br /&gt;
&lt;br /&gt;
==Component Flow Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:flow_f15_m1504.png]]&lt;br /&gt;
&lt;br /&gt;
==Design Patterns ==&lt;br /&gt;
We will be using &amp;quot;State Pattern&amp;quot; for our final project implementation. Our implementation will store the new CHARSET and MIME type based on what user has requested. So once user has requested for override in this value which in turns ensures the system behaves as per this new value.&lt;br /&gt;
&lt;br /&gt;
[[File: Component flow diagram.png]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Test Cases==&lt;br /&gt;
The tests have already been written for the XMLHttpRequest APIs related to our project. So the test cases that could validate our changes to the code are as follows:&lt;br /&gt;
&lt;br /&gt;
* If XMLHttpRequest is in unsent state, then overrideMimeType() should be able to enforce Shift-JIS charset encoding&lt;br /&gt;
* If XMLHttpRequest is in open state, then overrideMimeType() should be able to enforce UTF-8 charset encoding&lt;br /&gt;
* If XMLHttpRequest is in open state with XML MIME type, then overrideMimeType() should be able to enforce UTF-8 charset encoding&lt;br /&gt;
* If XMLHttpRequest is in HEADERS RECEIVED state, then overrideMimeType() will be able to enforce Shift-JIS charset encoding&lt;br /&gt;
* responseXML attribute should throw InvalidStateError if response type is not null or document&lt;br /&gt;
* The various responseXML document properties like domain, URL, title, body, images, etc. must be correctly initialized&lt;br /&gt;
* If the state of XMLHttpRequest is not done then responseXML must be null&lt;br /&gt;
* withCredentials must have a default value of false and after setting the variable it is correctly set as true&lt;br /&gt;
* When XMLHttpRequest is not in UNSENT or OPENED state setting withCredentials variable should throw InvalidStateError exception&lt;br /&gt;
* When synchronous flag is set, trying to set withCredentials variable must throw an InvalidAccessError exception&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
* Steps for installing [https://github.com/rust-lang/rust rust]&lt;br /&gt;
* Building [https://github.com/servo/servo Servo]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=99565</id>
		<title>CSC/ECE 517 Fall 2015 M1504 Implement support for missing XMLHttpRequest APIs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=99565"/>
		<updated>2015-11-13T17:44:35Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: Project Description section reduced in size&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt; is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]&amp;lt;ref&amp;gt;https://github.com/rust-lang/rust&amp;lt;/ref&amp;gt; and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla Research]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo is built on top of Rust to provide a secure and reliable foundation and is focused on creating a reliable and fast browser engine.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language.&lt;br /&gt;
&lt;br /&gt;
Rust is a modern, fast, memory safe and multithreaded programming language that focuses on speed and safety for developing reliable and efficient systems. It eliminates all data races by having numerous compile-time safety checks that adds no runtime overhead.&amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/book/README.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Servo task Architecture==&lt;br /&gt;
&lt;br /&gt;
[[File:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Description===&lt;br /&gt;
&lt;br /&gt;
* Each box corresponds to a Rust task.&lt;br /&gt;
* The primary tasks in the browser pipeline are represented by Blue boxes.&lt;br /&gt;
* Dashed lines indicate supervisor relationships.&lt;br /&gt;
* Gray boxes indicate tasks auxiliary to the browser pipeline.&lt;br /&gt;
* Communication channels are represented as solid lines.&lt;br /&gt;
* White boxes are represented as worker tasks. Each such box represents several tasks which varies with the workload.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
===XMLHttpRequest===&lt;br /&gt;
&amp;quot;[https://xhr.spec.whatwg.org/ XMLHttpRequest] is a specification which defines [https://en.wikipedia.org/wiki/Application_programming_interface APIs] that provides scripted client functionality for transferring data between a client and a server.&amp;quot;&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/&amp;lt;/ref&amp;gt; XMLHttpRequest provides a way for data to be retrieved from a URL without having to retrieve the entire page. It supports protocols other than HTTP and can be used to retrieve any type of data.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some of the APIs and properties present in XMLHttpRequest specification are '''overrideMimeType()''' , '''responseXML''' and '''withCredentials'''. The following javascript code snippets briefly explain about each of these APIs.&lt;br /&gt;
&lt;br /&gt;
;overrideMimeType&amp;lt;ref&amp;gt;https://github.com/servo/servo/blob/master/tests/wpt/web-platform-tests/XMLHttpRequest/overridemimetype-open-state-force-xml.htm&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
//override the Mime type to retrieve the response as an XML Object&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 var client = new XMLHttpRequest();&lt;br /&gt;
 client.onreadystatechange = function() {&lt;br /&gt;
          if (client.readyState !== 4) return;&lt;br /&gt;
					try{&lt;br /&gt;
            var str = client.responseXML.documentElement.tagName+&lt;br /&gt;
                      client.responseXML.documentElement.firstChild.tagName+&lt;br /&gt;
                      client.responseXML.documentElement.firstChild.textContent;&lt;br /&gt;
					}catch(e){&lt;br /&gt;
						assert_unreached('Exception when reading responseXML');&lt;br /&gt;
					}&lt;br /&gt;
          assert_equals( client.responseXML.documentElement.tagName,  'test' );&lt;br /&gt;
          assert_equals( client.responseXML.documentElement.firstChild.tagName,  'message' );&lt;br /&gt;
          assert_equals( client.responseXML.documentElement.firstChild.textContent,  'Hello World！' );&lt;br /&gt;
          test.done();&lt;br /&gt;
        };&lt;br /&gt;
        client.open(&amp;quot;GET&amp;quot;, &amp;quot;resources/status.py?type=&amp;quot;&lt;br /&gt;
                    +encodeURIComponent('text/plain;charset=Shift-JIS')&lt;br /&gt;
                    +'&amp;amp;content='+ encodeURIComponent('&amp;lt;test&amp;gt;&amp;lt;message&amp;gt;Hello World！&amp;lt;/message&amp;gt;&amp;lt;/test&amp;gt;'));&lt;br /&gt;
        client.overrideMimeType('application/xml;charset=UTF-8');&lt;br /&gt;
        client.send();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;responseXML property&amp;lt;ref&amp;gt;https://msdn.microsoft.com/en-us/library/ms534370(v=vs.85).aspx&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//read the response from the server as an XML Object&lt;br /&gt;
&lt;br /&gt;
var oReq = new XMLHttpRequest();&lt;br /&gt;
oReq.open(&amp;quot;GET&amp;quot;, &amp;quot;http://localhost/books.xml&amp;quot;, false);&lt;br /&gt;
oReq.send();&lt;br /&gt;
console.log(oReq.responseXML.xml);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;withCredentials property&amp;lt;ref&amp;gt;http://arunranga.com/examples/access-control/credentialedRequest.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
//create cross site requests using cookies as credentials&lt;br /&gt;
 &lt;br /&gt;
var invocation = new XMLHttpRequest();&lt;br /&gt;
var url = 'http://crossoriginurl.com/resources/access-control-with-credentials/';&lt;br /&gt;
invocation.open('GET', url, true);&lt;br /&gt;
invocation.withCredentials = &amp;quot;true&amp;quot;;&lt;br /&gt;
invocation.onreadystatechange = handler;&lt;br /&gt;
invocation.send(); &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The above mentioned APIs and properties for XMLHttpRequest are currently unimplemented in servo.&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
Our project aim is to implement few of the missing XMLHttpRequest APIs. The [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2015/oss_M1504_JJD OSS project] involved implementing initial steps of the [https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs specifications]. It basically involved implementing overrideMimeType method and adjusting related test expectations. &lt;br /&gt;
&lt;br /&gt;
The current scope of the project involves:&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Implementing the specified behavior of the final MIME type and final charset based on the implemented override_mime_type() method in the initial steps&lt;br /&gt;
* Implementing responseXML API and document response type according to the XHR specifications&lt;br /&gt;
* Implementing withCredentials API&lt;br /&gt;
&lt;br /&gt;
==Requirement Analysis==&lt;br /&gt;
&lt;br /&gt;
Below is an overview of the various steps identified as a part of the requirement analysis:&lt;br /&gt;
&lt;br /&gt;
''' XMLHttpRequest Interface '''&lt;br /&gt;
* We have to uncomment the responseXML API&lt;br /&gt;
* A webpage can make use of this API to read the document response &lt;br /&gt;
&lt;br /&gt;
'''XMLHttpRequest DOM '''&lt;br /&gt;
&lt;br /&gt;
# Create helper methods for final_mime_type and final_charset&lt;br /&gt;
#* Implement the two methods as per the behavior mentioned in the [https://xhr.spec.whatwg.org/#final-mime-type specification]&lt;br /&gt;
# Implement correct behavior for the text_response method&lt;br /&gt;
#* Make use of the final_charset and final_mime_type helper methods to determine the correct encoding for the response and decode the response using this encoding&lt;br /&gt;
# Create and implement a new method &amp;quot;document_response&amp;quot; according to the [https://xhr.spec.whatwg.org/#document-response xhr specification]&lt;br /&gt;
# Implement the correct behavior for the responseXML API to handle exceptions and return the document response using the method implemented above &amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#dom-xmlhttprequest-responsexml&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Implement the withCredentials APIs (setter and getter) as per the [https://xhr.spec.whatwg.org/#dom-xmlhttprequest-withcredentials specification]&lt;br /&gt;
# Add support to the send() and open() API to test the value of the withCredentials attribute where necessary&lt;br /&gt;
&lt;br /&gt;
''' net_traits '''&lt;br /&gt;
* Add a new member to the LoadData Structure which will be used by the http_loader to conditionally exclude cookies from the XHR request based on the value of the member.&lt;br /&gt;
&lt;br /&gt;
''' XHR Tests '''&lt;br /&gt;
* We need to pass [[#Proposed_Test_Cases | most tests]] related to overrideMimeType, responseXML and withCredentials present in the [https://github.com/servo/servo/tree/master/tests/wpt/web-platform-tests/XMLHttpRequest XHR test-suite]&lt;br /&gt;
&lt;br /&gt;
==Component Flow Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:flow_f15_m1504.png]]&lt;br /&gt;
&lt;br /&gt;
==Design Patterns ==&lt;br /&gt;
We will be using &amp;quot;State Pattern&amp;quot; for our final project implementation. Our implementation will store the new CHARSET and MIME type based on what user has requested. So once user has requested for override in this value which in turns ensures the system behaves as per this new value.&lt;br /&gt;
&lt;br /&gt;
[[File: Component flow diagram.png]]&lt;br /&gt;
&lt;br /&gt;
==Proposed Test Cases==&lt;br /&gt;
The tests have already been written for the XMLHttpRequest APIs related to our project. So the test cases that could validate our changes to the code are as follows:&lt;br /&gt;
&lt;br /&gt;
* overrideMimeType() in unsent state enforces Shift-JIS encoding&lt;br /&gt;
* overrideMimeType() in open state enforces UTF-8 encoding&lt;br /&gt;
* overrideMimeType() in open state and XML MIME type with UTF-8 charset is correctly enforced&lt;br /&gt;
* overrideMimeType() in HEADERS RECEIVED state enforces Shift-JIS encoding&lt;br /&gt;
* responseXML attribute throws InvalidStateError if response type is not null or document&lt;br /&gt;
* The various responseXML document properties are correctly initialized&lt;br /&gt;
* The type of the responseXML stylesheets and implementation must be object&lt;br /&gt;
* If the state of XMLHttpRequest is not done then responseXML is null&lt;br /&gt;
* Check withCredentials defaults to false and set value is true&lt;br /&gt;
* Setting withCredentials when not in UNSENT, OPENED state throws InvalidStateError exception&lt;br /&gt;
* Setting withCredentials when synchornous flag is set throws InvalidAccessError exception&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
* Steps for installing [https://github.com/rust-lang/rust rust]&lt;br /&gt;
* Building [https://github.com/servo/servo Servo]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Flow_f15_m1504.png&amp;diff=99364</id>
		<title>File:Flow f15 m1504.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Flow_f15_m1504.png&amp;diff=99364"/>
		<updated>2015-11-10T04:36:45Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Flow.png&amp;diff=99363</id>
		<title>File:Flow.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Flow.png&amp;diff=99363"/>
		<updated>2015-11-10T04:35:22Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: uploaded a new version of &amp;amp;quot;File:Flow.png&amp;amp;quot;: Reverted to version as of 23:14, 10 February 2012&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Flow.png&amp;diff=99358</id>
		<title>File:Flow.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Flow.png&amp;diff=99358"/>
		<updated>2015-11-10T04:30:33Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: uploaded a new version of &amp;amp;quot;File:Flow.png&amp;amp;quot;: M 1504 diagram Fall 15&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=99251</id>
		<title>CSC/ECE 517 Fall 2015 M1504 Implement support for missing XMLHttpRequest APIs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=99251"/>
		<updated>2015-11-10T01:03:14Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: reordering of sections&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt; is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]&amp;lt;ref&amp;gt;https://github.com/rust-lang/rust&amp;lt;/ref&amp;gt; and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla Research]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo is built on top of Rust to provide a secure and reliable foundation and is focused on creating a reliable and fast browser engine.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language.&lt;br /&gt;
&lt;br /&gt;
Rust is a modern, fast, memory safe and multithreaded programming language that focuses on speed and safety for developing reliable and efficient systems. It eliminates all data races by having numerous compile-time safety checks that adds no runtime overhead.&amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/book/README.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Servo task Architecture==&lt;br /&gt;
&lt;br /&gt;
[[File:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Description===&lt;br /&gt;
&lt;br /&gt;
* Each box corresponds to a Rust task.&lt;br /&gt;
* The primary tasks in the browser pipeline are represented by Blue boxes.&lt;br /&gt;
* Dashed lines indicate supervisor relationships.&lt;br /&gt;
* Gray boxes indicate tasks auxiliary to the browser pipeline.&lt;br /&gt;
* Communication channels are represented as solid lines.&lt;br /&gt;
* White boxes are represented as worker tasks. Each such box represents several tasks which varies with the workload.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
===XMLHttpRequest===&lt;br /&gt;
&amp;quot;[https://xhr.spec.whatwg.org/ XMLHttpRequest] is a specification which defines [https://en.wikipedia.org/wiki/Application_programming_interface APIs] that provides scripted client functionality for transferring data between a client and a server.&amp;quot;&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/&amp;lt;/ref&amp;gt; XMLHttpRequest provides a way for data to be retrieved from a URL without having to retrieve the entire page. It supports protocols other than HTTP and can be used to retrieve any type of data.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some of the APIs and properties present in XMLHttpRequest specification are '''overrideMimeType()''' , '''responseXML''' and '''withCredentials'''. The following javascript code snippets briefly explain about each of these APIs.&lt;br /&gt;
&lt;br /&gt;
;overrideMimeType&amp;lt;ref&amp;gt;https://github.com/servo/servo/blob/master/tests/wpt/web-platform-tests/XMLHttpRequest/overridemimetype-open-state-force-xml.htm&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
//override the Mime type to retrieve the response as an XML Object&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 var client = new XMLHttpRequest();&lt;br /&gt;
 client.onreadystatechange = function() {&lt;br /&gt;
          if (client.readyState !== 4) return;&lt;br /&gt;
					try{&lt;br /&gt;
            var str = client.responseXML.documentElement.tagName+client.responseXML.documentElement.firstChild.tagName+client.responseXML.documentElement.firstChild.textContent;&lt;br /&gt;
					}catch(e){&lt;br /&gt;
						assert_unreached('Exception when reading responseXML');&lt;br /&gt;
					}&lt;br /&gt;
          assert_equals( client.responseXML.documentElement.tagName,  'test' );&lt;br /&gt;
          assert_equals( client.responseXML.documentElement.firstChild.tagName,  'message' );&lt;br /&gt;
          assert_equals( client.responseXML.documentElement.firstChild.textContent,  'Hello World！' );&lt;br /&gt;
          test.done();&lt;br /&gt;
        };&lt;br /&gt;
        client.open(&amp;quot;GET&amp;quot;, &amp;quot;resources/status.py?type=&amp;quot;+encodeURIComponent('text/plain;charset=Shift-JIS')+'&amp;amp;content='+encodeURIComponent('&amp;lt;test&amp;gt;&amp;lt;message&amp;gt;Hello World！&amp;lt;/message&amp;gt;&amp;lt;/test&amp;gt;'));&lt;br /&gt;
        client.overrideMimeType('application/xml;charset=UTF-8');&lt;br /&gt;
        client.send();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;responseXML property&amp;lt;ref&amp;gt;https://msdn.microsoft.com/en-us/library/ms534370(v=vs.85).aspx&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//read the response from the server as an XML Object&lt;br /&gt;
&lt;br /&gt;
var oReq = new XMLHttpRequest();&lt;br /&gt;
oReq.open(&amp;quot;GET&amp;quot;, &amp;quot;http://localhost/books.xml&amp;quot;, false);&lt;br /&gt;
oReq.send();&lt;br /&gt;
console.log(oReq.responseXML.xml);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;withCredentials property&amp;lt;ref&amp;gt;http://arunranga.com/examples/access-control/credentialedRequest.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
//create cross site requests using cookies as credentials&lt;br /&gt;
 &lt;br /&gt;
var invocation = new XMLHttpRequest();&lt;br /&gt;
var url = 'http://crossoriginurl.com/resources/access-control-with-credentials/';&lt;br /&gt;
invocation.open('GET', url, true);&lt;br /&gt;
invocation.withCredentials = &amp;quot;true&amp;quot;;&lt;br /&gt;
invocation.onreadystatechange = handler;&lt;br /&gt;
invocation.send(); &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The above mentioned APIs and properties for XMLHttpRequest are currently unimplemented in servo.&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
Servo has implemented many API specifications that relies upon JavaScript that executes on all the browsers. [https://xhr.spec.whatwg.org/ XMLHttpRequest] is one such specification which is used for making HTTP requests dynamically. Our project aim is to implement few of the missing XMLHttpRequest APIs. The [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2015/oss_M1504_JJD OSS project] involved implementing initial steps of the [https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs specifications]. It basically involved implementing overrideMimeType method and adjusting related test expectations. &lt;br /&gt;
&lt;br /&gt;
The current scope of the project involves:&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Implementing the specified behavior of the final MIME type and final charset based on the implemented override_mime_type() method in the initial steps&lt;br /&gt;
* Implementing responseXML API and document response type according to the XHR specifications&lt;br /&gt;
* Implementing withCredentials API&lt;br /&gt;
&lt;br /&gt;
==Requirement Analysis==&lt;br /&gt;
&lt;br /&gt;
Below is an overview of the various steps identified as a part of the requirement analysis:&lt;br /&gt;
&lt;br /&gt;
''' XMLHttpRequest Interface '''&lt;br /&gt;
* We have to uncomment the responseXML API&lt;br /&gt;
* A webpage can make use of this API to read the document response &lt;br /&gt;
&lt;br /&gt;
'''XMLHttpRequest DOM '''&lt;br /&gt;
&lt;br /&gt;
# Create helper methods for final_mime_type and final_charset&lt;br /&gt;
#* Implement the two methods as per the behavior mentioned in the [https://xhr.spec.whatwg.org/#final-mime-type specification]&lt;br /&gt;
# Implement correct behavior for the text_response method&lt;br /&gt;
#* Make use of the final_charset and final_mime_type helper methods to determine the correct encoding for the response and decode the response using this encoding&lt;br /&gt;
# Create and implement a new method &amp;quot;document_response&amp;quot; according to the [https://xhr.spec.whatwg.org/#document-response xhr specification]&lt;br /&gt;
# Implement the correct behavior for the responseXML API to handle exceptions and return the document response using the method implemented above &amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#dom-xmlhttprequest-responsexml&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Implement the withCredentials APIs (setter and getter) as per the [https://xhr.spec.whatwg.org/#dom-xmlhttprequest-withcredentials specification]&lt;br /&gt;
# Add support to the send() and open() API to test the value of the withCredentials attribute where necessary&lt;br /&gt;
&lt;br /&gt;
''' net_traits '''&lt;br /&gt;
* Add a new member to the LoadData Structure which will be used by the http_loader to conditionally exclude cookies from the XHR request based on the value of the member.&lt;br /&gt;
&lt;br /&gt;
''' XHR Tests '''&lt;br /&gt;
* We need to pass [[#Proposed_Test_Cases | most tests]] related to overrideMimeType, responseXML and withCredentials present in the [https://github.com/servo/servo/tree/master/tests/wpt/web-platform-tests/XMLHttpRequest XHR test-suite]&lt;br /&gt;
&lt;br /&gt;
==Component Flow Diagram==&lt;br /&gt;
{{wide image|Component Flow Diagram.png|1000px|alt=component flow diagram)}&lt;br /&gt;
&lt;br /&gt;
==Proposed Test Cases==&lt;br /&gt;
The tests have already been written for the XMLHttpRequest APIs related to our project. So the test cases that could validate our changes to the code are as follows:&lt;br /&gt;
&lt;br /&gt;
* overrideMimeType() in unsent state enforces Shift-JIS encoding&lt;br /&gt;
* overrideMimeType() in open state enforces UTF-8 encoding&lt;br /&gt;
* overrideMimeType() in open state and XML MIME type with UTF-8 charset is correctly enforced&lt;br /&gt;
* overrideMimeType() in HEADERS RECEIVED state enforces Shift-JIS encoding&lt;br /&gt;
* responseXML attribute throws InvalidStateError if response type is not null or document&lt;br /&gt;
* The various responseXML document properties are correctly initialized&lt;br /&gt;
* The type of the responseXML stylesheets and implementation must be object&lt;br /&gt;
* If the state of XMLHttpRequest is not done then responseXML is null&lt;br /&gt;
* Check withCredentials defaults to false and set value is true&lt;br /&gt;
* Setting withCredentials when not in UNSENT, OPENED state throws InvalidStateError exception&lt;br /&gt;
* Setting withCredentials when synchornous flag is set throws InvalidAccessError exception&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
* Steps for installing [https://github.com/rust-lang/rust rust]&lt;br /&gt;
* Building [https://github.com/servo/servo Servo]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=99219</id>
		<title>CSC/ECE 517 Fall 2015 M1504 Implement support for missing XMLHttpRequest APIs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=99219"/>
		<updated>2015-11-10T00:41:43Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: Added Project Description&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt; is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]&amp;lt;ref&amp;gt;https://github.com/rust-lang/rust&amp;lt;/ref&amp;gt; and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla Research]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo is built on top of Rust to provide a secure and reliable foundation and is focused on creating a reliable and fast browser engine.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language.&lt;br /&gt;
&lt;br /&gt;
Rust is a modern, fast, memory safe and multithreaded programming language that focuses on speed and safety for developing reliable and efficient systems. It eliminates all data races by having numerous compile-time safety checks that adds no runtime overhead.&amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/book/README.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
===XMLHttpRequest===&lt;br /&gt;
&amp;quot;[https://xhr.spec.whatwg.org/ XMLHttpRequest(XHR)] is a definition of an [https://en.wikipedia.org/wiki/Application_programming_interface API] that provides scripted client functionality for transferring data between a client and a server.&amp;quot;&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/&amp;lt;/ref&amp;gt; XMLHttpRequest provides a way for data to be retrieved from a URL without having to retrieve the entire page. It supports protocols other than HTTP and can be used to retrieve any type of data.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Servo task Architecture==&lt;br /&gt;
&lt;br /&gt;
[[File:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Description===&lt;br /&gt;
&lt;br /&gt;
* Each box corresponds to a Rust task.&lt;br /&gt;
* The primary tasks in the browser pipeline are represented by Blue boxes.&lt;br /&gt;
* Dashed lines indicate supervisor relationships.&lt;br /&gt;
* Gray boxes indicate tasks auxiliary to the browser pipeline.&lt;br /&gt;
* Communication channels are represented as solid lines.&lt;br /&gt;
* White boxes are represented as worker tasks. Each such box represents several tasks which varies with the workload.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Project Description==&lt;br /&gt;
&lt;br /&gt;
Servo has implemented many API specifications that relies upon JavaScript that executes on all the browsers. [https://xhr.spec.whatwg.org/ XMLHttpRequest] is one such specification which is used for making HTTP requests dynamically. Our project aim is to implement few of the missing XMLHttpRequest APIs. The [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2015/oss_M1504_JJD OSS project] involved implementing initial steps of the [https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs specifications]. It basically involved implementing overrideMimeType method and adjusting related test expectations. &lt;br /&gt;
&lt;br /&gt;
The current scope of the project involves:&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Implementing the specified behavior of the final MIME type and final charset based on the implemented override_mime_type() method in the initial steps&lt;br /&gt;
* Implementing responseXML API and document response type according to the XHR specifications&lt;br /&gt;
* Implementing withCredentials API&lt;br /&gt;
&lt;br /&gt;
==Requirement Analysis==&lt;br /&gt;
&lt;br /&gt;
Below is an overview of the various steps identified as a part of the requirement analysis:&lt;br /&gt;
&lt;br /&gt;
''' XMLHttpRequest Interface '''&lt;br /&gt;
* We have to uncomment the responseXML API&lt;br /&gt;
* A webpage can make use of this API to read the document response &lt;br /&gt;
&lt;br /&gt;
'''XMLHttpRequest DOM '''&lt;br /&gt;
&lt;br /&gt;
# Create helper methods for final_mime_type and final_charset&lt;br /&gt;
#* Implement the two methods as per the behavior mentioned in the [https://xhr.spec.whatwg.org/#final-mime-type specification]&lt;br /&gt;
# Implement correct behavior for the text_response method&lt;br /&gt;
#* Make use of the final_charset and final_mime_type helper methods to determine the correct encoding for the response and decode the response using this encoding&lt;br /&gt;
# Create and implement a new method &amp;quot;document_response&amp;quot; according to the [https://xhr.spec.whatwg.org/#document-response xhr specification]&lt;br /&gt;
# Implement the correct behavior for the responseXML API to handle exceptions and return the document response using the method implemented above &amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#dom-xmlhttprequest-responsexml&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Implement the withCredentials APIs (setter and getter) as per the [https://xhr.spec.whatwg.org/#dom-xmlhttprequest-withcredentials specification]&lt;br /&gt;
# Add support to the send() and open() API to test the value of the withCredentials attribute where necessary&lt;br /&gt;
&lt;br /&gt;
''' net_traits '''&lt;br /&gt;
* Add a new member to the LoadData Structure which will be used by the http_loader to conditionally exclude cookies from the XHR request based on the value of the member.&lt;br /&gt;
&lt;br /&gt;
''' XHR Tests '''&lt;br /&gt;
* We need to pass [[#Proposed_Test_Cases | most tests]] related to overrideMimeType, responseXML and withCredentials present in the [https://github.com/servo/servo/tree/master/tests/wpt/web-platform-tests/XMLHttpRequest XHR test-suite]&lt;br /&gt;
&lt;br /&gt;
==Component Flow Diagram==&lt;br /&gt;
{{wide image|Component Flow Diagram.png|1000px|alt=component flow diagram)}&lt;br /&gt;
&lt;br /&gt;
==Proposed Test Cases==&lt;br /&gt;
The tests have already been written for the XMLHttpRequest APIs related to our project. So the test cases that could validate our changes to the code are as follows:&lt;br /&gt;
&lt;br /&gt;
* overrideMimeType() in unsent state enforces Shift-JIS encoding&lt;br /&gt;
* overrideMimeType() in open state enforces UTF-8 encoding&lt;br /&gt;
* overrideMimeType() in open state and XML MIME type with UTF-8 charset is correctly enforced&lt;br /&gt;
* overrideMimeType() in HEADERS RECEIVED state enforces Shift-JIS encoding&lt;br /&gt;
* responseXML attribute throws InvalidStateError if response type is not null or document&lt;br /&gt;
* The various responseXML document properties are correctly initialized&lt;br /&gt;
* The type of the responseXML stylesheets and implementation must be object&lt;br /&gt;
* If the state of XMLHttpRequest is not done then responseXML is null&lt;br /&gt;
* Check withCredentials defaults to false and set value is true&lt;br /&gt;
* Setting withCredentials when not in UNSENT, OPENED state throws InvalidStateError exception&lt;br /&gt;
* Setting withCredentials when synchornous flag is set throws InvalidAccessError exception&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
* Steps for installing [https://github.com/rust-lang/rust rust]&lt;br /&gt;
* Building [https://github.com/servo/servo Servo]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=99206</id>
		<title>CSC/ECE 517 Fall 2015 M1504 Implement support for missing XMLHttpRequest APIs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=99206"/>
		<updated>2015-11-09T23:34:16Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: Added Architecture section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt; is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]&amp;lt;ref&amp;gt;https://github.com/rust-lang/rust&amp;lt;/ref&amp;gt; and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla Research]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo is built on top of Rust to provide a secure and reliable foundation and is focused on creating a reliable and fast browser engine.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language.&lt;br /&gt;
&lt;br /&gt;
Rust is a modern, fast, memory safe and multithreaded programming language that focuses on speed and safety for developing reliable and efficient systems. It eliminates all data races by having numerous compile-time safety checks that adds no runtime overhead.&amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/book/README.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
===XMLHttpRequest===&lt;br /&gt;
&amp;quot;[https://xhr.spec.whatwg.org/ XMLHttpRequest] is a definition of an [https://en.wikipedia.org/wiki/Application_programming_interface API] that provides scripted client functionality for transferring data between a client and a server.&amp;quot;&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/&amp;lt;/ref&amp;gt; XMLHttpRequest provides a way for data to be retrieved from a URL without having to retrieve the entire page. It supports protocols other than HTTP and can be used to retrieve any type of data.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Servo task Architecture==&lt;br /&gt;
&lt;br /&gt;
[[File:task.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Description===&lt;br /&gt;
&lt;br /&gt;
* Each box corresponds to a Rust task.&lt;br /&gt;
* The primary tasks in the browser pipeline are represented by Blue boxes.&lt;br /&gt;
* Dashed lines indicate supervisor relationships.&lt;br /&gt;
* Gray boxes indicate tasks auxiliary to the browser pipeline.&lt;br /&gt;
* Communication channels are represented as solid lines.&lt;br /&gt;
* White boxes are represented as worker tasks. Each such box represents several tasks which varies with the workload.&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Design&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirement Analysis==&lt;br /&gt;
&lt;br /&gt;
Below is an overview of the various steps identified as a part of the requirement analysis:&lt;br /&gt;
&lt;br /&gt;
''' XMLHttpRequest Interface '''&lt;br /&gt;
* We have to uncomment the responseXML API&lt;br /&gt;
* A webpage can make use of this API to read the document response &lt;br /&gt;
&lt;br /&gt;
'''XMLHttpRequest DOM '''&lt;br /&gt;
&lt;br /&gt;
# Create helper methods for final_mime_type and final_charset&lt;br /&gt;
#* Implement the two methods as per the behavior mentioned in the [https://xhr.spec.whatwg.org/#final-mime-type specification]&lt;br /&gt;
# Implement correct behavior for the text_response method&lt;br /&gt;
#* Make use of the final_charset and final_mime_type helper methods to determine the correct encoding for the response and decode the response using this encoding&lt;br /&gt;
# Create and implement a new method &amp;quot;document_response&amp;quot; according to the [https://xhr.spec.whatwg.org/#document-response xhr specification]&lt;br /&gt;
# Implement the correct behavior for the responseXML API to handle exceptions and return the document response using the method implemented above &amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/#dom-xmlhttprequest-responsexml&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Implement the withCredentials APIs (setter and getter) as per the [https://xhr.spec.whatwg.org/#dom-xmlhttprequest-withcredentials specification]&lt;br /&gt;
# Add support to the send() and open() API to test the value of the withCredentials attribute where necessary&lt;br /&gt;
&lt;br /&gt;
''' net_traits '''&lt;br /&gt;
* Add a new member to the LoadData Structure which will be used by the http_loader to conditionally exclude cookies from the XHR request based on the value of the member.&lt;br /&gt;
&lt;br /&gt;
''' XHR Tests '''&lt;br /&gt;
* We need to pass [[#Proposed_Test_Cases | most tests]] related to overrideMimeType, responseXML and withCredentials present in the [https://github.com/servo/servo/tree/master/tests/wpt/web-platform-tests/XMLHttpRequest XHR test-suite]&lt;br /&gt;
&lt;br /&gt;
==Component Flow Diagram==&lt;br /&gt;
{{wide image|Component Flow Diagram.png|1000px|alt=component flow diagram)}&lt;br /&gt;
&lt;br /&gt;
==Proposed Test Cases==&lt;br /&gt;
The tests have already been written for the XMLHttpRequest APIs related to our project. So the test cases that could validate our changes to the code are as follows:&lt;br /&gt;
&lt;br /&gt;
* overrideMimeType() in unsent state enforces Shift-JIS encoding&lt;br /&gt;
* overrideMimeType() in open state enforces UTF-8 encoding&lt;br /&gt;
* overrideMimeType() in open state and XML MIME type with UTF-8 charset is correctly enforced&lt;br /&gt;
* overrideMimeType() in HEADERS RECEIVED state enforces Shift-JIS encoding&lt;br /&gt;
* responseXML attribute throws InvalidStateError if response type is not null or document&lt;br /&gt;
* The various responseXML document properties are correctly initialized&lt;br /&gt;
* The type of the responseXML stylesheets and implementation must be object&lt;br /&gt;
* If the state of XMLHttpRequest is not done then responseXML is null&lt;br /&gt;
* Check withCredentials defaults to false and set value is true&lt;br /&gt;
* Setting withCredentials when not in UNSENT, OPENED state throws InvalidStateError exception&lt;br /&gt;
* Setting withCredentials when synchornous flag is set throws InvalidAccessError exception&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
* Steps for installing [https://github.com/rust-lang/rust rust]&lt;br /&gt;
* Building [https://github.com/servo/servo Servo]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=98997</id>
		<title>CSC/ECE 517 Fall 2015 M1504 Implement support for missing XMLHttpRequest APIs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=98997"/>
		<updated>2015-11-09T01:51:00Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: Added Proposed Test Cases section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt; is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]&amp;lt;ref&amp;gt;https://github.com/rust-lang/rust&amp;lt;/ref&amp;gt; and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla Research]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo is built on top of Rust to provide a secure and reliable foundation and is focused on creating a reliable and fast browser engine.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language.&lt;br /&gt;
&lt;br /&gt;
Rust is a modern, fast, memory safe and multithreaded programming language that focuses on speed and safety for developing reliable and efficient systems. It eliminates all data races by having numerous compile-time safety checks that adds no runtime overhead.&amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/book/README.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===XMLHttpRequest===&lt;br /&gt;
&amp;quot;[https://xhr.spec.whatwg.org/ XMLHttpRequest] is a definition of an [https://en.wikipedia.org/wiki/Application_programming_interface API] that provides scripted client functionality for transferring data between a client and a server.&amp;quot;&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/&amp;lt;/ref&amp;gt; XMLHttpRequest provides a way for data to be retrieved from a URL without having to retrieve the entire page. It supports protocols other than HTTP and can be used to retrieve any type of data.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Component Flow Diagram==&lt;br /&gt;
{{wide image|Component Flow Diagram.png|1000px|alt=component flow diagram)}&lt;br /&gt;
&lt;br /&gt;
==Proposed Test Cases==&lt;br /&gt;
The tests have already been written for the XMLHttpRequest APIs related to our project. So the test cases that could validate our changes to the code are as follows:&lt;br /&gt;
&lt;br /&gt;
* overrideMimeType() in unsent state enforces Shift-JIS encoding&lt;br /&gt;
* overrideMimeType() in open state enforces UTF-8 encoding&lt;br /&gt;
* overrideMimeType() in open state and XML MIME type with UTF-8 charset is correctly enforced&lt;br /&gt;
* overrideMimeType() in HEADERS RECEIVED state enforces Shift-JIS encoding&lt;br /&gt;
* responseXML attribute throws InvalidStateError if response type is not null or document&lt;br /&gt;
* The various responseXML document properties are correctly initialized&lt;br /&gt;
* The type of the responseXML stylesheets and implementation must be object&lt;br /&gt;
* If the state of XMLHttpRequest is not done then responseXML is null&lt;br /&gt;
* Check withCredentials defaults to false and set value is true&lt;br /&gt;
* Setting withCredentials when not in UNSENT, OPENED state throws InvalidStateError exception&lt;br /&gt;
* Setting withCredentials when synchornous flag is set throws InvalidAccessError exception&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
* Steps for installing [https://github.com/rust-lang/rust rust]&lt;br /&gt;
* Building [https://github.com/servo/servo Servo]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=98987</id>
		<title>CSC/ECE 517 Fall 2015 M1504 Implement support for missing XMLHttpRequest APIs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=98987"/>
		<updated>2015-11-08T22:19:33Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: Added Appendix section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt; is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]&amp;lt;ref&amp;gt;https://github.com/rust-lang/rust&amp;lt;/ref&amp;gt; and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla Research]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo is built on top of Rust to provide a secure and reliable foundation and is focused on creating a reliable and fast browser engine.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language.&lt;br /&gt;
&lt;br /&gt;
Rust is a modern, fast, memory safe and multithreaded programming language that focuses on speed and safety for developing reliable and efficient systems. It eliminates all data races by having numerous compile-time safety checks that adds no runtime overhead.&amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/book/README.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===XMLHttpRequest===&lt;br /&gt;
&amp;quot;[https://xhr.spec.whatwg.org/ XMLHttpRequest] is a definition of an [https://en.wikipedia.org/wiki/Application_programming_interface API] that provides scripted client functionality for transferring data between a client and a server.&amp;quot;&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/&amp;lt;/ref&amp;gt; XMLHttpRequest provides a way for data to be retrieved from a URL without having to retrieve the entire page. It supports protocols other than HTTP and can be used to retrieve any type of data.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
* Steps for installing [https://github.com/rust-lang/rust rust]&lt;br /&gt;
* Building [https://github.com/servo/servo Servo]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=98986</id>
		<title>CSC/ECE 517 Fall 2015 M1504 Implement support for missing XMLHttpRequest APIs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_M1504_Implement_support_for_missing_XMLHttpRequest_APIs&amp;diff=98986"/>
		<updated>2015-11-08T22:01:40Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: Added Introduction section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt; is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]&amp;lt;ref&amp;gt;https://github.com/rust-lang/rust&amp;lt;/ref&amp;gt; and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla Research]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo is built on top of Rust to provide a secure and reliable foundation and is focused on creating a reliable and fast browser engine.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language.&lt;br /&gt;
&lt;br /&gt;
Rust is a modern, fast, memory safe and multithreaded programming language that focuses on speed and safety for developing reliable and efficient systems. It eliminates all data races by having numerous compile-time safety checks that adds no runtime overhead.&amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/book/README.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===XMLHttpRequest===&lt;br /&gt;
&amp;quot;[https://xhr.spec.whatwg.org/ XMLHttpRequest] is a definition of an [https://en.wikipedia.org/wiki/Application_programming_interface API] that provides scripted client functionality for transferring data between a client and a server.&amp;quot;&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/&amp;lt;/ref&amp;gt; XMLHttpRequest provides a way for data to be retrieved from a URL without having to retrieve the entire page. It supports protocols other than HTTP and can be used to retrieve any type of data.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_M1504_JJD&amp;diff=98195</id>
		<title>CSC/ECE 517 Fall 2015/oss M1504 JJD</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_M1504_JJD&amp;diff=98195"/>
		<updated>2015-11-06T00:52:59Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: reordering of sections&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;M1504: Implement support for missing XMLHttpRequest APIs&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[https://xhr.spec.whatwg.org/ XMLHttpRequest] is one of the implemented API specifications of Servo that relies upon JavaScript and is used for making dynamic HTTP requests. The goal of the project was to implement support for less common but missing features of the XMLHttpRequest API for [https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo].&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt; is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]&amp;lt;ref&amp;gt;https://github.com/rust-lang/rust&amp;lt;/ref&amp;gt; and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla Research]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo is built on top of Rust to provide a secure and reliable foundation and is focused on creating a reliable and fast browser engine.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language.&lt;br /&gt;
&lt;br /&gt;
Rust is a modern, fast, memory safe and multithreaded programming language that focuses on speed and safety for developing reliable and efficient systems. It eliminates all data races by having numerous compile-time safety checks that adds no runtime overhead.&amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/book/README.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===XMLHttpRequest===&lt;br /&gt;
&amp;quot;[https://xhr.spec.whatwg.org/ XMLHttpRequest] is a definition of an [https://en.wikipedia.org/wiki/Application_programming_interface API] that provides scripted client functionality for transferring data between a client and a server.&amp;quot;&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/&amp;lt;/ref&amp;gt; XMLHttpRequest provides a way for data to be retrieved from a URL without having to retrieve the entire page. It supports protocols other than HTTP and can be used to retrieve any type of data.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Scope==&lt;br /&gt;
The scope of the project was to complete the initial steps mentioned [https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs here].&lt;br /&gt;
&lt;br /&gt;
The steps are as follows:&lt;br /&gt;
* compile Servo and ensure that it runs on tests/html/about-mozilla.html&lt;br /&gt;
* uncomment the overrideMimeType API in XMLHttpRequest.webidl, and add a stub method that allows Servo to compile again to xmlhttprequest.rs.&lt;br /&gt;
* run the tests via ./mach test-wpt tests/wpt/web-platform-tests/XMLHttpRequest/ and adjust the expectations for any that now pass (tests/wpt/metadata/XMLHttpRequest/)&lt;br /&gt;
* add new override_charset and override_mime_type fields to the XMLHttpRequest structure&lt;br /&gt;
* implement the overrideMimeType steps described in the specification&lt;br /&gt;
* update any tests that now pass&lt;br /&gt;
&lt;br /&gt;
The subsequent steps mentioned [https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs here] are to be done for the final project.&lt;br /&gt;
&lt;br /&gt;
==Design Pattern==&lt;br /&gt;
Design patterns are not applicable as our task involved just implementing a method. However, the [[CSC/ECE_517_Fall_2015/oss_M1504_JJD#Implementation|Implementation]] section below provides details of the steps as why it was implemented, the way it was implemented.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
The following steps were followed to meet the project requirements as per this [https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs github page].&lt;br /&gt;
&lt;br /&gt;
===Step 1===&lt;br /&gt;
&lt;br /&gt;
As we need to implement the overrideMimeType() method, we have uncommented the overrideMimeType() method from the XMLHttpRequest interface (components/script/dom/webidls/XMLHttpRequest.webidl).&lt;br /&gt;
&lt;br /&gt;
[[File:Uncomment-overrideMimeType.png]]&lt;br /&gt;
&lt;br /&gt;
===Step 2===&lt;br /&gt;
&lt;br /&gt;
As two new fields are necessary for overrideMimeType() method implementation, override_mime_type to store the mime type of the mime passed in the argument and override_charset to store the charset of the mime passed in the argument. &lt;br /&gt;
Hence, we have added two new fields: override_mime_type and override_charset to the XMLHttpRequest structure.&lt;br /&gt;
&lt;br /&gt;
[[File:XHRStruct.png]]&lt;br /&gt;
&lt;br /&gt;
===Step 3===&lt;br /&gt;
&lt;br /&gt;
Finally, we have implemented the overrideMimeType method according to the [https://xhr.spec.whatwg.org/#the-overridemimetype%28%29-method XHR specifications].&lt;br /&gt;
* If the state is loading or done, we have returned Invalid State Error&lt;br /&gt;
* Then we have parsed the mime passed in the argument&lt;br /&gt;
* If the parsing of mime was successful, we have saved the appropriate values in override_mime_type and override_charset&lt;br /&gt;
&lt;br /&gt;
[[File:overrideMimeType.png]]&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
Following are the steps to run all the tests for XMLHttpRequest:&lt;br /&gt;
&lt;br /&gt;
# Install the pre-requisites required for servo as mentioned [https://github.com/servo/servo/blob/master/README.md here] &lt;br /&gt;
# Run the following commands&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
  cd&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 git clone https://github.com/jitendra29/servo.git&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 cd servo&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 git checkout -b test origin/overrideMimeType&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 ./mach build --release&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: It may take around 30 mins to build&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 ./mach test-wpt XMLHttpRequest/ --release&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see that all tests pass as expected.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' We have not added any new tests to the test suite as servo follows TDD and tests were previously written for XMLHttpRequest. We have just adjusted some of the test expectations for the tests which now pass due to our implementation.&lt;br /&gt;
&lt;br /&gt;
=== Testing From UI ===&lt;br /&gt;
&lt;br /&gt;
Our project cannot be tested from UI since it is basically improving some javascript features (XMLHttpRequest) in servo. However you can check that it doesn't break the existing code and the browser runs correctly by running a test page on servo after performing the build as mentioned above.&lt;br /&gt;
&lt;br /&gt;
Run the following command after the project is build: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 ./mach run tests/html/about-mozilla.html&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
==Pull Request==&lt;br /&gt;
Here is our [https://github.com/servo/servo/pull/8182 pull request]. In the link you can see all code snippets changed due to implementing the above steps, as well as integration test progression information.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_M1504_JJD&amp;diff=98189</id>
		<title>CSC/ECE 517 Fall 2015/oss M1504 JJD</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_M1504_JJD&amp;diff=98189"/>
		<updated>2015-11-05T23:16:06Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: Added Scope section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;M1504: Implement support for missing XMLHttpRequest APIs&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[https://xhr.spec.whatwg.org/ XMLHttpRequest] is one of the implemented API specifications of Servo that relies upon JavaScript and is used for making dynamic HTTP requests. The goal of the project was to implement support for less common but missing features of the XMLHttpRequest API for [https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo].&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt; is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]&amp;lt;ref&amp;gt;https://github.com/rust-lang/rust&amp;lt;/ref&amp;gt; and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla Research]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo is built on top of Rust to provide a secure and reliable foundation and is focused on creating a reliable and fast browser engine.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language.&lt;br /&gt;
&lt;br /&gt;
Rust is a modern, fast, memory safe and multithreaded programming language that focuses on speed and safety for developing reliable and efficient systems. It eliminates all data races by having numerous compile-time safety checks that adds no runtime overhead.&amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/book/README.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===XMLHttpRequest===&lt;br /&gt;
&amp;quot;[https://xhr.spec.whatwg.org/ XMLHttpRequest] is a definition of an [https://en.wikipedia.org/wiki/Application_programming_interface API] that provides scripted client functionality for transferring data between a client and a server.&amp;quot;&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/&amp;lt;/ref&amp;gt; XMLHttpRequest provides a way for data to be retrieved from a URL without having to retrieve the entire page. It supports protocols other than HTTP and can be used to retrieve any type of data.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Design Pattern==&lt;br /&gt;
Design patterns are not applicable as our task involved just implementing a method. However, the [[CSC/ECE_517_Fall_2015/oss_M1504_JJD#Implementation|Implementation]] section below provides details of the steps as why it was implemented, the way it was implemented.&lt;br /&gt;
&lt;br /&gt;
==Scope==&lt;br /&gt;
The scope of the project was to complete the initial steps mentioned [https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs here].&lt;br /&gt;
&lt;br /&gt;
The steps are as follows:&lt;br /&gt;
* compile Servo and ensure that it runs on tests/html/about-mozilla.html&lt;br /&gt;
* uncomment the overrideMimeType API in XMLHttpRequest.webidl, and add a stub method that allows Servo to compile again to xmlhttprequest.rs.&lt;br /&gt;
* run the tests via ./mach test-wpt tests/wpt/web-platform-tests/XMLHttpRequest/ and adjust the expectations for any that now pass (tests/wpt/metadata/XMLHttpRequest/)&lt;br /&gt;
* add new override_charset and override_mime_type fields to the XMLHttpRequest structure&lt;br /&gt;
* implement the overrideMimeType steps described in the specification&lt;br /&gt;
* update any tests that now pass&lt;br /&gt;
&lt;br /&gt;
The subsequent steps mentioned [https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs here] are to be done for the final project.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
The following steps were followed to meet the project requirements as per this [https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs github page].&lt;br /&gt;
&lt;br /&gt;
===Step 1===&lt;br /&gt;
&lt;br /&gt;
As we need to implement the overrideMimeType() method, we have uncommented the overrideMimeType() method from the XMLHttpRequest interface (components/script/dom/webidls/XMLHttpRequest.webidl).&lt;br /&gt;
&lt;br /&gt;
[[File:Uncomment-overrideMimeType.png]]&lt;br /&gt;
&lt;br /&gt;
===Step 2===&lt;br /&gt;
&lt;br /&gt;
As two new fields are necessary for overrideMimeType() method implementation, override_mime_type to store the mime type of the mime passed in the argument and override_charset to store the charset of the mime passed in the argument. &lt;br /&gt;
Hence, we have added two new fields: override_mime_type and override_charset to the XMLHttpRequest structure.&lt;br /&gt;
&lt;br /&gt;
[[File:XHRStruct.png]]&lt;br /&gt;
&lt;br /&gt;
===Step 3===&lt;br /&gt;
&lt;br /&gt;
Finally, we have implemented the overrideMimeType method according to the [https://xhr.spec.whatwg.org/#the-overridemimetype%28%29-method XHR specifications].&lt;br /&gt;
* If the state is loading or done, we have returned Invalid State Error&lt;br /&gt;
* Then we have parsed the mime passed in the argument&lt;br /&gt;
* If the parsing of mime was successful, we have saved the appropriate values in override_mime_type and override_charset&lt;br /&gt;
&lt;br /&gt;
[[File:overrideMimeType.png]]&lt;br /&gt;
&lt;br /&gt;
==Pull Request==&lt;br /&gt;
Here is our [https://github.com/servo/servo/pull/8182 pull request]. In the link you can see all code snippets changed due to implementing the above steps, as well as integration test progression information.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_M1504_JJD&amp;diff=98181</id>
		<title>CSC/ECE 517 Fall 2015/oss M1504 JJD</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_M1504_JJD&amp;diff=98181"/>
		<updated>2015-11-05T22:50:33Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: Added Design Patterns section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;M1504: Implement support for missing XMLHttpRequest APIs&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[https://xhr.spec.whatwg.org/ XMLHttpRequest] is one of the implemented API specifications of Servo that relies upon JavaScript and is used for making dynamic HTTP requests. The goal of the project was to implement support for less common but missing features of the XMLHttpRequest API for [https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo].&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt; is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]&amp;lt;ref&amp;gt;https://github.com/rust-lang/rust&amp;lt;/ref&amp;gt; and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla Research]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo is built on top of Rust to provide a secure and reliable foundation and is focused on creating a reliable and fast browser engine.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language.&lt;br /&gt;
&lt;br /&gt;
Rust is a modern, fast, memory safe and multithreaded programming language that focuses on speed and safety for developing reliable and efficient systems. It eliminates all data races by having numerous compile-time safety checks that adds no runtime overhead.&amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/book/README.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===XMLHttpRequest===&lt;br /&gt;
&amp;quot;[https://xhr.spec.whatwg.org/ XMLHttpRequest] is a definition of an [https://en.wikipedia.org/wiki/Application_programming_interface API] that provides scripted client functionality for transferring data between a client and a server.&amp;quot;&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/&amp;lt;/ref&amp;gt; XMLHttpRequest provides a way for data to be retrieved from a URL without having to retrieve the entire page. It supports protocols other than HTTP and can be used to retrieve any type of data.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Design Pattern==&lt;br /&gt;
Design patterns are not applicable as our task involved just implementing a method. However, the [[CSC/ECE_517_Fall_2015/oss_M1504_JJD#Implementation|Implementation]] section below provides details of the steps as why it was implemented, the way it was implemented.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
The following steps were followed to meet the project requirements as per this [https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs github page].&lt;br /&gt;
&lt;br /&gt;
===Step 1===&lt;br /&gt;
&lt;br /&gt;
As we need to implement the overrideMimeType() method, we have uncommented the overrideMimeType() method from the XMLHttpRequest interface (components/script/dom/webidls/XMLHttpRequest.webidl).&lt;br /&gt;
&lt;br /&gt;
[[File:Uncomment-overrideMimeType.png]]&lt;br /&gt;
&lt;br /&gt;
===Step 2===&lt;br /&gt;
&lt;br /&gt;
As two new fields are necessary for overrideMimeType() method implementation, override_mime_type to store the mime type of the mime passed in the argument and override_charset to store the charset of the mime passed in the argument. &lt;br /&gt;
Hence, we have added two new fields: override_mime_type and override_charset to the XMLHttpRequest structure.&lt;br /&gt;
&lt;br /&gt;
[[File:XHRStruct.png]]&lt;br /&gt;
&lt;br /&gt;
===Step 3===&lt;br /&gt;
&lt;br /&gt;
Finally, we have implemented the overrideMimeType method according to the [https://xhr.spec.whatwg.org/#the-overridemimetype%28%29-method XHR specifications].&lt;br /&gt;
* If the state is loading or done, we have returned Invalid State Error&lt;br /&gt;
* Then we have parsed the mime passed in the argument&lt;br /&gt;
* If the parsing of mime was successful, we have saved the appropriate values in override_mime_type and override_charset&lt;br /&gt;
&lt;br /&gt;
[[File:overrideMimeType.png]]&lt;br /&gt;
&lt;br /&gt;
==Pull Request==&lt;br /&gt;
Here is our [https://github.com/servo/servo/pull/8182 pull request]. In the link you can see all code snippets changed due to implementing the above steps, as well as integration test progression information.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_M1504_JJD&amp;diff=98179</id>
		<title>CSC/ECE 517 Fall 2015/oss M1504 JJD</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_M1504_JJD&amp;diff=98179"/>
		<updated>2015-11-05T22:39:59Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: Description of the steps performed.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;M1504: Implement support for missing XMLHttpRequest APIs&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[https://xhr.spec.whatwg.org/ XMLHttpRequest] is one of the implemented API specifications of Servo that relies upon JavaScript and is used for making dynamic HTTP requests. The goal of the project was to implement support for less common but missing features of the XMLHttpRequest API for [https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo].&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt; is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]&amp;lt;ref&amp;gt;https://github.com/rust-lang/rust&amp;lt;/ref&amp;gt; and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla Research]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo is built on top of Rust to provide a secure and reliable foundation and is focused on creating a reliable and fast browser engine.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language.&lt;br /&gt;
&lt;br /&gt;
Rust is a modern, fast, memory safe and multithreaded programming language that focuses on speed and safety for developing reliable and efficient systems. It eliminates all data races by having numerous compile-time safety checks that adds no runtime overhead.&amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/book/README.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===XMLHttpRequest===&lt;br /&gt;
&amp;quot;[https://xhr.spec.whatwg.org/ XMLHttpRequest] is a definition of an [https://en.wikipedia.org/wiki/Application_programming_interface API] that provides scripted client functionality for transferring data between a client and a server.&amp;quot;&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/&amp;lt;/ref&amp;gt; XMLHttpRequest provides a way for data to be retrieved from a URL without having to retrieve the entire page. It supports protocols other than HTTP and can be used to retrieve any type of data.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
The following steps were followed to meet the project requirements as per this [https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs github page].&lt;br /&gt;
&lt;br /&gt;
===Step 1===&lt;br /&gt;
&lt;br /&gt;
As we need to implement the overrideMimeType() method, we have uncommented the overrideMimeType() method from the XMLHttpRequest interface (components/script/dom/webidls/XMLHttpRequest.webidl).&lt;br /&gt;
&lt;br /&gt;
[[File:Uncomment-overrideMimeType.png]]&lt;br /&gt;
&lt;br /&gt;
===Step 2===&lt;br /&gt;
&lt;br /&gt;
As two new fields are necessary for overrideMimeType() method implementation, override_mime_type to store the mime type of the mime passed in the argument and override_charset to store the charset of the mime passed in the argument. &lt;br /&gt;
Hence, we have added two new fields: override_mime_type and override_charset to the XMLHttpRequest structure.&lt;br /&gt;
&lt;br /&gt;
[[File:XHRStruct.png]]&lt;br /&gt;
&lt;br /&gt;
===Step 3===&lt;br /&gt;
&lt;br /&gt;
Finally, we have implemented the overrideMimeType method according to the [https://xhr.spec.whatwg.org/#the-overridemimetype%28%29-method XHR specifications].&lt;br /&gt;
* If the state is loading or done, we have returned Invalid State Error&lt;br /&gt;
* Then we have parsed the mime passed in the argument.&lt;br /&gt;
* If the parsing of mime was successful, we have saved the appropriate values in override_mime_type and override_charset.&lt;br /&gt;
&lt;br /&gt;
[[File:overrideMimeType.png]]&lt;br /&gt;
&lt;br /&gt;
==Pull Request==&lt;br /&gt;
Here is our [https://github.com/servo/servo/pull/8182 pull request]. In the link you can see all code snippets changed due to implementing the above steps, as well as integration test progression information.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_M1504_JJD&amp;diff=97978</id>
		<title>CSC/ECE 517 Fall 2015/oss M1504 JJD</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_M1504_JJD&amp;diff=97978"/>
		<updated>2015-11-01T01:31:17Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: Added content to Introduction section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;M1504: Implement support for missing XMLHttpRequest APIs&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[https://xhr.spec.whatwg.org/ XMLHttpRequest] is one of the implemented API specifications of Servo that relies upon JavaScript and is used for making dynamic HTTP requests. The goal of the project was to implement support for less common but missing features of the XMLHttpRequest API for [https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo].&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt; is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]&amp;lt;ref&amp;gt;https://github.com/rust-lang/rust&amp;lt;/ref&amp;gt; and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla Research]. The aim of the project is not to create a full browser but is rather to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Servo is built on top of Rust to provide a secure and reliable foundation and is focused on creating a reliable and fast browser engine.&lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language.&lt;br /&gt;
&lt;br /&gt;
Rust is a modern, fast, memory safe and multithreaded programming language that focuses on speed and safety for developing reliable and efficient systems. It eliminates all data races by having numerous compile-time safety checks that adds no runtime overhead.&amp;lt;ref&amp;gt; http://doc.rust-lang.org/nightly/book/README.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===XMLHttpRequest===&lt;br /&gt;
&amp;quot;[https://xhr.spec.whatwg.org/ XMLHttpRequest] is a definition of an [https://en.wikipedia.org/wiki/Application_programming_interface API] that provides scripted client functionality for transferring data between a client and a server.&amp;quot;&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/&amp;lt;/ref&amp;gt; XMLHttpRequest provides a way for data to be retrieved from a URL without having to retrieve the entire page. It supports protocols other than HTTP and can be used to retrieve any type of data.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
The following steps were followed to meet the project requirements as per this [https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs github page].&lt;br /&gt;
&lt;br /&gt;
===Step 1===&lt;br /&gt;
&lt;br /&gt;
We uncommented the overrideMimeType() method from the XMLHttpRequest interface (components/script/dom/webidls/XMLHttpRequest.webidl)&lt;br /&gt;
&lt;br /&gt;
[[File:Uncomment-overrideMimeType.png]]&lt;br /&gt;
&lt;br /&gt;
===Step 2===&lt;br /&gt;
&lt;br /&gt;
We have added two new fields: override_mime_type and override_charset to the XMLHttpRequest structure.&lt;br /&gt;
&lt;br /&gt;
[[File:XHRStruct.png]]&lt;br /&gt;
&lt;br /&gt;
===Step 3===&lt;br /&gt;
&lt;br /&gt;
Finally, we have implemented the overrideMimeType method according to the [https://xhr.spec.whatwg.org/#the-overridemimetype%28%29-method XHR specifications]&lt;br /&gt;
&lt;br /&gt;
[[File:overrideMimeType.png]]&lt;br /&gt;
&lt;br /&gt;
==Pull Request==&lt;br /&gt;
Here is our [https://github.com/servo/servo/pull/8182 pull request]. In the link you can see all code snippets changed due to implementing the above steps, as well as integration test progression information.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:OverrideMimeType.png&amp;diff=97951</id>
		<title>File:OverrideMimeType.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:OverrideMimeType.png&amp;diff=97951"/>
		<updated>2015-11-01T01:08:37Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: uploaded a new version of &amp;amp;quot;File:OverrideMimeType.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:XHRStruct.png&amp;diff=97946</id>
		<title>File:XHRStruct.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:XHRStruct.png&amp;diff=97946"/>
		<updated>2015-11-01T01:04:59Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: uploaded a new version of &amp;amp;quot;File:XHRStruct.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:XHRStruct.png&amp;diff=97944</id>
		<title>File:XHRStruct.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:XHRStruct.png&amp;diff=97944"/>
		<updated>2015-11-01T01:03:23Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: uploaded a new version of &amp;amp;quot;File:XHRStruct.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Uncomment-overrideMimeType.png&amp;diff=97941</id>
		<title>File:Uncomment-overrideMimeType.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Uncomment-overrideMimeType.png&amp;diff=97941"/>
		<updated>2015-11-01T01:00:16Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: uploaded a new version of &amp;amp;quot;File:Uncomment-overrideMimeType.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_M1504_JJD&amp;diff=97870</id>
		<title>CSC/ECE 517 Fall 2015/oss M1504 JJD</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_M1504_JJD&amp;diff=97870"/>
		<updated>2015-11-01T00:04:44Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: Added information before introduction.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;M1504: Implement support for missing XMLHttpRequest APIs&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[https://xhr.spec.whatwg.org/ XMLHttpRequest] is one of the implemented API specifications of Servo that relies upon JavaScript and is used for making dynamic HTTP requests. The goal of the project was to implement support for less common but missing features of the XMLHttpRequest API for [https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo].&amp;lt;ref&amp;gt;https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt; is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]&amp;lt;ref&amp;gt;https://github.com/rust-lang/rust&amp;lt;/ref&amp;gt; and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla Research]. The aim of the project is to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language.&lt;br /&gt;
&lt;br /&gt;
===XMLHttpRequest===&lt;br /&gt;
&amp;quot;[https://xhr.spec.whatwg.org/ XMLHttpRequest] is a definition of an [https://en.wikipedia.org/wiki/Application_programming_interface API] that provides scripted client functionality for transferring data between a client and a server.&amp;quot;&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/&amp;lt;/ref&amp;gt; XMLHttpRequest provides a way for data to be retrieved from a URL without having to retrieve the entire page. It supports protocols other than HTTP and can be used to retrieve any type of data.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
===Initial Steps===&lt;br /&gt;
The following steps were followed to meet the project requirements as per this [https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs github page].&lt;br /&gt;
&lt;br /&gt;
*compile Servo and ensure that it runs on tests/html/about-mozilla.html&lt;br /&gt;
*uncomment the overrideMimeType API in XMLHttpRequest.webidl, and add a stub method that allows Servo to compile again to xmlhttprequest.rs.&lt;br /&gt;
*run the tests via ./mach test-wpt tests/wpt/web-platform-tests/XMLHttpRequest/ and adjust the expectations for any that now pass (tests/wpt/metadata/XMLHttpRequest/)&lt;br /&gt;
*add new override_charset and override_mime_type fields to the XMLHttpRequest structure&lt;br /&gt;
*implement the overrideMimeType steps described in the [https://xhr.spec.whatwg.org/#the-overridemimetype%28%29-method specifications]&lt;br /&gt;
*update any tests that now pass&lt;br /&gt;
&lt;br /&gt;
===Accepted Pull Request===&lt;br /&gt;
Here is our [https://github.com/servo/servo/pull/8182 pull request]. In the link you can see all code snippets changed, as well as integration test progression information.&lt;br /&gt;
&lt;br /&gt;
===Design Patterns and Principles===&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_M1504_JJD&amp;diff=97850</id>
		<title>CSC/ECE 517 Fall 2015/oss M1504 JJD</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_M1504_JJD&amp;diff=97850"/>
		<updated>2015-10-31T23:33:43Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: Formatting.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;5&amp;quot;&amp;gt;M1504: Implement support for missing XMLHttpRequest APIs&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The goal of this project was to implement support for missing less-common features of the XMLHttpRequest API for [https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo].&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt; is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]&amp;lt;ref&amp;gt;https://github.com/rust-lang/rust&amp;lt;/ref&amp;gt; and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla Research]. The aim of the project is to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language.&lt;br /&gt;
&lt;br /&gt;
===XMLHttpRequest===&lt;br /&gt;
&amp;quot;[https://xhr.spec.whatwg.org/ XMLHttpRequest] is a definition of an [https://en.wikipedia.org/wiki/Application_programming_interface API] that provides scripted client functionality for transferring data between a client and a server.&amp;quot;&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/&amp;lt;/ref&amp;gt; XMLHttpRequest provides a way for data to be retrieved from a URL without having to retrieve the entire page. It supports protocols other than HTTP and can be used to retrieve any type of data.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
===Initial Steps===&lt;br /&gt;
The following steps were followed to meet the project requirements as per this [https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs github page].&lt;br /&gt;
&lt;br /&gt;
*compile Servo and ensure that it runs on tests/html/about-mozilla.html&lt;br /&gt;
*uncomment the overrideMimeType API in XMLHttpRequest.webidl, and add a stub method that allows Servo to compile again to xmlhttprequest.rs.&lt;br /&gt;
*run the tests via ./mach test-wpt tests/wpt/web-platform-tests/XMLHttpRequest/ and adjust the expectations for any that now pass (tests/wpt/metadata/XMLHttpRequest/)&lt;br /&gt;
*add new override_charset and override_mime_type fields to the XMLHttpRequest structure&lt;br /&gt;
*implement the overrideMimeType steps described in the [https://xhr.spec.whatwg.org/#the-overridemimetype%28%29-method specifications]&lt;br /&gt;
*update any tests that now pass&lt;br /&gt;
&lt;br /&gt;
===Accepted Pull Request===&lt;br /&gt;
Here is our [https://github.com/servo/servo/pull/8182 pull request]. In the link you can see all code snippets changed, as well as integration test progression information.&lt;br /&gt;
&lt;br /&gt;
===Design Patterns and Principles===&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_M1504_JJD&amp;diff=97804</id>
		<title>CSC/ECE 517 Fall 2015/oss M1504 JJD</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_M1504_JJD&amp;diff=97804"/>
		<updated>2015-10-31T23:04:15Z</updated>

		<summary type="html">&lt;p&gt;Jmehta2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''M1504: Implement support for missing XMLHttpRequest APIs'''==&lt;br /&gt;
The goal of this project was to implement support for missing less-common features of the XMLHttpRequest API for [https://en.wikipedia.org/wiki/Servo_(layout_engine) Servo].&lt;br /&gt;
&lt;br /&gt;
===Servo===&lt;br /&gt;
&lt;br /&gt;
Servo &amp;lt;ref&amp;gt; https://github.com/servo/servo &amp;lt;/ref&amp;gt; is a web browser layout engine written in [https://github.com/rust-lang/rust Rust]&amp;lt;ref&amp;gt;https://github.com/rust-lang/rust&amp;lt;/ref&amp;gt; and is currently being developed by [https://en.wikipedia.org/wiki/Mozilla Mozilla Research]. The aim of the project is to create a highly parallel environment that allows for many components be handled by fine-grained, isolated tasks.&amp;lt;ref&amp;gt;https://en.wikipedia.org/wiki/Servo_(layout_engine)&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Rust===&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Rust_(programming_language) Rust] is a multi-paradigm, compiled programming language that is a good language for creating highly safe systems. Rust and Servo have a symbiotic relationship as the development of servo has influenced the design of the language.&lt;br /&gt;
&lt;br /&gt;
===XMLHttpRequest===&lt;br /&gt;
&amp;quot;[https://xhr.spec.whatwg.org/ XMLHttpRequest] is a definition of an [https://en.wikipedia.org/wiki/Application_programming_interface API] that provides scripted client functionality for transferring data between a client and a server.&amp;quot;&amp;lt;ref&amp;gt;https://xhr.spec.whatwg.org/&amp;lt;/ref&amp;gt; XMLHttpRequest provides a way for data to be retrieved from a URL without having to retrieve the entire page. It supports protocols other than HTTP and can be used to retrieve any type of data.&amp;lt;ref&amp;gt;https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
===Initial Steps===&lt;br /&gt;
The following steps were followed to meet the project requirements as per this [https://github.com/servo/servo/wiki/Implement-support-for-missing-XMLHttpRequest-APIs github page].&lt;br /&gt;
&lt;br /&gt;
*compile Servo and ensure that it runs on tests/html/about-mozilla.html&lt;br /&gt;
*uncomment the overrideMimeType API in XMLHttpRequest.webidl, and add a stub method that allows Servo to compile again to xmlhttprequest.rs.&lt;br /&gt;
*run the tests via ./mach test-wpt tests/wpt/web-platform-tests/XMLHttpRequest/ and adjust the expectations for any that now pass (tests/wpt/metadata/XMLHttpRequest/)&lt;br /&gt;
*add new override_charset and override_mime_type fields to the XMLHttpRequest structure&lt;br /&gt;
*implement the overrideMimeType steps described in the [https://xhr.spec.whatwg.org/#the-overridemimetype%28%29-method specifications]&lt;br /&gt;
*update any tests that now pass&lt;br /&gt;
&lt;br /&gt;
===Accepted Pull Request===&lt;br /&gt;
Here is our [https://github.com/servo/servo/pull/8182 pull request]. In the link you can see all code snippets changed, as well as integration test progression information.&lt;br /&gt;
&lt;br /&gt;
===Design Patterns and Principles===&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jmehta2</name></author>
	</entry>
</feed>