Commit graph

545 commits

Author SHA1 Message Date
Zhen Zhang
a51db4cfa8 Implement trait-based ResourceThreads and clean up related naming issues
Changes include:

- Introduce an IpcSend trait to abstract over a collection of IpcSenders
- Implement ResourceThreads collection to abstract the resource-related
  sub threads across the component
- Rename original ResourceThread and ControlMsg into an unifed CoreResource__
  to accommodate above changes and avoid confusions
2016-05-20 08:00:16 +08:00
Josh Matthews
9e8cf19e51 Add timeline markers for HTTP requests, JS evaluation, and HTML parsing. 2016-05-18 08:02:42 -05:00
bors-servo
c519739b7b Auto merge of #11196 - fduraffourg:master, r=jdm
Add unit tests for cookies handling

Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data:
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #9965

Either:
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because _____

Add unit tests for the `net` component about cookies. The tests are generated
with a new `mach update-net-cookies` command from this repo: https://github.com/abarth/http-state.

This PR also includes two trivial bug fixes about cookie handling.

From all the tests included, the following ones are currently failing:

- cookie_http_state::test_0003
- cookie_http_state::test_0006
- cookie_http_state::test_attribute0004
- cookie_http_state::test_attribute0005
- cookie_http_state::test_attribute0007
- cookie_http_state::test_attribute0008
- cookie_http_state::test_domain0017
- cookie_http_state::test_mozilla0001
- cookie_http_state::test_mozilla0002
- cookie_http_state::test_mozilla0003
- cookie_http_state::test_mozilla0005
- cookie_http_state::test_mozilla0007
- cookie_http_state::test_mozilla0009
- cookie_http_state::test_mozilla0010
- cookie_http_state::test_mozilla0013

`test_000[36]` and `test_mozilla*` are failing because there is currently no
method to clean a `net::cookie_storage` from expired cookies.

`test_attribute000[4578]` are failing because hyper does not parse the `Secure`
attribute correctly. I will open an issue on the upstream project.

`test_domain0017` fails because the TLD .org is not on the PUB_DOMAINS list.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11196)
<!-- Reviewable:end -->
2016-05-17 16:34:16 -07:00
Anthony Ramine
b9cda99ca5 Update internal crates to bitflags 0.7 2016-05-17 23:34:04 +02:00
Anthony Ramine
d580226a9c Reorder dependencies in many Cargo.toml files 2016-05-17 23:34:02 +02:00
Florian Duraffourg
4fb53c8256 Correct cookie handling behavior
- Cookies with empty values are not to be ignored as per RFC6265
- A space should separate two cookie-pairs as per RFC6265 section
  4.2.1
2016-05-17 10:13:47 +02:00
Per Lundberg
2f7ed1d73e Removed unused imports
This fixes #11185.
2016-05-15 22:24:26 +03:00
bors-servo
d55884d73e Auto merge of #11148 - mbrubeck:warnings, r=metajack
Fix some warnings

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11148)
<!-- Reviewable:end -->
2016-05-12 06:19:10 -07:00
bors-servo
e2a5b1cb71 Auto merge of #11129 - KiChjang:fetch-read-block, r=jdm
Use read_block in http_network_fetch

Previously the commented out code was not working because there was a deadlock situation where `res_body` is being locked and borrowed to read the inner `body` if it is a `ResponseBody::Receiving` variant, and then locked and borrowed mutably to change `res_body` to `ResponseBody::Done`.

r? @jdm

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11129)
<!-- Reviewable:end -->
2016-05-11 23:44:15 -07:00
Matt Brubeck
d560ae79b4 Fix some warnings 2016-05-11 21:03:12 -07:00
Keith Yeung
7a72981d87 Use read_block in http_network_fetch 2016-05-11 09:34:43 -04:00
bors-servo
b61ad4190f Auto merge of #11029 - izgzhen:filemanager_thread, r=Manishearth
Add FileManagerThread

This is intended to support the File API implementation. Basically an event loop with three kinds of messages:

+ Select a file
+ Read a file with ID
+ Delete the ID from manager-owned map

The design decision in this PR is not the final (or best I think) version, welcome reviews :)

TODOs:

