mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Remove empty lines following braces.
This commit is contained in:
parent
4ebc065cba
commit
3cb8af20c2
69 changed files with 3 additions and 162 deletions
|
@ -548,7 +548,6 @@ impl<'a> CanvasPaintThread<'a> {
|
|||
offset: Point2D<f64>,
|
||||
image_data_size: Size2D<f64>,
|
||||
mut dirty_rect: Rect<f64>) {
|
||||
|
||||
if image_data_size.width <= 0.0 || image_data_size.height <= 0.0 {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -929,7 +929,6 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
debug!("Panic handler for pipeline {:?}: {}.", pipeline_id, reason);
|
||||
|
||||
if let Some(pipeline_id) = pipeline_id {
|
||||
|
||||
let parent_info = self.pipelines.get(&pipeline_id).and_then(|pipeline| pipeline.parent_info);
|
||||
let window_size = self.pipelines.get(&pipeline_id).and_then(|pipeline| pipeline.size);
|
||||
|
||||
|
@ -1026,13 +1025,11 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
// containing_page_pipeline_id's frame tree's children. This message is never the result of a
|
||||
// page navigation.
|
||||
fn handle_script_loaded_url_in_iframe_msg(&mut self, load_info: IFrameLoadInfo) {
|
||||
|
||||
let old_pipeline_id = load_info.old_subpage_id
|
||||
.and_then(|old_subpage_id| self.subpage_map.get(&(load_info.containing_pipeline_id, old_subpage_id)))
|
||||
.cloned();
|
||||
|
||||
let (load_data, script_chan, window_size) = {
|
||||
|
||||
let old_pipeline = old_pipeline_id
|
||||
.and_then(|old_pipeline_id| self.pipelines.get(&old_pipeline_id));
|
||||
|
||||
|
@ -1599,7 +1596,6 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
}
|
||||
|
||||
fn add_or_replace_pipeline_in_frame_tree(&mut self, frame_change: FrameChange) {
|
||||
|
||||
// If the currently focused pipeline is the one being changed (or a child
|
||||
// of the pipeline being changed) then update the focus pipeline to be
|
||||
// the replacement.
|
||||
|
@ -1804,7 +1800,6 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
// are met, then the output image should not change and a reftest
|
||||
// screenshot can safely be written.
|
||||
for frame in self.current_frame_tree_iter(self.root_frame_id) {
|
||||
|
||||
let pipeline_id = frame.current;
|
||||
|
||||
let pipeline = match self.pipelines.get(&pipeline_id) {
|
||||
|
@ -2050,7 +2045,6 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
// with low-resource scenarios.
|
||||
if let Some(root_frame_id) = self.root_frame_id {
|
||||
if let Some(frame_tree) = self.frame_to_sendable(root_frame_id) {
|
||||
|
||||
let (chan, port) = ipc::channel().expect("Failed to create IPC channel!");
|
||||
self.compositor_proxy.send(ToCompositorMsg::SetFrameTree(frame_tree,
|
||||
chan,
|
||||
|
|
|
@ -373,7 +373,6 @@ impl NetworkEventActor {
|
|||
}
|
||||
|
||||
pub fn response_cookies(&self) -> ResponseCookiesMsg {
|
||||
|
||||
let mut cookies_size = 0;
|
||||
if let Some(ref headers) = self.response.headers {
|
||||
cookies_size = match headers.get() {
|
||||
|
@ -387,7 +386,6 @@ impl NetworkEventActor {
|
|||
}
|
||||
|
||||
pub fn response_headers(&self) -> ResponseHeadersMsg {
|
||||
|
||||
let mut headers_size = 0;
|
||||
let mut headers_byte_count = 0;
|
||||
if let Some(ref headers) = self.response.headers {
|
||||
|
@ -404,7 +402,6 @@ impl NetworkEventActor {
|
|||
}
|
||||
|
||||
pub fn request_cookies(&self) -> RequestCookiesMsg {
|
||||
|
||||
let mut cookies_size = 0;
|
||||
if let Some(ref headers) = self.response.headers {
|
||||
cookies_size = match headers.get() {
|
||||
|
|
|
@ -127,7 +127,6 @@ impl TimelineActor {
|
|||
pub fn new(name: String,
|
||||
pipeline: PipelineId,
|
||||
script_sender: IpcSender<DevtoolScriptControlMsg>) -> TimelineActor {
|
||||
|
||||
let marker_types = vec!(TimelineMarkerType::Reflow,
|
||||
TimelineMarkerType::DOMEvent);
|
||||
|
||||
|
@ -270,7 +269,6 @@ impl Emitter {
|
|||
stream: TcpStream,
|
||||
memory_actor_name: Option<String>,
|
||||
framerate_actor_name: Option<String>) -> Emitter {
|
||||
|
||||
Emitter {
|
||||
from: name,
|
||||
stream: stream,
|
||||
|
|
|
@ -387,7 +387,6 @@ fn run_server(sender: Sender<DevtoolsControlMsg>,
|
|||
pipeline_id: PipelineId,
|
||||
request_id: String,
|
||||
network_event: NetworkEvent) {
|
||||
|
||||
let console_actor_name = match find_console_actor(actors.clone(), pipeline_id, None,
|
||||
actor_workers, actor_pipelines) {
|
||||
Some(name) => name,
|
||||
|
|
|
@ -422,7 +422,6 @@ impl DisplayList {
|
|||
traversal: &mut DisplayListTraversal<'a>,
|
||||
paint_context: &mut PaintContext,
|
||||
transform: &Matrix4D<f32>) {
|
||||
|
||||
if stacking_context.context_type != StackingContextType::Real {
|
||||
self.draw_stacking_context_contents(stacking_context,
|
||||
traversal,
|
||||
|
|
|
@ -405,7 +405,6 @@ impl FontCacheThread {
|
|||
|
||||
pub fn find_font_template(&self, family: FontFamily, desc: FontTemplateDescriptor)
|
||||
-> Option<FontTemplateInfo> {
|
||||
|
||||
let (response_chan, response_port) = ipc::channel().unwrap();
|
||||
self.chan.send(Command::GetFontTemplate(family, desc, response_chan)).unwrap();
|
||||
|
||||
|
@ -420,7 +419,6 @@ impl FontCacheThread {
|
|||
|
||||
pub fn last_resort_font_template(&self, desc: FontTemplateDescriptor)
|
||||
-> FontTemplateInfo {
|
||||
|
||||
let (response_chan, response_port) = ipc::channel().unwrap();
|
||||
self.chan.send(Command::GetLastResortFontTemplate(desc, response_chan)).unwrap();
|
||||
|
||||
|
|
|
@ -663,7 +663,6 @@ impl<'a> PaintContext<'a> {
|
|||
fn corner_bounds(bounds: &Rect<f32>,
|
||||
border: &SideOffsets2D<f32>,
|
||||
radii: &BorderRadii<AzFloat>) -> (CornerOrigin, SideOffsets2D<Size2D<f32>>) {
|
||||
|
||||
fn distance_to_elbow(radius: &Size2D<AzFloat>,
|
||||
corner_width: f32,
|
||||
corner_height: f32) -> Size2D<f32> {
|
||||
|
@ -1658,7 +1657,6 @@ pub trait ToAzureRect {
|
|||
}
|
||||
|
||||
impl ToAzureRect for Rect<Au> {
|
||||
|
||||
/// Round rects to pixel coordinates, maintaining the invariant of non-overlap,
|
||||
/// assuming that before rounding rects don't overlap.
|
||||
fn to_nearest_azure_rect(&self, pixels_per_px: ScaleFactor<PagePx, ScreenPx, f32>) -> Rect<AzFloat> {
|
||||
|
|
|
@ -867,7 +867,6 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
|||
splits,
|
||||
fragments: successors,
|
||||
})) => {
|
||||
|
||||
// Bubble up {ib} splits.
|
||||
self.accumulate_inline_block_splits(splits,
|
||||
node,
|
||||
|
|
|
@ -120,7 +120,6 @@ impl<'a> StyleContext<'a, ServoSelectorImpl> for LayoutContext<'a> {
|
|||
|
||||
impl<'a> LayoutContext<'a> {
|
||||
pub fn new(shared_layout_context: &'a SharedLayoutContext) -> LayoutContext<'a> {
|
||||
|
||||
let local_context = create_or_get_local_context(shared_layout_context);
|
||||
|
||||
LayoutContext {
|
||||
|
|
|
@ -108,7 +108,6 @@ impl FlexFlow {
|
|||
pub fn from_fragment(fragment: Fragment,
|
||||
flotation: Option<FloatKind>)
|
||||
-> FlexFlow {
|
||||
|
||||
let (main_mode, is_reverse) = match fragment.style.get_position().flex_direction {
|
||||
flex_direction::T::row => (Mode::Inline, false),
|
||||
flex_direction::T::row_reverse => (Mode::Inline, true),
|
||||
|
|
|
@ -51,7 +51,6 @@ fn overflow_direction(writing_mode: &WritingMode) -> OverflowDirection {
|
|||
}
|
||||
|
||||
impl LayoutRPC for LayoutRPCImpl {
|
||||
|
||||
// The neat thing here is that in order to answer the following two queries we only
|
||||
// need to compare nodes for equality. Thus we can safely work only with `OpaqueNode`.
|
||||
fn content_box(&self) -> ContentBoxResponse {
|
||||
|
|
|
@ -411,7 +411,6 @@ impl TextRunScanner {
|
|||
#[inline]
|
||||
fn bounding_box_for_run_metrics(metrics: &RunMetrics, writing_mode: WritingMode)
|
||||
-> LogicalSize<Au> {
|
||||
|
||||
// This does nothing, but it will fail to build
|
||||
// when more values are added to the `text-orientation` CSS property.
|
||||
// This will be a reminder to update the code below.
|
||||
|
|
|
@ -982,7 +982,6 @@ impl<'a> PartialEq for ServoThreadSafeLayoutNode<'a> {
|
|||
}
|
||||
|
||||
impl<'ln> DangerousThreadSafeLayoutNode for ServoThreadSafeLayoutNode<'ln> {
|
||||
|
||||
unsafe fn dangerous_first_child(&self) -> Option<Self> {
|
||||
self.get_jsmanaged().first_child_ref()
|
||||
.map(|node| self.new_with_this_lifetime(&node))
|
||||
|
|
|
@ -77,7 +77,6 @@ fn match_headers(cors_cache: &CORSCacheEntry, cors_req: &Request) -> bool {
|
|||
pub struct CORSCache(Vec<CORSCacheEntry>);
|
||||
|
||||
impl CORSCache {
|
||||
|
||||
pub fn new() -> CORSCache {
|
||||
CORSCache(vec![])
|
||||
}
|
||||
|
|
|
@ -47,7 +47,6 @@ pub fn fetch(request: Rc<Request>) -> Response {
|
|||
}
|
||||
|
||||
pub fn fetch_with_cors_cache(request: Rc<Request>, cache: &mut CORSCache) -> Response {
|
||||
|
||||
// Step 1
|
||||
if request.window.get() == Window::Client {
|
||||
// TODO: Set window to request's client object if client is a Window object
|
||||
|
@ -63,9 +62,7 @@ pub fn fetch_with_cors_cache(request: Rc<Request>, cache: &mut CORSCache) -> Res
|
|||
|
||||
// Step 3
|
||||
if !request.headers.borrow().has::<Accept>() {
|
||||
|
||||
let value = match request.type_ {
|
||||
|
||||
// Substep 2
|
||||
_ if request.is_navigation_request() =>
|
||||
vec
|
||||
fn basic_fetch(request: Rc<Request>, cache: &mut CORSCache) -> Response {
|
||||
|
||||
let url = request.current_url();
|
||||
|
||||
match url.scheme() {
|
||||
|
||||
"about" if url.path() == "blank" => {
|
||||
let mut response = Response::new();
|
||||
response.headers.set(ContentType(mime!(Text / Html; Charset = Utf8)));
|
||||
|
@ -358,7 +351,6 @@ fn http_fetch(request: Rc<Request>,
|
|||
cors_flag: bool,
|
||||
cors_preflight_flag: bool,
|
||||
authentication_fetch_flag: bool) -> Response {
|
||||
|
||||
// Step 1
|
||||
let mut response: Option<Response> = None;
|
||||
|
||||
|
@ -367,12 +359,10 @@ fn http_fetch(request: Rc<Request>,
|
|||
|
||||
// Step 3
|
||||
if !request.skip_service_worker.get() && !request.is_service_worker_global_scope {
|
||||
|
||||
// Substep 1
|
||||
// TODO (handle fetch unimplemented)
|
||||
|
||||
if let Some(ref res) = response {
|
||||
|
||||
// Substep 2
|
||||
// nothing to do, since actual_response is a function on response
|
||||
|
||||
|
@ -400,7 +390,6 @@ fn http_fetch(request: Rc<Request>,
|
|||
|
||||
// Step 4
|
||||
if response.is_none() {
|
||||
|
||||
// Substep 1
|
||||
if cors_preflight_flag {
|
||||
let method_cache_match = cache.match_method(&*request,
|
||||
|
@ -450,11 +439,9 @@ fn http_fetch(request: Rc<Request>,
|
|||
|
||||
// Step 5
|
||||
match response.actual_response().status.unwrap() {
|
||||
|
||||
// Code 301, 302, 303, 307, 308
|
||||
StatusCode::MovedPermanently | StatusCode::Found | StatusCode::SeeOther |
|
||||
StatusCode::TemporaryRedirect | StatusCode::PermanentRedirect => {
|
||||
|
||||
response = match request.redirect_mode.get() {
|
||||
RedirectMode::Error => Response::network_error(),
|
||||
RedirectMode::Manual => {
|
||||
|
@ -470,7 +457,6 @@ fn http_fetch(request: Rc<Request>,
|
|||
|
||||
// Code 401
|
||||
StatusCode::Unauthorized => {
|
||||
|
||||
// Step 1
|
||||
// FIXME: Figure out what to do with request window objects
|
||||
if cors_flag || request.credentials_mode != CredentialsMode::Include {
|
||||
|
@ -491,7 +477,6 @@ fn http_fetch(request: Rc<Request>,
|
|||
|
||||
// Code 407
|
||||
StatusCode::ProxyAuthenticationRequired => {
|
||||
|
||||
// Step 1
|
||||
// TODO: Figure out what to do with request window objects
|
||||
|
||||
|
@ -526,7 +511,6 @@ fn http_redirect_fetch(request: Rc<Request>,
|
|||
cache: &mut CORSCache,
|
||||
response: Rc<Response>,
|
||||
cors_flag: bool) -> Response {
|
||||
|
||||
// Step 1
|
||||
assert_eq!(response.return_internal.get(), true);
|
||||
|
||||
|
@ -592,7 +576,6 @@ fn http_redirect_fetch(request: Rc<Request>,
|
|||
if ((status_code == StatusCode::MovedPermanently || status_code == StatusCode::Found) &&
|
||||
*request.method.borrow() == Method::Post) ||
|
||||
status_code == StatusCode::SeeOther {
|
||||
|
||||
*request.method.borrow_mut() = Method::Get;
|
||||
*request.body.borrow_mut() = None;
|
||||
}
|
||||
|
@ -608,7 +591,6 @@ fn http_redirect_fetch(request: Rc<Request>,
|
|||
fn http_network_or_cache_fetch(request: Rc<Request>,
|
||||
credentials_flag: bool,
|
||||
authentication_fetch_flag: bool) -> Response {
|
||||
|
||||
// TODO: Implement Window enum for Request
|
||||
let request_has_no_window = true;
|
||||
|
||||
|
@ -662,7 +644,6 @@ fn http_network_or_cache_fetch(request: Rc<Request>,
|
|||
}
|
||||
|
||||
match http_request.cache_mode.get() {
|
||||
|
||||
// Step 9
|
||||
CacheMode::Default if is_no_store_cache(&http_request.headers.borrow()) => {
|
||||
http_request.cache_mode.set(CacheMode::NoStore);
|
||||
|
@ -695,13 +676,11 @@ fn http_network_or_cache_fetch(request: Rc<Request>,
|
|||
// Step 13
|
||||
// TODO some of this step can't be implemented yet
|
||||
if credentials_flag {
|
||||
|
||||
// Substep 1
|
||||
// TODO http://mxr.mozilla.org/servo/source/components/net/http_loader.rs#504
|
||||
|
||||
// Substep 2
|
||||
if !http_request.headers.borrow().has::<Authorization<String>>() {
|
||||
|
||||
// Substep 3
|
||||
let mut authorization_value = None;
|
||||
|
||||
|
@ -710,7 +689,6 @@ fn http_network_or_cache_fetch(request: Rc<Request>,
|
|||
|
||||
// Substep 5
|
||||
if authentication_fetch_flag {
|
||||
|
||||
let current_url = http_request.current_url();
|
||||
|
||||
authorization_value = if has_credentials(¤t_url) {
|
||||
|
@ -742,7 +720,6 @@ fn http_network_or_cache_fetch(request: Rc<Request>,
|
|||
if http_request.cache_mode.get() != CacheMode::NoStore &&
|
||||
http_request.cache_mode.get() != CacheMode::Reload &&
|
||||
complete_http_response_from_cache.is_some() {
|
||||
|
||||
// Substep 1
|
||||
if http_request.cache_mode.get() == CacheMode::ForceCache {
|
||||
// TODO pull response from HTTP cache
|
||||
|
@ -764,7 +741,6 @@ fn http_network_or_cache_fetch(request: Rc<Request>,
|
|||
// Substep 3
|
||||
if revalidation_needed && http_request.cache_mode.get() == CacheMode::Default ||
|
||||
http_request.cache_mode.get() == CacheMode::NoCache {
|
||||
|
||||
// TODO this substep
|
||||
}
|
||||
|
||||
|
@ -786,7 +762,6 @@ fn http_network_or_cache_fetch(request: Rc<Request>,
|
|||
if status == StatusCode::NotModified &&
|
||||
(http_request.cache_mode.get() == CacheMode::Default ||
|
||||
http_request.cache_mode.get() == CacheMode::NoCache) {
|
||||
|
||||
// Substep 1
|
||||
// TODO this substep
|
||||
// let cached_response: Option<Response> = None;
|
||||
|
@ -848,7 +823,6 @@ fn http_network_fetch(request: Rc<Request>,
|
|||
|
||||
let res_body = response.body.clone();
|
||||
thread::spawn(move || {
|
||||
|
||||
*res_body.lock().unwrap() = ResponseBody::Receiving(vec![]);
|
||||
|
||||
loop {
|
||||
|
@ -892,11 +866,9 @@ fn http_network_fetch(request: Rc<Request>,
|
|||
// TODO this step
|
||||
if let Some(encoding) = response.headers.get::<ContentEncoding>() {
|
||||
if encoding.contains(&Encoding::Gzip) {
|
||||
|
||||
}
|
||||
|
||||
else if encoding.contains(&Encoding::Compress) {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1027,7 +999,6 @@ fn cors_preflight_fetch(request: Rc<Request>, cache: &mut CORSCache) -> Response
|
|||
|
||||
/// [CORS check](https://fetch.spec.whatwg.org#concept-cors-check)
|
||||
fn cors_check(request: Rc<Request>, response: &Response) -> Result<(), ()> {
|
||||
|
||||
// Step 1
|
||||
let origin = response.headers.get::<AccessControlAllowOrigin>().cloned();
|
||||
|
||||
|
|
|
@ -132,7 +132,6 @@ impl FileManager {
|
|||
}
|
||||
|
||||
fn read_file(&mut self, sender: IpcSender<FileManagerResult<Vec<u8>>>, id: Uuid) {
|
||||
|
||||
match self.idmap.borrow().get(&id).and_then(|filepath| {
|
||||
let mut buffer = vec![];
|
||||
match File::open(&filepath) {
|
||||
|
|
|
@ -124,7 +124,6 @@ fn load_for_consumer(load_data: LoadData,
|
|||
devtools_chan: Option<Sender<DevtoolsControlMsg>>,
|
||||
cancel_listener: CancellationListener,
|
||||
user_agent: String) {
|
||||
|
||||
let factory = NetworkHttpRequestFactory {
|
||||
connector: connector,
|
||||
};
|
||||
|
@ -555,7 +554,6 @@ fn send_request_to_devtools(devtools_chan: Option<Sender<DevtoolsControlMsg>>,
|
|||
headers: Headers,
|
||||
body: Option<Vec<u8>>,
|
||||
pipeline_id: PipelineId, now: Tm) {
|
||||
|
||||
if let Some(ref chan) = devtools_chan {
|
||||
let request = DevtoolsHttpRequest {
|
||||
url: url, method: method, headers: headers, body: body, pipeline_id: pipeline_id, startedDateTime: now };
|
||||
|
@ -632,7 +630,6 @@ pub fn modify_request_headers(headers: &mut Headers,
|
|||
fn set_auth_header(headers: &mut Headers,
|
||||
url: &Url,
|
||||
auth_cache: &Arc<RwLock<AuthCache>>) {
|
||||
|
||||
if !headers.has::<Authorization<Basic>>() {
|
||||
if let Some(auth) = auth_from_url(url) {
|
||||
headers.set(auth);
|
||||
|
@ -694,7 +691,6 @@ pub fn obtain_response<A>(request_factory: &HttpRequestFactory<R=A>,
|
|||
devtools_chan: &Option<Sender<DevtoolsControlMsg>>,
|
||||
request_id: &str)
|
||||
-> Result<A::R, LoadError> where A: HttpRequest + 'static {
|
||||
|
||||
let null_data = None;
|
||||
let response;
|
||||
let connection_url = replace_hosts(&url);
|
||||
|
|
|
@ -266,7 +266,6 @@ trait Matches {
|
|||
}
|
||||
|
||||
impl <'a, T: Iterator<Item=&'a u8> + Clone> Matches for T {
|
||||
|
||||
// Matching function that works on an iterator.
|
||||
// see if the next matches.len() bytes in data_iterator equal matches
|
||||
// move iterator and return true or just return false
|
||||
|
@ -587,7 +586,6 @@ struct FeedsClassifier;
|
|||
impl FeedsClassifier {
|
||||
// Implements sniffing for mislabeled feeds (https://mimesniff.spec.whatwg.org/#sniffing-a-mislabeled-feed)
|
||||
fn classify_impl(&self, data: &[u8]) -> Option<(&'static str, &'static str)> {
|
||||
|
||||
// Step 4: can not be feed unless length is > 3
|
||||
if data.len() < 3 {
|
||||
return None;
|
||||
|
@ -603,7 +601,6 @@ impl FeedsClassifier {
|
|||
// TODO: need max_bytes to prevent inadvertently examining html document
|
||||
// eg. an html page with a feed example
|
||||
loop {
|
||||
|
||||
if matcher.find(|&x| *x == b'<').is_none() {
|
||||
return None;
|
||||
}
|
||||
|
|
|
@ -234,7 +234,6 @@ impl ResourceChannelManager {
|
|||
}
|
||||
|
||||
pub fn read_json_from_file<T: Decodable>(data: &mut T, config_dir: &str, filename: &str) {
|
||||
|
||||
let path = Path::new(config_dir).join(filename);
|
||||
let display = path.display();
|
||||
|
||||
|
@ -262,7 +261,6 @@ pub fn read_json_from_file<T: Decodable>(data: &mut T, config_dir: &str, filenam
|
|||
}
|
||||
|
||||
pub fn write_json_to_file<T: Encodable>(data: &T, config_dir: &str, filename: &str) {
|
||||
|
||||
let json_encoded: String;
|
||||
match json::encode(&data) {
|
||||
Ok(d) => json_encoded = d,
|
||||
|
@ -357,7 +355,6 @@ pub struct AuthCacheEntry {
|
|||
}
|
||||
|
||||
impl AuthCache {
|
||||
|
||||
pub fn new() -> AuthCache {
|
||||
AuthCache {
|
||||
version: 1,
|
||||
|
@ -429,7 +426,6 @@ impl CoreResourceManager {
|
|||
consumer: LoadConsumer,
|
||||
id_sender: Option<IpcSender<ResourceId>>,
|
||||
resource_thread: CoreResourceThread) {
|
||||
|
||||
fn from_factory(factory: fn(LoadData, LoadConsumer, Arc<MIMEClassifier>, CancellationListener))
|
||||
-> Box<FnBox(LoadData,
|
||||
LoadConsumer,
|
||||
|
|
|
@ -30,7 +30,6 @@ fn establish_a_websocket_connection(resource_url: &Url, net_url: (Host, String,
|
|||
origin: String, protocols: Vec<String>,
|
||||
cookie_jar: Arc<RwLock<CookieStorage>>)
|
||||
-> WebSocketResult<(Headers, Sender<WebSocketStream>, Receiver<WebSocketStream>)> {
|
||||
|
||||
let host = Host {
|
||||
hostname: resource_url.host_str().unwrap().to_owned(),
|
||||
port: resource_url.port_or_known_default(),
|
||||
|
|
|
@ -116,7 +116,6 @@ pub struct ImageCacheThread {
|
|||
|
||||
/// The public API for the image cache thread.
|
||||
impl ImageCacheThread {
|
||||
|
||||
/// Construct a new image cache
|
||||
pub fn new(chan: IpcSender<ImageCacheCommand>) -> ImageCacheThread {
|
||||
ImageCacheThread {
|
||||
|
|
|
@ -163,7 +163,6 @@ impl Response {
|
|||
/// Convert to a filtered response, of type `filter_type`.
|
||||
/// Do not use with type Error or Default
|
||||
pub fn to_filtered(self, filter_type: ResponseType) -> Response {
|
||||
|
||||
assert!(filter_type != ResponseType::Error);
|
||||
assert!(filter_type != ResponseType::Default);
|
||||
|
||||
|
@ -179,7 +178,6 @@ impl Response {
|
|||
response.response_type = filter_type;
|
||||
|
||||
match filter_type {
|
||||
|
||||
ResponseType::Default | ResponseType::Error => unreachable!(),
|
||||
|
||||
ResponseType::Basic => {
|
||||
|
@ -193,7 +191,6 @@ impl Response {
|
|||
},
|
||||
|
||||
ResponseType::CORS => {
|
||||
|
||||
let access = old_headers.get::<AccessControlExposeHeaders>();
|
||||
let allowed_headers = access.as_ref().map(|v| &v[..]).unwrap_or(&[]);
|
||||
|
||||
|
|
|
@ -138,9 +138,7 @@ impl Profiler {
|
|||
let (chan, port) = ipc::channel().unwrap();
|
||||
reporter.collect_reports(ReportsChan(chan));
|
||||
if let Ok(mut reports) = port.recv() {
|
||||
|
||||
for report in &mut reports {
|
||||
|
||||
// Add "explicit" to the start of the path, when appropriate.
|
||||
match report.kind {
|
||||
ReportKind::ExplicitJemallocHeapSize |
|
||||
|
|
|
@ -182,7 +182,7 @@ impl Profiler {
|
|||
});
|
||||
// decide if we need to spawn the timer thread
|
||||
match option {
|
||||
&OutputOptions::FileName(_) => {/* no timer thread needed */},
|
||||
&OutputOptions::FileName(_) => { /* no timer thread needed */ },
|
||||
&OutputOptions::Stdout(period) => {
|
||||
// Spawn a timer thread
|
||||
let chan = chan.clone();
|
||||
|
@ -389,7 +389,7 @@ impl Profiler {
|
|||
}
|
||||
writeln!(&mut lock, "").unwrap();
|
||||
},
|
||||
None => {/* Do nothing if not output option has been set */},
|
||||
None => { /* Do nothing if not output option has been set */ },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,11 +122,9 @@ impl CORSRequest {
|
|||
// framework right now. It would be worth redesigning http_fetch to do this properly.
|
||||
impl AsyncResponseListener for CORSContext {
|
||||
fn headers_available(&mut self, _metadata: Result<Metadata, NetworkError>) {
|
||||
|
||||
}
|
||||
|
||||
fn data_available(&mut self, _payload: Vec<u8>) {
|
||||
|
||||
}
|
||||
|
||||
fn response_complete(&mut self, _status: Result<(), NetworkError>) {
|
||||
|
|
|
@ -94,7 +94,6 @@ pub struct Blob {
|
|||
}
|
||||
|
||||
impl Blob {
|
||||
|
||||
pub fn new(global: GlobalRef, slice: DataSlice, typeString: &str) -> Root<Blob> {
|
||||
let boxed_blob = box Blob::new_inherited(slice, typeString);
|
||||
reflect_dom_object(boxed_blob, global, BlobBinding::Wrap)
|
||||
|
@ -114,7 +113,6 @@ impl Blob {
|
|||
blobParts: Option<Vec<BlobOrString>>,
|
||||
blobPropertyBag: &BlobBinding::BlobPropertyBag)
|
||||
-> Fallible<Root<Blob>> {
|
||||
|
||||
// TODO: accept other blobParts types - ArrayBuffer or ArrayBufferView
|
||||
let bytes: Vec<u8> = match blobParts {
|
||||
None => Vec::new(),
|
||||
|
@ -160,7 +158,6 @@ impl BlobMethods for Blob {
|
|||
end: Option<i64>,
|
||||
contentType: Option<DOMString>)
|
||||
-> Root<Blob> {
|
||||
|
||||
let relativeContentType = match contentType {
|
||||
None => DOMString::new(),
|
||||
Some(mut str) => {
|
||||
|
|
|
@ -128,7 +128,6 @@ fn convert_request_device_options(options: &RequestDeviceOptions,
|
|||
}
|
||||
|
||||
impl BluetoothMethods for Bluetooth {
|
||||
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetooth-requestdevice
|
||||
fn RequestDevice(&self, option: &RequestDeviceOptions) -> Fallible<Root<BluetoothDevice>> {
|
||||
let (sender, receiver) = ipc::channel().unwrap();
|
||||
|
|
|
@ -49,7 +49,6 @@ impl BluetoothDevice {
|
|||
}
|
||||
|
||||
impl BluetoothDeviceMethods for BluetoothDevice {
|
||||
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothdevice-id
|
||||
fn Id(&self) -> DOMString {
|
||||
self.id.clone()
|
||||
|
|
|
@ -75,7 +75,6 @@ impl BluetoothRemoteGATTCharacteristic {
|
|||
}
|
||||
|
||||
impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteristic {
|
||||
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-properties
|
||||
fn Properties(&self) -> Root<BluetoothCharacteristicProperties> {
|
||||
self.properties.get()
|
||||
|
|
|
@ -68,7 +68,6 @@ impl BluetoothRemoteGATTDescriptor {
|
|||
}
|
||||
|
||||
impl BluetoothRemoteGATTDescriptorMethods for BluetoothRemoteGATTDescriptor {
|
||||
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattdescriptor-characteristic
|
||||
fn Characteristic(&self) -> Root<BluetoothRemoteGATTCharacteristic> {
|
||||
self.characteristic.get()
|
||||
|
|
|
@ -49,7 +49,6 @@ impl BluetoothRemoteGATTServer {
|
|||
}
|
||||
|
||||
impl BluetoothRemoteGATTServerMethods for BluetoothRemoteGATTServer {
|
||||
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-device
|
||||
fn Device(&self) -> Root<BluetoothDevice> {
|
||||
self.device.get()
|
||||
|
|
|
@ -270,7 +270,6 @@ const DESCRIPTOR_PREFIX: &'static str = "org.bluetooth.descriptor";
|
|||
const VALID_UUID_REGEX: &'static str = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";
|
||||
|
||||
impl BluetoothUUID {
|
||||
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothuuid-canonicaluuid
|
||||
pub fn CanonicalUUID(_: GlobalRef, alias: u32) -> UUID {
|
||||
DOMString::from(format!("{:08x}", &alias) + BASE_UUID)
|
||||
|
|
|
@ -1040,7 +1040,6 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D {
|
|||
sw: Finite<f64>,
|
||||
sh: Finite<f64>)
|
||||
-> Fallible<Root<ImageData>> {
|
||||
|
||||
if !self.origin_is_clean() {
|
||||
return Err(Error::Security)
|
||||
}
|
||||
|
|
|
@ -182,7 +182,6 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
|
|||
if shorthand.longhands().iter()
|
||||
.map(|&longhand| self.GetPropertyPriority(DOMString::from(longhand)))
|
||||
.all(|priority| priority == "important") {
|
||||
|
||||
return DOMString::from("important");
|
||||
}
|
||||
// Step 3
|
||||
|
|
|
@ -167,7 +167,6 @@ impl DedicatedWorkerGlobalScope {
|
|||
timer_event_chan: IpcSender<TimerEvent>,
|
||||
timer_event_port: Receiver<(TrustedWorkerAddress, TimerEvent)>)
|
||||
-> DedicatedWorkerGlobalScope {
|
||||
|
||||
DedicatedWorkerGlobalScope {
|
||||
workerglobalscope: WorkerGlobalScope::new_inherited(init,
|
||||
worker_url,
|
||||
|
|
|
@ -600,7 +600,6 @@ impl Document {
|
|||
/// Reassign the focus context to the element that last requested focus during this
|
||||
/// transaction, or none if no elements requested it.
|
||||
pub fn commit_focus_transaction(&self, focus_type: FocusType) {
|
||||
|
||||
if let Some(ref elem) = self.focused.get() {
|
||||
let node = elem.upcast::<Node>();
|
||||
elem.set_focus_state(false);
|
||||
|
@ -755,7 +754,6 @@ impl Document {
|
|||
client_point: Point2D<f32>,
|
||||
pressure: f32,
|
||||
phase_now: TouchpadPressurePhase) {
|
||||
|
||||
let phase_before = self.touchpad_pressure_phase.get();
|
||||
self.touchpad_pressure_phase.set(phase_now);
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ impl DOMQuad {
|
|||
p3: &DOMPoint,
|
||||
p4: &DOMPoint)
|
||||
-> DOMQuad {
|
||||
|
||||
DOMQuad {
|
||||
reflector_: Reflector::new(),
|
||||
p1: JS::from_ref(p1),
|
||||
|
|
|
@ -758,7 +758,6 @@ impl Element {
|
|||
pub fn update_inline_style(&self,
|
||||
declarations: Vec<PropertyDeclaration>,
|
||||
style_priority: StylePriority) {
|
||||
|
||||
fn update(element: &Element, mut declarations: Vec<PropertyDeclaration>, style_priority: StylePriority) {
|
||||
let mut inline_declarations = element.style_attribute().borrow_mut();
|
||||
if let &mut Some(ref mut existing_declarations) = &mut *inline_declarations {
|
||||
|
@ -1285,7 +1284,6 @@ impl Element {
|
|||
|
||||
// https://drafts.csswg.org/cssom-view/#dom-element-scroll
|
||||
pub fn scroll(&self, x_: f64, y_: f64, behavior: ScrollBehavior) {
|
||||
|
||||
// Step 1.2 or 2.3
|
||||
let x = if x_.is_finite() { x_ } else { 0.0f64 };
|
||||
let y = if y_.is_finite() { y_ } else { 0.0f64 };
|
||||
|
@ -1476,7 +1474,6 @@ impl ElementMethods for Element {
|
|||
});
|
||||
|
||||
if let Some(position) = position {
|
||||
|
||||
let old_attr = Root::from_ref(&*self.attrs.borrow()[position]);
|
||||
|
||||
// Step 3.
|
||||
|
|
|
@ -80,7 +80,6 @@ impl File {
|
|||
}
|
||||
|
||||
impl FileMethods for File {
|
||||
|
||||
// https://w3c.github.io/FileAPI/#dfn-name
|
||||
fn Name(&self) -> DOMString {
|
||||
self.name.clone()
|
||||
|
|
|
@ -79,7 +79,7 @@ pub struct FileReader {
|
|||
impl FileReader {
|
||||
pub fn new_inherited() -> FileReader {
|
||||
FileReader {
|
||||
eventtarget: EventTarget::new_inherited(),//?
|
||||
eventtarget: EventTarget::new_inherited(),
|
||||
ready_state: Cell::new(FileReaderReadyState::Empty),
|
||||
error: MutNullableHeap::new(None),
|
||||
result: DOMRefCell::new(None),
|
||||
|
@ -201,7 +201,6 @@ impl FileReader {
|
|||
// https://w3c.github.io/FileAPI/#dfn-readAsText
|
||||
fn perform_readastext(data: ReadMetaData, blob_bytes: &[u8])
|
||||
-> DOMString {
|
||||
|
||||
let blob_label = &data.label;
|
||||
let blob_type = &data.blobtype;
|
||||
|
||||
|
@ -319,7 +318,6 @@ impl FileReaderMethods for FileReader {
|
|||
|
||||
impl FileReader {
|
||||
fn dispatch_progress_event(&self, type_: Atom, loaded: u64, total: Option<u64>) {
|
||||
|
||||
let global = self.global();
|
||||
let progressevent = ProgressEvent::new(global.r(),
|
||||
type_, EventBubbles::DoesNotBubble, EventCancelable::NotCancelable,
|
||||
|
|
|
@ -39,7 +39,6 @@ impl ForceTouchEvent {
|
|||
}
|
||||
|
||||
impl<'a> ForceTouchEventMethods for &'a ForceTouchEvent {
|
||||
|
||||
fn ServoForce(&self) -> Finite<f32> {
|
||||
Finite::wrap(self.force)
|
||||
}
|
||||
|
|
|
@ -516,7 +516,6 @@ impl Activatable for HTMLAnchorElement {
|
|||
let mut ismap_suffix = None;
|
||||
if let Some(element) = target.downcast::<Element>() {
|
||||
if target.is::<HTMLImageElement>() && element.has_attribute(&atom!("ismap")) {
|
||||
|
||||
let target_node = element.upcast::<Node>();
|
||||
let rect = window_from_node(target_node).content_box_query(
|
||||
target_node.to_trusted_node_address());
|
||||
|
|
|
@ -254,7 +254,6 @@ impl HTMLCanvasElementMethods for HTMLCanvasElement {
|
|||
_context: *mut JSContext,
|
||||
_mime_type: Option<DOMString>,
|
||||
_arguments: Vec<HandleValue>) -> Fallible<DOMString> {
|
||||
|
||||
// Step 1.
|
||||
if let Some(CanvasContext::Context2d(ref context)) = *self.context.borrow() {
|
||||
if !context.origin_is_clean() {
|
||||
|
|
|
@ -270,7 +270,6 @@ impl LayoutHTMLInputElementHelpers for LayoutJS<HTMLInputElement> {
|
|||
}
|
||||
|
||||
impl HTMLInputElementMethods for HTMLInputElement {
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-input-accept
|
||||
make_getter!(Accept, "accept");
|
||||
|
||||
|
@ -786,7 +785,6 @@ impl VirtualMethods for HTMLInputElement {
|
|||
let new_value_mode = self.value_mode();
|
||||
|
||||
match (&old_value_mode, old_idl_value.is_empty(), new_value_mode) {
|
||||
|
||||
// Step 1
|
||||
(&ValueMode::Value, false, ValueMode::Default) |
|
||||
(&ValueMode::Value, false, ValueMode::DefaultOn) => {
|
||||
|
|
|
@ -1638,7 +1638,6 @@ impl Node {
|
|||
// https://dom.spec.whatwg.org/#concept-node-clone
|
||||
pub fn clone(node: &Node, maybe_doc: Option<&Document>,
|
||||
clone_children: CloneChildrenFlag) -> Root<Node> {
|
||||
|
||||
// Step 1.
|
||||
let document = match maybe_doc {
|
||||
Some(doc) => Root::from_ref(doc),
|
||||
|
@ -1994,7 +1993,6 @@ impl NodeMethods for Node {
|
|||
|
||||
// https://dom.spec.whatwg.org/#concept-node-replace
|
||||
fn ReplaceChild(&self, node: &Node, child: &Node) -> Fallible<Root<Node>> {
|
||||
|
||||
// Step 1.
|
||||
match self.type_id() {
|
||||
NodeTypeId::Document(_) |
|
||||
|
|
|
@ -166,7 +166,6 @@ impl NodeIteratorMethods for NodeIterator {
|
|||
|
||||
// Step 3-1.
|
||||
for preceding_node in node.preceding_nodes(&self.root_node) {
|
||||
|
||||
// Step 3-2.
|
||||
let result = try!(self.accept_node(preceding_node.r()));
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@ impl PerformanceTiming {
|
|||
navigation_start: u64,
|
||||
navigation_start_precise: f64)
|
||||
-> Root<PerformanceTiming> {
|
||||
|
||||
let timing = PerformanceTiming::new_inherited(navigation_start,
|
||||
navigation_start_precise,
|
||||
window.Document().r());
|
||||
|
|
|
@ -32,7 +32,6 @@ impl PluginArray {
|
|||
impl PluginArrayMethods for PluginArray {
|
||||
// https://html.spec.whatwg.org/multipage/#dom-pluginarray-refresh
|
||||
fn Refresh(&self, _reload: bool) {
|
||||
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-pluginarray-length
|
||||
|
|
|
@ -53,7 +53,6 @@ impl ValidityState {
|
|||
}
|
||||
|
||||
impl ValidityStateMethods for ValidityState {
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-validitystate-valuemissing
|
||||
fn ValueMissing(&self) -> bool {
|
||||
false
|
||||
|
|
|
@ -382,7 +382,6 @@ impl WebSocketMethods for WebSocket {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-websocket-send
|
||||
fn Send(&self, data: USVString) -> ErrorResult {
|
||||
|
||||
let data_byte_len = data.0.as_bytes().len() as u64;
|
||||
let send_data = try!(self.send_impl(data_byte_len));
|
||||
|
||||
|
@ -397,7 +396,6 @@ impl WebSocketMethods for WebSocket {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-websocket-send
|
||||
fn Send_(&self, blob: &Blob) -> ErrorResult {
|
||||
|
||||
/* As per https://html.spec.whatwg.org/multipage/#websocket
|
||||
the buffered amount needs to be clamped to u32, even though Blob.Size() is u64
|
||||
If the buffer limit is reached in the first place, there are likely other major problems
|
||||
|
|
|
@ -1197,7 +1197,6 @@ impl Window {
|
|||
// https://drafts.csswg.org/cssom-view/#dom-element-scroll
|
||||
pub fn scroll_node(&self, node: TrustedNodeAddress,
|
||||
x_: f64, y_: f64, behavior: ScrollBehavior) {
|
||||
|
||||
self.reflow(ReflowGoal::ForScriptQuery,
|
||||
ReflowQueryType::NodeLayerIdQuery(node),
|
||||
ReflowReason::Query);
|
||||
|
|
|
@ -835,7 +835,6 @@ impl ScriptThread {
|
|||
|
||||
fn profile_event<F, R>(&self, category: ScriptThreadEventCategory, f: F) -> R
|
||||
where F: FnOnce() -> R {
|
||||
|
||||
if opts::get().profile_script_events {
|
||||
let profiler_cat = match category {
|
||||
ScriptThreadEventCategory::AttachLayout => ProfilerCategory::ScriptAttachLayout,
|
||||
|
@ -1693,7 +1692,6 @@ impl ScriptThread {
|
|||
///
|
||||
/// TODO: Actually perform DOM event dispatch.
|
||||
fn handle_event(&self, pipeline_id: PipelineId, event: CompositorEvent) {
|
||||
|
||||
// DOM events can only be handled if there's a root browsing context.
|
||||
if !self.root_browsing_context_exists() {
|
||||
return;
|
||||
|
|
|
@ -264,7 +264,6 @@ impl OneshotTimers {
|
|||
is_interval: IsInterval,
|
||||
source: TimerSource)
|
||||
-> i32 {
|
||||
|
||||
self.js_timers.set_timeout_or_interval(global,
|
||||
callback,
|
||||
arguments,
|
||||
|
@ -478,7 +477,6 @@ impl JsTimerTask {
|
|||
// reschedule repeating timers when they were not canceled as part of step 4.2.
|
||||
if self.is_interval == IsInterval::Interval &&
|
||||
timers.active_timers.borrow().contains_key(&self.handle) {
|
||||
|
||||
timers.initialize_and_schedule(this.global().r(), self);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -268,7 +268,6 @@ impl<Impl: SelectorImplExt> Stylist<Impl> {
|
|||
-> Option<Arc<Impl::ComputedValues>> {
|
||||
debug_assert!(Impl::pseudo_element_cascade_type(pseudo).is_precomputed());
|
||||
if let Some(declarations) = self.precomputed_pseudo_element_decls.get(pseudo) {
|
||||
|
||||
let (computed, _) =
|
||||
properties::cascade(self.device.au_viewport_size(),
|
||||
&declarations, false,
|
||||
|
|
|
@ -807,7 +807,6 @@ pub mod specified {
|
|||
impl ToCss for CalcLengthOrPercentage {
|
||||
#[allow(unused_assignments)]
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
|
||||
macro_rules! count {
|
||||
( $( $val:ident ),* ) => {
|
||||
{
|
||||
|
@ -1139,7 +1138,6 @@ pub mod specified {
|
|||
}
|
||||
impl PositionComponent {
|
||||
pub fn parse(input: &mut Parser) -> Result<PositionComponent, ()> {
|
||||
|
||||
input.try(LengthOrPercentage::parse)
|
||||
.map(PositionComponent::LengthOrPercentage)
|
||||
.or_else(|()| {
|
||||
|
|
|
@ -471,7 +471,6 @@ const DEFAULT_USER_AGENT: UserAgent = UserAgent::Gonk;
|
|||
const DEFAULT_USER_AGENT: UserAgent = UserAgent::Desktop;
|
||||
|
||||
pub fn default_opts() -> Opts {
|
||||
|
||||
Opts {
|
||||
is_running_problem_test: false,
|
||||
url: Some(Url::parse("about:blank").unwrap()),
|
||||
|
|
|
@ -28,7 +28,6 @@ pub fn set_thread_local_hook(local: Box<FnBox(&Any)>) {
|
|||
/// Initiates the custom panic hook
|
||||
/// Should be called in main() after arguments have been parsed
|
||||
pub fn initiate_panic_hook() {
|
||||
|
||||
// Set the panic handler only once. It is global.
|
||||
HOOK_SET.call_once(|| {
|
||||
// The original backtrace-printing hook. We still want to call this
|
||||
|
|
|
@ -8,7 +8,6 @@ use std::{u32, u64};
|
|||
pub const NANOS_PER_SEC: u32 = 1_000_000_000;
|
||||
|
||||
pub fn duration_from_seconds(secs: f64) -> Duration {
|
||||
|
||||
// Get number of seconds and check that it fits in a u64.
|
||||
let whole_secs = secs.trunc();
|
||||
assert!(whole_secs >= 0.0 && whole_secs <= u64::MAX as f64);
|
||||
|
|
|
@ -275,7 +275,6 @@ impl<QueueData: Sync, WorkData: Send> WorkQueue<QueueData, WorkData> {
|
|||
|
||||
// Spawn threads.
|
||||
for (i, thread) in threads.into_iter().enumerate() {
|
||||
|
||||
spawn_named(
|
||||
format!("{} worker {}/{}", thread_name, i + 1, thread_count),
|
||||
move || {
|
||||
|
|
|
@ -778,7 +778,6 @@ impl WebDriverHandler<ServoExtensionRoute> for Handler {
|
|||
fn handle_command(&mut self,
|
||||
_session: &Option<Session>,
|
||||
msg: &WebDriverMessage<ServoExtensionRoute>) -> WebDriverResult<WebDriverResponse> {
|
||||
|
||||
// Unless we are trying to create a new session, we need to ensure that a
|
||||
// session has previously been created
|
||||
match msg.command {
|
||||
|
|
|
@ -20,7 +20,6 @@ use util::thread_state;
|
|||
use util::workqueue::WorkQueue;
|
||||
|
||||
pub struct PerDocumentStyleData {
|
||||
|
||||
/// Rule processor.
|
||||
pub stylist: Arc<Stylist>,
|
||||
|
||||
|
|
|
@ -140,7 +140,6 @@ pub extern "C" fn Servo_StylesheetFromUTF8Bytes(bytes: *const u8,
|
|||
referrer: *mut ThreadSafeURIHolder,
|
||||
principal: *mut ThreadSafePrincipalHolder)
|
||||
-> *mut RawServoStyleSheet {
|
||||
|
||||
let input = unsafe { from_utf8_unchecked(slice::from_raw_parts(bytes, length as usize)) };
|
||||
|
||||
let origin = match mode {
|
||||
|
|
|
@ -785,7 +785,6 @@ impl WindowMethods for Window {
|
|||
|
||||
/// Helper function to handle keyboard events.
|
||||
fn handle_key(&self, key: Key, mods: constellation_msg::KeyModifiers) {
|
||||
|
||||
match (mods, key) {
|
||||
(_, Key::Equal) => {
|
||||
if mods & !SHIFT == CMD_OR_CONTROL {
|
||||
|
|
|
@ -796,11 +796,9 @@ impl WindowMethods for Window {
|
|||
}
|
||||
|
||||
fn set_inner_size(&self, _: Size2D<u32>) {
|
||||
|
||||
}
|
||||
|
||||
fn set_position(&self, _: Point2D<i32>) {
|
||||
|
||||
}
|
||||
|
||||
/// Presents the window to the screen (perhaps by page flipping).
|
||||
|
|
|
@ -8,7 +8,6 @@ use std::env;
|
|||
use std::path::PathBuf;
|
||||
|
||||
pub fn run_mode(mode: &'static str) {
|
||||
|
||||
let mut config = compiletest::default_config();
|
||||
let cfg_mode = mode.parse().ok().expect("Invalid mode");
|
||||
|
||||
|
|
|
@ -42,7 +42,6 @@ impl AsyncFetchListener for FetchResponseCollector {
|
|||
}
|
||||
|
||||
fn make_server<H: Handler + 'static>(handler: H) -> (Listening, Url) {
|
||||
|
||||
// this is a Listening server because of handle_threads()
|
||||
let server = Server::http("0.0.0.0:0").unwrap().handle_threads(handler, 1).unwrap();
|
||||
let port = server.socket.port().to_string();
|
||||
|
@ -54,7 +53,6 @@ fn make_server<H: Handler + 'static>(handler: H) -> (Listening, Url) {
|
|||
|
||||
#[test]
|
||||
fn test_fetch_response_is_not_network_error() {
|
||||
|
||||
static MESSAGE: &'static [u8] = b"";
|
||||
let handler = move |_: HyperRequest, response: HyperResponse| {
|
||||
response.send(MESSAGE).unwrap();
|
||||
|
@ -76,7 +74,6 @@ fn test_fetch_response_is_not_network_error() {
|
|||
|
||||
#[test]
|
||||
fn test_fetch_response_body_matches_const_message() {
|
||||
|
||||
static MESSAGE: &'static [u8] = b"Hello World!";
|
||||
let handler = move |_: HyperRequest, response: HyperResponse| {
|
||||
response.send(MESSAGE).unwrap();
|
||||
|
@ -104,7 +101,6 @@ fn test_fetch_response_body_matches_const_message() {
|
|||
|
||||
#[test]
|
||||
fn test_fetch_aboutblank() {
|
||||
|
||||
let url = Url::parse("about:blank").unwrap();
|
||||
let origin = Origin::Origin(url.origin());
|
||||
let mut request = Request::new(url, Some(origin), false);
|
||||
|
@ -118,7 +114,6 @@ fn test_fetch_aboutblank() {
|
|||
|
||||
#[test]
|
||||
fn test_fetch_data() {
|
||||
|
||||
let url = Url::parse("data:text/html,<p>Servo</p>").unwrap();
|
||||
let origin = Origin::Origin(url.origin());
|
||||
let request = Request::new(url, Some(origin), false);
|
||||
|
@ -145,7 +140,6 @@ fn test_fetch_data() {
|
|||
|
||||
#[test]
|
||||
fn test_fetch_file() {
|
||||
|
||||
let mut path = resources_dir_path();
|
||||
path.push("servo.css");
|
||||
|
||||
|
@ -295,10 +289,8 @@ fn test_cors_preflight_fetch_network_error() {
|
|||
|
||||
#[test]
|
||||
fn test_fetch_response_is_basic_filtered() {
|
||||
|
||||
static MESSAGE: &'static [u8] = b"";
|
||||
let handler = move |_: HyperRequest, mut response: HyperResponse| {
|
||||
|
||||
response.headers_mut().set(SetCookie(vec![]));
|
||||
// this header is obsoleted, so hyper doesn't implement it, but it's still covered by the spec
|
||||
response.headers_mut().set_raw("Set-Cookie2", vec![]);
|
||||
|
@ -325,10 +317,8 @@ fn test_fetch_response_is_basic_filtered() {
|
|||
|
||||
#[test]
|
||||
fn test_fetch_response_is_cors_filtered() {
|
||||
|
||||
static MESSAGE: &'static [u8] = b"";
|
||||
let handler = move |_: HyperRequest, mut response: HyperResponse| {
|
||||
|
||||
// this is mandatory for the Cors Check to pass
|
||||
// TODO test using different url encodings with this value ie. punycode
|
||||
response.headers_mut().set(AccessControlAllowOrigin::Any);
|
||||
|
@ -383,7 +373,6 @@ fn test_fetch_response_is_cors_filtered() {
|
|||
|
||||
#[test]
|
||||
fn test_fetch_response_is_opaque_filtered() {
|
||||
|
||||
static MESSAGE: &'static [u8] = b"";
|
||||
let handler = move |_: HyperRequest, response: HyperResponse| {
|
||||
response.send(MESSAGE).unwrap();
|
||||
|
@ -419,10 +408,8 @@ fn test_fetch_response_is_opaque_filtered() {
|
|||
|
||||
#[test]
|
||||
fn test_fetch_response_is_opaque_redirect_filtered() {
|
||||
|
||||
static MESSAGE: &'static [u8] = b"";
|
||||
let handler = move |request: HyperRequest, mut response: HyperResponse| {
|
||||
|
||||
let redirects = match request.uri {
|
||||
RequestUri::AbsolutePath(url) =>
|
||||
url.split("/").collect::<String>().parse::<u32>().unwrap_or(0),
|
||||
|
@ -500,9 +487,7 @@ fn test_fetch_with_local_urls_only() {
|
|||
}
|
||||
|
||||
fn setup_server_and_fetch(message: &'static [u8], redirect_cap: u32) -> Response {
|
||||
|
||||
let handler = move |request: HyperRequest, mut response: HyperResponse| {
|
||||
|
||||
let redirects = match request.uri {
|
||||
RequestUri::AbsolutePath(url) =>
|
||||
url.split("/").collect::<String>().parse::<u32>().unwrap_or(0),
|
||||
|
@ -534,7 +519,6 @@ fn setup_server_and_fetch(message: &'static [u8], redirect_cap: u32) -> Response
|
|||
|
||||
#[test]
|
||||
fn test_fetch_redirect_count_ceiling() {
|
||||
|
||||
static MESSAGE: &'static [u8] = b"no more redirects";
|
||||
// how many redirects to cause
|
||||
let redirect_cap = 20;
|
||||
|
@ -554,7 +538,6 @@ fn test_fetch_redirect_count_ceiling() {
|
|||
|
||||
#[test]
|
||||
fn test_fetch_redirect_count_failure() {
|
||||
|
||||
static MESSAGE: &'static [u8] = b"this message shouldn't be reachable";
|
||||
// how many redirects to cause
|
||||
let redirect_cap = 21;
|
||||
|
@ -570,12 +553,10 @@ fn test_fetch_redirect_count_failure() {
|
|||
}
|
||||
|
||||
fn test_fetch_redirect_updates_method_runner(tx: Sender<bool>, status_code: StatusCode, method: Method) {
|
||||
|
||||
let handler_method = method.clone();
|
||||
let handler_tx = Arc::new(Mutex::new(tx));
|
||||
|
||||
let handler = move |request: HyperRequest, mut response: HyperResponse| {
|
||||
|
||||
let redirects = match request.uri {
|
||||
RequestUri::AbsolutePath(url) =>
|
||||
url.split("/").collect::<String>().parse::<u32>().unwrap_or(0),
|
||||
|
@ -587,12 +568,10 @@ fn test_fetch_redirect_updates_method_runner(tx: Sender<bool>, status_code: Stat
|
|||
let mut test_pass = true;
|
||||
|
||||
if redirects == 0 {
|
||||
|
||||
*response.status_mut() = StatusCode::TemporaryRedirect;
|
||||
response.headers_mut().set(Location("1".to_owned()));
|
||||
|
||||
} else if redirects == 1 {
|
||||
|
||||
// this makes sure that the request method does't change from the wrong status code
|
||||
if handler_method != Method::Get && request.method == Method::Get {
|
||||
test_pass = false;
|
||||
|
@ -625,7 +604,6 @@ fn test_fetch_redirect_updates_method_runner(tx: Sender<bool>, status_code: Stat
|
|||
|
||||
#[test]
|
||||
fn test_fetch_redirect_updates_method() {
|
||||
|
||||
let (tx, rx) = channel();
|
||||
|
||||
test_fetch_redirect_updates_method_runner(tx.clone(), StatusCode::MovedPermanently, Method::Post);
|
||||
|
@ -665,7 +643,6 @@ fn test_fetch_redirect_updates_method() {
|
|||
}
|
||||
|
||||
fn response_is_done(response: &Response) -> bool {
|
||||
|
||||
let response_complete = match response.response_type {
|
||||
ResponseType::Default | ResponseType::Basic | ResponseType::CORS => {
|
||||
(*response.body.lock().unwrap()).is_done()
|
||||
|
@ -685,7 +662,6 @@ fn response_is_done(response: &Response) -> bool {
|
|||
|
||||
#[test]
|
||||
fn test_fetch_async_returns_complete_response() {
|
||||
|
||||
static MESSAGE: &'static [u8] = b"this message should be retrieved in full";
|
||||
let handler = move |_: HyperRequest, response: HyperResponse| {
|
||||
response.send(MESSAGE).unwrap();
|
||||
|
@ -710,7 +686,6 @@ fn test_fetch_async_returns_complete_response() {
|
|||
|
||||
#[test]
|
||||
fn test_opaque_filtered_fetch_async_returns_complete_response() {
|
||||
|
||||
static MESSAGE: &'static [u8] = b"";
|
||||
let handler = move |_: HyperRequest, response: HyperResponse| {
|
||||
response.send(MESSAGE).unwrap();
|
||||
|
@ -737,10 +712,8 @@ fn test_opaque_filtered_fetch_async_returns_complete_response() {
|
|||
|
||||
#[test]
|
||||
fn test_opaque_redirect_filtered_fetch_async_returns_complete_response() {
|
||||
|
||||
static MESSAGE: &'static [u8] = b"";
|
||||
let handler = move |request: HyperRequest, mut response: HyperResponse| {
|
||||
|
||||
let redirects = match request.uri {
|
||||
RequestUri::AbsolutePath(url) =>
|
||||
url.split("/").collect::<String>().parse::<u32>().unwrap_or(0),
|
||||
|
|
|
@ -976,7 +976,6 @@ fn test_when_cookie_received_marked_secure_is_ignored_for_http() {
|
|||
|
||||
#[test]
|
||||
fn test_when_cookie_set_marked_httpsonly_secure_isnt_sent_on_http_request() {
|
||||
|
||||
let sec_url = Url::parse("https://mozilla.com").unwrap();
|
||||
let url = Url::parse("http://mozilla.com").unwrap();
|
||||
|
||||
|
@ -1609,7 +1608,6 @@ fn test_referer_set_to_origin_with_originonly_policy() {
|
|||
|
||||
#[test]
|
||||
fn test_referer_set_to_stripped_url_with_unsafeurl_policy() {
|
||||
|
||||
let request_url = "http://mozilla.com";
|
||||
let referrer_url = "http://username:password@someurl.com/some/path#fragment";
|
||||
let referrer_policy = Some(ReferrerPolicy::UnsafeUrl);
|
||||
|
@ -1787,7 +1785,6 @@ fn test_no_referrer_policy_follows_noreferrerwhendowngrade_http_to_http() {
|
|||
|
||||
#[test]
|
||||
fn test_no_referer_set_with_noreferrer_policy() {
|
||||
|
||||
let request_url = "http://mozilla.com";
|
||||
let referrer_url = "http://someurl.com";
|
||||
let referrer_policy = Some(ReferrerPolicy::NoReferrer);
|
||||
|
|
|
@ -48,7 +48,6 @@ fn test_get_set_reset_extend() {
|
|||
|
||||
#[test]
|
||||
fn test_default_config_dir_create_read_write() {
|
||||
|
||||
let json_str = "{\
|
||||
\"layout.writing-mode.enabled\": true,\
|
||||
\"extra.stuff\": false,\
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue