Auto merge of #14895 - dowoncha:request-websocket, r=jdm

Added Websocket to RequestMode enum

Added Websocket to RequestMode enum
---
<!-- 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 #14785  (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because matching the enum should have default control flow.

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14895)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-01-08 08:57:52 -08:00 committed by GitHub
commit 8fff2f29d0
3 changed files with 3 additions and 0 deletions

View file

@ -330,6 +330,7 @@ impl CoreResourceManager {
let ua = self.user_agent.clone();
let dc = self.devtools_chan.clone();
let filemanager = self.filemanager.clone();
thread::Builder::new().name(format!("fetch thread for {}", init.url)).spawn(move || {
let request = Request::from_init(init);
// XXXManishearth: Check origin against pipeline id (also ensure that the mode is allowed)

View file

@ -77,6 +77,7 @@ pub enum RequestMode {
SameOrigin,
NoCors,
CorsMode,
WebSocket
}
/// Request [credentials mode](https://fetch.spec.whatwg.org/#concept-request-credentials-mode)

View file

@ -826,6 +826,7 @@ impl Into<RequestMode> for NetTraitsRequestMode {
NetTraitsRequestMode::SameOrigin => RequestMode::Same_origin,
NetTraitsRequestMode::NoCors => RequestMode::No_cors,
NetTraitsRequestMode::CorsMode => RequestMode::Cors,
NetTraitsRequestMode::WebSocket => unreachable!("Websocket request mode should never be exposed to JS"),
}
}
}