- [x] Add multiple file selection

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11029)
<!-- Reviewable:end -->
2016-05-11 04:28:58 -07:00
Zhen Zhang
c618ee21d0 add filemanager_thread 2016-05-11 15:14:03 +08:00
Matt Brubeck
5695da0c38 Use openssl-verify to check certificate + hostname
Fixes #4954.
2016-05-10 11:30:11 -07:00
Matt Brubeck
c344461017 Move http_loader::Connector to a separate module 2016-05-10 11:20:32 -07:00
zakorgy
ed92f31ebc Remove BluetoothDevice members 2016-05-05 12:47:52 +02:00
bors-servo
20fc8b3c8d Auto merge of #10932 - jdm:401, r=SimonSapin
Add the requesting URL to the 401 prompt. Only show the 401 prompt wh…

…en the WWW-Authenticate header is present.

Fixes #10912.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10932)
<!-- Reviewable:end -->
2016-05-04 11:37:16 -07:00
Josh Matthews
cb63ad6c87 Add the requesting URL to the 401 prompt. Only show the 401 prompt when the WWW-Authenticate header is present. 2016-05-03 13:19:42 -04:00
fokinv
c8672ed0af Refactor IPC-message sending 2016-05-03 11:35:34 +02:00
Attila Dusnoki
ecf4c942da BluetoothThread refactor 2016-05-03 11:35:33 +02:00
zakorgy
ef296b86e8 Refactor scan filter 2016-05-03 11:35:32 +02:00
fokinv
f47f8d1a5c Style fix 2016-05-03 11:35:28 +02:00
Attila Dusnoki
b851045415 Fix incorrect behaviours 2016-05-03 11:35:25 +02:00
zakorgy
66fbc4ac46 requestDevice options (filters and optionalServices) 2016-05-03 11:35:18 +02:00
fokinv
b01c52c18f Implementation of the getPrimaryService(s), the getCharacteristic(s) and the getDescriptor(s) functions. 2016-05-03 10:17:42 +02:00
fokinv
9825ea41b4 Add Bluetooth IPC support 2016-05-03 10:17:41 +02:00
Joshua Holmer
8bb740e95e Remove CacheRequestDetails
Fixes #10904
2016-05-02 22:08:16 -04:00
bors-servo
0f1a921ba6 Auto merge of #10928 - servo:warnings, r=mbrubeck
Fix some warnings

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10928)
<!-- Reviewable:end -->
2016-04-30 05:16:46 -07:00
Simon Sapin
756a34e93d Fix some warnings 2016-04-29 19:14:46 +02:00
Ramana Venkata
7c14de6d4b Implement fetching file URL's 2016-04-29 16:06:07 +05:30
bors-servo
3d38a60cee Auto merge of #10867 - danlrobertson:sandbox, r=KiChjang
Fix logic for cors cache match

The current logic for a cors cache match does not consider "credentials is false and request's credentials mode is not "include" or credentials is true."

I could have missed something, but `CacheRequestDetails::credentials` is set to true if credentials mode is "include", and false otherwise. So `(!cors_cache.credentials && !cors_req.credentials) || cors_cache.credentials` would be directly following the spec, but unless I'm mistaken `cors_cache.credentials || !cors_req.credentials` is logically the same.

Fixes: #10525

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10867)
<!-- Reviewable:end -->
2016-04-28 13:36:05 -07:00
Daniel Robertson
483f07c8f0
Cleanup CORSCache
Remove the CORSCache trait, CORSCacheSender, CORSCacheThreadMsg, and
CORSCacheThread. Rename BasicCORSCache to CORSCache and keep its old
implementation of CORSCache.
2016-04-27 17:02:54 -04:00
Daniel Robertson
153059c55c
Fix logic for cors cache match
The current logic for a cors cache match does not consider "credentials
is false and request's credentials mode is not "include" or credentials
is true."
2016-04-27 16:39:57 -04:00
bors-servo
88020e9151 Auto merge of #10869 - frewsxcv:dry, r=jdm
DRY out `StreamedResponse::from_http_response`.

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10869)
<!-- Reviewable:end -->
2016-04-27 04:23:34 -07:00
Corey Farwell
87b54ef685 DRY out StreamedResponse::from_http_response. 2016-04-27 01:00:50 -04:00
Corey Farwell
55c2f93740 Add NetworkError::LoadCancelled variant. 2016-04-27 00:25:27 -04:00
bors-servo
2729864af7 Auto merge of #10857 - servo:toml, r=nox
Simplify TOML syntax

