Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix commonmark Markdown warnings in docs, part 1 #18924

Merged
merged 1 commit into from Oct 17, 2017
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Fix commonmark Markdown warnings in docs, part 1

Fixes warnings from rust-lang/rust#44229 when `--enable-commonmark` is
passed to rustdoc.

This is mostly a global find-and-replace for bare URIs on lines by
themselves in doc comments.
  • Loading branch information
mbrubeck committed Oct 17, 2017
commit efc3683cc7ceff0cd8c8528a168a78d42fb1a0e8
@@ -865,7 +865,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
}
}

/// http://w3c.github.io/touch-events/#mouse-events
/// <http://w3c.github.io/touch-events/#mouse-events>
fn simulate_mouse_click(&mut self, p: TypedPoint2D<f32, DevicePixel>) {
let button = MouseButton::Left;
self.dispatch_mouse_window_move_event_class(p);
@@ -40,6 +40,7 @@ pub struct Opts {
pub device_pixels_per_px: Option<f32>,

/// `None` to disable the time profiler or `Some` to enable it with:
///
/// - an interval in seconds to cause it to produce output on that interval.
/// (`i.e. -p 5`).
/// - a file path to write profiling info to a TSV file upon Servo's termination.
@@ -68,7 +69,7 @@ pub struct Opts {
pub output_file: Option<String>,

/// Replace unpaires surrogates in DOM strings with U+FFFD.
/// See https://github.com/servo/servo/issues/6564
/// See <https://github.com/servo/servo/issues/6564>
pub replace_surrogates: bool,

/// Log GC passes and their durations.
@@ -296,7 +297,7 @@ pub struct DebugOptions {
pub convert_mouse_to_touch: bool,

/// Replace unpaires surrogates in DOM strings with U+FFFD.
/// See https://github.com/servo/servo/issues/6564
/// See <https://github.com/servo/servo/issues/6564>
pub replace_surrogates: bool,

/// Log GC passes and their durations.
@@ -109,7 +109,7 @@ impl BrowsingContext {
/// When we operate on the joint session history, entries are sorted chronologically,
/// so we timestamp the entries by when the entry was added to the session history.
///
/// https://html.spec.whatwg.org/multipage/#session-history-entry
/// <https://html.spec.whatwg.org/multipage/#session-history-entry>
#[derive(Clone)]
pub struct SessionHistoryEntry {
/// The timestamp for when the session history entry was created
@@ -12,7 +12,7 @@ use script_traits::ConstellationControlMsg;
use std::marker::PhantomData;
use std::rc::Rc;

/// https://html.spec.whatwg.org/multipage/#event-loop
/// <https://html.spec.whatwg.org/multipage/#event-loop>
pub struct EventLoop {
script_chan: IpcSender<ConstellationControlMsg>,
dont_send_or_sync: PhantomData<Rc<()>>,
@@ -858,7 +858,7 @@ fn get_ellipse_radius<F>(size: &Size2D<Au>, center: &Point2D<Au>, cmp: F) -> Siz
}

/// Determines the radius of a circle if it was not explictly provided.
/// https://drafts.csswg.org/css-images-3/#typedef-size
/// <https://drafts.csswg.org/css-images-3/#typedef-size>
fn convert_circle_size_keyword(keyword: ShapeExtent,
size: &Size2D<Au>,
center: &Point2D<Au>) -> Size2D<Au> {
@@ -882,7 +882,7 @@ fn convert_circle_size_keyword(keyword: ShapeExtent,
}

/// Determines the radius of an ellipse if it was not explictly provided.
/// https://drafts.csswg.org/css-images-3/#typedef-size
/// <https://drafts.csswg.org/css-images-3/#typedef-size>
fn convert_ellipse_size_keyword(keyword: ShapeExtent,
size: &Size2D<Au>,
center: &Point2D<Au>) -> Size2D<Au> {
@@ -264,7 +264,7 @@ impl FlexLine {
/// This method implements the flexible lengths resolving algorithm.
/// The 'collapse' parameter is used to indicate whether items with 'visibility: collapse'
/// is included in length resolving. The result main size is stored in 'item.main_size'.
/// https://drafts.csswg.org/css-flexbox/#resolve-flexible-lengths
/// <https://drafts.csswg.org/css-flexbox/#resolve-flexible-lengths>
pub fn flex_resolve(&mut self, items: &mut [FlexItem], collapse: bool) {
let mut total_grow = 0.0;
let mut total_shrink = 0.0;
@@ -679,7 +679,7 @@ pub fn process_node_scroll_area_request< N: LayoutNode>(requested_node: N, layou
}

/// Return the resolved value of property for a given (pseudo)element.
/// https://drafts.csswg.org/cssom/#resolved-value
/// <https://drafts.csswg.org/cssom/#resolved-value>
pub fn process_resolved_style_request<'a, N>(context: &LayoutContext,
node: N,
pseudo: &Option<PseudoElement>,
@@ -42,7 +42,7 @@ impl Cookie {
.unwrap_or(None)
}

/// http://tools.ietf.org/html/rfc6265#section-5.3
/// <http://tools.ietf.org/html/rfc6265#section-5.3>
pub fn new_wrapped(mut cookie: cookie_rs::Cookie<'static>, request: &ServoUrl, source: CookieSource)
-> Option<Cookie> {
// Step 3
@@ -494,7 +494,7 @@ fn scheme_fetch(request: &mut Request,
}
}

/// https://fetch.spec.whatwg.org/#cors-safelisted-request-header
/// <https://fetch.spec.whatwg.org/#cors-safelisted-request-header>
pub fn is_cors_safelisted_request_header(h: &HeaderView) -> bool {
if h.is::<ContentType>() {
match h.value() {
@@ -509,7 +509,7 @@ pub fn is_cors_safelisted_request_header(h: &HeaderView) -> bool {
}
}

/// https://fetch.spec.whatwg.org/#cors-safelisted-method
/// <https://fetch.spec.whatwg.org/#cors-safelisted-method>
pub fn is_cors_safelisted_method(m: &Method) -> bool {
match *m {
Method::Get | Method::Head | Method::Post => true,
@@ -528,9 +528,9 @@ fn is_null_body_status(status: &Option<StatusCode>) -> bool {
}
}

/// https://fetch.spec.whatwg.org/#should-response-to-request-be-blocked-due-to-nosniff?
/// <https://fetch.spec.whatwg.org/#should-response-to-request-be-blocked-due-to-nosniff?>
pub fn should_be_blocked_due_to_nosniff(request_type: Type, response_headers: &Headers) -> bool {
/// https://fetch.spec.whatwg.org/#x-content-type-options-header
/// <https://fetch.spec.whatwg.org/#x-content-type-options-header>
/// This is needed to parse `X-Content-Type-Options` according to spec,
/// which requires that we inspect only the first value.
///
@@ -572,7 +572,7 @@ pub fn should_be_blocked_due_to_nosniff(request_type: Type, response_headers: &H
// Note: an invalid MIME type will produce a `None`.
let content_type_header = response_headers.get::<ContentType>();

/// https://html.spec.whatwg.org/multipage/#scriptingLanguages
/// <https://html.spec.whatwg.org/multipage/#scriptingLanguages>
#[inline]
fn is_javascript_mime_type(mime_type: &Mime) -> bool {
let javascript_mime_types: [Mime; 16] = [
@@ -619,7 +619,7 @@ pub fn should_be_blocked_due_to_nosniff(request_type: Type, response_headers: &H
};
}

/// https://fetch.spec.whatwg.org/#should-response-to-request-be-blocked-due-to-mime-type?
/// <https://fetch.spec.whatwg.org/#should-response-to-request-be-blocked-due-to-mime-type?>
fn should_be_blocked_due_to_mime_type(request_type: Type, response_headers: &Headers) -> bool {
let mime_type = match response_headers.get::<ContentType>() {
Some(header) => header,
@@ -634,7 +634,7 @@ fn should_be_blocked_due_to_mime_type(request_type: Type, response_headers: &Hea
}
}

/// https://fetch.spec.whatwg.org/#block-bad-port
/// <https://fetch.spec.whatwg.org/#block-bad-port>
pub fn should_be_blocked_due_to_bad_port(url: &ServoUrl) -> bool {
// Step 1 is not applicable, this function just takes the URL directly.

@@ -662,12 +662,12 @@ pub fn should_be_blocked_due_to_bad_port(url: &ServoUrl) -> bool {
false
}

/// https://fetch.spec.whatwg.org/#network-scheme
/// <https://fetch.spec.whatwg.org/#network-scheme>
fn is_network_scheme(scheme: &str) -> bool {
scheme == "ftp" || scheme == "http" || scheme == "https"
}

/// https://fetch.spec.whatwg.org/#bad-port
/// <https://fetch.spec.whatwg.org/#bad-port>
fn is_bad_port(port: u16) -> bool {
static BAD_PORTS: [u16; 64] = [
1, 7, 9, 11, 13, 15, 17, 19, 20, 21, 22, 23, 25, 37, 42,
@@ -193,23 +193,23 @@ pub fn set_default_accept_language(headers: &mut Headers) {
]));
}

/// https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-state-no-referrer-when-downgrade
/// <https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-state-no-referrer-when-downgrade>
fn no_referrer_when_downgrade_header(referrer_url: ServoUrl, url: ServoUrl) -> Option<ServoUrl> {
if referrer_url.scheme() == "https" && url.scheme() != "https" {
return None;
}
return strip_url(referrer_url, false);
}

/// https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-strict-origin
/// <https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-strict-origin>
fn strict_origin(referrer_url: ServoUrl, url: ServoUrl) -> Option<ServoUrl> {
if referrer_url.scheme() == "https" && url.scheme() != "https" {
return None;
}
strip_url(referrer_url, true)
}

/// https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-strict-origin-when-cross-origin
/// <https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-strict-origin-when-cross-origin>
fn strict_origin_when_cross_origin(referrer_url: ServoUrl, url: ServoUrl) -> Option<ServoUrl> {
if referrer_url.scheme() == "https" && url.scheme() != "https" {
return None;
@@ -218,7 +218,7 @@ fn strict_origin_when_cross_origin(referrer_url: ServoUrl, url: ServoUrl) -> Opt
strip_url(referrer_url, cross_origin)
}

/// https://w3c.github.io/webappsec-referrer-policy/#strip-url
/// <https://w3c.github.io/webappsec-referrer-policy/#strip-url>
fn strip_url(mut referrer_url: ServoUrl, origin_only: bool) -> Option<ServoUrl> {
if referrer_url.scheme() == "https" || referrer_url.scheme() == "http" {
{
@@ -236,7 +236,7 @@ fn strip_url(mut referrer_url: ServoUrl, origin_only: bool) -> Option<ServoUrl>
return None;
}

/// https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer
/// <https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer>
/// Steps 4-6.
pub fn determine_request_referrer(headers: &mut Headers,
referrer_policy: ReferrerPolicy,
@@ -1376,7 +1376,7 @@ fn response_needs_revalidation(_response: &Response) -> bool {
false
}

/// https://fetch.spec.whatwg.org/#redirect-status
/// <https://fetch.spec.whatwg.org/#redirect-status>
pub fn is_redirect_status(status: StatusCode) -> bool {
match status {
StatusCode::MovedPermanently |
@@ -30,7 +30,7 @@ pub enum ApacheBugFlag {
}

impl ApacheBugFlag {
/// https://mimesniff.spec.whatwg.org/#supplied-mime-type-detection-algorithm
/// <https://mimesniff.spec.whatwg.org/#supplied-mime-type-detection-algorithm>
pub fn from_content_type(last_raw_content_type: &[u8]) -> ApacheBugFlag {
if last_raw_content_type == b"text/plain"
|| last_raw_content_type == b"text/plain; charset=ISO-8859-1"
@@ -16,7 +16,7 @@ const SUPPORTED_ALGORITHM: &'static [&'static str] = &[
pub type StaticCharVec = &'static [char];
/// A "space character" according to:
///
/// https://html.spec.whatwg.org/multipage/#space-character
/// <https://html.spec.whatwg.org/multipage/#space-character>
pub static HTML_SPACE_CHARACTERS: StaticCharVec = &[
'\u{0020}',
'\u{0009}',
@@ -44,7 +44,7 @@ impl SriEntry {
}
}

/// https://w3c.github.io/webappsec-subresource-integrity/#parse-metadata
/// <https://w3c.github.io/webappsec-subresource-integrity/#parse-metadata>
pub fn parsed_metadata(integrity_metadata: &str) -> Vec<SriEntry> {
// Step 1
let mut result = vec![];
@@ -77,7 +77,7 @@ pub fn parsed_metadata(integrity_metadata: &str) -> Vec<SriEntry> {
return result;
}

/// https://w3c.github.io/webappsec-subresource-integrity/#getprioritizedhashfunction
/// <https://w3c.github.io/webappsec-subresource-integrity/#getprioritizedhashfunction>
pub fn get_prioritized_hash_function(hash_func_left: &str, hash_func_right: &str) -> Option<String> {
let left_priority = SUPPORTED_ALGORITHM.iter().position(|s| s.to_owned() == hash_func_left).unwrap();
let right_priority = SUPPORTED_ALGORITHM.iter().position(|s| s.to_owned() == hash_func_right).unwrap();
@@ -93,7 +93,7 @@ pub fn get_prioritized_hash_function(hash_func_left: &str, hash_func_right: &str

}

/// https://w3c.github.io/webappsec-subresource-integrity/#get-the-strongest-metadata
/// <https://w3c.github.io/webappsec-subresource-integrity/#get-the-strongest-metadata>
pub fn get_strongest_metadata(integrity_metadata_list: Vec<SriEntry>) -> Vec<SriEntry> {
let mut result: Vec<SriEntry> = vec![integrity_metadata_list[0].clone()];
let mut current_algorithm = result[0].alg.clone();
@@ -114,7 +114,7 @@ pub fn get_strongest_metadata(integrity_metadata_list: Vec<SriEntry>) -> Vec<Sri
result
}

/// https://w3c.github.io/webappsec-subresource-integrity/#apply-algorithm-to-response
/// <https://w3c.github.io/webappsec-subresource-integrity/#apply-algorithm-to-response>
fn apply_algorithm_to_response(body: MutexGuard<ResponseBody>,
message_digest: MessageDigest)
-> String {
@@ -126,15 +126,15 @@ fn apply_algorithm_to_response(body: MutexGuard<ResponseBody>,
}
}

/// https://w3c.github.io/webappsec-subresource-integrity/#is-response-eligible
/// <https://w3c.github.io/webappsec-subresource-integrity/#is-response-eligible>
fn is_eligible_for_integrity_validation(response: &Response) -> bool {
match response.response_type {
ResponseType::Basic | ResponseType::Default | ResponseType::Cors => true,
_ => false,
}
}

/// https://w3c.github.io/webappsec-subresource-integrity/#does-response-match-metadatalist
/// <https://w3c.github.io/webappsec-subresource-integrity/#does-response-match-metadatalist>
pub fn is_response_integrity_valid(integrity_metadata: &str, response: &Response) -> bool {
let parsed_metadata_list: Vec<SriEntry> = parsed_metadata(integrity_metadata);

@@ -34,7 +34,8 @@ pub struct BlobBuf {
}

/// Parse URL as Blob URL scheme's definition
/// https://w3c.github.io/FileAPI/#DefinitionOfScheme
///
/// <https://w3c.github.io/FileAPI/#DefinitionOfScheme>
pub fn parse_blob_url(url: &ServoUrl) -> Result<(Uuid, FileOrigin), ()> {
let url_inner = Url::parse(url.path()).map_err(|_| ())?;
let id = {
@@ -47,6 +48,7 @@ pub fn parse_blob_url(url: &ServoUrl) -> Result<(Uuid, FileOrigin), ()> {

/// Given an URL, returning the Origin that a Blob created under this
/// URL should have.
///
/// HACK(izgzhen): Not well-specified on spec, and it is a bit a hack
/// both due to ambiguity of spec and that we have to serialization the
/// Origin here.
@@ -17,7 +17,7 @@ pub type FileOrigin = String;

/// Relative slice positions of a sequence,
/// whose semantic should be consistent with (start, end) parameters in
/// https://w3c.github.io/FileAPI/#dfn-slice
/// <https://w3c.github.io/FileAPI/#dfn-slice>
#[derive(Clone, Deserialize, Serialize)]
pub struct RelativePos {
/// Relative to first byte if non-negative,
@@ -59,7 +59,7 @@ impl RelativePos {
}

/// Compute absolute range by giving the total size
/// https://w3c.github.io/FileAPI/#slice-method-algo
/// <https://w3c.github.io/FileAPI/#slice-method-algo>
pub fn to_abs_range(&self, size: usize) -> Range<usize> {
let size = size as i64;

@@ -59,7 +59,7 @@ pub mod image {
}

/// A loading context, for context-specific sniffing, as defined in
/// https://mimesniff.spec.whatwg.org/#context-specific-sniffing
/// <https://mimesniff.spec.whatwg.org/#context-specific-sniffing>
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
pub enum LoadContext {
Browsing,
@@ -159,25 +159,25 @@ pub enum FetchResponseMsg {
}

pub trait FetchTaskTarget {
/// https://fetch.spec.whatwg.org/#process-request-body
/// <https://fetch.spec.whatwg.org/#process-request-body>
///
/// Fired when a chunk of the request body is transmitted
fn process_request_body(&mut self, request: &Request);

/// https://fetch.spec.whatwg.org/#process-request-end-of-file
/// <https://fetch.spec.whatwg.org/#process-request-end-of-file>
///
/// Fired when the entire request finishes being transmitted
fn process_request_eof(&mut self, request: &Request);

/// https://fetch.spec.whatwg.org/#process-response
/// <https://fetch.spec.whatwg.org/#process-response>
///
/// Fired when headers are received
fn process_response(&mut self, response: &Response);

/// Fired when a chunk of response content is received
fn process_response_chunk(&mut self, chunk: Vec<u8>);

/// https://fetch.spec.whatwg.org/#process-response-end-of-file
/// <https://fetch.spec.whatwg.org/#process-response-end-of-file>
///
/// Fired when the response is fully fetched
fn process_response_eof(&mut self, response: &Response);
@@ -7,7 +7,7 @@
//! The list is a file located on the `resources` folder and loaded once on first need.
//!
//! The list can be updated with `./mach update-pub-domains` from this source:
//! https://publicsuffix.org/list/
//! <https://publicsuffix.org/list/>
//!
//! This implementation is not strictly following the specification of the list. Wildcards are not
//! restricted to appear only in the leftmost position, but the current list has no such cases so
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.