aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom')
-rw-r--r--components/script/dom/audiobuffer.rs4
-rw-r--r--components/script/dom/baseaudiocontext.rs4
-rw-r--r--components/script/dom/bindings/cell.rs4
-rw-r--r--components/script/dom/htmlformelement.rs6
-rw-r--r--components/script/dom/offlineaudiocontext.rs4
-rw-r--r--components/script/dom/workerglobalscope.rs3
6 files changed, 13 insertions, 12 deletions
diff --git a/components/script/dom/audiobuffer.rs b/components/script/dom/audiobuffer.rs
index 1b6fbfd0e48..2572041bdba 100644
--- a/components/script/dom/audiobuffer.rs
+++ b/components/script/dom/audiobuffer.rs
@@ -114,8 +114,8 @@ impl AudioBuffer {
proto: Option<HandleObject>,
options: &AudioBufferOptions,
) -> Fallible<DomRoot<AudioBuffer>> {
- if options.length <= 0 ||
- options.numberOfChannels <= 0 ||
+ if options.length == 0 ||
+ options.numberOfChannels == 0 ||
options.numberOfChannels > MAX_CHANNEL_COUNT ||
*options.sampleRate < MIN_SAMPLE_RATE ||
*options.sampleRate > MAX_SAMPLE_RATE
diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs
index d0cfc8ab203..462274bb685 100644
--- a/components/script/dom/baseaudiocontext.rs
+++ b/components/script/dom/baseaudiocontext.rs
@@ -404,9 +404,9 @@ impl BaseAudioContextMethods for BaseAudioContext {
length: u32,
sample_rate: Finite<f32>,
) -> Fallible<DomRoot<AudioBuffer>> {
- if number_of_channels <= 0 ||
+ if number_of_channels == 0 ||
number_of_channels > MAX_CHANNEL_COUNT ||
- length <= 0 ||
+ length == 0 ||
*sample_rate <= 0.
{
return Err(Error::NotSupported);
diff --git a/components/script/dom/bindings/cell.rs b/components/script/dom/bindings/cell.rs
index a9fb9b9b9d3..d56465594ca 100644
--- a/components/script/dom/bindings/cell.rs
+++ b/components/script/dom/bindings/cell.rs
@@ -41,7 +41,7 @@ impl<T> DomRefCell<T> {
/// Borrow the contents for the purpose of script deallocation.
///
- #[allow(unsafe_code)]
+ #[allow(unsafe_code, clippy::mut_from_ref)]
pub unsafe fn borrow_for_script_deallocation(&self) -> &mut T {
assert_in_script();
&mut *self.value.as_ptr()
@@ -49,7 +49,7 @@ impl<T> DomRefCell<T> {
/// Mutably borrow a cell for layout. Ideally this would use
/// `RefCell::try_borrow_mut_unguarded` but that doesn't exist yet.
- #[allow(unsafe_code)]
+ #[allow(unsafe_code, clippy::mut_from_ref)]
pub unsafe fn borrow_mut_for_layout(&self) -> &mut T {
assert_in_layout();
&mut *self.value.as_ptr()
diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs
index 43f2f6df72b..307fbb78cd0 100644
--- a/components/script/dom/htmlformelement.rs
+++ b/components/script/dom/htmlformelement.rs
@@ -1049,9 +1049,9 @@ impl HTMLFormElement {
validatable
.validity_state()
.perform_validation_and_update(ValidationFlags::all());
- if !validatable.is_instance_validatable() {
- None
- } else if validatable.validity_state().invalid_flags().is_empty() {
+ if !validatable.is_instance_validatable() ||
+ validatable.validity_state().invalid_flags().is_empty()
+ {
None
} else {
Some(DomRoot::from_ref(el))
diff --git a/components/script/dom/offlineaudiocontext.rs b/components/script/dom/offlineaudiocontext.rs
index 88186bde5ee..072f19d80da 100644
--- a/components/script/dom/offlineaudiocontext.rs
+++ b/components/script/dom/offlineaudiocontext.rs
@@ -79,8 +79,8 @@ impl OfflineAudioContext {
sample_rate: f32,
) -> Fallible<DomRoot<OfflineAudioContext>> {
if channel_count > MAX_CHANNEL_COUNT ||
- channel_count <= 0 ||
- length <= 0 ||
+ channel_count == 0 ||
+ length == 0 ||
sample_rate < MIN_SAMPLE_RATE ||
sample_rate > MAX_SAMPLE_RATE
{
diff --git a/components/script/dom/workerglobalscope.rs b/components/script/dom/workerglobalscope.rs
index 76f5770bbc1..0ab01a38c59 100644
--- a/components/script/dom/workerglobalscope.rs
+++ b/components/script/dom/workerglobalscope.rs
@@ -519,6 +519,7 @@ impl WorkerGlobalScope {
/// Process a single event as if it were the next event
/// in the queue for this worker event-loop.
/// Returns a boolean indicating whether further events should be processed.
+ #[allow(unsafe_code)]
pub fn process_event(&self, msg: CommonScriptMsg) -> bool {
if self.is_closing() {
return false;
@@ -528,7 +529,7 @@ impl WorkerGlobalScope {
CommonScriptMsg::CollectReports(reports_chan) => {
let cx = self.get_cx();
let path_seg = format!("url({})", self.get_url());
- let reports = get_reports(*cx, path_seg);
+ let reports = unsafe { get_reports(*cx, path_seg) };
reports_chan.send(reports);
},
}