* Sections like `[dependencies.foo]` can be entries in a `[dependencies]` section with the `{key = value}` syntax.
* Per-target dependencies can be expressed with more general `cfg(…)` conditions instead of exact target triples: https://github.com/rust-lang/cargo/pull/2328

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10857)
<!-- Reviewable:end -->
2016-04-26 15:46:37 -07:00
Simon Sapin
83b3ebf6ac Simplify TOML syntax
* Sections like `[dependencies.foo]` can be entries in a `[dependencies]`
  section with the `{key = value}` syntax.
* Per-target dependencies can be expressed with more general `cfg(…)`
  conditions instead of exact target triples:
  https://github.com/rust-lang/cargo/pull/2328
2016-04-26 23:51:36 +02:00
bors-servo
47efbea666 Auto merge of #10767 - akhan7:command, r=jdm
Added Store Command to ImageCache Task

Implemented last bullet of [Image conformance student project: Initial Steps](https://github.com/servo/servo/wiki/Image-load-conformance-student-project)

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10767)
<!-- Reviewable:end -->
2016-04-26 07:40:18 -07:00
Sagar Muchhal
5b9251ed3b Added Store Command to ImageCache Task 2016-04-26 03:05:15 -04:00
bors-servo
7a582b4bf9 Auto merge of #10800 - DDEFISHER:read_profile_dir_from_file, r=frewsxcv
read cookie_jar, hsts_list, auth_cache, and local_data from file if profile_dir option is present

Last step in Persistent sessions student project

"check for the presence of the profile directory command-line option in the ResourceThread constructor and look for files that will contain serialized versions of the previous steps. If they exist, populate the appropriate fields with deserialized versions of the file contents."

Also populated local_data in StorageManager constructor

I am not sure if the handling of decoding and encoding the Option Tm type was done in the cleanest way here.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10800)
<!-- Reviewable:end -->
2016-04-25 18:10:40 -07:00
Daniel
d9c32b273a read cookie_jar, hsts_list, auth_cache, and local_data from file if profile_dir option is present 2016-04-25 19:39:40 -04:00
bors-servo
81f6e70a62 Auto merge of #10785 - frewsxcv:loaderrortype-nostring, r=jdm
Refactor `LoadErrorType` to not require a `String` for every type.

Some of the `LoadErrorType` like `LoadCancelled` don't need a `String`
associated with the type since the variant is self-explanatory.

There are some variants that don't need an associated `String`, but that
can be cleaned up in a later refactor. Also, `net_traits::NetworkError`
currently requires a `String`, but that can potentially also be
refactored away too.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10785)
<!-- Reviewable:end -->
2016-04-25 14:37:44 -07:00
Corey Farwell
2675d9d1ff Refactor LoadErrorType to not require a String for every type.
Some of the `LoadErrorType` like `LoadCancelled` don't need a `String`
associated with the type since the variant is self-explanatory.

There are some variants that don't need an associated `String`, but that
can be cleaned up in a later refactor. Also, `net_traits::NetworkError`
currently requires a `String`, but that can potentially also be
refactored away too.
2016-04-25 17:10:33 -04:00
Rebecca
526525b835 Add referrer policy pass-through and referrer header logic
add pass-through from doc to http-loader for referrer_policy, ref_URL
add logic for setting referer header
add script pass-through for referrer
add unit tests for setting referer header
2016-04-25 16:41:06 -04:00
Simon Sapin
e662605138 More chrome URL hardenning and tests. 2016-04-23 20:28:03 +02:00
Simon Sapin
374679852c Make chrome: URLs have a "host". 2016-04-23 20:28:02 +02:00
Simon Sapin
7932ab6ac2 Upgrade to rust-url 1.0 and hyper 0.9 2016-04-23 20:27:58 +02:00
Zbynek Winkler
924d804583 Move '&&' to the end of the previous line.
Following https://github.com/servo/servo/issues/10692 this is just a
formating change to satisfy a new tidy requirement of not having '&&' at
the beginning of a line.
2016-04-22 14:28:18 +02:00
Daniel
d4f63cda5f write cookie_jar, hsts_list, auth_cache, and local_data to file if profile_dir option is present 2016-04-20 18:12:00 -04:00