mirror of
https://github.com/servo/servo.git
synced 2025-09-30 00:29:14 +01:00
tidy: Add a rule ensuring that //
comments are followed by a space in Rust (#38698)
This shows up sometimes in code reviews, so it makes sense that tidy enforces it. `rustfmt` supports this via comment normalization, but it does many other things and is still an unstable feature (with bugs). Testing: There are new tidy tests for this change. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
8ca00a3b0c
commit
8743a11ba4
68 changed files with 169 additions and 152 deletions
|
@ -95,7 +95,7 @@ unsafe extern "C" fn principals_is_system_or_addon_principal(_: *mut JSPrincipal
|
|||
false
|
||||
}
|
||||
|
||||
//TODO is same_origin_domain equivalent to subsumes for our purposes
|
||||
// TODO is same_origin_domain equivalent to subsumes for our purposes
|
||||
pub(crate) unsafe extern "C" fn subsumes(obj: *mut JSPrincipals, other: *mut JSPrincipals) -> bool {
|
||||
match (NonNull::new(obj), NonNull::new(other)) {
|
||||
(Some(obj), Some(other)) => {
|
||||
|
|
|
@ -8,7 +8,7 @@ use js::jsapi::{GetScriptedCallerGlobal, JSTracer};
|
|||
use js::rust::Runtime;
|
||||
use script_bindings::settings_stack::*;
|
||||
|
||||
//use script_bindings::interfaces::{DomHelpers, GlobalScopeHelpers};
|
||||
// use script_bindings::interfaces::{DomHelpers, GlobalScopeHelpers};
|
||||
use crate::dom::bindings::root::DomRoot;
|
||||
use crate::dom::bindings::trace::JSTraceable;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
|
|
|
@ -564,7 +564,7 @@ impl BluetoothMethods<crate::DomTypeHolder> for Bluetooth {
|
|||
sender,
|
||||
can_gc,
|
||||
);
|
||||
//Note: Step 3 - 4. in response function, Step 5. in handle_response function.
|
||||
// Note: Step 3 - 4. in response function, Step 5. in handle_response function.
|
||||
p
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ pub(crate) struct BluetoothUUID {
|
|||
reflector_: Reflector,
|
||||
}
|
||||
|
||||
//https://developer.bluetooth.org/gatt/services/Pages/ServicesHome.aspx
|
||||
// https://developer.bluetooth.org/gatt/services/Pages/ServicesHome.aspx
|
||||
const BLUETOOTH_ASSIGNED_SERVICES: &[(&str, u32)] = &[
|
||||
("org.bluetooth.service.alert_notification", 0x1811_u32),
|
||||
("org.bluetooth.service.automation_io", 0x1815_u32),
|
||||
|
@ -76,7 +76,7 @@ const BLUETOOTH_ASSIGNED_SERVICES: &[(&str, u32)] = &[
|
|||
("org.bluetooth.service.weight_scale", 0x181d_u32),
|
||||
];
|
||||
|
||||
//https://developer.bluetooth.org/gatt/services/Pages/ServicesHome.aspx
|
||||
// https://developer.bluetooth.org/gatt/services/Pages/ServicesHome.aspx
|
||||
const BLUETOOTH_ASSIGNED_CHARCTERISTICS: &[(&str, u32)] = &[
|
||||
(
|
||||
"org.bluetooth.characteristic.aerobic_heart_rate_lower_limit",
|
||||
|
@ -524,7 +524,7 @@ const BLUETOOTH_ASSIGNED_CHARCTERISTICS: &[(&str, u32)] = &[
|
|||
("org.bluetooth.characteristic.wind_chill", 0x2a79_u32),
|
||||
];
|
||||
|
||||
//https://developer.bluetooth.org/gatt/services/Pages/ServicesHome.aspx
|
||||
// https://developer.bluetooth.org/gatt/services/Pages/ServicesHome.aspx
|
||||
const BLUETOOTH_ASSIGNED_DESCRIPTORS: &[(&str, u32)] = &[
|
||||
(
|
||||
"org.bluetooth.descriptor.gatt.characteristic_extended_properties",
|
||||
|
|
|
@ -169,7 +169,7 @@ fn create_html_element(
|
|||
// steps while catching any exceptions:
|
||||
CustomElementCreationMode::Synchronous => {
|
||||
let local_name = name.local.clone();
|
||||
//TODO(jdm) Pass proto to create_element?
|
||||
// TODO(jdm) Pass proto to create_element?
|
||||
// Steps 4.1.1-4.1.11
|
||||
return match definition.create_element(document, prefix.clone(), can_gc) {
|
||||
Ok(element) => {
|
||||
|
|
|
@ -205,7 +205,7 @@ impl DataTransferMethods<crate::DomTypeHolder> for DataTransfer {
|
|||
// Step 9 If convert-to-URL is true, then parse result as appropriate for text/uri-list data,
|
||||
// and then set result to the first URL from the list, if any, or the empty string otherwise.
|
||||
if convert_to_url {
|
||||
//TODO parse uri-list as [RFC2483]
|
||||
// TODO parse uri-list as [RFC2483]
|
||||
}
|
||||
|
||||
// Step 10 Return result.
|
||||
|
|
|
@ -1868,7 +1868,7 @@ impl Document {
|
|||
// TODO: Step 1, increase the event loop's termination nesting level by 1.
|
||||
// Step 2
|
||||
self.incr_ignore_opens_during_unload_counter();
|
||||
//Step 3-5.
|
||||
// Step 3-5.
|
||||
let beforeunload_event = BeforeUnloadEvent::new(
|
||||
&self.window,
|
||||
atom!("beforeunload"),
|
||||
|
@ -3267,7 +3267,7 @@ impl Document {
|
|||
LazyLock::new(StyleSharedRwLock::new);
|
||||
|
||||
PER_PROCESS_AUTHOR_SHARED_LOCK.clone()
|
||||
//StyleSharedRwLock::new()
|
||||
// StyleSharedRwLock::new()
|
||||
},
|
||||
stylesheets: DomRefCell::new(DocumentStylesheetSet::new()),
|
||||
stylesheet_list: MutNullableDom::new(None),
|
||||
|
|
|
@ -1275,7 +1275,7 @@ impl DocumentEventHandler {
|
|||
_ => (),
|
||||
}
|
||||
}
|
||||
//Step 5
|
||||
// Step 5
|
||||
true
|
||||
}
|
||||
|
||||
|
|
|
@ -2940,8 +2940,8 @@ impl Element {
|
|||
HTMLElementTypeId::HTMLAnchorElement,
|
||||
)) => element.has_attribute(&local_name!("href")),
|
||||
|
||||
//TODO focusable if editing host
|
||||
//TODO focusable if "sorting interface th elements"
|
||||
// TODO focusable if editing host
|
||||
// TODO focusable if "sorting interface th elements"
|
||||
_ => {
|
||||
// Draggable elements are focusable.
|
||||
element.get_string_attribute(&local_name!("draggable")) == "true"
|
||||
|
|
|
@ -718,7 +718,7 @@ impl EventSourceTimeoutCallback {
|
|||
let mut request = event_source.request();
|
||||
// Step 5.3
|
||||
if !event_source.last_event_id.borrow().is_empty() {
|
||||
//TODO(eijebong): Change this once typed header support custom values
|
||||
// TODO(eijebong): Change this once typed header support custom values
|
||||
request.headers.insert(
|
||||
HeaderName::from_static("last-event-id"),
|
||||
HeaderValue::from_str(&String::from(event_source.last_event_id.borrow().clone()))
|
||||
|
|
|
@ -377,7 +377,7 @@ impl CompiledEventListener {
|
|||
) {
|
||||
let value = rooted_return_value.handle();
|
||||
|
||||
//Step 5
|
||||
// Step 5
|
||||
let should_cancel = value.is_boolean() && !value.to_boolean();
|
||||
|
||||
if should_cancel {
|
||||
|
|
|
@ -139,7 +139,7 @@ impl FileReaderSharedFunctionality {
|
|||
blob_type: &str,
|
||||
blob_label: &Option<String>,
|
||||
) -> DOMString {
|
||||
//https://w3c.github.io/FileAPI/#encoding-determination
|
||||
// https://w3c.github.io/FileAPI/#encoding-determination
|
||||
// Steps 1 & 2 & 3
|
||||
let mut encoding = blob_label
|
||||
.as_ref()
|
||||
|
@ -194,7 +194,7 @@ impl FileReader {
|
|||
reflect_dom_object_with_proto(Box::new(FileReader::new_inherited()), global, proto, can_gc)
|
||||
}
|
||||
|
||||
//https://w3c.github.io/FileAPI/#dfn-error-steps
|
||||
// https://w3c.github.io/FileAPI/#dfn-error-steps
|
||||
pub(crate) fn process_read_error(
|
||||
filereader: TrustedFileReader,
|
||||
gen_id: GenerationId,
|
||||
|
@ -244,7 +244,7 @@ impl FileReader {
|
|||
);
|
||||
);
|
||||
return_on_abort!();
|
||||
//FIXME Step 7 send current progress
|
||||
// FIXME Step 7 send current progress
|
||||
fr.dispatch_progress_event(atom!("progress"), 0, None, can_gc);
|
||||
}
|
||||
|
||||
|
@ -328,7 +328,7 @@ impl FileReader {
|
|||
*result.borrow_mut() = Some(FileReaderResult::String(output));
|
||||
}
|
||||
|
||||
//https://w3c.github.io/FileAPI/#dfn-readAsDataURL
|
||||
// https://w3c.github.io/FileAPI/#dfn-readAsDataURL
|
||||
fn perform_readasdataurl(
|
||||
result: &DomRefCell<Option<FileReaderResult>>,
|
||||
data: ReadMetaData,
|
||||
|
|
|
@ -2691,7 +2691,7 @@ impl GlobalScope {
|
|||
type_: "PageError".to_string(),
|
||||
error_message: error_info.message.clone(),
|
||||
source_name: error_info.filename.clone(),
|
||||
line_text: "".to_string(), //TODO
|
||||
line_text: "".to_string(), // TODO
|
||||
line_number: error_info.lineno,
|
||||
column_number: error_info.column,
|
||||
category: "script".to_string(),
|
||||
|
|
|
@ -527,7 +527,7 @@ fn is_legal_header_value(value: &[u8]) -> bool {
|
|||
// If accepting non-UTF8 header values causes breakage,
|
||||
// removing the above "true" and uncommenting the below code
|
||||
// would ameliorate it while still accepting most reasonable headers:
|
||||
//match str::from_utf8(value) {
|
||||
// match str::from_utf8(value) {
|
||||
// Ok(_) => true,
|
||||
// Err(_) => {
|
||||
// warn!(
|
||||
|
|
|
@ -318,7 +318,7 @@ impl Activatable for HTMLAnchorElement {
|
|||
self.as_element().has_attribute(&local_name!("href"))
|
||||
}
|
||||
|
||||
//https://html.spec.whatwg.org/multipage/#the-a-element:activation-behaviour
|
||||
// https://html.spec.whatwg.org/multipage/#the-a-element:activation-behaviour
|
||||
fn activation_behavior(&self, event: &Event, target: &EventTarget, _: CanGc) {
|
||||
let element = self.as_element();
|
||||
let mouse_event = event.downcast::<MouseEvent>().unwrap();
|
||||
|
@ -339,7 +339,7 @@ impl Activatable for HTMLAnchorElement {
|
|||
}
|
||||
|
||||
// Step 2.
|
||||
//TODO: Download the link is `download` attribute is set.
|
||||
// TODO: Download the link is `download` attribute is set.
|
||||
follow_hyperlink(element, self.relations.get(), ismap_suffix);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -197,7 +197,7 @@ impl VirtualMethods for HTMLBodyElement {
|
|||
&local_name!("onunload") => {
|
||||
let source = &**attr.value();
|
||||
let evtarget = window.upcast::<EventTarget>(); // forwarded event
|
||||
let source_line = 1; //TODO(#9604) obtain current JS execution line
|
||||
let source_line = 1; // TODO(#9604) obtain current JS execution line
|
||||
evtarget.set_event_handler_uncompiled(
|
||||
window.get_url(),
|
||||
source_line,
|
||||
|
|
|
@ -354,7 +354,7 @@ impl Activatable for HTMLButtonElement {
|
|||
}
|
||||
|
||||
fn is_instance_activatable(&self) -> bool {
|
||||
//https://html.spec.whatwg.org/multipage/#the-button-element
|
||||
// https://html.spec.whatwg.org/multipage/#the-button-element
|
||||
!self.upcast::<Element>().disabled_state()
|
||||
}
|
||||
|
||||
|
@ -362,7 +362,7 @@ impl Activatable for HTMLButtonElement {
|
|||
fn activation_behavior(&self, _event: &Event, _target: &EventTarget, can_gc: CanGc) {
|
||||
let ty = self.button_type.get();
|
||||
match ty {
|
||||
//https://html.spec.whatwg.org/multipage/#attr-button-type-submit-state
|
||||
// https://html.spec.whatwg.org/multipage/#attr-button-type-submit-state
|
||||
ButtonType::Submit => {
|
||||
// TODO: is document owner fully active?
|
||||
if let Some(owner) = self.form_owner() {
|
||||
|
|
|
@ -717,7 +717,7 @@ fn to_camel_case(name: &str) -> Option<DOMString> {
|
|||
let mut result = String::with_capacity(name.len().saturating_sub(DATA_PREFIX.len()));
|
||||
let mut name_chars = name.chars();
|
||||
while let Some(curr_char) = name_chars.next() {
|
||||
//check for hyphen followed by character
|
||||
// check for hyphen followed by character
|
||||
if curr_char == DATA_HYPHEN_SEPARATOR {
|
||||
if let Some(next_char) = name_chars.next() {
|
||||
if next_char.is_ascii_lowercase() {
|
||||
|
@ -1105,7 +1105,7 @@ impl VirtualMethods for HTMLElement {
|
|||
(name, AttributeMutation::Set(_)) if name.starts_with("on") => {
|
||||
let source = &**attr.value();
|
||||
let evtarget = self.upcast::<EventTarget>();
|
||||
let source_line = 1; //TODO(#9604) get current JS execution line
|
||||
let source_line = 1; // TODO(#9604) get current JS execution line
|
||||
evtarget.set_event_handler_uncompiled(
|
||||
self.owner_window().get_url(),
|
||||
source_line,
|
||||
|
|
|
@ -789,7 +789,7 @@ impl HTMLImageElement {
|
|||
let wid = imgsource.descriptor.width.unwrap();
|
||||
imgsource.descriptor.density = Some(wid as f64 / source_size_length.to_f64_px());
|
||||
} else {
|
||||
//Step 2.3
|
||||
// Step 2.3
|
||||
imgsource.descriptor.density = Some(1_f64);
|
||||
}
|
||||
}
|
||||
|
@ -1547,7 +1547,7 @@ impl LayoutHTMLImageElementHelpers for LayoutDom<'_, HTMLImageElement> {
|
|||
}
|
||||
}
|
||||
|
||||
//https://html.spec.whatwg.org/multipage/#parse-a-sizes-attribute
|
||||
// https://html.spec.whatwg.org/multipage/#parse-a-sizes-attribute
|
||||
pub(crate) fn parse_a_sizes_attribute(value: DOMString) -> SourceSizeList {
|
||||
let mut input = ParserInput::new(&value);
|
||||
let mut parser = Parser::new(&mut input);
|
||||
|
|
|
@ -810,7 +810,7 @@ impl HTMLInputElement {
|
|||
if (value - step_base) % allowed_value_step != 0.0 {
|
||||
value = match dir {
|
||||
StepDirection::Down =>
|
||||
//step down a fractional step to be on a step multiple
|
||||
// step down a fractional step to be on a step multiple
|
||||
{
|
||||
let intervals_from_base = ((value - step_base) / allowed_value_step).floor();
|
||||
intervals_from_base * allowed_value_step + step_base
|
||||
|
@ -3065,7 +3065,7 @@ impl VirtualMethods for HTMLInputElement {
|
|||
// WHATWG-specified activation behaviors are handled elsewhere;
|
||||
// this is for all the other things a UI click might do
|
||||
|
||||
//TODO(#10083): set the editing position for text inputs
|
||||
// TODO(#10083): set the editing position for text inputs
|
||||
|
||||
if self.input_type().is_textual_or_password() &&
|
||||
// Check if we display a placeholder. Layout doesn't know about this.
|
||||
|
|
|
@ -424,7 +424,7 @@ impl FetchResponseListener for ClassicContext {
|
|||
|
||||
let elem = self.elem.root();
|
||||
let global = elem.global();
|
||||
//let cx = GlobalScope::get_cx();
|
||||
// let cx = GlobalScope::get_cx();
|
||||
let _ar = enter_realm(&*global);
|
||||
|
||||
/*
|
||||
|
@ -471,7 +471,7 @@ impl FetchResponseListener for ClassicContext {
|
|||
Ok(load),
|
||||
CanGc::note(),
|
||||
);
|
||||
//}
|
||||
// }
|
||||
}
|
||||
|
||||
fn resource_timing_mut(&mut self) -> &mut ResourceFetchTiming {
|
||||
|
|
|
@ -641,7 +641,7 @@ impl VirtualMethods for HTMLTextAreaElement {
|
|||
}
|
||||
|
||||
if event.type_() == atom!("click") && !event.DefaultPrevented() {
|
||||
//TODO: set the editing position for text inputs
|
||||
// TODO: set the editing position for text inputs
|
||||
} else if event.type_() == atom!("keydown") && !event.DefaultPrevented() {
|
||||
if let Some(kevent) = event.downcast::<KeyboardEvent>() {
|
||||
// This can't be inlined, as holding on to textinput.borrow_mut()
|
||||
|
|
|
@ -306,7 +306,7 @@ impl Performance {
|
|||
}
|
||||
|
||||
// Step 4.
|
||||
//add the new entry to the buffer.
|
||||
// add the new entry to the buffer.
|
||||
self.buffer
|
||||
.borrow_mut()
|
||||
.entries
|
||||
|
|
|
@ -27,7 +27,7 @@ use crate::script_runtime::{CanGc, JSContext};
|
|||
|
||||
/// List of allowed performance entry types, in alphabetical order.
|
||||
pub(crate) const VALID_ENTRY_TYPES: &[&str] = &[
|
||||
// "frame", //TODO Frame Timing API
|
||||
// "frame", // TODO Frame Timing API
|
||||
"mark", // User Timing API
|
||||
"measure", // User Timing API
|
||||
"navigation", // Navigation Timing API
|
||||
|
|
|
@ -63,9 +63,9 @@ pub(crate) struct PerformanceResourceTiming {
|
|||
response_start: Option<CrossProcessInstant>,
|
||||
#[no_trace]
|
||||
response_end: Option<CrossProcessInstant>,
|
||||
transfer_size: u64, //size in octets
|
||||
encoded_body_size: u64, //size in octets
|
||||
decoded_body_size: u64, //size in octets
|
||||
transfer_size: u64, // size in octets
|
||||
encoded_body_size: u64, // size in octets
|
||||
decoded_body_size: u64, // size in octets
|
||||
}
|
||||
|
||||
// TODO(#21269): next_hop
|
||||
|
@ -114,7 +114,7 @@ impl PerformanceResourceTiming {
|
|||
}
|
||||
}
|
||||
|
||||
//TODO fetch start should be in RFT
|
||||
// TODO fetch start should be in RFT
|
||||
#[cfg_attr(crown, allow(crown::unrooted_must_root))]
|
||||
fn from_resource_timing(
|
||||
url: ServoUrl,
|
||||
|
@ -140,7 +140,7 @@ impl PerformanceResourceTiming {
|
|||
redirect_end: resource_timing.redirect_end,
|
||||
fetch_start: resource_timing.fetch_start,
|
||||
domain_lookup_start: resource_timing.domain_lookup_start,
|
||||
//TODO (#21260)
|
||||
// TODO (#21260)
|
||||
domain_lookup_end: None,
|
||||
connect_start: resource_timing.connect_start,
|
||||
connect_end: resource_timing.connect_end,
|
||||
|
|
|
@ -23,7 +23,7 @@ use crate::dom::range::WeakRangeVec;
|
|||
use crate::dom::shadowroot::ShadowRoot;
|
||||
use crate::dom::window::LayoutValue;
|
||||
|
||||
//XXX(ferjm) Ideally merge NodeRareData and ElementRareData so they share
|
||||
// XXX(ferjm) Ideally merge NodeRareData and ElementRareData so they share
|
||||
// storage.
|
||||
|
||||
#[derive(Default, JSTraceable, MallocSizeOf)]
|
||||
|
|
|
@ -1180,7 +1180,7 @@ impl ReadableByteStreamController {
|
|||
// Assert: bytesFilled ≤ pullIntoDescriptor’s byte length.
|
||||
assert!(bytes_filled <= pull_into_descriptor.byte_length);
|
||||
|
||||
//Assert: the remainder after dividing bytesFilled by elementSize is 0.
|
||||
// Assert: the remainder after dividing bytesFilled by elementSize is 0.
|
||||
assert!(bytes_filled % element_size == 0);
|
||||
|
||||
// Let buffer be ! TransferArrayBuffer(pullIntoDescriptor’s buffer).
|
||||
|
|
|
@ -252,7 +252,7 @@ impl ResponseMethods<crate::DomTypeHolder> for Response {
|
|||
|
||||
/// <https://fetch.spec.whatwg.org/#dom-response-type>
|
||||
fn Type(&self) -> DOMResponseType {
|
||||
*self.response_type.borrow() //into()
|
||||
*self.response_type.borrow() // into()
|
||||
}
|
||||
|
||||
/// <https://fetch.spec.whatwg.org/#dom-response-url>
|
||||
|
|
|
@ -186,7 +186,7 @@ impl ShadowRoot {
|
|||
}
|
||||
|
||||
pub(crate) fn get_focused_element(&self) -> Option<DomRoot<Element>> {
|
||||
//XXX get retargeted focused element
|
||||
// XXX get retargeted focused element
|
||||
None
|
||||
}
|
||||
|
||||
|
|
|
@ -72,9 +72,9 @@ impl TrustedScript {
|
|||
global: &GlobalScope,
|
||||
code_string: DOMString,
|
||||
compilation_type: CompilationType,
|
||||
_parameter_strings: u8, //FIXME in bindings generation
|
||||
_parameter_strings: u8, // FIXME in bindings generation
|
||||
body_string: DOMString,
|
||||
_parameter_args: u8, //FIXME in bindings generation
|
||||
_parameter_args: u8, // FIXME in bindings generation
|
||||
body_arg: HandleValue,
|
||||
can_gc: CanGc,
|
||||
) -> bool {
|
||||
|
|
|
@ -178,7 +178,7 @@ impl GPUAdapterMethods<crate::DomTypeHolder> for GPUAdapter {
|
|||
|
||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuadapter-isfallbackadapter>
|
||||
fn IsFallbackAdapter(&self) -> bool {
|
||||
//TODO
|
||||
// TODO
|
||||
false
|
||||
}
|
||||
|
||||
|
|
|
@ -102,12 +102,12 @@ pub(crate) struct WebSocket {
|
|||
url: ServoUrl,
|
||||
ready_state: Cell<WebSocketRequestState>,
|
||||
buffered_amount: Cell<u64>,
|
||||
clearing_buffer: Cell<bool>, //Flag to tell if there is a running thread to clear buffered_amount
|
||||
clearing_buffer: Cell<bool>, // Flag to tell if there is a running thread to clear buffered_amount
|
||||
#[ignore_malloc_size_of = "Defined in std"]
|
||||
#[no_trace]
|
||||
sender: IpcSender<WebSocketDomAction>,
|
||||
binary_type: Cell<BinaryType>,
|
||||
protocol: DomRefCell<String>, //Subprotocol selected by server
|
||||
protocol: DomRefCell<String>, // Subprotocol selected by server
|
||||
}
|
||||
|
||||
impl WebSocket {
|
||||
|
@ -421,22 +421,22 @@ impl WebSocketMethods<crate::DomTypeHolder> for WebSocket {
|
|||
// https://html.spec.whatwg.org/multipage/#dom-websocket-close
|
||||
fn Close(&self, code: Option<u16>, reason: Option<USVString>) -> ErrorResult {
|
||||
if let Some(code) = code {
|
||||
//Fail if the supplied code isn't normal and isn't reserved for libraries, frameworks, and applications
|
||||
// Fail if the supplied code isn't normal and isn't reserved for libraries, frameworks, and applications
|
||||
if code != close_code::NORMAL && !(3000..=4999).contains(&code) {
|
||||
return Err(Error::InvalidAccess);
|
||||
}
|
||||
}
|
||||
if let Some(ref reason) = reason {
|
||||
if reason.0.len() > 123 {
|
||||
//reason cannot be larger than 123 bytes
|
||||
// reason cannot be larger than 123 bytes
|
||||
return Err(Error::Syntax);
|
||||
}
|
||||
}
|
||||
|
||||
match self.ready_state.get() {
|
||||
WebSocketRequestState::Closing | WebSocketRequestState::Closed => {}, //Do nothing
|
||||
WebSocketRequestState::Closing | WebSocketRequestState::Closed => {}, // Do nothing
|
||||
WebSocketRequestState::Connecting => {
|
||||
//Connection is not yet established
|
||||
// Connection is not yet established
|
||||
/*By setting the state to closing, the open function
|
||||
will abort connecting the websocket*/
|
||||
self.ready_state.set(WebSocketRequestState::Closing);
|
||||
|
@ -459,7 +459,7 @@ impl WebSocketMethods<crate::DomTypeHolder> for WebSocket {
|
|||
let _ = self.sender.send(WebSocketDomAction::Close(code, reason));
|
||||
},
|
||||
}
|
||||
Ok(()) //Return Ok
|
||||
Ok(()) // Return Ok
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1502,7 +1502,7 @@ impl WindowMethods<crate::DomTypeHolder> for Window {
|
|||
}
|
||||
|
||||
// https://drafts.csswg.org/cssom-view/#dom-window-innerheight
|
||||
//TODO Include Scrollbar
|
||||
// TODO Include Scrollbar
|
||||
fn InnerHeight(&self) -> i32 {
|
||||
self.viewport_details
|
||||
.get()
|
||||
|
@ -1513,7 +1513,7 @@ impl WindowMethods<crate::DomTypeHolder> for Window {
|
|||
}
|
||||
|
||||
// https://drafts.csswg.org/cssom-view/#dom-window-innerwidth
|
||||
//TODO Include Scrollbar
|
||||
// TODO Include Scrollbar
|
||||
fn InnerWidth(&self) -> i32 {
|
||||
self.viewport_details.get().size.width.to_i32().unwrap_or(0)
|
||||
}
|
||||
|
@ -1611,7 +1611,7 @@ impl WindowMethods<crate::DomTypeHolder> for Window {
|
|||
// https://drafts.csswg.org/cssom-view/#dom-window-moveto
|
||||
fn MoveTo(&self, x: i32, y: i32) {
|
||||
// Step 1
|
||||
//TODO determine if this operation is allowed
|
||||
// TODO determine if this operation is allowed
|
||||
let dpr = self.device_pixel_ratio();
|
||||
let point = Point2D::new(x, y).to_f32() * dpr;
|
||||
let msg = EmbedderMsg::MoveTo(self.webview_id(), point.to_i32());
|
||||
|
@ -2019,13 +2019,13 @@ impl Window {
|
|||
.max(0.0f64);
|
||||
|
||||
// Step 10
|
||||
//TODO handling ongoing smooth scrolling
|
||||
// TODO handling ongoing smooth scrolling
|
||||
let scroll_offset = self.scroll_offset();
|
||||
if x == scroll_offset.x as f64 && y == scroll_offset.y as f64 {
|
||||
return;
|
||||
}
|
||||
|
||||
//TODO Step 11
|
||||
// TODO Step 11
|
||||
|
||||
// Step 12: Perform a scroll of the viewport to position, document’s root element
|
||||
// as the associated element, if there is one, or null otherwise, and the scroll
|
||||
|
@ -3313,7 +3313,7 @@ impl ParseErrorReporter for CSSErrorReporter {
|
|||
)
|
||||
}
|
||||
|
||||
//TODO: report a real filename
|
||||
// TODO: report a real filename
|
||||
let _ = self.script_chan.send(ScriptThreadMessage::ReportCSSError(
|
||||
self.pipelineid,
|
||||
url.0.to_string(),
|
||||
|
|
|
@ -344,7 +344,7 @@ impl XMLHttpRequestMethods<crate::DomTypeHolder> for XMLHttpRequest {
|
|||
}
|
||||
|
||||
// Step 5
|
||||
//FIXME(seanmonstar): use a Trie instead?
|
||||
// FIXME(seanmonstar): use a Trie instead?
|
||||
let maybe_method = method.as_str().and_then(|s| {
|
||||
// Note: hyper tests against the uppercase versions
|
||||
// Since we want to pass methods not belonging to the short list above
|
||||
|
@ -662,7 +662,7 @@ impl XMLHttpRequestMethods<crate::DomTypeHolder> for XMLHttpRequest {
|
|||
}
|
||||
|
||||
// Step 6
|
||||
//TODO - set referrer_policy/referrer_url in request
|
||||
// TODO - set referrer_policy/referrer_url in request
|
||||
let credentials_mode = if self.with_credentials.get() {
|
||||
CredentialsMode::Include
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue