diff options
author | Kunal Mohan <kunalmohan99@gmail.com> | 2020-01-18 01:29:26 +0530 |
---|---|---|
committer | Kunal Mohan <kunalmohan99@gmail.com> | 2020-01-18 14:22:15 +0530 |
commit | f7db4b7f8011239f01c3ba2e5e402c866fbe68fb (patch) | |
tree | a57f171e34f1df63302eeee5e7b7544baf461158 /components | |
parent | 2a594821ba44ba2c13e9a39c6fd8c5a450bd06f4 (diff) | |
download | servo-f7db4b7f8011239f01c3ba2e5e402c866fbe68fb.tar.gz servo-f7db4b7f8011239f01c3ba2e5e402c866fbe68fb.zip |
Modify `script` to prevent further violations of snake_case
Diffstat (limited to 'components')
134 files changed, 203 insertions, 52 deletions
diff --git a/components/script/dom/analysernode.rs b/components/script/dom/analysernode.rs index 4c2025f8eb4..397d3102ff3 100644 --- a/components/script/dom/analysernode.rs +++ b/components/script/dom/analysernode.rs @@ -119,6 +119,7 @@ impl AnalyserNode { } /// https://webaudio.github.io/web-audio-api/#dom-analysernode-analysernode + #[allow(non_snake_case)] pub fn Constructor( window: &Window, context: &BaseAudioContext, diff --git a/components/script/dom/audiobuffer.rs b/components/script/dom/audiobuffer.rs index 984445c8072..a3ef575b820 100644 --- a/components/script/dom/audiobuffer.rs +++ b/components/script/dom/audiobuffer.rs @@ -90,6 +90,7 @@ impl AudioBuffer { } // https://webaudio.github.io/web-audio-api/#dom-audiobuffer-audiobuffer + #[allow(non_snake_case)] pub fn Constructor( window: &Window, options: &AudioBufferOptions, diff --git a/components/script/dom/audiobuffersourcenode.rs b/components/script/dom/audiobuffersourcenode.rs index 7810199750c..656cfef9699 100644 --- a/components/script/dom/audiobuffersourcenode.rs +++ b/components/script/dom/audiobuffersourcenode.rs @@ -107,6 +107,7 @@ impl AudioBufferSourceNode { )) } + #[allow(non_snake_case)] pub fn Constructor( window: &Window, context: &BaseAudioContext, diff --git a/components/script/dom/audiocontext.rs b/components/script/dom/audiocontext.rs index 0212cb78ffa..a72f326d916 100644 --- a/components/script/dom/audiocontext.rs +++ b/components/script/dom/audiocontext.rs @@ -85,6 +85,7 @@ impl AudioContext { } // https://webaudio.github.io/web-audio-api/#AudioContext-constructors + #[allow(non_snake_case)] pub fn Constructor( window: &Window, options: &AudioContextOptions, diff --git a/components/script/dom/audiolistener.rs b/components/script/dom/audiolistener.rs index 31ef2c4cac9..79bbe381b07 100644 --- a/components/script/dom/audiolistener.rs +++ b/components/script/dom/audiolistener.rs @@ -147,6 +147,7 @@ impl AudioListener { } } +#[allow(non_snake_case)] impl AudioListenerMethods for AudioListener { // https://webaudio.github.io/web-audio-api/#dom-audiolistener-positionx fn PositionX(&self) -> DomRoot<AudioParam> { diff --git a/components/script/dom/biquadfilternode.rs b/components/script/dom/biquadfilternode.rs index 27bbc5f56fc..5b3569eeb9b 100644 --- a/components/script/dom/biquadfilternode.rs +++ b/components/script/dom/biquadfilternode.rs @@ -120,6 +120,7 @@ impl BiquadFilterNode { )) } + #[allow(non_snake_case)] pub fn Constructor( window: &Window, context: &BaseAudioContext, diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs index 86f967764c1..f8b29b895fd 100644 --- a/components/script/dom/blob.rs +++ b/components/script/dom/blob.rs @@ -50,6 +50,7 @@ impl Blob { } // https://w3c.github.io/FileAPI/#constructorBlob + #[allow(non_snake_case)] pub fn Constructor( global: &GlobalScope, blobParts: Option<Vec<ArrayBufferOrArrayBufferViewOrBlobOrString>>, diff --git a/components/script/dom/bluetooth.rs b/components/script/dom/bluetooth.rs index 7ede2395c04..d28717e3eaf 100644 --- a/components/script/dom/bluetooth.rs +++ b/components/script/dom/bluetooth.rs @@ -66,6 +66,7 @@ const BT_DESC_CONVERSION_ERROR: &'static str = "Can't convert to an IDL value of type BluetoothPermissionDescriptor"; #[derive(JSTraceable, MallocSizeOf)] +#[allow(non_snake_case)] pub struct AllowedBluetoothDevice { pub deviceId: DOMString, pub mayUseGATT: bool, diff --git a/components/script/dom/bluetoothadvertisingevent.rs b/components/script/dom/bluetoothadvertisingevent.rs index d6877805711..7a85acb6e16 100644 --- a/components/script/dom/bluetoothadvertisingevent.rs +++ b/components/script/dom/bluetoothadvertisingevent.rs @@ -30,6 +30,7 @@ pub struct BluetoothAdvertisingEvent { rssi: Option<i8>, } +#[allow(non_snake_case)] impl BluetoothAdvertisingEvent { pub fn new_inherited( device: &BluetoothDevice, diff --git a/components/script/dom/bluetoothcharacteristicproperties.rs b/components/script/dom/bluetoothcharacteristicproperties.rs index ae66e7cdfda..10dc09b77da 100644 --- a/components/script/dom/bluetoothcharacteristicproperties.rs +++ b/components/script/dom/bluetoothcharacteristicproperties.rs @@ -24,6 +24,7 @@ pub struct BluetoothCharacteristicProperties { writable_auxiliaries: bool, } +#[allow(non_snake_case)] impl BluetoothCharacteristicProperties { pub fn new_inherited( broadcast: bool, diff --git a/components/script/dom/bluetoothremotegattcharacteristic.rs b/components/script/dom/bluetoothremotegattcharacteristic.rs index cdbec2d92bd..d50e4b54894 100644 --- a/components/script/dom/bluetoothremotegattcharacteristic.rs +++ b/components/script/dom/bluetoothremotegattcharacteristic.rs @@ -67,11 +67,14 @@ impl BluetoothRemoteGATTCharacteristic { service: &BluetoothRemoteGATTService, uuid: DOMString, properties: &BluetoothCharacteristicProperties, - instanceID: String, + instance_id: String, ) -> DomRoot<BluetoothRemoteGATTCharacteristic> { reflect_dom_object( Box::new(BluetoothRemoteGATTCharacteristic::new_inherited( - service, uuid, properties, instanceID, + service, + uuid, + properties, + instance_id, )), global, BluetoothRemoteGATTCharacteristicBinding::Wrap, diff --git a/components/script/dom/bluetoothremotegattdescriptor.rs b/components/script/dom/bluetoothremotegattdescriptor.rs index 4538f61fe4c..7cc53159d21 100644 --- a/components/script/dom/bluetoothremotegattdescriptor.rs +++ b/components/script/dom/bluetoothremotegattdescriptor.rs @@ -55,13 +55,13 @@ impl BluetoothRemoteGATTDescriptor { global: &GlobalScope, characteristic: &BluetoothRemoteGATTCharacteristic, uuid: DOMString, - instanceID: String, + instance_id: String, ) -> DomRoot<BluetoothRemoteGATTDescriptor> { reflect_dom_object( Box::new(BluetoothRemoteGATTDescriptor::new_inherited( characteristic, uuid, - instanceID, + instance_id, )), global, BluetoothRemoteGATTDescriptorBinding::Wrap, diff --git a/components/script/dom/bluetoothremotegattservice.rs b/components/script/dom/bluetoothremotegattservice.rs index 20bd96ebf24..e82267a62aa 100644 --- a/components/script/dom/bluetoothremotegattservice.rs +++ b/components/script/dom/bluetoothremotegattservice.rs @@ -45,6 +45,7 @@ impl BluetoothRemoteGATTService { } } + #[allow(non_snake_case)] pub fn new( global: &GlobalScope, device: &BluetoothDevice, diff --git a/components/script/dom/bluetoothuuid.rs b/components/script/dom/bluetoothuuid.rs index 103f39db776..70c0c28550a 100644 --- a/components/script/dom/bluetoothuuid.rs +++ b/components/script/dom/bluetoothuuid.rs @@ -583,6 +583,7 @@ const DESCRIPTOR_ERROR_MESSAGE: &'static str = "https://developer.bluetooth.org/gatt/descriptors/Pages/\ DescriptorsHomePage.aspx\ne.g. 'gatt.characteristic_presentation_format'."; +#[allow(non_snake_case)] impl BluetoothUUID { // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothuuid-canonicaluuid pub fn CanonicalUUID(_: &Window, alias: u32) -> UUID { diff --git a/components/script/dom/channelmergernode.rs b/components/script/dom/channelmergernode.rs index 65364f69ae2..0ebc086626c 100644 --- a/components/script/dom/channelmergernode.rs +++ b/components/script/dom/channelmergernode.rs @@ -68,6 +68,7 @@ impl ChannelMergerNode { )) } + #[allow(non_snake_case)] pub fn Constructor( window: &Window, context: &BaseAudioContext, diff --git a/components/script/dom/channelsplitternode.rs b/components/script/dom/channelsplitternode.rs index 6803e3e5a67..4ec38609bce 100644 --- a/components/script/dom/channelsplitternode.rs +++ b/components/script/dom/channelsplitternode.rs @@ -70,6 +70,7 @@ impl ChannelSplitterNode { )) } + #[allow(non_snake_case)] pub fn Constructor( window: &Window, context: &BaseAudioContext, diff --git a/components/script/dom/closeevent.rs b/components/script/dom/closeevent.rs index 1c07813bce3..8bd0446d24e 100644 --- a/components/script/dom/closeevent.rs +++ b/components/script/dom/closeevent.rs @@ -23,6 +23,7 @@ pub struct CloseEvent { reason: DOMString, } +#[allow(non_snake_case)] impl CloseEvent { pub fn new_inherited(was_clean: bool, code: u16, reason: DOMString) -> CloseEvent { CloseEvent { diff --git a/components/script/dom/comment.rs b/components/script/dom/comment.rs index 00079673c7e..06750f4a67f 100644 --- a/components/script/dom/comment.rs +++ b/components/script/dom/comment.rs @@ -34,6 +34,7 @@ impl Comment { ) } + #[allow(non_snake_case)] pub fn Constructor(window: &Window, data: DOMString) -> Fallible<DomRoot<Comment>> { let document = window.Document(); Ok(Comment::new(data, &document)) diff --git a/components/script/dom/compositionevent.rs b/components/script/dom/compositionevent.rs index 8b00ed1ac9c..121034f42bc 100644 --- a/components/script/dom/compositionevent.rs +++ b/components/script/dom/compositionevent.rs @@ -58,6 +58,7 @@ impl CompositionEvent { ev } + #[allow(non_snake_case)] pub fn Constructor( window: &Window, type_: DOMString, diff --git a/components/script/dom/console.rs b/components/script/dom/console.rs index ff0510fea6b..22caa2993bd 100644 --- a/components/script/dom/console.rs +++ b/components/script/dom/console.rs @@ -43,6 +43,7 @@ where f() } +#[allow(non_snake_case)] impl Console { // https://developer.mozilla.org/en-US/docs/Web/API/Console/log pub fn Log(global: &GlobalScope, messages: Vec<DOMString>) { diff --git a/components/script/dom/constantsourcenode.rs b/components/script/dom/constantsourcenode.rs index 27ee869054d..ca7b9b382f5 100644 --- a/components/script/dom/constantsourcenode.rs +++ b/components/script/dom/constantsourcenode.rs @@ -73,6 +73,7 @@ impl ConstantSourceNode { )) } + #[allow(non_snake_case)] pub fn Constructor( window: &Window, context: &BaseAudioContext, diff --git a/components/script/dom/css.rs b/components/script/dom/css.rs index d7a5b98aec0..138ffb6b9da 100644 --- a/components/script/dom/css.rs +++ b/components/script/dom/css.rs @@ -22,6 +22,7 @@ pub struct CSS { reflector_: Reflector, } +#[allow(non_snake_case)] impl CSS { /// <http://dev.w3.org/csswg/cssom/#serialize-an-identifier> pub fn Escape(_: &Window, ident: DOMString) -> Fallible<DOMString> { diff --git a/components/script/dom/customevent.rs b/components/script/dom/customevent.rs index 91035f56e03..26366f65f5e 100644 --- a/components/script/dom/customevent.rs +++ b/components/script/dom/customevent.rs @@ -55,7 +55,7 @@ impl CustomEvent { ev } - #[allow(unsafe_code)] + #[allow(unsafe_code, non_snake_case)] pub fn Constructor( global: &GlobalScope, type_: DOMString, diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 1f24a96c6a0..16f22c1dfa8 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -450,6 +450,7 @@ impl CollectionFilter for AnchorsFilter { } } +#[allow(non_snake_case)] impl Document { #[inline] pub fn loader(&self) -> Ref<DocumentLoader> { @@ -2899,6 +2900,7 @@ impl Document { } // https://dom.spec.whatwg.org/#dom-document-document + #[allow(non_snake_case)] pub fn Constructor(window: &Window) -> Fallible<DomRoot<Document>> { let doc = window.Document(); let docloader = DocumentLoader::new(&*doc.loader()); diff --git a/components/script/dom/documentfragment.rs b/components/script/dom/documentfragment.rs index 1561b0d007e..a7da3745ee0 100644 --- a/components/script/dom/documentfragment.rs +++ b/components/script/dom/documentfragment.rs @@ -46,6 +46,7 @@ impl DocumentFragment { ) } + #[allow(non_snake_case)] pub fn Constructor(window: &Window) -> Fallible<DomRoot<DocumentFragment>> { let document = window.Document(); diff --git a/components/script/dom/domexception.rs b/components/script/dom/domexception.rs index 218771851b6..e8d848d0b9f 100644 --- a/components/script/dom/domexception.rs +++ b/components/script/dom/domexception.rs @@ -138,6 +138,7 @@ impl DOMException { ) } + #[allow(non_snake_case)] pub fn Constructor( global: &GlobalScope, message: DOMString, diff --git a/components/script/dom/dommatrix.rs b/components/script/dom/dommatrix.rs index c9cc366e8ec..0f6d2ae2cd2 100644 --- a/components/script/dom/dommatrix.rs +++ b/components/script/dom/dommatrix.rs @@ -27,6 +27,7 @@ pub struct DOMMatrix { parent: DOMMatrixReadOnly, } +#[allow(non_snake_case)] impl DOMMatrix { #[allow(unrooted_must_root)] pub fn new(global: &GlobalScope, is2D: bool, matrix: Transform3D<f64>) -> DomRoot<Self> { @@ -74,7 +75,7 @@ impl DOMMatrix { } pub fn from_readonly(global: &GlobalScope, ro: &DOMMatrixReadOnly) -> DomRoot<Self> { - Self::new(global, ro.is_2d(), ro.matrix().clone()) + Self::new(global, ro.is2D(), ro.matrix().clone()) } // https://drafts.fxtf.org/geometry-1/#dom-dommatrix-fromfloat32array @@ -102,6 +103,7 @@ impl DOMMatrix { } } +#[allow(non_snake_case)] impl DOMMatrixMethods for DOMMatrix { // https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-m11 fn M11(&self) -> f64 { diff --git a/components/script/dom/dommatrixreadonly.rs b/components/script/dom/dommatrixreadonly.rs index acfd02bd56d..e7e32318020 100644 --- a/components/script/dom/dommatrixreadonly.rs +++ b/components/script/dom/dommatrixreadonly.rs @@ -33,12 +33,14 @@ use std::ptr::NonNull; use style::parser::ParserContext; #[dom_struct] +#[allow(non_snake_case)] pub struct DOMMatrixReadOnly { reflector_: Reflector, matrix: DomRefCell<Transform3D<f64>>, is2D: Cell<bool>, } +#[allow(non_snake_case)] impl DOMMatrixReadOnly { #[allow(unrooted_must_root)] pub fn new(global: &GlobalScope, is2D: bool, matrix: Transform3D<f64>) -> DomRoot<Self> { @@ -91,7 +93,7 @@ impl DOMMatrixReadOnly { self.matrix.borrow() } - pub fn is_2d(&self) -> bool { + pub fn is2D(&self) -> bool { self.is2D.get() } @@ -421,6 +423,7 @@ impl DOMMatrixReadOnly { } } +#[allow(non_snake_case)] impl DOMMatrixReadOnlyMethods for DOMMatrixReadOnly { // https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-m11 fn M11(&self) -> f64 { @@ -761,7 +764,7 @@ pub fn dommatrixinit_to_matrix(dict: &DOMMatrixInit) -> Fallible<(bool, Transfor { Err(error::Error::Type("Invalid matrix initializer.".to_owned())) } else { - let mut is2D = dict.is2D; + let mut is_2d = dict.is2D; // Step 2. let m11 = dict.m11.unwrap_or(dict.a.unwrap_or(1.0)); // Step 3. @@ -775,7 +778,7 @@ pub fn dommatrixinit_to_matrix(dict: &DOMMatrixInit) -> Fallible<(bool, Transfor // Step 7. let m42 = dict.m42.unwrap_or(dict.f.unwrap_or(0.0)); // Step 8. - if is2D.is_none() && + if is_2d.is_none() && (dict.m31 != 0.0 || dict.m32 != 0.0 || dict.m13 != 0.0 || @@ -787,17 +790,17 @@ pub fn dommatrixinit_to_matrix(dict: &DOMMatrixInit) -> Fallible<(bool, Transfor dict.m33 != 1.0 || dict.m44 != 1.0) { - is2D = Some(false); + is_2d = Some(false); } // Step 9. - if is2D.is_none() { - is2D = Some(true); + if is_2d.is_none() { + is_2d = Some(true); } let matrix = Transform3D::row_major( m11, m12, dict.m13, dict.m14, m21, m22, dict.m23, dict.m24, dict.m31, dict.m32, dict.m33, dict.m34, m41, m42, dict.m43, dict.m44, ); - Ok((is2D.unwrap(), matrix)) + Ok((is_2d.unwrap(), matrix)) } } diff --git a/components/script/dom/domparser.rs b/components/script/dom/domparser.rs index dea8af24c1c..d714ba30ed2 100644 --- a/components/script/dom/domparser.rs +++ b/components/script/dom/domparser.rs @@ -44,6 +44,7 @@ impl DOMParser { ) } + #[allow(non_snake_case)] pub fn Constructor(window: &Window) -> Fallible<DomRoot<DOMParser>> { Ok(DOMParser::new(window)) } diff --git a/components/script/dom/dompoint.rs b/components/script/dom/dompoint.rs index 6a89249342d..4c1fde655cc 100644 --- a/components/script/dom/dompoint.rs +++ b/components/script/dom/dompoint.rs @@ -19,6 +19,7 @@ pub struct DOMPoint { point: DOMPointReadOnly, } +#[allow(non_snake_case)] impl DOMPoint { fn new_inherited(x: f64, y: f64, z: f64, w: f64) -> DOMPoint { DOMPoint { diff --git a/components/script/dom/dompointreadonly.rs b/components/script/dom/dompointreadonly.rs index 4c327107388..d98e9a4bde3 100644 --- a/components/script/dom/dompointreadonly.rs +++ b/components/script/dom/dompointreadonly.rs @@ -23,6 +23,7 @@ pub struct DOMPointReadOnly { w: Cell<f64>, } +#[allow(non_snake_case)] impl DOMPointReadOnly { pub fn new_inherited(x: f64, y: f64, z: f64, w: f64) -> DOMPointReadOnly { DOMPointReadOnly { @@ -58,6 +59,7 @@ impl DOMPointReadOnly { } } +#[allow(non_snake_case)] impl DOMPointReadOnlyMethods for DOMPointReadOnly { // https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-x fn X(&self) -> f64 { @@ -80,6 +82,7 @@ impl DOMPointReadOnlyMethods for DOMPointReadOnly { } } +#[allow(non_snake_case)] pub trait DOMPointWriteMethods { fn SetX(&self, value: f64); fn SetY(&self, value: f64); diff --git a/components/script/dom/domquad.rs b/components/script/dom/domquad.rs index 12c878357d0..3101370582a 100644 --- a/components/script/dom/domquad.rs +++ b/components/script/dom/domquad.rs @@ -23,6 +23,7 @@ pub struct DOMQuad { p4: Dom<DOMPoint>, } +#[allow(non_snake_case)] impl DOMQuad { fn new_inherited(p1: &DOMPoint, p2: &DOMPoint, p3: &DOMPoint, p4: &DOMPoint) -> DOMQuad { DOMQuad { diff --git a/components/script/dom/domrect.rs b/components/script/dom/domrect.rs index 7b0f4b1ad17..0aab9dc4d61 100644 --- a/components/script/dom/domrect.rs +++ b/components/script/dom/domrect.rs @@ -32,6 +32,7 @@ impl DOMRect { ) } + #[allow(non_snake_case)] pub fn Constructor( global: &GlobalScope, x: f64, diff --git a/components/script/dom/domrectreadonly.rs b/components/script/dom/domrectreadonly.rs index 79d02169a5b..6bdbac9c388 100644 --- a/components/script/dom/domrectreadonly.rs +++ b/components/script/dom/domrectreadonly.rs @@ -46,6 +46,7 @@ impl DOMRectReadOnly { ) } + #[allow(non_snake_case)] pub fn Constructor( global: &GlobalScope, x: f64, diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 00e70f2df02..cb7d339a78e 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -1202,6 +1202,7 @@ impl Element { } } + #[allow(non_snake_case)] pub fn xmlSerialize(&self, traversal_scope: XmlTraversalScope) -> Fallible<DOMString> { let mut writer = vec![]; match xmlSerialize::serialize( diff --git a/components/script/dom/errorevent.rs b/components/script/dom/errorevent.rs index c306f6cf7f9..10f3ab5853f 100644 --- a/components/script/dom/errorevent.rs +++ b/components/script/dom/errorevent.rs @@ -77,6 +77,7 @@ impl ErrorEvent { ev } + #[allow(non_snake_case)] pub fn Constructor( global: &GlobalScope, type_: DOMString, diff --git a/components/script/dom/event.rs b/components/script/dom/event.rs index 52c9af3b061..e8e7ad7251c 100644 --- a/components/script/dom/event.rs +++ b/components/script/dom/event.rs @@ -82,6 +82,7 @@ impl Event { event } + #[allow(non_snake_case)] pub fn Constructor( global: &GlobalScope, type_: DOMString, diff --git a/components/script/dom/eventsource.rs b/components/script/dom/eventsource.rs index bbda6c24396..1b471a85631 100644 --- a/components/script/dom/eventsource.rs +++ b/components/script/dom/eventsource.rs @@ -18,7 +18,7 @@ use crate::dom::eventtarget::EventTarget; use crate::dom::globalscope::GlobalScope; use crate::dom::messageevent::MessageEvent; use crate::dom::performanceresourcetiming::InitiatorType; -use crate::fetch::{create_a_potential_CORS_request, FetchCanceller}; +use crate::fetch::{create_a_potential_cors_request, FetchCanceller}; use crate::network_listener::{self, NetworkListener, PreInvoke, ResourceTimingListener}; use crate::task_source::{TaskSource, TaskSourceName}; use crate::timers::OneshotTimerCallback; @@ -488,6 +488,7 @@ impl EventSource { } // https://html.spec.whatwg.org/multipage/#dom-eventsource + #[allow(non_snake_case)] pub fn Constructor( global: &GlobalScope, url: DOMString, @@ -516,7 +517,7 @@ impl EventSource { }; // Step 8 // TODO: Step 9 set request's client settings - let mut request = create_a_potential_CORS_request( + let mut request = create_a_potential_cors_request( url_record, Destination::None, Some(cors_attribute_state), diff --git a/components/script/dom/eventtarget.rs b/components/script/dom/eventtarget.rs index cb42539a8e5..9106587ec31 100644 --- a/components/script/dom/eventtarget.rs +++ b/components/script/dom/eventtarget.rs @@ -339,6 +339,7 @@ impl EventTarget { reflect_dom_object(Box::new(EventTarget::new_inherited()), global, Wrap) } + #[allow(non_snake_case)] pub fn Constructor(global: &GlobalScope) -> Fallible<DomRoot<EventTarget>> { Ok(EventTarget::new(global)) } diff --git a/components/script/dom/extendableevent.rs b/components/script/dom/extendableevent.rs index 6f1b9f322a0..a7b0e2dd581 100644 --- a/components/script/dom/extendableevent.rs +++ b/components/script/dom/extendableevent.rs @@ -23,6 +23,7 @@ pub struct ExtendableEvent { extensions_allowed: bool, } +#[allow(non_snake_case)] impl ExtendableEvent { pub fn new_inherited() -> ExtendableEvent { ExtendableEvent { diff --git a/components/script/dom/extendablemessageevent.rs b/components/script/dom/extendablemessageevent.rs index a1433ec6269..ff9903fc1a6 100644 --- a/components/script/dom/extendablemessageevent.rs +++ b/components/script/dom/extendablemessageevent.rs @@ -26,6 +26,7 @@ use js::rust::HandleValue; use servo_atoms::Atom; #[dom_struct] +#[allow(non_snake_case)] pub struct ExtendableMessageEvent { event: ExtendableEvent, #[ignore_malloc_size_of = "mozjs"] @@ -37,6 +38,7 @@ pub struct ExtendableMessageEvent { frozen_ports: DomRefCell<Option<Heap<JSVal>>>, } +#[allow(non_snake_case)] impl ExtendableMessageEvent { pub fn new_inherited( origin: DOMString, @@ -101,6 +103,7 @@ impl ExtendableMessageEvent { } } +#[allow(non_snake_case)] impl ExtendableMessageEvent { pub fn dispatch_jsval( target: &EventTarget, diff --git a/components/script/dom/file.rs b/components/script/dom/file.rs index ed4753a58b3..9fcd580bbee 100644 --- a/components/script/dom/file.rs +++ b/components/script/dom/file.rs @@ -80,6 +80,7 @@ impl File { } // https://w3c.github.io/FileAPI/#file-constructor + #[allow(non_snake_case)] pub fn Constructor( global: &GlobalScope, fileBits: Vec<ArrayBufferOrArrayBufferViewOrBlobOrString>, diff --git a/components/script/dom/filereader.rs b/components/script/dom/filereader.rs index d40ae95aac3..ce828435c4b 100644 --- a/components/script/dom/filereader.rs +++ b/components/script/dom/filereader.rs @@ -159,6 +159,7 @@ impl FileReader { ) } + #[allow(non_snake_case)] pub fn Constructor(global: &GlobalScope) -> Fallible<DomRoot<FileReader>> { Ok(FileReader::new(global)) } diff --git a/components/script/dom/filereadersync.rs b/components/script/dom/filereadersync.rs index 1ed9c6c8007..5b3ace3863e 100644 --- a/components/script/dom/filereadersync.rs +++ b/components/script/dom/filereadersync.rs @@ -40,6 +40,7 @@ impl FileReaderSync { ) } + #[allow(non_snake_case)] pub fn Constructor(global: &GlobalScope) -> Fallible<DomRoot<FileReaderSync>> { Ok(FileReaderSync::new(global)) } diff --git a/components/script/dom/focusevent.rs b/components/script/dom/focusevent.rs index 2a19ce48729..5ff76a0d60e 100644 --- a/components/script/dom/focusevent.rs +++ b/components/script/dom/focusevent.rs @@ -60,6 +60,7 @@ impl FocusEvent { ev } + #[allow(non_snake_case)] pub fn Constructor( window: &Window, type_: DOMString, diff --git a/components/script/dom/formdata.rs b/components/script/dom/formdata.rs index b8503a4f0dc..fd69adbe337 100644 --- a/components/script/dom/formdata.rs +++ b/components/script/dom/formdata.rs @@ -51,6 +51,7 @@ impl FormData { } // https://xhr.spec.whatwg.org/#dom-formdata + #[allow(non_snake_case)] pub fn Constructor( global: &GlobalScope, form: Option<&HTMLFormElement>, diff --git a/components/script/dom/formdataevent.rs b/components/script/dom/formdataevent.rs index c380abf217a..60eb479f7dd 100644 --- a/components/script/dom/formdataevent.rs +++ b/components/script/dom/formdataevent.rs @@ -48,6 +48,7 @@ impl FormDataEvent { ev } + #[allow(non_snake_case)] pub fn Constructor( window: &Window, type_: DOMString, diff --git a/components/script/dom/gainnode.rs b/components/script/dom/gainnode.rs index a4c5bb36f4e..f91a2ba2591 100644 --- a/components/script/dom/gainnode.rs +++ b/components/script/dom/gainnode.rs @@ -76,6 +76,7 @@ impl GainNode { )) } + #[allow(non_snake_case)] pub fn Constructor( window: &Window, context: &BaseAudioContext, diff --git a/components/script/dom/gamepadevent.rs b/components/script/dom/gamepadevent.rs index f3f4023e88b..3d57645a9be 100644 --- a/components/script/dom/gamepadevent.rs +++ b/components/script/dom/gamepadevent.rs @@ -69,6 +69,7 @@ impl GamepadEvent { } // https://w3c.github.io/gamepad/#gamepadevent-interface + #[allow(non_snake_case)] pub fn Constructor( window: &Window, type_: DOMString, diff --git a/components/script/dom/gpudevice.rs b/components/script/dom/gpudevice.rs index d2d2b2013d8..1cc00110146 100644 --- a/components/script/dom/gpudevice.rs +++ b/components/script/dom/gpudevice.rs @@ -238,6 +238,7 @@ impl GPUDeviceMethods for GPUDevice { } /// https://gpuweb.github.io/gpuweb/#GPUDevice-createBindGroupLayout + #[allow(non_snake_case)] fn CreateBindGroupLayout( &self, descriptor: &GPUBindGroupLayoutDescriptor, diff --git a/components/script/dom/hashchangeevent.rs b/components/script/dom/hashchangeevent.rs index 2ff234d2c06..44a46f162db 100644 --- a/components/script/dom/hashchangeevent.rs +++ b/components/script/dom/hashchangeevent.rs @@ -60,6 +60,7 @@ impl HashChangeEvent { ev } + #[allow(non_snake_case)] pub fn Constructor( window: &Window, type_: DOMString, diff --git a/components/script/dom/headers.rs b/components/script/dom/headers.rs index a75b0292d6f..f16d24604db 100644 --- a/components/script/dom/headers.rs +++ b/components/script/dom/headers.rs @@ -50,6 +50,7 @@ impl Headers { } // https://fetch.spec.whatwg.org/#dom-headers + #[allow(non_snake_case)] pub fn Constructor( global: &GlobalScope, init: Option<HeadersInit>, @@ -393,13 +394,13 @@ pub fn normalize_value(value: ByteString) -> ByteString { } } -fn is_HTTP_whitespace(byte: u8) -> bool { +fn is_http_whitespace(byte: u8) -> bool { byte == b'\t' || byte == b'\n' || byte == b'\r' || byte == b' ' } fn index_of_first_non_whitespace(value: &ByteString) -> Option<usize> { for (index, &byte) in value.iter().enumerate() { - if !is_HTTP_whitespace(byte) { + if !is_http_whitespace(byte) { return Some(index); } } @@ -408,7 +409,7 @@ fn index_of_first_non_whitespace(value: &ByteString) -> Option<usize> { fn index_of_last_non_whitespace(value: &ByteString) -> Option<usize> { for (index, &byte) in value.iter().enumerate().rev() { - if !is_HTTP_whitespace(byte) { + if !is_http_whitespace(byte) { return Some(index); } } diff --git a/components/script/dom/htmlaudioelement.rs b/components/script/dom/htmlaudioelement.rs index af92835af6a..1a8472cf8ee 100644 --- a/components/script/dom/htmlaudioelement.rs +++ b/components/script/dom/htmlaudioelement.rs @@ -49,6 +49,7 @@ impl HTMLAudioElement { } // https://html.spec.whatwg.org/multipage/#dom-audio + #[allow(non_snake_case)] pub fn Audio(window: &Window, src: Option<DOMString>) -> Fallible<DomRoot<HTMLAudioElement>> { let document = window.Document(); let audio = HTMLAudioElement::new(local_name!("audio"), None, &document); diff --git a/components/script/dom/htmlformcontrolscollection.rs b/components/script/dom/htmlformcontrolscollection.rs index 8bf296a8417..1cf969a2fdd 100644 --- a/components/script/dom/htmlformcontrolscollection.rs +++ b/components/script/dom/htmlformcontrolscollection.rs @@ -47,6 +47,7 @@ impl HTMLFormControlsCollection { // FIXME: This shouldn't need to be implemented here since HTMLCollection (the parent of // HTMLFormControlsCollection) implements Length + #[allow(non_snake_case)] pub fn Length(&self) -> u32 { self.collection.Length() } diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs index c36f30c1fb3..ebbe1d49615 100644 --- a/components/script/dom/htmlformelement.rs +++ b/components/script/dom/htmlformelement.rs @@ -378,6 +378,7 @@ impl HTMLFormElementMethods for HTMLFormElement { } // https://html.spec.whatwg.org/multipage/#the-form-element:supported-property-names + #[allow(non_snake_case)] fn SupportedPropertyNames(&self) -> Vec<DOMString> { // Step 1 #[derive(Debug, Eq, Ord, PartialEq, PartialOrd)] diff --git a/components/script/dom/htmlhtmlelement.rs b/components/script/dom/htmlhtmlelement.rs index 9aa4f4ab9a0..b95f79e5ac0 100644 --- a/components/script/dom/htmlhtmlelement.rs +++ b/components/script/dom/htmlhtmlelement.rs @@ -15,6 +15,7 @@ pub struct HTMLHtmlElement { htmlelement: HTMLElement, } +#[allow(non_snake_case)] impl HTMLHtmlElement { fn new_inherited( localName: LocalName, diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs index fd2a58f8d7d..9fb2cfe704b 100644 --- a/components/script/dom/htmlimageelement.rs +++ b/components/script/dom/htmlimageelement.rs @@ -41,7 +41,7 @@ use crate::dom::performanceresourcetiming::InitiatorType; use crate::dom::values::UNSIGNED_LONG_MAX; use crate::dom::virtualmethods::VirtualMethods; use crate::dom::window::Window; -use crate::fetch::create_a_potential_CORS_request; +use crate::fetch::create_a_potential_cors_request; use crate::image_listener::{add_cache_listener_for_element, ImageCacheListener}; use crate::microtask::{Microtask, MicrotaskRunnable}; use crate::network_listener::{self, NetworkListener, PreInvoke, ResourceTimingListener}; @@ -283,7 +283,7 @@ pub(crate) fn image_fetch_request( from_picture_or_srcset: FromPictureOrSrcSet, ) -> RequestBuilder { let mut request = - create_a_potential_CORS_request(img_url, Destination::Image, cors_setting, None) + create_a_potential_cors_request(img_url, Destination::Image, cors_setting, None) .origin(origin) .pipeline_id(Some(pipeline_id)) .referrer_policy(referrer_policy); @@ -293,6 +293,7 @@ pub(crate) fn image_fetch_request( request } +#[allow(non_snake_case)] impl HTMLImageElement { /// Update the current image with a valid URL. fn fetch_image(&self, img_url: &ServoUrl) { diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index 22333a17051..cb269e92270 100755 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -290,6 +290,7 @@ static DEFAULT_INPUT_SIZE: u32 = 20; static DEFAULT_MAX_LENGTH: i32 = -1; static DEFAULT_MIN_LENGTH: i32 = -1; +#[allow(non_snake_case)] impl HTMLInputElement { fn new_inherited( local_name: LocalName, @@ -1038,7 +1039,7 @@ impl HTMLInputElementMethods for HTMLInputElement { } // https://html.spec.whatwg.org/multipage/#dom-input-valueasdate - #[allow(unsafe_code)] + #[allow(unsafe_code, non_snake_case)] fn SetValueAsDate(&self, cx: SafeJSContext, value: *mut JSObject) -> ErrorResult { rooted!(in(*cx) let value = value); if !self.does_value_as_date_apply() { diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs index cb93a77a90d..500e54e3867 100644 --- a/components/script/dom/htmlmediaelement.rs +++ b/components/script/dom/htmlmediaelement.rs @@ -60,7 +60,7 @@ use crate::dom::url::URL; use crate::dom::videotrack::VideoTrack; use crate::dom::videotracklist::VideoTrackList; use crate::dom::virtualmethods::VirtualMethods; -use crate::fetch::{create_a_potential_CORS_request, FetchCanceller}; +use crate::fetch::{create_a_potential_cors_request, FetchCanceller}; use crate::microtask::{Microtask, MicrotaskRunnable}; use crate::network_listener::{self, NetworkListener, PreInvoke, ResourceTimingListener}; use crate::script_thread::ScriptThread; @@ -292,6 +292,7 @@ impl From<MediaStreamOrBlob> for SrcObject { } #[dom_struct] +#[allow(non_snake_case)] pub struct HTMLMediaElement { htmlelement: HTMLElement, /// <https://html.spec.whatwg.org/multipage/#dom-media-networkstate> @@ -837,7 +838,7 @@ impl HTMLMediaElement { }; let cors_setting = cors_setting_for_element(self.upcast()); - let request = create_a_potential_CORS_request(url.clone(), destination, cors_setting, None) + let request = create_a_potential_cors_request(url.clone(), destination, cors_setting, None) .headers(headers) .origin(document.origin().immutable().clone()) .pipeline_id(Some(self.global().pipeline_id())) diff --git a/components/script/dom/htmloptionelement.rs b/components/script/dom/htmloptionelement.rs index d61f4b6ffb0..ca95400dc80 100644 --- a/components/script/dom/htmloptionelement.rs +++ b/components/script/dom/htmloptionelement.rs @@ -77,6 +77,7 @@ impl HTMLOptionElement { } // https://html.spec.whatwg.org/multipage/#dom-option + #[allow(non_snake_case)] pub fn Option( window: &Window, text: DOMString, diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs index 3a55590c81d..74773bad36b 100644 --- a/components/script/dom/htmlscriptelement.rs +++ b/components/script/dom/htmlscriptelement.rs @@ -26,7 +26,7 @@ use crate::dom::node::{document_from_node, window_from_node}; use crate::dom::node::{BindContext, ChildrenMutation, CloneChildrenFlag, Node}; use crate::dom::performanceresourcetiming::InitiatorType; use crate::dom::virtualmethods::VirtualMethods; -use crate::fetch::create_a_potential_CORS_request; +use crate::fetch::create_a_potential_cors_request; use crate::network_listener::{self, NetworkListener, PreInvoke, ResourceTimingListener}; use crate::script_module::fetch_inline_module_script; use crate::script_module::{fetch_external_module_script, ModuleOwner}; @@ -326,7 +326,7 @@ pub(crate) fn script_fetch_request( referrer_policy: Option<ReferrerPolicy>, integrity_metadata: String, ) -> RequestBuilder { - create_a_potential_CORS_request(url, Destination::Script, cors_setting, None) + create_a_potential_cors_request(url, Destination::Script, cors_setting, None) .origin(origin) .pipeline_id(Some(pipeline_id)) .referrer(Some(referrer)) diff --git a/components/script/dom/imagedata.rs b/components/script/dom/imagedata.rs index b09984e267f..e17c82fffd4 100644 --- a/components/script/dom/imagedata.rs +++ b/components/script/dom/imagedata.rs @@ -128,14 +128,13 @@ impl ImageData { )) } // https://html.spec.whatwg.org/multipage/#pixel-manipulation:dom-imagedata-3 - #[allow(unsafe_code)] + #[allow(unsafe_code, non_snake_case)] pub fn Constructor(global: &GlobalScope, width: u32, height: u32) -> Fallible<DomRoot<Self>> { unsafe { Self::new_without_jsobject(global, width, height) } } // https://html.spec.whatwg.org/multipage/#pixel-manipulation:dom-imagedata-4 - #[allow(unsafe_code)] - #[allow(unused_variables)] + #[allow(unsafe_code, unused_variables, non_snake_case)] pub unsafe fn Constructor_( cx: JSContext, global: &GlobalScope, diff --git a/components/script/dom/inputevent.rs b/components/script/dom/inputevent.rs index 9a0925d7f21..7ef60327fcb 100644 --- a/components/script/dom/inputevent.rs +++ b/components/script/dom/inputevent.rs @@ -44,6 +44,7 @@ impl InputEvent { ev } + #[allow(non_snake_case)] pub fn Constructor( window: &Window, type_: DOMString, diff --git a/components/script/dom/keyboardevent.rs b/components/script/dom/keyboardevent.rs index cdf44774454..d2fdda5fcef 100644 --- a/components/script/dom/keyboardevent.rs +++ b/components/script/dom/keyboardevent.rs @@ -96,6 +96,7 @@ impl KeyboardEvent { ev } + #[allow(non_snake_case)] pub fn Constructor( window: &Window, type_: DOMString, diff --git a/components/script/dom/mediaelementaudiosourcenode.rs b/components/script/dom/mediaelementaudiosourcenode.rs index 07ca70bd80e..f748ac0251d 100644 --- a/components/script/dom/mediaelementaudiosourcenode.rs +++ b/components/script/dom/mediaelementaudiosourcenode.rs @@ -63,6 +63,7 @@ impl MediaElementAudioSourceNode { )) } + #[allow(non_snake_case)] pub fn Constructor( window: &Window, context: &AudioContext, diff --git a/components/script/dom/mediametadata.rs b/components/script/dom/mediametadata.rs index f2e94abfaa1..53346eba167 100644 --- a/components/script/dom/mediametadata.rs +++ b/components/script/dom/mediametadata.rs @@ -43,6 +43,7 @@ impl MediaMetadata { } /// https://w3c.github.io/mediasession/#dom-mediametadata-mediametadata + #[allow(non_snake_case)] pub fn Constructor( window: &Window, init: &MediaMetadataInit, diff --git a/components/script/dom/mediaquerylistevent.rs b/components/script/dom/mediaquerylistevent.rs index c665a27d9d3..6e05b50998a 100644 --- a/components/script/dom/mediaquerylistevent.rs +++ b/components/script/dom/mediaquerylistevent.rs @@ -56,6 +56,7 @@ impl MediaQueryListEvent { ev } + #[allow(non_snake_case)] pub fn Constructor( window: &Window, type_: DOMString, diff --git a/components/script/dom/mediastream.rs b/components/script/dom/mediastream.rs index 88729b57ce5..553177ce964 100644 --- a/components/script/dom/mediastream.rs +++ b/components/script/dom/mediastream.rs @@ -21,6 +21,7 @@ pub struct MediaStream { tracks: DomRefCell<Vec<Dom<MediaStreamTrack>>>, } +#[allow(non_snake_case)] impl MediaStream { pub fn new_inherited() -> MediaStream { MediaStream { diff --git a/components/script/dom/messagechannel.rs b/components/script/dom/messagechannel.rs index efe883c6e6e..f43b6cd7c38 100644 --- a/components/script/dom/messagechannel.rs +++ b/components/script/dom/messagechannel.rs @@ -19,6 +19,7 @@ pub struct MessageChannel { impl MessageChannel { /// <https://html.spec.whatwg.org/multipage/#dom-messagechannel> + #[allow(non_snake_case)] pub fn Constructor(global: &GlobalScope) -> Fallible<DomRoot<MessageChannel>> { let incumbent = GlobalScope::incumbent().ok_or(Error::InvalidState)?; diff --git a/components/script/dom/messageevent.rs b/components/script/dom/messageevent.rs index 54a6f2ee588..62d7789e7e5 100644 --- a/components/script/dom/messageevent.rs +++ b/components/script/dom/messageevent.rs @@ -53,6 +53,7 @@ impl From<&WindowProxyOrMessagePortOrServiceWorker> for SrcObject { } #[dom_struct] +#[allow(non_snake_case)] pub struct MessageEvent { event: Event, #[ignore_malloc_size_of = "mozjs"] @@ -65,6 +66,7 @@ pub struct MessageEvent { frozen_ports: DomRefCell<Option<Heap<JSVal>>>, } +#[allow(non_snake_case)] impl MessageEvent { pub fn new_inherited( origin: DOMString, @@ -262,6 +264,7 @@ impl MessageEventMethods for MessageEvent { } /// <https://html.spec.whatwg.org/multipage/#dom-messageevent-initmessageevent> + #[allow(non_snake_case)] fn InitMessageEvent( &self, _cx: JSContext, diff --git a/components/script/dom/mouseevent.rs b/components/script/dom/mouseevent.rs index b6ba307af52..3975f57ace0 100644 --- a/components/script/dom/mouseevent.rs +++ b/components/script/dom/mouseevent.rs @@ -124,6 +124,7 @@ impl MouseEvent { ev } + #[allow(non_snake_case)] pub fn Constructor( window: &Window, type_: DOMString, diff --git a/components/script/dom/mutationobserver.rs b/components/script/dom/mutationobserver.rs index 6320c0497d2..111fc00f795 100644 --- a/components/script/dom/mutationobserver.rs +++ b/components/script/dom/mutationobserver.rs @@ -79,6 +79,7 @@ impl MutationObserver { } } + #[allow(non_snake_case)] pub fn Constructor( global: &Window, callback: Rc<MutationCallback>, diff --git a/components/script/dom/navigatorinfo.rs b/components/script/dom/navigatorinfo.rs index 0ebb9043765..e674834f14b 100644 --- a/components/script/dom/navigatorinfo.rs +++ b/components/script/dom/navigatorinfo.rs @@ -5,62 +5,76 @@ use crate::dom::bindings::str::DOMString; use std::borrow::Cow; +#[allow(non_snake_case)] pub fn Product() -> DOMString { DOMString::from("Gecko") } +#[allow(non_snake_case)] pub fn ProductSub() -> DOMString { DOMString::from("20100101") } +#[allow(non_snake_case)] pub fn Vendor() -> DOMString { DOMString::from("") } +#[allow(non_snake_case)] pub fn VendorSub() -> DOMString { DOMString::from("") } +#[allow(non_snake_case)] pub fn TaintEnabled() -> bool { false } +#[allow(non_snake_case)] pub fn AppName() -> DOMString { DOMString::from("Netscape") // Like Gecko/Webkit } +#[allow(non_snake_case)] pub fn AppCodeName() -> DOMString { DOMString::from("Mozilla") } +#[allow(non_snake_case)] #[cfg(target_os = "windows")] pub fn Platform() -> DOMString { DOMString::from("Win32") } +#[allow(non_snake_case)] #[cfg(any(target_os = "android", target_os = "linux"))] pub fn Platform() -> DOMString { DOMString::from("Linux") } +#[allow(non_snake_case)] #[cfg(target_os = "macos")] pub fn Platform() -> DOMString { DOMString::from("Mac") } +#[allow(non_snake_case)] #[cfg(target_os = "ios")] pub fn Platform() -> DOMString { DOMString::from("iOS") } +#[allow(non_snake_case)] pub fn UserAgent(user_agent: Cow<'static, str>) -> DOMString { DOMString::from(&*user_agent) } +#[allow(non_snake_case)] pub fn AppVersion() -> DOMString { DOMString::from("4.0") } +#[allow(non_snake_case)] pub fn Language() -> DOMString { DOMString::from("en-US") } diff --git a/components/script/dom/offlineaudiocompletionevent.rs b/components/script/dom/offlineaudiocompletionevent.rs index 26180e93d74..f093f583608 100644 --- a/components/script/dom/offlineaudiocompletionevent.rs +++ b/components/script/dom/offlineaudiocompletionevent.rs @@ -47,6 +47,7 @@ impl OfflineAudioCompletionEvent { ev } + #[allow(non_snake_case)] pub fn Constructor( window: &Window, type_: DOMString, diff --git a/components/script/dom/offlineaudiocontext.rs b/components/script/dom/offlineaudiocontext.rs index d499e79c159..63ec3ffdbe2 100644 --- a/components/script/dom/offlineaudiocontext.rs +++ b/components/script/dom/offlineaudiocontext.rs @@ -41,6 +41,7 @@ pub struct OfflineAudioContext { pending_rendering_promise: DomRefCell<Option<Rc<Promise>>>, } +#[allow(non_snake_case)] impl OfflineAudioContext { #[allow(unrooted_must_root)] fn new_inherited( diff --git a/components/script/dom/offscreencanvas.rs b/components/script/dom/offscreencanvas.rs index 704918510a6..70e0573a2c4 100644 --- a/components/script/dom/offscreencanvas.rs +++ b/components/script/dom/offscreencanvas.rs @@ -69,6 +69,7 @@ impl OffscreenCanvas { ) } + #[allow(non_snake_case)] pub fn Constructor( global: &GlobalScope, width: u64, diff --git a/components/script/dom/oscillatornode.rs b/components/script/dom/oscillatornode.rs index e2b33f4639e..2a5f6615db6 100644 --- a/components/script/dom/oscillatornode.rs +++ b/components/script/dom/oscillatornode.rs @@ -95,6 +95,7 @@ impl OscillatorNode { )) } + #[allow(non_snake_case)] pub fn Constructor( window: &Window, context: &BaseAudioContext, diff --git a/components/script/dom/pagetransitionevent.rs b/components/script/dom/pagetransitionevent.rs index 0c07339c9fa..41be9fd2488 100644 --- a/components/script/dom/pagetransitionevent.rs +++ b/components/script/dom/pagetransitionevent.rs @@ -55,6 +55,7 @@ impl PageTransitionEvent { ev } + #[allow(non_snake_case)] pub fn Constructor( window: &Window, type_: DOMString, diff --git a/components/script/dom/pannernode.rs b/components/script/dom/pannernode.rs index 047ac0ef442..ae36a9cc701 100644 --- a/components/script/dom/pannernode.rs +++ b/components/script/dom/pannernode.rs @@ -184,6 +184,7 @@ impl PannerNode { )) } + #[allow(non_snake_case)] pub fn Constructor( window: &Window, context: &BaseAudioContext, diff --git a/components/script/dom/performanceobserver.rs b/components/script/dom/performanceobserver.rs index dc66e88b5a3..0683a3cb46e 100644 --- a/components/script/dom/performanceobserver.rs +++ b/components/script/dom/performanceobserver.rs @@ -61,6 +61,7 @@ impl PerformanceObserver { reflect_dom_object(Box::new(observer), global, PerformanceObserverBinding::Wrap) } + #[allow(non_snake_case)] pub fn Constructor( global: &GlobalScope, callback: Rc<PerformanceObserverCallback>, diff --git a/components/script/dom/permissions.rs b/components/script/dom/permissions.rs index fba7965eee1..66fe3f01be7 100644 --- a/components/script/dom/permissions.rs +++ b/components/script/dom/permissions.rs @@ -85,6 +85,7 @@ impl Permissions { // https://w3c.github.io/permissions/#dom-permissions-query // https://w3c.github.io/permissions/#dom-permissions-request // https://w3c.github.io/permissions/#dom-permissions-revoke + #[allow(non_snake_case)] fn manipulate( &self, op: Operation, @@ -199,6 +200,7 @@ impl Permissions { } } +#[allow(non_snake_case)] impl PermissionsMethods for Permissions { // https://w3c.github.io/permissions/#dom-permissions-query fn Query(&self, cx: JSContext, permissionDesc: *mut JSObject) -> Rc<Promise> { diff --git a/components/script/dom/popstateevent.rs b/components/script/dom/popstateevent.rs index d5cb3c0ff3a..9c4ba63cb93 100644 --- a/components/script/dom/popstateevent.rs +++ b/components/script/dom/popstateevent.rs @@ -61,6 +61,7 @@ impl PopStateEvent { ev } + #[allow(non_snake_case)] pub fn Constructor( window: &Window, type_: DOMString, diff --git a/components/script/dom/progressevent.rs b/components/script/dom/progressevent.rs index c5f33dfe305..325e247bc52 100644 --- a/components/script/dom/progressevent.rs +++ b/components/script/dom/progressevent.rs @@ -56,6 +56,8 @@ impl ProgressEvent { } ev } + + #[allow(non_snake_case)] pub fn Constructor( global: &GlobalScope, type_: DOMString, diff --git a/components/script/dom/promiserejectionevent.rs b/components/script/dom/promiserejectionevent.rs index 19bf96b9b12..8e1e62bc18d 100644 --- a/components/script/dom/promiserejectionevent.rs +++ b/components/script/dom/promiserejectionevent.rs @@ -65,7 +65,7 @@ impl PromiseRejectionEvent { ev } - #[allow(unrooted_must_root)] + #[allow(unrooted_must_root, non_snake_case)] pub fn Constructor( global: &GlobalScope, type_: DOMString, diff --git a/components/script/dom/radionodelist.rs b/components/script/dom/radionodelist.rs index 21b7d39772b..6882aefff35 100644 --- a/components/script/dom/radionodelist.rs +++ b/components/script/dom/radionodelist.rs @@ -67,6 +67,7 @@ impl RadioNodeList { // https://dom.spec.whatwg.org/#dom-nodelist-length // https://github.com/servo/servo/issues/5875 + #[allow(non_snake_case)] pub fn Length(&self) -> u32 { self.node_list.Length() } diff --git a/components/script/dom/range.rs b/components/script/dom/range.rs index 665469f4884..e9e62a9cdc0 100644 --- a/components/script/dom/range.rs +++ b/components/script/dom/range.rs @@ -83,6 +83,7 @@ impl Range { } // https://dom.spec.whatwg.org/#dom-range + #[allow(non_snake_case)] pub fn Constructor(window: &Window) -> Fallible<DomRoot<Range>> { let document = window.Document(); Ok(Range::new_with_doc(&document)) diff --git a/components/script/dom/request.rs b/components/script/dom/request.rs index dcd206e3eaf..d75c452c7b9 100644 --- a/components/script/dom/request.rs +++ b/components/script/dom/request.rs @@ -74,6 +74,7 @@ impl Request { } // https://fetch.spec.whatwg.org/#dom-request + #[allow(non_snake_case)] pub fn Constructor( global: &GlobalScope, input: RequestInfo, diff --git a/components/script/dom/response.rs b/components/script/dom/response.rs index 802e803b17f..f329b16c3c5 100644 --- a/components/script/dom/response.rs +++ b/components/script/dom/response.rs @@ -53,6 +53,7 @@ pub struct Response { stream_consumer: DomRefCell<Option<StreamConsumer>>, } +#[allow(non_snake_case)] impl Response { pub fn new_inherited() -> Response { Response { diff --git a/components/script/dom/rtcicecandidate.rs b/components/script/dom/rtcicecandidate.rs index 9eefcd35134..a432010b858 100644 --- a/components/script/dom/rtcicecandidate.rs +++ b/components/script/dom/rtcicecandidate.rs @@ -59,6 +59,7 @@ impl RTCIceCandidate { ) } + #[allow(non_snake_case)] pub fn Constructor( window: &Window, config: &RTCIceCandidateInit, diff --git a/components/script/dom/rtcpeerconnection.rs b/components/script/dom/rtcpeerconnection.rs index 9fbe4b8ce45..13ac289263d 100644 --- a/components/script/dom/rtcpeerconnection.rs +++ b/components/script/dom/rtcpeerconnection.rs @@ -196,6 +196,7 @@ impl RTCPeerConnection { this } + #[allow(non_snake_case)] pub fn Constructor( window: &Window, config: &RTCConfiguration, diff --git a/components/script/dom/rtcpeerconnectioniceevent.rs b/components/script/dom/rtcpeerconnectioniceevent.rs index 8293ed48696..795cb330829 100644 --- a/components/script/dom/rtcpeerconnectioniceevent.rs +++ b/components/script/dom/rtcpeerconnectioniceevent.rs @@ -56,6 +56,7 @@ impl RTCPeerConnectionIceEvent { e } + #[allow(non_snake_case)] pub fn Constructor( window: &Window, ty: DOMString, diff --git a/components/script/dom/rtcsessiondescription.rs b/components/script/dom/rtcsessiondescription.rs index 0ef79a321c6..68be62e577b 100644 --- a/components/script/dom/rtcsessiondescription.rs +++ b/components/script/dom/rtcsessiondescription.rs @@ -44,6 +44,7 @@ impl RTCSessionDescription { ) } + #[allow(non_snake_case)] pub fn Constructor( window: &Window, config: &RTCSessionDescriptionInit, diff --git a/components/script/dom/rtctrackevent.rs b/components/script/dom/rtctrackevent.rs index 9c5d7bec362..386349bcaa1 100644 --- a/components/script/dom/rtctrackevent.rs +++ b/components/script/dom/rtctrackevent.rs @@ -50,6 +50,7 @@ impl RTCTrackEvent { trackevent } + #[allow(non_snake_case)] pub fn Constructor( window: &Window, type_: DOMString, diff --git a/components/script/dom/stereopannernode.rs b/components/script/dom/stereopannernode.rs index 3d57993889d..66383352086 100644 --- a/components/script/dom/stereopannernode.rs +++ b/components/script/dom/stereopannernode.rs @@ -83,6 +83,7 @@ impl StereoPannerNode { )) } + #[allow(non_snake_case)] pub fn Constructor( window: &Window, context: &BaseAudioContext, diff --git a/components/script/dom/storageevent.rs b/components/script/dom/storageevent.rs index 19e5a96da9c..c2ecaf59611 100644 --- a/components/script/dom/storageevent.rs +++ b/components/script/dom/storageevent.rs @@ -27,6 +27,7 @@ pub struct StorageEvent { storage_area: MutNullableDom<Storage>, } +#[allow(non_snake_case)] impl StorageEvent { pub fn new_inherited( key: Option<DOMString>, @@ -109,6 +110,7 @@ impl StorageEvent { } } +#[allow(non_snake_case)] impl StorageEventMethods for StorageEvent { // https://html.spec.whatwg.org/multipage/#dom-storageevent-key fn GetKey(&self) -> Option<DOMString> { diff --git a/components/script/dom/svgsvgelement.rs b/components/script/dom/svgsvgelement.rs index efc1e00ff33..57f88db6f5b 100644 --- a/components/script/dom/svgsvgelement.rs +++ b/components/script/dom/svgsvgelement.rs @@ -55,7 +55,7 @@ pub trait LayoutSVGSVGElementHelpers { } impl LayoutSVGSVGElementHelpers for LayoutDom<SVGSVGElement> { - #[allow(unsafe_code)] + #[allow(unsafe_code, non_snake_case)] fn data(&self) -> SVGSVGData { unsafe { let SVG = &*self.unsafe_get(); diff --git a/components/script/dom/testbinding.rs b/components/script/dom/testbinding.rs index 475f432417f..52018d73b6f 100644 --- a/components/script/dom/testbinding.rs +++ b/components/script/dom/testbinding.rs @@ -72,6 +72,7 @@ pub struct TestBinding { url: MutableWeakRef<URL>, } +#[allow(non_snake_case)] impl TestBinding { fn new_inherited() -> TestBinding { TestBinding { @@ -1076,6 +1077,7 @@ impl TestBindingMethods for TestBinding { } } +#[allow(non_snake_case)] impl TestBinding { pub fn BooleanAttributeStatic(_: &GlobalScope) -> bool { false diff --git a/components/script/dom/testbindingiterable.rs b/components/script/dom/testbindingiterable.rs index 2bf8fa547ca..d2ee66521ff 100644 --- a/components/script/dom/testbindingiterable.rs +++ b/components/script/dom/testbindingiterable.rs @@ -33,6 +33,7 @@ impl TestBindingIterable { ) } + #[allow(non_snake_case)] pub fn Constructor(global: &GlobalScope) -> Fallible<DomRoot<TestBindingIterable>> { Ok(TestBindingIterable::new(global)) } diff --git a/components/script/dom/testbindingpairiterable.rs b/components/script/dom/testbindingpairiterable.rs index a1957fd74eb..8c85de40f0c 100644 --- a/components/script/dom/testbindingpairiterable.rs +++ b/components/script/dom/testbindingpairiterable.rs @@ -59,6 +59,7 @@ impl TestBindingPairIterable { ) } + #[allow(non_snake_case)] pub fn Constructor(global: &GlobalScope) -> Fallible<DomRoot<TestBindingPairIterable>> { Ok(TestBindingPairIterable::new(global)) } diff --git a/components/script/dom/testrunner.rs b/components/script/dom/testrunner.rs index 69c993a1423..5adc77e0d0c 100644 --- a/components/script/dom/testrunner.rs +++ b/components/script/dom/testrunner.rs @@ -42,6 +42,7 @@ impl TestRunner { impl TestRunnerMethods for TestRunner { // https://webbluetoothcg.github.io/web-bluetooth/tests#setBluetoothMockDataSet + #[allow(non_snake_case)] fn SetBluetoothMockDataSet(&self, dataSetName: DOMString) -> ErrorResult { let (sender, receiver) = ipc::channel(self.global().time_profiler_chan().clone()).unwrap(); self.get_bluetooth_thread() diff --git a/components/script/dom/testworklet.rs b/components/script/dom/testworklet.rs index c3d214a306b..5d44203d024 100644 --- a/components/script/dom/testworklet.rs +++ b/components/script/dom/testworklet.rs @@ -45,12 +45,14 @@ impl TestWorklet { ) } + #[allow(non_snake_case)] pub fn Constructor(window: &Window) -> Fallible<DomRoot<TestWorklet>> { Ok(TestWorklet::new(window)) } } impl TestWorkletMethods for TestWorklet { + #[allow(non_snake_case)] fn AddModule( &self, moduleURL: USVString, diff --git a/components/script/dom/text.rs b/components/script/dom/text.rs index 541bfd1ebd5..36273f933a2 100644 --- a/components/script/dom/text.rs +++ b/components/script/dom/text.rs @@ -38,6 +38,7 @@ impl Text { ) } + #[allow(non_snake_case)] pub fn Constructor(window: &Window, text: DOMString) -> Fallible<DomRoot<Text>> { let document = window.Document(); Ok(Text::new(text, &document)) diff --git a/components/script/dom/textdecoder.rs b/components/script/dom/textdecoder.rs index 84d07abf391..484ac269ec6 100644 --- a/components/script/dom/textdecoder.rs +++ b/components/script/dom/textdecoder.rs @@ -18,6 +18,7 @@ use std::borrow::ToOwned; use std::cell::{Cell, RefCell}; #[dom_struct] +#[allow(non_snake_case)] pub struct TextDecoder { reflector_: Reflector, encoding: &'static Encoding, @@ -29,6 +30,7 @@ pub struct TextDecoder { do_not_flush: Cell<bool>, } +#[allow(non_snake_case)] impl TextDecoder { fn new_inherited(encoding: &'static Encoding, fatal: bool, ignoreBOM: bool) -> TextDecoder { TextDecoder { diff --git a/components/script/dom/textencoder.rs b/components/script/dom/textencoder.rs index fae24beaf78..65d41c1c88e 100644 --- a/components/script/dom/textencoder.rs +++ b/components/script/dom/textencoder.rs @@ -37,6 +37,7 @@ impl TextEncoder { } // https://encoding.spec.whatwg.org/#dom-textencoder + #[allow(non_snake_case)] pub fn Constructor(global: &GlobalScope) -> Fallible<DomRoot<TextEncoder>> { Ok(TextEncoder::new(global)) } diff --git a/components/script/dom/textmetrics.rs b/components/script/dom/textmetrics.rs index 867071bd0aa..eca24e19452 100644 --- a/components/script/dom/textmetrics.rs +++ b/components/script/dom/textmetrics.rs @@ -11,6 +11,7 @@ use crate::dom::globalscope::GlobalScope; use dom_struct::dom_struct; #[dom_struct] +#[allow(non_snake_case)] pub struct TextMetrics { reflector_: Reflector, width: Finite<f64>, @@ -27,6 +28,7 @@ pub struct TextMetrics { ideographicBaseline: Finite<f64>, } +#[allow(non_snake_case)] impl TextMetrics { fn new_inherited( width: f64, diff --git a/components/script/dom/trackevent.rs b/components/script/dom/trackevent.rs index 5a734a0e4c9..634548eb351 100644 --- a/components/script/dom/trackevent.rs +++ b/components/script/dom/trackevent.rs @@ -34,6 +34,7 @@ pub struct TrackEvent { track: Option<MediaTrack>, } +#[allow(non_snake_case)] impl TrackEvent { #[allow(unrooted_must_root)] fn new_inherited(track: &Option<VideoTrackOrAudioTrackOrTextTrack>) -> TrackEvent { @@ -90,6 +91,7 @@ impl TrackEvent { } } +#[allow(non_snake_case)] impl TrackEventMethods for TrackEvent { // https://html.spec.whatwg.org/multipage/#dom-trackevent-track fn GetTrack(&self) -> Option<VideoTrackOrAudioTrackOrTextTrack> { diff --git a/components/script/dom/transitionevent.rs b/components/script/dom/transitionevent.rs index e9f87d623cb..5f4d5aa7088 100644 --- a/components/script/dom/transitionevent.rs +++ b/components/script/dom/transitionevent.rs @@ -53,6 +53,7 @@ impl TransitionEvent { ev } + #[allow(non_snake_case)] pub fn Constructor( window: &Window, type_: DOMString, diff --git a/components/script/dom/uievent.rs b/components/script/dom/uievent.rs index b9ab31958c9..45bdda0ccc6 100644 --- a/components/script/dom/uievent.rs +++ b/components/script/dom/uievent.rs @@ -61,6 +61,7 @@ impl UIEvent { ev } + #[allow(non_snake_case)] pub fn Constructor( window: &Window, type_: DOMString, diff --git a/components/script/dom/url.rs b/components/script/dom/url.rs index cc6c83e2c18..715d1ededd7 100644 --- a/components/script/dom/url.rs +++ b/components/script/dom/url.rs @@ -69,6 +69,7 @@ impl URL { } } +#[allow(non_snake_case)] impl URL { // https://url.spec.whatwg.org/#constructors pub fn Constructor( diff --git a/components/script/dom/urlhelper.rs b/components/script/dom/urlhelper.rs index 69cad894c99..144212e0600 100644 --- a/components/script/dom/urlhelper.rs +++ b/components/script/dom/urlhelper.rs @@ -10,6 +10,7 @@ use url::quirks; #[derive(MallocSizeOf)] pub struct UrlHelper; +#[allow(non_snake_case)] impl UrlHelper { pub fn Origin(url: &ServoUrl) -> USVString { USVString(quirks::origin(url.as_url()).to_owned()) diff --git a/components/script/dom/urlsearchparams.rs b/components/script/dom/urlsearchparams.rs index 3664d30d1f7..670304a75a1 100644 --- a/components/script/dom/urlsearchparams.rs +++ b/components/script/dom/urlsearchparams.rs @@ -45,6 +45,7 @@ impl URLSearchParams { } // https://url.spec.whatwg.org/#dom-urlsearchparams-urlsearchparams + #[allow(non_snake_case)] pub fn Constructor( global: &GlobalScope, init: USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString, diff --git a/components/script/dom/vrdisplay.rs b/components/script/dom/vrdisplay.rs index c3652fea392..d10c4bede11 100644 --- a/components/script/dom/vrdisplay.rs +++ b/components/script/dom/vrdisplay.rs @@ -212,7 +212,7 @@ impl VRDisplayMethods for VRDisplay { } // https://w3c.github.io/webvr/#dom-vrdisplay-getframedata-framedata-framedata - fn GetFrameData(&self, frameData: &VRFrameData) -> bool { + fn GetFrameData(&self, frame_data: &VRFrameData) -> bool { // If presenting we use a synced data with compositor for the whole frame. // Frame data is only synced with compositor when GetFrameData is called from // inside the VRDisplay.requestAnimationFrame. This is checked using the running_display_raf property. @@ -223,7 +223,7 @@ impl VRDisplayMethods for VRDisplay { if self.frame_data_status.get() == VRFrameDataStatus::Waiting { self.sync_frame_data(); } - frameData.update(&self.frame_data.borrow()); + frame_data.update(&self.frame_data.borrow()); return true; } @@ -240,7 +240,7 @@ impl VRDisplayMethods for VRDisplay { .unwrap(); return match receiver.recv().unwrap() { Ok(data) => { - frameData.update(&data); + frame_data.update(&data); true }, Err(e) => { diff --git a/components/script/dom/vrdisplayevent.rs b/components/script/dom/vrdisplayevent.rs index 20e028463d0..711349b4496 100644 --- a/components/script/dom/vrdisplayevent.rs +++ b/components/script/dom/vrdisplayevent.rs @@ -91,6 +91,7 @@ impl VRDisplayEvent { ) } + #[allow(non_snake_case)] pub fn Constructor( window: &Window, type_: DOMString, diff --git a/components/script/dom/vrframedata.rs b/components/script/dom/vrframedata.rs index b7b8c743080..d4e92433f10 100644 --- a/components/script/dom/vrframedata.rs +++ b/components/script/dom/vrframedata.rs @@ -71,6 +71,7 @@ impl VRFrameData { root } + #[allow(non_snake_case)] pub fn Constructor(window: &Window) -> Fallible<DomRoot<VRFrameData>> { Ok(VRFrameData::new(&window.global())) } diff --git a/components/script/dom/webgl2renderingcontext.rs b/components/script/dom/webgl2renderingcontext.rs index af11e947eda..2d782d8604f 100644 --- a/components/script/dom/webgl2renderingcontext.rs +++ b/components/script/dom/webgl2renderingcontext.rs @@ -2708,6 +2708,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext { } /// https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.15 + #[allow(non_snake_case)] fn BeginTransformFeedback(&self, primitiveMode: u32) { match primitiveMode { constants::POINTS | constants::LINES | constants::TRIANGLES => {}, @@ -2775,6 +2776,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext { } /// https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.15 + #[allow(non_snake_case)] fn TransformFeedbackVaryings( &self, program: &WebGLProgram, diff --git a/components/script/dom/webglcontextevent.rs b/components/script/dom/webglcontextevent.rs index e4b0efe0360..f9714fc37e9 100644 --- a/components/script/dom/webglcontextevent.rs +++ b/components/script/dom/webglcontextevent.rs @@ -63,6 +63,7 @@ impl WebGLContextEvent { event } + #[allow(non_snake_case)] pub fn Constructor( window: &Window, type_: DOMString, diff --git a/components/script/dom/websocket.rs b/components/script/dom/websocket.rs index c931437bd4f..2354bdef91f 100644 --- a/components/script/dom/websocket.rs +++ b/components/script/dom/websocket.rs @@ -143,6 +143,7 @@ impl WebSocket { } /// <https://html.spec.whatwg.org/multipage/#dom-websocket> + #[allow(non_snake_case)] pub fn Constructor( global: &GlobalScope, url: DOMString, diff --git a/components/script/dom/wheelevent.rs b/components/script/dom/wheelevent.rs index 4c3d6d94efa..8b8ef288282 100644 --- a/components/script/dom/wheelevent.rs +++ b/components/script/dom/wheelevent.rs @@ -73,6 +73,7 @@ impl WheelEvent { ev } + #[allow(non_snake_case)] pub fn Constructor( window: &Window, type_: DOMString, diff --git a/components/script/dom/windowproxy.rs b/components/script/dom/windowproxy.rs index 6aa0b9244cf..21e40f79989 100644 --- a/components/script/dom/windowproxy.rs +++ b/components/script/dom/windowproxy.rs @@ -743,7 +743,7 @@ fn parse_open_feature_boolean(tokenized_features: &IndexMap<String, String>, nam // This is only called from extern functions, // there's no use using the lifetimed handles here. // https://html.spec.whatwg.org/multipage/#accessing-other-browsing-contexts -#[allow(unsafe_code)] +#[allow(unsafe_code, non_snake_case)] unsafe fn GetSubframeWindowProxy( cx: *mut JSContext, proxy: RawHandleObject, @@ -797,7 +797,7 @@ unsafe fn GetSubframeWindowProxy( None } -#[allow(unsafe_code)] +#[allow(unsafe_code, non_snake_case)] unsafe extern "C" fn getOwnPropertyDescriptor( cx: *mut JSContext, proxy: RawHandleObject, @@ -828,7 +828,7 @@ unsafe extern "C" fn getOwnPropertyDescriptor( true } -#[allow(unsafe_code)] +#[allow(unsafe_code, non_snake_case)] unsafe extern "C" fn defineProperty( cx: *mut JSContext, proxy: RawHandleObject, @@ -1044,7 +1044,7 @@ unsafe extern "C" fn delete_xorigin( throw_security_error(cx) } -#[allow(unsafe_code)] +#[allow(unsafe_code, non_snake_case)] unsafe extern "C" fn getOwnPropertyDescriptor_xorigin( cx: *mut JSContext, proxy: RawHandleObject, @@ -1056,7 +1056,7 @@ unsafe extern "C" fn getOwnPropertyDescriptor_xorigin( found && getOwnPropertyDescriptor(cx, proxy, id, desc) } -#[allow(unsafe_code)] +#[allow(unsafe_code, non_snake_case)] unsafe extern "C" fn defineProperty_xorigin( cx: *mut JSContext, _: RawHandleObject, @@ -1067,7 +1067,7 @@ unsafe extern "C" fn defineProperty_xorigin( throw_security_error(cx) } -#[allow(unsafe_code)] +#[allow(unsafe_code, non_snake_case)] unsafe extern "C" fn preventExtensions_xorigin( cx: *mut JSContext, _: RawHandleObject, diff --git a/components/script/dom/worker.rs b/components/script/dom/worker.rs index 7eb958cd095..a35efd3ef3b 100644 --- a/components/script/dom/worker.rs +++ b/components/script/dom/worker.rs @@ -76,7 +76,7 @@ impl Worker { } // https://html.spec.whatwg.org/multipage/#dom-worker - #[allow(unsafe_code)] + #[allow(unsafe_code, non_snake_case)] pub fn Constructor( global: &GlobalScope, script_url: USVString, diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs index ce90aed8f44..1e8176cb781 100644 --- a/components/script/dom/xmlhttprequest.rs +++ b/components/script/dom/xmlhttprequest.rs @@ -224,6 +224,7 @@ impl XMLHttpRequest { } // https://xhr.spec.whatwg.org/#constructors + #[allow(non_snake_case)] pub fn Constructor(global: &GlobalScope) -> Fallible<DomRoot<XMLHttpRequest>> { Ok(XMLHttpRequest::new(global)) } diff --git a/components/script/dom/xmlserializer.rs b/components/script/dom/xmlserializer.rs index 350da26abf9..bb5085b1738 100644 --- a/components/script/dom/xmlserializer.rs +++ b/components/script/dom/xmlserializer.rs @@ -35,6 +35,7 @@ impl XMLSerializer { ) } + #[allow(non_snake_case)] pub fn Constructor(window: &Window) -> Fallible<DomRoot<XMLSerializer>> { Ok(XMLSerializer::new(window)) } diff --git a/components/script/dom/xrinputsourceevent.rs b/components/script/dom/xrinputsourceevent.rs index aa177f1df9a..445ad84f59a 100644 --- a/components/script/dom/xrinputsourceevent.rs +++ b/components/script/dom/xrinputsourceevent.rs @@ -56,6 +56,7 @@ impl XRInputSourceEvent { trackevent } + #[allow(non_snake_case)] pub fn Constructor( window: &Window, type_: DOMString, diff --git a/components/script/dom/xrinputsourceschangeevent.rs b/components/script/dom/xrinputsourceschangeevent.rs index f5a2e6f33ad..3b68a3b8d2a 100644 --- a/components/script/dom/xrinputsourceschangeevent.rs +++ b/components/script/dom/xrinputsourceschangeevent.rs @@ -77,6 +77,7 @@ impl XRInputSourcesChangeEvent { changeevent } + #[allow(non_snake_case)] pub fn Constructor( window: &Window, type_: DOMString, diff --git a/components/script/dom/xrrigidtransform.rs b/components/script/dom/xrrigidtransform.rs index 2b09b89e096..86593ae6b97 100644 --- a/components/script/dom/xrrigidtransform.rs +++ b/components/script/dom/xrrigidtransform.rs @@ -59,6 +59,7 @@ impl XRRigidTransform { } // https://immersive-web.github.io/webxr/#dom-xrrigidtransform-xrrigidtransform + #[allow(non_snake_case)] pub fn Constructor( window: &Window, position: &DOMPointInit, diff --git a/components/script/dom/xrsessionevent.rs b/components/script/dom/xrsessionevent.rs index 6c2e8c0fb00..18a8b83a8c3 100644 --- a/components/script/dom/xrsessionevent.rs +++ b/components/script/dom/xrsessionevent.rs @@ -50,6 +50,7 @@ impl XRSessionEvent { trackevent } + #[allow(non_snake_case)] pub fn Constructor( window: &Window, type_: DOMString, diff --git a/components/script/dom/xrwebgllayer.rs b/components/script/dom/xrwebgllayer.rs index 498a5035ce0..f6e05844dd8 100644 --- a/components/script/dom/xrwebgllayer.rs +++ b/components/script/dom/xrwebgllayer.rs @@ -83,6 +83,7 @@ impl XRWebGLLayer { } /// https://immersive-web.github.io/webxr/#dom-xrwebgllayer-xrwebgllayer + #[allow(non_snake_case)] pub fn Constructor( global: &Window, session: &XRSession, diff --git a/components/script/fetch.rs b/components/script/fetch.rs index e7f045895d8..d03976bf94d 100644 --- a/components/script/fetch.rs +++ b/components/script/fetch.rs @@ -132,7 +132,7 @@ fn request_init_from_request(request: NetTraitsRequest) -> RequestBuilder { } // https://fetch.spec.whatwg.org/#fetch-method -#[allow(unrooted_must_root)] +#[allow(unrooted_must_root, non_snake_case)] pub fn Fetch( global: &GlobalScope, input: RequestInfo, @@ -349,7 +349,7 @@ pub fn load_whole_resource( } /// https://html.spec.whatwg.org/multipage/#create-a-potential-cors-request -pub(crate) fn create_a_potential_CORS_request( +pub(crate) fn create_a_potential_cors_request( url: ServoUrl, destination: Destination, cors_setting: Option<CorsSettings>, diff --git a/components/script/lib.rs b/components/script/lib.rs index 2ae7f76923a..e74af20db42 100644 --- a/components/script/lib.rs +++ b/components/script/lib.rs @@ -9,7 +9,6 @@ #![feature(plugin)] #![feature(register_tool)] #![deny(unsafe_code)] -#![allow(non_snake_case)] #![doc = "The script crate contains all matters DOM."] #![cfg_attr(not(feature = "unrooted_must_root_lint"), allow(unknown_lints))] #![allow(deprecated)] // FIXME: Can we make `allow` only apply to the `plugin` crate attribute? diff --git a/components/script/script_module.rs b/components/script/script_module.rs index 4bb60f5a233..91fca91e6a0 100644 --- a/components/script/script_module.rs +++ b/components/script/script_module.rs @@ -1050,7 +1050,7 @@ impl ResourceTimingListener for ModuleContext { impl PreInvoke for ModuleContext {} -#[allow(unsafe_code)] +#[allow(unsafe_code, non_snake_case)] /// A function to register module hooks (e.g. listening on resolving modules, /// getting module metadata, getting script private reference and resolving dynamic import) pub unsafe fn EnsureModuleHooksInitialized(rt: *mut JSRuntime) { @@ -1065,7 +1065,7 @@ pub unsafe fn EnsureModuleHooksInitialized(rt: *mut JSRuntime) { SetModuleDynamicImportHook(rt, None); } -#[allow(unsafe_code)] +#[allow(unsafe_code, non_snake_case)] /// https://tc39.github.io/ecma262/#sec-hostresolveimportedmodule /// https://html.spec.whatwg.org/multipage/#hostresolveimportedmodule(referencingscriptormodule%2C-specifier) unsafe extern "C" fn HostResolveImportedModule( diff --git a/components/script/script_runtime.rs b/components/script/script_runtime.rs index 284c49312c6..b84178a166f 100644 --- a/components/script/script_runtime.rs +++ b/components/script/script_runtime.rs @@ -904,7 +904,7 @@ impl StreamConsumer { unsafe extern "C" fn consume_stream( _cx: *mut RawJSContext, obj: HandleObject, - _mimeType: MimeType, + _mime_type: MimeType, _consumer: *mut JSStreamConsumer, ) -> bool { let cx = JSContext::from_ptr(_cx); diff --git a/components/script/stylesheet_loader.rs b/components/script/stylesheet_loader.rs index 82b5bbdf532..8e3f3624fb1 100644 --- a/components/script/stylesheet_loader.rs +++ b/components/script/stylesheet_loader.rs @@ -16,7 +16,7 @@ use crate::dom::htmllinkelement::{HTMLLinkElement, RequestGenerationId}; use crate::dom::node::{containing_shadow_root, document_from_node, window_from_node}; use crate::dom::performanceresourcetiming::InitiatorType; use crate::dom::shadowroot::ShadowRoot; -use crate::fetch::create_a_potential_CORS_request; +use crate::fetch::create_a_potential_cors_request; use crate::network_listener::{self, NetworkListener, PreInvoke, ResourceTimingListener}; use cssparser::SourceLocation; use encoding_rs::UTF_8; @@ -344,7 +344,7 @@ pub(crate) fn stylesheet_fetch_request( referrer_policy: Option<ReferrerPolicy>, integrity_metadata: String, ) -> RequestBuilder { - create_a_potential_CORS_request(url, Destination::Style, cors_setting, None) + create_a_potential_cors_request(url, Destination::Style, cors_setting, None) .origin(origin) .pipeline_id(Some(pipeline_id)) .referrer(Some(referrer)) diff --git a/components/script/test.rs b/components/script/test.rs index 5cb2dca8006..247acb80940 100644 --- a/components/script/test.rs +++ b/components/script/test.rs @@ -15,6 +15,7 @@ pub mod area { pub use crate::dom::htmlareaelement::{Area, Shape}; } +#[allow(non_snake_case)] pub mod size_of { use crate::dom::characterdata::CharacterData; use crate::dom::element::Element; diff --git a/components/script/webdriver_handlers.rs b/components/script/webdriver_handlers.rs index cea4cca5c71..f177f8e4c30 100644 --- a/components/script/webdriver_handlers.rs +++ b/components/script/webdriver_handlers.rs @@ -383,14 +383,14 @@ fn get_element_in_view_center_point(element: &Element) -> Option<Point2D<i64>> { let width = rectangle.Width().round() as i64; let height = rectangle.Height().round() as i64; - let clientWidth = body.ClientWidth() as i64; - let clientHeight = body.ClientHeight() as i64; + let client_width = body.ClientWidth() as i64; + let client_height = body.ClientHeight() as i64; // Steps 2 - 5 let left = cmp::max(0, cmp::min(x, x + width)); - let right = cmp::min(clientWidth, cmp::max(x, x + width)); + let right = cmp::min(client_width, cmp::max(x, x + width)); let top = cmp::max(0, cmp::min(y, y + height)); - let bottom = cmp::min(clientHeight, cmp::max(y, y + height)); + let bottom = cmp::min(client_height, cmp::max(y, y + height)); // Steps 6 - 7 let x = (left + right) / 2; |