mirror of
https://github.com/servo/servo.git
synced 2025-07-06 23:13:39 +01:00
Auto merge of #16137 - nox:die-rustc-serialize-die, r=emilio
Replace use of rustc_serialize::base64 by base64 <!-- 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/16137) <!-- Reviewable:end -->
This commit is contained in:
commit
d992442dc6
12 changed files with 30 additions and 34 deletions
|
@ -10,6 +10,7 @@ name = "net"
|
|||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
base64 = "0.4.1"
|
||||
brotli = "1.0.6"
|
||||
cookie = "0.2.5"
|
||||
devtools_traits = {path = "../devtools_traits"}
|
||||
|
@ -27,7 +28,6 @@ net_traits = {path = "../net_traits"}
|
|||
openssl = "0.7.6"
|
||||
openssl-verify = "0.1"
|
||||
profile_traits = {path = "../profile_traits"}
|
||||
rustc-serialize = "0.3"
|
||||
serde = "0.9"
|
||||
serde_derive = "0.9"
|
||||
serde_json = "0.9"
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use base64;
|
||||
use hyper::mime::{Attr, Mime, SubLevel, TopLevel, Value};
|
||||
use rustc_serialize::base64::FromBase64;
|
||||
use servo_url::ServoUrl;
|
||||
use url::Position;
|
||||
use url::percent_encoding::percent_decode;
|
||||
|
@ -46,7 +46,7 @@ pub fn decode(url: &ServoUrl) -> Result<DecodeData, DecodeError> {
|
|||
// FIXME(#2909): It’s unclear what to do with non-alphabet characters,
|
||||
// but Acid 3 apparently depends on spaces being ignored.
|
||||
bytes = bytes.into_iter().filter(|&b| b != b' ').collect::<Vec<u8>>();
|
||||
match bytes.from_base64() {
|
||||
match base64::decode(&bytes) {
|
||||
Err(..) => return Err(DecodeError::NonBase64DataUri),
|
||||
Ok(data) => bytes = data,
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#![feature(mpsc_select)]
|
||||
#![feature(step_by)]
|
||||
|
||||
extern crate base64;
|
||||
extern crate brotli;
|
||||
extern crate cookie as cookie_rs;
|
||||
extern crate devtools_traits;
|
||||
|
@ -25,7 +26,6 @@ extern crate net_traits;
|
|||
extern crate openssl;
|
||||
extern crate openssl_verify;
|
||||
extern crate profile_traits;
|
||||
extern crate rustc_serialize;
|
||||
extern crate serde;
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use base64;
|
||||
use net_traits::response::{Response, ResponseBody, ResponseType};
|
||||
use openssl::crypto::hash::{hash, Type as MessageDigest};
|
||||
use rustc_serialize::base64::{STANDARD, ToBase64};
|
||||
use std::iter::Filter;
|
||||
use std::str::Split;
|
||||
use std::sync::MutexGuard;
|
||||
|
@ -120,7 +120,7 @@ fn apply_algorithm_to_response(body: MutexGuard<ResponseBody>,
|
|||
-> String {
|
||||
if let ResponseBody::Done(ref vec) = *body {
|
||||
let response_digest = hash(message_digest, vec);
|
||||
response_digest.to_base64(STANDARD)
|
||||
base64::encode(&response_digest)
|
||||
} else {
|
||||
unreachable!("Tried to calculate digest of incomplete response body")
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ angle = {git = "https://github.com/servo/angle", branch = "servo"}
|
|||
app_units = "0.4"
|
||||
audio-video-metadata = "0.1.2"
|
||||
atomic_refcell = "0.1"
|
||||
base64 = "0.4.1"
|
||||
bitflags = "0.7"
|
||||
bluetooth_traits = {path = "../bluetooth_traits"}
|
||||
byteorder = "1.0"
|
||||
|
@ -69,7 +70,6 @@ range = {path = "../range"}
|
|||
ref_filter_map = "1.0.1"
|
||||
ref_slice = "1.0"
|
||||
regex = "0.2"
|
||||
rustc-serialize = "0.3"
|
||||
script_layout_interface = {path = "../script_layout_interface"}
|
||||
script_plugins = {path = "../script_plugins"}
|
||||
script_traits = {path = "../script_traits"}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use base64;
|
||||
use dom::bindings::cell::DOMRefCell;
|
||||
use dom::bindings::codegen::Bindings::BlobBinding::BlobMethods;
|
||||
use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
|
||||
|
@ -29,7 +30,6 @@ use js::jsapi::JSAutoCompartment;
|
|||
use js::jsapi::JSContext;
|
||||
use js::jsval::{self, JSVal};
|
||||
use js::typedarray::{ArrayBuffer, CreateWith};
|
||||
use rustc_serialize::base64::{CharacterSet, Config, Newline, ToBase64};
|
||||
use script_thread::RunnableWrapper;
|
||||
use servo_atoms::Atom;
|
||||
use std::cell::Cell;
|
||||
|
@ -247,13 +247,7 @@ impl FileReader {
|
|||
|
||||
//https://w3c.github.io/FileAPI/#dfn-readAsDataURL
|
||||
fn perform_readasdataurl(result: &DOMRefCell<Option<FileReaderResult>>, data: ReadMetaData, bytes: &[u8]) {
|
||||
let config = Config {
|
||||
char_set: CharacterSet::UrlSafe,
|
||||
newline: Newline::LF,
|
||||
pad: true,
|
||||
line_length: None
|
||||
};
|
||||
let base64 = bytes.to_base64(config);
|
||||
let base64 = base64::encode(bytes);
|
||||
|
||||
let output = if data.blobtype.is_empty() {
|
||||
format!("data:base64,{}", base64)
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use base64;
|
||||
use canvas_traits::{CanvasMsg, FromScriptMsg};
|
||||
use dom::attr::Attr;
|
||||
use dom::bindings::cell::DOMRefCell;
|
||||
|
@ -33,7 +34,6 @@ use ipc_channel::ipc::{self, IpcSender};
|
|||
use js::error::throw_type_error;
|
||||
use js::jsapi::{HandleValue, JSContext};
|
||||
use offscreen_gl_context::GLContextAttributes;
|
||||
use rustc_serialize::base64::{STANDARD, ToBase64};
|
||||
use script_layout_interface::HTMLCanvasData;
|
||||
use std::iter::repeat;
|
||||
use style::attr::AttrValue;
|
||||
|
@ -296,7 +296,7 @@ impl HTMLCanvasElementMethods for HTMLCanvasElement {
|
|||
encoder.encode(&raw_data, self.Width(), self.Height(), ColorType::RGBA(8)).unwrap();
|
||||
}
|
||||
|
||||
let encoded = encoded.to_base64(STANDARD);
|
||||
let encoded = base64::encode(&encoded);
|
||||
Ok(DOMString::from(format!("data:{};base64,{}", mime_type, encoded)))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use app_units::Au;
|
||||
use base64;
|
||||
use bluetooth_traits::BluetoothRequest;
|
||||
use cssparser::Parser;
|
||||
use devtools_traits::{ScriptToDevtoolsControlMsg, TimelineMarker, TimelineMarkerType};
|
||||
|
@ -68,7 +69,6 @@ use num_traits::ToPrimitive;
|
|||
use open;
|
||||
use profile_traits::mem::ProfilerChan as MemProfilerChan;
|
||||
use profile_traits::time::ProfilerChan as TimeProfilerChan;
|
||||
use rustc_serialize::base64::{FromBase64, STANDARD, ToBase64};
|
||||
use script_layout_interface::{TrustedNodeAddress, PendingImageState};
|
||||
use script_layout_interface::message::{Msg, Reflow, ReflowQueryType, ScriptReflow};
|
||||
use script_layout_interface::reporter::CSSErrorReporter;
|
||||
|
@ -410,16 +410,13 @@ pub fn base64_btoa(input: DOMString) -> Fallible<DOMString> {
|
|||
|
||||
// "and then must apply the base64 algorithm to that sequence of
|
||||
// octets, and return the result. [RFC4648]"
|
||||
Ok(DOMString::from(octets.to_base64(STANDARD)))
|
||||
Ok(DOMString::from(base64::encode(&octets)))
|
||||
}
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#atob
|
||||
pub fn base64_atob(input: DOMString) -> Fallible<DOMString> {
|
||||
// "Remove all space characters from input."
|
||||
// serialize::base64::from_base64 ignores \r and \n,
|
||||
// but it treats the other space characters as
|
||||
// invalid input.
|
||||
fn is_html_space(c: char) -> bool {
|
||||
HTML_SPACE_CHARACTERS.iter().any(|&m| m == c)
|
||||
}
|
||||
|
@ -456,7 +453,7 @@ pub fn base64_atob(input: DOMString) -> Fallible<DOMString> {
|
|||
return Err(Error::InvalidCharacter)
|
||||
}
|
||||
|
||||
match input.from_base64() {
|
||||
match base64::decode(&input) {
|
||||
Ok(data) => Ok(DOMString::from(data.iter().map(|&b| b as char).collect::<String>())),
|
||||
Err(..) => Err(Error::InvalidCharacter)
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ extern crate angle;
|
|||
extern crate app_units;
|
||||
extern crate atomic_refcell;
|
||||
extern crate audio_video_metadata;
|
||||
extern crate base64;
|
||||
#[macro_use]
|
||||
extern crate bitflags;
|
||||
extern crate bluetooth_traits;
|
||||
|
@ -78,7 +79,6 @@ extern crate range;
|
|||
extern crate ref_filter_map;
|
||||
extern crate ref_slice;
|
||||
extern crate regex;
|
||||
extern crate rustc_serialize;
|
||||
extern crate script_layout_interface;
|
||||
extern crate script_traits;
|
||||
extern crate selectors;
|
||||
|
|
|
@ -10,6 +10,7 @@ name = "webdriver_server"
|
|||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
base64 = "0.4.1"
|
||||
cookie = "0.2.5"
|
||||
euclid = "0.11"
|
||||
hyper = "0.9.9"
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#![deny(unsafe_code)]
|
||||
|
||||
extern crate base64;
|
||||
extern crate cookie as cookie_rs;
|
||||
extern crate euclid;
|
||||
extern crate hyper;
|
||||
|
@ -34,7 +35,6 @@ use keys::keycodes_to_keys;
|
|||
use msg::constellation_msg::{FrameId, PipelineId, TraversalDirection};
|
||||
use net_traits::image::base::PixelFormat;
|
||||
use regex::Captures;
|
||||
use rustc_serialize::base64::{CharacterSet, Config, Newline, ToBase64};
|
||||
use rustc_serialize::json::{Json, ToJson};
|
||||
use script_traits::{ConstellationMsg, LoadData, WebDriverCommandMsg};
|
||||
use script_traits::webdriver_msg::{LoadStatus, WebDriverCookieError, WebDriverFrameId};
|
||||
|
@ -831,13 +831,7 @@ impl Handler {
|
|||
let mut png_data = Vec::new();
|
||||
DynamicImage::ImageRgb8(rgb).save(&mut png_data, ImageFormat::PNG).unwrap();
|
||||
|
||||
let config = Config {
|
||||
char_set: CharacterSet::Standard,
|
||||
newline: Newline::LF,
|
||||
pad: true,
|
||||
line_length: None
|
||||
};
|
||||
let encoded = png_data.to_base64(config);
|
||||
let encoded = base64::encode(&png_data);
|
||||
Ok(WebDriverResponse::Generic(ValueResponse::new(encoded.to_json())))
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue