Rustfmt has changed its default style :/

This commit is contained in:
Simon Sapin 2018-12-14 08:31:30 +01:00
parent 82fc6d9f49
commit be69f9c3e6
207 changed files with 1200 additions and 1339 deletions

View file

@ -108,9 +108,9 @@ impl AnalyserNode {
let this = this.clone();
let _ = source.queue_with_canceller(
task!(append_analysis_block: move || {
let this = this.root();
this.push_block(block.to().unwrap())
}),
let this = this.root();
this.push_block(block.to().unwrap())
}),
&canceller,
);
}),

View file

@ -134,20 +134,20 @@ impl AudioContextMethods for AudioContext {
let context = Trusted::new(self);
let _ = task_source.queue(
task!(suspend_ok: move || {
let base_context = base_context.root();
let context = context.root();
let promise = trusted_promise.root();
promise.resolve_native(&());
if base_context.State() != AudioContextState::Suspended {
base_context.set_state_attribute(AudioContextState::Suspended);
let window = DomRoot::downcast::<Window>(context.global()).unwrap();
window.task_manager().dom_manipulation_task_source().queue_simple_event(
context.upcast(),
atom!("statechange"),
&window
);
}
}),
let base_context = base_context.root();
let context = context.root();
let promise = trusted_promise.root();
promise.resolve_native(&());
if base_context.State() != AudioContextState::Suspended {
base_context.set_state_attribute(AudioContextState::Suspended);
let window = DomRoot::downcast::<Window>(context.global()).unwrap();
window.task_manager().dom_manipulation_task_source().queue_simple_event(
context.upcast(),
atom!("statechange"),
&window
);
}
}),
window.upcast(),
);
},
@ -156,9 +156,9 @@ impl AudioContextMethods for AudioContext {
// never fail, but we handle the case here for completion.
let _ = task_source.queue(
task!(suspend_error: move || {
let promise = trusted_promise.root();
promise.reject_error(Error::Type("Something went wrong".to_owned()));
}),
let promise = trusted_promise.root();
promise.reject_error(Error::Type("Something went wrong".to_owned()));
}),
window.upcast(),
);
},
@ -196,20 +196,20 @@ impl AudioContextMethods for AudioContext {
let context = Trusted::new(self);
let _ = task_source.queue(
task!(suspend_ok: move || {
let base_context = base_context.root();
let context = context.root();
let promise = trusted_promise.root();
promise.resolve_native(&());
if base_context.State() != AudioContextState::Closed {
base_context.set_state_attribute(AudioContextState::Closed);
let window = DomRoot::downcast::<Window>(context.global()).unwrap();
window.task_manager().dom_manipulation_task_source().queue_simple_event(
context.upcast(),
atom!("statechange"),
&window
);
}
}),
let base_context = base_context.root();
let context = context.root();
let promise = trusted_promise.root();
promise.resolve_native(&());
if base_context.State() != AudioContextState::Closed {
base_context.set_state_attribute(AudioContextState::Closed);
let window = DomRoot::downcast::<Window>(context.global()).unwrap();
window.task_manager().dom_manipulation_task_source().queue_simple_event(
context.upcast(),
atom!("statechange"),
&window
);
}
}),
window.upcast(),
);
},
@ -218,9 +218,9 @@ impl AudioContextMethods for AudioContext {
// never fail, but we handle the case here for completion.
let _ = task_source.queue(
task!(suspend_error: move || {
let promise = trusted_promise.root();
promise.reject_error(Error::Type("Something went wrong".to_owned()));
}),
let promise = trusted_promise.root();
promise.reject_error(Error::Type("Something went wrong".to_owned()));
}),
window.upcast(),
);
},

View file

@ -244,8 +244,8 @@ impl BaseAudioContext {
)));
let _ = task_source.queue(
task!(resume_error: move || {
this.root().fulfill_in_flight_resume_promises(|| {})
}),
this.root().fulfill_in_flight_resume_promises(|| {})
}),
window.upcast(),
);
},

View file

@ -4,8 +4,6 @@
//! Utilities to throw exceptions from Rust bindings.
#[cfg(feature = "js_backtrace")]
use backtrace::Backtrace;
#[cfg(feature = "js_backtrace")]
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::DOMExceptionBinding::DOMExceptionMethods;
@ -17,6 +15,8 @@ use crate::dom::bindings::conversions::{
use crate::dom::bindings::str::USVString;
use crate::dom::domexception::{DOMErrorName, DOMException};
use crate::dom::globalscope::GlobalScope;
#[cfg(feature = "js_backtrace")]
use backtrace::Backtrace;
use js::error::{throw_range_error, throw_type_error};
use js::jsapi::JSContext;
use js::jsapi::JS_ClearPendingException;

View file

@ -105,7 +105,7 @@ where
None => {
return Err(Error::Type(
"No custom element definition found for new.target".to_owned(),
))
));
},
};

View file

@ -734,10 +734,10 @@ fn parse_floating_point_number(input: &str) -> Result<f64, ()> {
match input.trim().parse::<f64>() {
Ok(val)
if !(
// A valid number is the same as what rust considers to be valid,
// except for +1., NaN, and Infinity.
val.is_infinite() || val.is_nan() || input.ends_with(".") || input.starts_with("+")
) =>
// A valid number is the same as what rust considers to be valid,
// except for +1., NaN, and Infinity.
val.is_infinite() || val.is_nan() || input.ends_with(".") || input.starts_with("+")
) =>
{
// TODO(#19773): need consider `min`, `max`, `step`, when they are implemented
Ok(val.round())

View file

@ -29,16 +29,6 @@
//! The `unsafe_no_jsmanaged_fields!()` macro adds an empty implementation of
//! `JSTraceable` to a datatype.
use app_units::Au;
use canvas_traits::canvas::{
CanvasGradientStop, CanvasId, LinearGradientStyle, RadialGradientStyle,
};
use canvas_traits::canvas::{CompositionOrBlending, LineCapStyle, LineJoinStyle, RepetitionStyle};
use canvas_traits::webgl::{ActiveAttribInfo, ActiveUniformInfo, TexDataType, TexFormat};
use canvas_traits::webgl::{WebGLBufferId, WebGLChan, WebGLContextShareMode, WebGLError};
use canvas_traits::webgl::{WebGLFramebufferId, WebGLMsgSender, WebGLPipeline, WebGLProgramId};
use canvas_traits::webgl::{WebGLReceiver, WebGLRenderbufferId, WebGLSLVersion, WebGLSender};
use canvas_traits::webgl::{WebGLShaderId, WebGLTextureId, WebGLVersion, WebGLVertexArrayId};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::error::Error;
use crate::dom::bindings::refcounted::{Trusted, TrustedPromise};
@ -50,6 +40,16 @@ use crate::dom::document::PendingRestyle;
use crate::dom::htmlimageelement::SourceSet;
use crate::dom::htmlmediaelement::MediaFrameRenderer;
use crate::task::TaskBox;
use app_units::Au;
use canvas_traits::canvas::{
CanvasGradientStop, CanvasId, LinearGradientStyle, RadialGradientStyle,
};
use canvas_traits::canvas::{CompositionOrBlending, LineCapStyle, LineJoinStyle, RepetitionStyle};
use canvas_traits::webgl::{ActiveAttribInfo, ActiveUniformInfo, TexDataType, TexFormat};
use canvas_traits::webgl::{WebGLBufferId, WebGLChan, WebGLContextShareMode, WebGLError};
use canvas_traits::webgl::{WebGLFramebufferId, WebGLMsgSender, WebGLPipeline, WebGLProgramId};
use canvas_traits::webgl::{WebGLReceiver, WebGLRenderbufferId, WebGLSLVersion, WebGLSender};
use canvas_traits::webgl::{WebGLShaderId, WebGLTextureId, WebGLVersion, WebGLVertexArrayId};
use crossbeam_channel::{Receiver, Sender};
use cssparser::RGBA;
use devtools_traits::{CSSError, TimelineMarkerType, WorkerId};
@ -769,8 +769,10 @@ struct RootedTraceableSet {
set: Vec<*const dyn JSTraceable>,
}
thread_local!(/// TLV Holds a set of JSTraceables that need to be rooted
static ROOTED_TRACEABLES: RefCell<RootedTraceableSet> = RefCell::new(RootedTraceableSet::new()););
thread_local!(
/// TLV Holds a set of JSTraceables that need to be rooted
static ROOTED_TRACEABLES: RefCell<RootedTraceableSet> = RefCell::new(RootedTraceableSet::new());
);
impl RootedTraceableSet {
fn new() -> RootedTraceableSet {

View file

@ -116,12 +116,16 @@ pub fn xml_name_type(name: &str) -> XMLName {
}
fn is_valid_continuation(c: char) -> bool {
is_valid_start(c) || match c {
'-' | '.' | '0'...'9' | '\u{B7}' | '\u{300}'...'\u{36F}' | '\u{203F}'...'\u{2040}' => {
true
},
_ => false,
}
is_valid_start(c) ||
match c {
'-' |
'.' |
'0'...'9' |
'\u{B7}' |
'\u{300}'...'\u{36F}' |
'\u{203F}'...'\u{2040}' => true,
_ => false,
}
}
let mut iter = name.chars();

View file

@ -426,7 +426,7 @@ fn canonicalize_filter(filter: &BluetoothLEScanFilterInit) -> Fallible<Bluetooth
let manufacturer_id = match u16::from_str(key.as_ref()) {
Ok(id) => id,
Err(err) => {
return Err(Type(format!("{} {} {}", KEY_CONVERSION_ERROR, key, err)))
return Err(Type(format!("{} {} {}", KEY_CONVERSION_ERROR, key, err)));
},
};

View file

@ -2,8 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use bluetooth_traits::{BluetoothCharacteristicMsg, BluetoothDescriptorMsg};
use bluetooth_traits::{BluetoothRequest, BluetoothResponse, BluetoothServiceMsg};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::BluetoothDeviceBinding;
use crate::dom::bindings::codegen::Bindings::BluetoothDeviceBinding::BluetoothDeviceMethods;
@ -23,6 +21,8 @@ use crate::dom::bluetoothremotegattservice::BluetoothRemoteGATTService;
use crate::dom::eventtarget::EventTarget;
use crate::dom::globalscope::GlobalScope;
use crate::dom::promise::Promise;
use bluetooth_traits::{BluetoothCharacteristicMsg, BluetoothDescriptorMsg};
use bluetooth_traits::{BluetoothRequest, BluetoothResponse, BluetoothServiceMsg};
use dom_struct::dom_struct;
use ipc_channel::ipc::IpcSender;
use profile_traits::ipc;

View file

@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use bluetooth_traits::{BluetoothRequest, BluetoothResponse};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::BluetoothPermissionResultBinding::{
self, BluetoothPermissionResultMethods,
@ -22,6 +21,7 @@ use crate::dom::bluetoothdevice::BluetoothDevice;
use crate::dom::globalscope::GlobalScope;
use crate::dom::permissionstatus::PermissionStatus;
use crate::dom::promise::Promise;
use bluetooth_traits::{BluetoothRequest, BluetoothResponse};
use dom_struct::dom_struct;
use ipc_channel::ipc::IpcSender;
use std::rc::Rc;

View file

@ -2,8 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use bluetooth_traits::blocklist::{uuid_is_blocklisted, Blocklist};
use bluetooth_traits::{BluetoothRequest, BluetoothResponse, GATTType};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::BluetoothCharacteristicPropertiesBinding::BluetoothCharacteristicPropertiesMethods;
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTCharacteristicBinding;
@ -25,6 +23,8 @@ use crate::dom::bluetoothuuid::{BluetoothDescriptorUUID, BluetoothUUID};
use crate::dom::eventtarget::EventTarget;
use crate::dom::globalscope::GlobalScope;
use crate::dom::promise::Promise;
use bluetooth_traits::blocklist::{uuid_is_blocklisted, Blocklist};
use bluetooth_traits::{BluetoothRequest, BluetoothResponse, GATTType};
use dom_struct::dom_struct;
use ipc_channel::ipc::IpcSender;
use std::rc::Rc;

View file

@ -2,8 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use bluetooth_traits::blocklist::{uuid_is_blocklisted, Blocklist};
use bluetooth_traits::{BluetoothRequest, BluetoothResponse};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTCharacteristicBinding::BluetoothRemoteGATTCharacteristicMethods;
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTDescriptorBinding;
@ -21,6 +19,8 @@ use crate::dom::bluetoothremotegattcharacteristic::{
};
use crate::dom::globalscope::GlobalScope;
use crate::dom::promise::Promise;
use bluetooth_traits::blocklist::{uuid_is_blocklisted, Blocklist};
use bluetooth_traits::{BluetoothRequest, BluetoothResponse};
use dom_struct::dom_struct;
use ipc_channel::ipc::IpcSender;
use std::rc::Rc;

View file

@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use bluetooth_traits::{BluetoothRequest, BluetoothResponse, GATTType};
use crate::dom::bindings::codegen::Bindings::BluetoothDeviceBinding::BluetoothDeviceMethods;
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding;
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods;
@ -15,6 +14,7 @@ use crate::dom::bluetoothdevice::BluetoothDevice;
use crate::dom::bluetoothuuid::{BluetoothServiceUUID, BluetoothUUID};
use crate::dom::globalscope::GlobalScope;
use crate::dom::promise::Promise;
use bluetooth_traits::{BluetoothRequest, BluetoothResponse, GATTType};
use dom_struct::dom_struct;
use ipc_channel::ipc::IpcSender;
use std::cell::Cell;

View file

@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use bluetooth_traits::{BluetoothResponse, GATTType};
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods;
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding;
use crate::dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods;
@ -16,6 +15,7 @@ use crate::dom::bluetoothuuid::{BluetoothCharacteristicUUID, BluetoothServiceUUI
use crate::dom::eventtarget::EventTarget;
use crate::dom::globalscope::GlobalScope;
use crate::dom::promise::Promise;
use bluetooth_traits::{BluetoothResponse, GATTType};
use dom_struct::dom_struct;
use std::rc::Rc;

View file

@ -2,9 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use canvas_traits::canvas::{
CanvasGradientStop, FillOrStrokeStyle, LinearGradientStyle, RadialGradientStyle,
};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::CanvasGradientBinding;
use crate::dom::bindings::codegen::Bindings::CanvasGradientBinding::CanvasGradientMethods;
@ -14,6 +11,9 @@ use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::globalscope::GlobalScope;
use canvas_traits::canvas::{
CanvasGradientStop, FillOrStrokeStyle, LinearGradientStyle, RadialGradientStyle,
};
use cssparser::Color as CSSColor;
use cssparser::{Parser, ParserInput, RGBA};
use dom_struct::dom_struct;

View file

@ -2,12 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use canvas_traits::canvas::{FillOrStrokeStyle, RepetitionStyle, SurfaceStyle};
use crate::dom::bindings::codegen::Bindings::CanvasPatternBinding;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::canvasgradient::ToFillOrStrokeStyle;
use crate::dom::globalscope::GlobalScope;
use canvas_traits::canvas::{FillOrStrokeStyle, RepetitionStyle, SurfaceStyle};
use dom_struct::dom_struct;
use euclid::Size2D;

View file

@ -2,10 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use canvas_traits::canvas::{Canvas2dMsg, CanvasId, CanvasMsg};
use canvas_traits::canvas::{CompositionOrBlending, FillOrStrokeStyle, FillRule};
use canvas_traits::canvas::{LineCapStyle, LineJoinStyle, LinearGradientStyle};
use canvas_traits::canvas::{RadialGradientStyle, RepetitionStyle};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding;
use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasFillRule;
@ -29,6 +25,10 @@ use crate::dom::htmlcanvaselement::{CanvasContext, HTMLCanvasElement};
use crate::dom::imagedata::ImageData;
use crate::dom::node::{window_from_node, Node, NodeDamage};
use crate::unpremultiplytable::UNPREMULTIPLY_TABLE;
use canvas_traits::canvas::{Canvas2dMsg, CanvasId, CanvasMsg};
use canvas_traits::canvas::{CompositionOrBlending, FillOrStrokeStyle, FillRule};
use canvas_traits::canvas::{LineCapStyle, LineJoinStyle, LinearGradientStyle};
use canvas_traits::canvas::{RadialGradientStyle, RepetitionStyle};
use cssparser::Color as CSSColor;
use cssparser::{Parser, ParserInput, RGBA};
use dom_struct::dom_struct;

View file

@ -522,7 +522,7 @@ impl CustomElementDefinition {
Ok(ConversionResult::Failure(..)) => {
return Err(Error::Type(
"Constructor did not return a DOM node".to_owned(),
))
));
},
_ => return Err(Error::JSFailed),
};

View file

@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use cookie::Cookie;
use crate::document_loader::{DocumentLoader, LoadType};
use crate::dom::activation::{synthetic_click_activation, ActivationSource};
use crate::dom::attr::Attr;
@ -104,6 +103,7 @@ use crate::script_thread::{MainThreadScriptMsg, ScriptThread};
use crate::task::TaskBox;
use crate::task_source::{TaskSource, TaskSourceName};
use crate::timers::OneshotTimerCallback;
use cookie::Cookie;
use devtools_traits::ScriptToDevtoolsControlMsg;
use dom_struct::dom_struct;
use embedder_traits::EmbedderMsg;
@ -542,30 +542,30 @@ impl Document {
.dom_manipulation_task_source()
.queue(
task!(fire_pageshow_event: move || {
let document = document.root();
let window = document.window();
// Step 4.6.1
if document.page_showing.get() {
return;
}
// Step 4.6.2
document.page_showing.set(true);
// Step 4.6.4
let event = PageTransitionEvent::new(
window,
atom!("pageshow"),
false, // bubbles
false, // cancelable
true, // persisted
);
let event = event.upcast::<Event>();
event.set_trusted(true);
// FIXME(nox): Why are errors silenced here?
let _ = window.upcast::<EventTarget>().dispatch_event_with_target(
document.upcast(),
&event,
);
}),
let document = document.root();
let window = document.window();
// Step 4.6.1
if document.page_showing.get() {
return;
}
// Step 4.6.2
document.page_showing.set(true);
// Step 4.6.4
let event = PageTransitionEvent::new(
window,
atom!("pageshow"),
false, // bubbles
false, // cancelable
true, // persisted
);
let event = event.upcast::<Event>();
event.set_trusted(true);
// FIXME(nox): Why are errors silenced here?
let _ = window.upcast::<EventTarget>().dispatch_event_with_target(
document.upcast(),
&event,
);
}),
self.window.upcast(),
)
.unwrap();
@ -615,11 +615,12 @@ impl Document {
// FIXME: This should check the dirty bit on the document,
// not the document element. Needs some layout changes to make
// that workable.
self.stylesheets.borrow().has_changed() || self.GetDocumentElement().map_or(false, |root| {
root.upcast::<Node>().has_dirty_descendants() ||
!self.pending_restyles.borrow().is_empty() ||
self.needs_paint()
})
self.stylesheets.borrow().has_changed() ||
self.GetDocumentElement().map_or(false, |root| {
root.upcast::<Node>().has_dirty_descendants() ||
!self.pending_restyles.borrow().is_empty() ||
self.needs_paint()
})
}
/// Returns the first `base` element in the DOM that has an `href` attribute.
@ -1940,46 +1941,46 @@ impl Document {
.dom_manipulation_task_source()
.queue(
task!(fire_load_event: move || {
let document = document.root();
let window = document.window();
if !window.is_alive() {
return;
}
let document = document.root();
let window = document.window();
if !window.is_alive() {
return;
}
// Step 7.1.
document.set_ready_state(DocumentReadyState::Complete);
// Step 7.1.
document.set_ready_state(DocumentReadyState::Complete);
// Step 7.2.
if document.browsing_context().is_none() {
return;
}
let event = Event::new(
window.upcast(),
atom!("load"),
EventBubbles::DoesNotBubble,
EventCancelable::NotCancelable,
);
event.set_trusted(true);
// Step 7.2.
if document.browsing_context().is_none() {
return;
}
let event = Event::new(
window.upcast(),
atom!("load"),
EventBubbles::DoesNotBubble,
EventCancelable::NotCancelable,
);
event.set_trusted(true);
// http://w3c.github.io/navigation-timing/#widl-PerformanceNavigationTiming-loadEventStart
update_with_current_time_ms(&document.load_event_start);
// http://w3c.github.io/navigation-timing/#widl-PerformanceNavigationTiming-loadEventStart
update_with_current_time_ms(&document.load_event_start);
debug!("About to dispatch load for {:?}", document.url());
// FIXME(nox): Why are errors silenced here?
let _ = window.upcast::<EventTarget>().dispatch_event_with_target(
document.upcast(),
&event,
);
debug!("About to dispatch load for {:?}", document.url());
// FIXME(nox): Why are errors silenced here?
let _ = window.upcast::<EventTarget>().dispatch_event_with_target(
document.upcast(),
&event,
);
// http://w3c.github.io/navigation-timing/#widl-PerformanceNavigationTiming-loadEventEnd
update_with_current_time_ms(&document.load_event_end);
// http://w3c.github.io/navigation-timing/#widl-PerformanceNavigationTiming-loadEventEnd
update_with_current_time_ms(&document.load_event_end);
window.reflow(ReflowGoal::Full, ReflowReason::DocumentLoaded);
window.reflow(ReflowGoal::Full, ReflowReason::DocumentLoaded);
if let Some(fragment) = document.url().fragment() {
document.check_and_scroll_fragment(fragment);
}
}),
if let Some(fragment) = document.url().fragment() {
document.check_and_scroll_fragment(fragment);
}
}),
self.window.upcast(),
)
.unwrap();
@ -1992,30 +1993,30 @@ impl Document {
.dom_manipulation_task_source()
.queue(
task!(fire_pageshow_event: move || {
let document = document.root();
let window = document.window();
if document.page_showing.get() || !window.is_alive() {
return;
}
let document = document.root();
let window = document.window();
if document.page_showing.get() || !window.is_alive() {
return;
}
document.page_showing.set(true);
document.page_showing.set(true);
let event = PageTransitionEvent::new(
window,
atom!("pageshow"),
false, // bubbles
false, // cancelable
false, // persisted
);
let event = event.upcast::<Event>();
event.set_trusted(true);
let event = PageTransitionEvent::new(
window,
atom!("pageshow"),
false, // bubbles
false, // cancelable
false, // persisted
);
let event = event.upcast::<Event>();
event.set_trusted(true);
// FIXME(nox): Why are errors silenced here?
let _ = window.upcast::<EventTarget>().dispatch_event_with_target(
document.upcast(),
&event,
);
}),
// FIXME(nox): Why are errors silenced here?
let _ = window.upcast::<EventTarget>().dispatch_event_with_target(
document.upcast(),
&event,
);
}),
self.window.upcast(),
)
.unwrap();
@ -2040,12 +2041,12 @@ impl Document {
.dom_manipulation_task_source()
.queue(
task!(completely_loaded: move || {
let document = document.root();
document.completely_loaded.set(true);
// Note: this will, among others, result in the "iframe-load-event-steps" being run.
// https://html.spec.whatwg.org/multipage/#iframe-load-event-steps
document.notify_constellation_load();
}),
let document = document.root();
document.completely_loaded.set(true);
// Note: this will, among others, result in the "iframe-load-event-steps" being run.
// https://html.spec.whatwg.org/multipage/#iframe-load-event-steps
document.notify_constellation_load();
}),
self.window.upcast(),
)
.unwrap();

View file

@ -1532,11 +1532,9 @@ impl Element {
pub fn get_int_attribute(&self, local_name: &LocalName, default: i32) -> i32 {
// TODO: Is this assert necessary?
assert!(
local_name
.chars()
.all(|ch| !ch.is_ascii() || ch.to_ascii_lowercase() == ch)
);
assert!(local_name
.chars()
.all(|ch| !ch.is_ascii() || ch.to_ascii_lowercase() == ch));
let attribute = self.get_attribute(&ns!(), local_name);
match attribute {
@ -1557,11 +1555,9 @@ impl Element {
}
pub fn get_uint_attribute(&self, local_name: &LocalName, default: u32) -> u32 {
assert!(
local_name
.chars()
.all(|ch| !ch.is_ascii() || ch.to_ascii_lowercase() == ch)
);
assert!(local_name
.chars()
.all(|ch| !ch.is_ascii() || ch.to_ascii_lowercase() == ch));
let attribute = self.get_attribute(&ns!(), local_name);
match attribute {
Some(ref attribute) => match *attribute.value() {
@ -2840,10 +2836,11 @@ impl<'a> SelectorsElement for DomRoot<Element> {
fn is_empty(&self) -> bool {
self.node.children().all(|node| {
!node.is::<Element>() && match node.downcast::<Text>() {
None => true,
Some(text) => text.upcast::<CharacterData>().data().is_empty(),
}
!node.is::<Element>() &&
match node.downcast::<Text>() {
None => true,
Some(text) => text.upcast::<CharacterData>().data().is_empty(),
}
})
}

View file

@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use base64;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::BlobBinding::BlobMethods;
use crate::dom::bindings::codegen::Bindings::FileReaderBinding::{
@ -25,6 +24,7 @@ use crate::dom::progressevent::ProgressEvent;
use crate::task::TaskCanceller;
use crate::task_source::file_reading::{FileReadingTask, FileReadingTaskSource};
use crate::task_source::{TaskSource, TaskSourceName};
use base64;
use dom_struct::dom_struct;
use encoding_rs::{Encoding, UTF_8};
use js::jsapi::Heap;

View file

@ -97,14 +97,12 @@ impl FileReaderSyncMethods for FileReaderSync {
// step 2
rooted!(in(cx) let mut array_buffer = ptr::null_mut::<JSObject>());
assert!(
ArrayBuffer::create(
cx,
CreateWith::Slice(&blob_contents),
array_buffer.handle_mut()
)
.is_ok()
);
assert!(ArrayBuffer::create(
cx,
CreateWith::Slice(&blob_contents),
array_buffer.handle_mut()
)
.is_ok());
Ok(NonNull::new_unchecked(array_buffer.get()))
}

View file

@ -367,9 +367,10 @@ pub fn is_forbidden_header_name(name: &str) -> bool {
let disallowed_header_prefixes = ["sec-", "proxy-"];
disallowed_headers.iter().any(|header| *header == name) || disallowed_header_prefixes
.iter()
.any(|prefix| name.starts_with(prefix))
disallowed_headers.iter().any(|header| *header == name) ||
disallowed_header_prefixes
.iter()
.any(|prefix| name.starts_with(prefix))
}
// There is some unresolved confusion over the definition of a name and a value.

View file

@ -413,8 +413,8 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
Some(ref url)
if url.host().is_none() || url.cannot_be_a_base() || url.scheme() == "file" =>
{
return
},
return;
}
None => return,
// Step 4.
Some(url) => {

View file

@ -61,9 +61,10 @@ impl HTMLBodyElement {
let self_node = self.upcast::<Node>();
let root_elem = self.upcast::<Element>().root_element();
let root_node = root_elem.upcast::<Node>();
root_node.is_parent_of(self_node) && self_node
.preceding_siblings()
.all(|n| !n.is::<HTMLBodyElement>())
root_node.is_parent_of(self_node) &&
self_node
.preceding_siblings()
.all(|n| !n.is::<HTMLBodyElement>())
}
}

View file

@ -2,9 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use base64;
use canvas_traits::canvas::{CanvasId, CanvasMsg, FromScriptMsg};
use canvas_traits::webgl::WebGLVersion;
use crate::dom::attr::Attr;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::HTMLCanvasElementBinding;
@ -31,6 +28,9 @@ use crate::dom::webgl2renderingcontext::WebGL2RenderingContext;
use crate::dom::webglrenderingcontext::{
LayoutCanvasWebGLRenderingContextHelpers, WebGLRenderingContext,
};
use base64;
use canvas_traits::canvas::{CanvasId, CanvasMsg, FromScriptMsg};
use canvas_traits::webgl::WebGLVersion;
use dom_struct::dom_struct;
use euclid::{Rect, Size2D};
use html5ever::{LocalName, Prefix};

View file

@ -628,20 +628,20 @@ impl VirtualMethods for HTMLIFrameElement {
let iframe = Trusted::new(self);
document_from_node(self).add_delayed_task(task!(IFrameDelayedInitialize: move || {
let this = iframe.root();
// https://html.spec.whatwg.org/multipage/#the-iframe-element
// "When an iframe element is inserted into a document that has
// a browsing context, the user agent must create a new
// browsing context, set the element's nested browsing context
// to the newly-created browsing context, and then process the
// iframe attributes for the "first time"."
if this.upcast::<Node>().is_in_doc_with_browsing_context() {
debug!("iframe bound to browsing context.");
debug_assert!(tree_in_doc, "is_in_doc_with_bc, but not tree_in_doc");
this.create_nested_browsing_context();
this.process_the_iframe_attributes(ProcessingMode::FirstTime);
}
}));
let this = iframe.root();
// https://html.spec.whatwg.org/multipage/#the-iframe-element
// "When an iframe element is inserted into a document that has
// a browsing context, the user agent must create a new
// browsing context, set the element's nested browsing context
// to the newly-created browsing context, and then process the
// iframe attributes for the "first time"."
if this.upcast::<Node>().is_in_doc_with_browsing_context() {
debug!("iframe bound to browsing context.");
debug_assert!(tree_in_doc, "is_in_doc_with_bc, but not tree_in_doc");
this.create_nested_browsing_context();
this.process_the_iframe_attributes(ProcessingMode::FirstTime);
}
}));
}
fn unbind_from_tree(&self, context: &UnbindContext) {

View file

@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use app_units::{Au, AU_PER_PX};
use crate::document_loader::{LoadBlocker, LoadType};
use crate::dom::activation::Activatable;
use crate::dom::attr::Attr;
@ -43,6 +42,7 @@ use crate::microtask::{Microtask, MicrotaskRunnable};
use crate::network_listener::{self, NetworkListener, PreInvoke, ResourceTimingListener};
use crate::script_thread::ScriptThread;
use crate::task_source::TaskSource;
use app_units::{Au, AU_PER_PX};
use cssparser::{Parser, ParserInput};
use dom_struct::dom_struct;
@ -286,12 +286,12 @@ impl HTMLImageElement {
// FIXME(nox): Why are errors silenced here?
let _ = task_source.queue_with_canceller(
task!(process_image_response: move || {
let element = element.root();
// Ignore any image response for a previous request that has been discarded.
if generation == element.generation.get() {
element.process_image_response(image);
}
}),
let element = element.root();
// Ignore any image response for a previous request that has been discarded.
if generation == element.generation.get() {
element.process_image_response(image);
}
}),
&canceller,
);
}),

View file

@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use caseless::compatibility_caseless_match_str;
use crate::dom::activation::{synthetic_click_activation, Activatable, ActivationSource};
use crate::dom::attr::Attr;
use crate::dom::bindings::cell::DomRefCell;
@ -47,6 +46,7 @@ use crate::textinput::KeyReaction::{
};
use crate::textinput::Lines::Single;
use crate::textinput::{Direction, SelectionDirection, TextInput};
use caseless::compatibility_caseless_match_str;
use dom_struct::dom_struct;
use embedder_traits::FilterPattern;
use html5ever::{LocalName, Prefix};
@ -946,7 +946,7 @@ impl HTMLInputElement {
match self.input_type() {
// Step 3.1: it's a button but it is not submitter.
InputType::Submit | InputType::Button | InputType::Reset if !is_submitter => {
return vec![]
return vec![];
},
// Step 3.1: it's the "Checkbox" or "Radio Button" and whose checkedness is false.
@ -1769,21 +1769,22 @@ impl Activatable for HTMLInputElement {
.unwrap()
.filter_map(DomRoot::downcast::<HTMLInputElement>)
.filter(|input| {
input.form_owner() == owner && match input.input_type() {
InputType::Text |
InputType::Search |
InputType::Url |
InputType::Tel |
InputType::Email |
InputType::Password |
InputType::Date |
InputType::Month |
InputType::Week |
InputType::Time |
InputType::DatetimeLocal |
InputType::Number => true,
_ => false,
}
input.form_owner() == owner &&
match input.input_type() {
InputType::Text |
InputType::Search |
InputType::Url |
InputType::Tel |
InputType::Email |
InputType::Password |
InputType::Date |
InputType::Month |
InputType::Week |
InputType::Time |
InputType::DatetimeLocal |
InputType::Number => true,
_ => false,
}
});
if inputs.skip(1).next().is_some() {

View file

@ -367,15 +367,15 @@ impl HTMLMediaElement {
task_source
.queue(
task!(resolve_pending_play_promises: move || {
let this = this.root();
if generation_id != this.generation_id.get() {
return;
}
let this = this.root();
if generation_id != this.generation_id.get() {
return;
}
this.fulfill_in_flight_play_promises(|| {
this.play_media();
});
}),
this.fulfill_in_flight_play_promises(|| {
this.play_media();
});
}),
window.upcast(),
)
.unwrap();
@ -820,8 +820,8 @@ impl HTMLMediaElement {
.media_element_task_source()
.queue(
task!(set_media_delay_load_event_flag_to_false: move || {
this.root().delay_load_event(false);
}),
this.root().delay_load_event(false);
}),
window.upcast(),
)
.unwrap();

View file

@ -779,8 +779,8 @@ impl VirtualMethods for HTMLScriptElement {
if tree_in_doc && !self.parser_inserted.get() {
let script = Trusted::new(self);
document_from_node(self).add_delayed_task(task!(ScriptDelayedInitialize: move || {
script.root().prepare();
}));
script.root().prepare();
}));
}
}
@ -822,9 +822,9 @@ impl HTMLScriptElementMethods for HTMLScriptElement {
// https://html.spec.whatwg.org/multipage/#dom-script-async
fn Async(&self) -> bool {
self.non_blocking.get() || self
.upcast::<Element>()
.has_attribute(&local_name!("async"))
self.non_blocking.get() ||
self.upcast::<Element>()
.has_attribute(&local_name!("async"))
}
// https://html.spec.whatwg.org/multipage/#dom-script-async

View file

@ -44,10 +44,10 @@ struct TableRowFilter {
impl CollectionFilter for TableRowFilter {
fn filter(&self, elem: &Element, root: &Node) -> bool {
elem.is::<HTMLTableRowElement>() &&
(root.is_parent_of(elem.upcast()) || self
.sections
.iter()
.any(|ref section| section.is_parent_of(elem.upcast())))
(root.is_parent_of(elem.upcast()) ||
self.sections
.iter()
.any(|ref section| section.is_parent_of(elem.upcast())))
}
}
@ -327,7 +327,8 @@ impl HTMLTableElementMethods for HTMLTableElement {
.filter_map(DomRoot::downcast::<Element>)
.find(|n| {
n.is::<HTMLTableSectionElement>() && n.local_name() == &local_name!("tbody")
}) {
})
{
last_tbody
.upcast::<Node>()
.AppendChild(new_row.upcast::<Node>())

View file

@ -4,7 +4,6 @@
//! The core DOM types. Defines the basic DOM hierarchy as well as all the HTML elements.
use app_units::Au;
use crate::document_loader::DocumentLoader;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::CharacterDataBinding::CharacterDataMethods;
@ -55,6 +54,7 @@ use crate::dom::text::Text;
use crate::dom::virtualmethods::{vtable_for, VirtualMethods};
use crate::dom::window::Window;
use crate::script_thread::ScriptThread;
use app_units::Au;
use devtools_traits::NodeInfo;
use dom_struct::dom_struct;
use euclid::{Point2D, Rect, Size2D, Vector2D};
@ -1850,10 +1850,9 @@ impl Node {
// https://dom.spec.whatwg.org/#concept-node-remove
fn remove(node: &Node, parent: &Node, suppress_observers: SuppressObserver) {
parent.owner_doc().add_script_and_layout_blocker();
assert!(
node.GetParentNode()
.map_or(false, |node_parent| &*node_parent == parent)
);
assert!(node
.GetParentNode()
.map_or(false, |node_parent| &*node_parent == parent));
let cached_index = {
if parent.ranges.is_empty() {
None
@ -2242,10 +2241,10 @@ impl NodeMethods for Node {
// Step 4-5.
match node.type_id() {
NodeTypeId::CharacterData(CharacterDataTypeId::Text) if self.is::<Document>() => {
return Err(Error::HierarchyRequest)
return Err(Error::HierarchyRequest);
},
NodeTypeId::DocumentType if !self.is::<Document>() => {
return Err(Error::HierarchyRequest)
return Err(Error::HierarchyRequest);
},
NodeTypeId::Document(_) => return Err(Error::HierarchyRequest),
_ => (),
@ -2462,14 +2461,14 @@ impl NodeMethods for Node {
NodeTypeId::CharacterData(CharacterDataTypeId::ProcessingInstruction)
if !is_equal_processinginstruction(this, node) =>
{
return false
},
return false;
}
NodeTypeId::CharacterData(CharacterDataTypeId::Text) |
NodeTypeId::CharacterData(CharacterDataTypeId::Comment)
if !is_equal_characterdata(this, node) =>
{
return false
},
return false;
}
// Step 4.
NodeTypeId::Element(..) if !is_equal_element_attrs(this, node) => return false,
_ => (),

View file

@ -2,9 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use canvas_traits::canvas::CanvasImageData;
use canvas_traits::canvas::CanvasMsg;
use canvas_traits::canvas::FromLayoutMsg;
use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasFillRule;
use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasImageSource;
use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasLineCap;
@ -25,6 +22,9 @@ use crate::dom::canvaspattern::CanvasPattern;
use crate::dom::canvasrenderingcontext2d::CanvasRenderingContext2D;
use crate::dom::paintworkletglobalscope::PaintWorkletGlobalScope;
use crate::dom::workletglobalscope::WorkletGlobalScope;
use canvas_traits::canvas::CanvasImageData;
use canvas_traits::canvas::CanvasMsg;
use canvas_traits::canvas::FromLayoutMsg;
use dom_struct::dom_struct;
use euclid::Size2D;
use euclid::TypedScale;

View file

@ -72,9 +72,10 @@ impl PerformanceEntryList {
.entries
.iter()
.filter(|e| {
name.as_ref().map_or(true, |name_| *e.name() == *name_) && entry_type
.as_ref()
.map_or(true, |type_| *e.entry_type() == *type_)
name.as_ref().map_or(true, |name_| *e.name() == *name_) &&
entry_type
.as_ref()
.map_or(true, |type_| *e.entry_type() == *type_)
})
.map(|e| e.clone())
.collect::<Vec<DomRoot<PerformanceEntry>>>();
@ -92,9 +93,10 @@ impl PerformanceEntryList {
entry_type: Option<DOMString>,
) {
self.entries.retain(|e| {
name.as_ref().map_or(true, |name_| *e.name() == *name_) && entry_type
.as_ref()
.map_or(true, |type_| *e.entry_type() == *type_)
name.as_ref().map_or(true, |name_| *e.name() == *name_) &&
entry_type
.as_ref()
.map_or(true, |type_| *e.entry_type() == *type_)
});
}

View file

@ -76,7 +76,7 @@ impl PromiseRejectionEvent {
None => {
return Err(Error::Type(
"required member promise is undefined.".to_string(),
))
));
},
};
let bubbles = EventBubbles::from(init.parent.bubbles);

View file

@ -758,11 +758,12 @@ impl RangeMethods for Range {
let new_offset = reference_node.r().map_or(parent.len(), |node| node.index());
// Step 11
let new_offset = new_offset + if node.type_id() == NodeTypeId::DocumentFragment {
node.len()
} else {
1
};
let new_offset = new_offset +
if node.type_id() == NodeTypeId::DocumentFragment {
node.len()
} else {
1
};
// Step 12.
Node::pre_insert(node, &parent, reference_node.r())?;
@ -874,7 +875,7 @@ impl RangeMethods for Range {
// Step 2.
match new_parent.type_id() {
NodeTypeId::Document(_) | NodeTypeId::DocumentType | NodeTypeId::DocumentFragment => {
return Err(Error::InvalidNodeType)
return Err(Error::InvalidNodeType);
},
_ => (),
}

View file

@ -379,12 +379,12 @@ impl Request {
HttpMethod::GET => {
return Err(Error::Type(
"Init's body is non-null, and request method is GET".to_string(),
))
));
},
HttpMethod::HEAD => {
return Err(Error::Type(
"Init's body is non-null, and request method is HEAD".to_string(),
))
));
},
_ => {},
}

View file

@ -213,21 +213,21 @@ impl Storage {
.dom_manipulation_task_source()
.queue(
task!(send_storage_notification: move || {
let this = this.root();
let global = this.global();
let event = StorageEvent::new(
global.as_window(),
atom!("storage"),
EventBubbles::DoesNotBubble,
EventCancelable::NotCancelable,
key.map(DOMString::from),
old_value.map(DOMString::from),
new_value.map(DOMString::from),
DOMString::from(url.into_string()),
Some(&this),
);
event.upcast::<Event>().fire(global.upcast());
}),
let this = this.root();
let global = this.global();
let event = StorageEvent::new(
global.as_window(),
atom!("storage"),
EventBubbles::DoesNotBubble,
EventCancelable::NotCancelable,
key.map(DOMString::from),
old_value.map(DOMString::from),
new_value.map(DOMString::from),
DOMString::from(url.into_string()),
Some(&this),
);
event.upcast::<Event>().fire(global.upcast());
}),
global.upcast(),
)
.unwrap();

View file

@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use bluetooth_traits::BluetoothRequest;
use crate::dom::bindings::codegen::Bindings::TestRunnerBinding;
use crate::dom::bindings::codegen::Bindings::TestRunnerBinding::TestRunnerMethods;
use crate::dom::bindings::error::{Error, ErrorResult};
@ -10,6 +9,7 @@ use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::globalscope::GlobalScope;
use bluetooth_traits::BluetoothRequest;
use dom_struct::dom_struct;
use ipc_channel::ipc::IpcSender;
use profile_traits::ipc;

View file

@ -189,8 +189,8 @@ impl TreeWalkerMethods for TreeWalker {
// This can happen if the user set the current node to somewhere
// outside of the tree rooted at the original root.
{
return Ok(None)
},
return Ok(None);
}
Some(n) => node = n,
}
// "5. Filter node and if the return value is FILTER_ACCEPT, then
@ -321,8 +321,8 @@ impl TreeWalker {
Some(ref parent)
if self.is_root_node(&parent) || self.is_current_node(&parent) =>
{
return Ok(None)
},
return Ok(None);
}
// "5. Otherwise, set node to parent."
Some(parent) => node = parent,
}

View file

@ -27,7 +27,7 @@ pub enum ValidityStatus {
Valid,
}
bitflags!{
bitflags! {
pub struct ValidationFlags: u32 {
const VALUE_MISSING = 0b0000000001;
const TYPE_MISMATCH = 0b0000000010;

View file

@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use canvas_traits::webgl::{webgl_channel, WebGLReceiver, WebVRCommand};
use crate::dom::bindings::callback::ExceptionHandling;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::PerformanceBinding::PerformanceBinding::PerformanceMethods;
@ -33,6 +32,7 @@ use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use crate::script_runtime::CommonScriptMsg;
use crate::script_runtime::ScriptThreadEventCategory::WebVREvent;
use crate::task_source::TaskSourceName;
use canvas_traits::webgl::{webgl_channel, WebGLReceiver, WebVRCommand};
use crossbeam_channel::{unbounded, Sender};
use dom_struct::dom_struct;
use ipc_channel::ipc::IpcSender;
@ -551,8 +551,8 @@ impl VRDisplay {
let this = address.clone();
let sender = raf_sender.clone();
let task = Box::new(task!(handle_vrdisplay_raf: move || {
this.root().handle_raf(&sender);
}));
this.root().handle_raf(&sender);
}));
// NOTE: WebVR spec doesn't specify what task source we should use. Is
// dom-manipulation a good choice long term?
js_sender

View file

@ -2,8 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/// https://www.khronos.org/registry/webgl/specs/latest/2.0/webgl.idl
use canvas_traits::webgl::WebGLVersion;
use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding;
use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextMethods;
use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLContextAttributes;
@ -31,6 +29,8 @@ use crate::dom::webglshaderprecisionformat::WebGLShaderPrecisionFormat;
use crate::dom::webgltexture::WebGLTexture;
use crate::dom::webgluniformlocation::WebGLUniformLocation;
use crate::dom::window::Window;
/// https://www.khronos.org/registry/webgl/specs/latest/2.0/webgl.idl
use canvas_traits::webgl::WebGLVersion;
use dom_struct::dom_struct;
use euclid::Size2D;
use js::jsapi::{JSContext, JSObject};

View file

@ -3,13 +3,13 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
use canvas_traits::webgl::WebGLVersion;
use crate::dom::bindings::codegen::Bindings::ANGLEInstancedArraysBinding;
use crate::dom::bindings::codegen::Bindings::ANGLEInstancedArraysBinding::ANGLEInstancedArraysConstants;
use crate::dom::bindings::codegen::Bindings::ANGLEInstancedArraysBinding::ANGLEInstancedArraysMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use canvas_traits::webgl::WebGLVersion;
use dom_struct::dom_struct;
#[dom_struct]

View file

@ -3,11 +3,11 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
use canvas_traits::webgl::WebGLVersion;
use crate::dom::bindings::codegen::Bindings::EXTBlendMinmaxBinding;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use canvas_traits::webgl::WebGLVersion;
use dom_struct::dom_struct;
#[dom_struct]

View file

@ -3,12 +3,12 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
use canvas_traits::webgl::WebGLVersion;
use crate::dom::bindings::codegen::Bindings::EXTColorBufferHalfFloatBinding;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webgl_extensions::ext::oestexturehalffloat::OESTextureHalfFloat;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use canvas_traits::webgl::WebGLVersion;
use dom_struct::dom_struct;
#[dom_struct]

View file

@ -3,11 +3,11 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
use canvas_traits::webgl::{is_gles, WebGLVersion};
use crate::dom::bindings::codegen::Bindings::EXTShaderTextureLodBinding;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use canvas_traits::webgl::{is_gles, WebGLVersion};
use dom_struct::dom_struct;
#[dom_struct]

View file

@ -3,12 +3,12 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
use canvas_traits::webgl::WebGLVersion;
use crate::dom::bindings::codegen::Bindings::EXTTextureFilterAnisotropicBinding;
use crate::dom::bindings::codegen::Bindings::EXTTextureFilterAnisotropicBinding::EXTTextureFilterAnisotropicConstants;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use canvas_traits::webgl::WebGLVersion;
use dom_struct::dom_struct;
#[dom_struct]

View file

@ -3,11 +3,11 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
use canvas_traits::webgl::{is_gles, WebGLVersion};
use crate::dom::bindings::codegen::Bindings::OESElementIndexUintBinding;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use canvas_traits::webgl::{is_gles, WebGLVersion};
use dom_struct::dom_struct;
#[dom_struct]

View file

@ -3,12 +3,12 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
use canvas_traits::webgl::{is_gles, WebGLVersion};
use crate::dom::bindings::codegen::Bindings::OESStandardDerivativesBinding;
use crate::dom::bindings::codegen::Bindings::OESStandardDerivativesBinding::OESStandardDerivativesConstants;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use canvas_traits::webgl::{is_gles, WebGLVersion};
use dom_struct::dom_struct;
#[dom_struct]

View file

@ -5,11 +5,11 @@
use super::{
constants as webgl, ext_constants as gl, WebGLExtension, WebGLExtensionSpec, WebGLExtensions,
};
use canvas_traits::webgl::WebGLVersion;
use crate::dom::bindings::codegen::Bindings::OESTextureFloatBinding;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use canvas_traits::webgl::WebGLVersion;
use dom_struct::dom_struct;
#[dom_struct]

View file

@ -5,13 +5,13 @@
use super::{
constants as webgl, ext_constants as gl, WebGLExtension, WebGLExtensionSpec, WebGLExtensions,
};
use canvas_traits::webgl::WebGLVersion;
use crate::dom::bindings::codegen::Bindings::OESTextureHalfFloatBinding::{
self, OESTextureHalfFloatConstants,
};
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use canvas_traits::webgl::WebGLVersion;
use dom_struct::dom_struct;
#[dom_struct]

View file

@ -3,7 +3,6 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
use canvas_traits::webgl::WebGLVersion;
use crate::dom::bindings::codegen::Bindings::OESVertexArrayObjectBinding::OESVertexArrayObjectConstants;
use crate::dom::bindings::codegen::Bindings::OESVertexArrayObjectBinding::{
self, OESVertexArrayObjectMethods,
@ -12,6 +11,7 @@ use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use crate::dom::webglvertexarrayobjectoes::WebGLVertexArrayObjectOES;
use canvas_traits::webgl::WebGLVersion;
use dom_struct::dom_struct;
#[dom_struct]

View file

@ -3,12 +3,12 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
use canvas_traits::webgl::WebGLVersion;
use crate::dom::bindings::codegen::Bindings::WEBGLColorBufferFloatBinding;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webgl_extensions::ext::oestexturefloat::OESTextureFloat;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use canvas_traits::webgl::WebGLVersion;
use dom_struct::dom_struct;
#[dom_struct]

View file

@ -3,11 +3,11 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use super::WebGLExtensions;
use canvas_traits::webgl::WebGLVersion;
use crate::dom::bindings::reflector::DomObject;
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::trace::JSTraceable;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use canvas_traits::webgl::WebGLVersion;
/// Trait implemented by WebGL extensions.
pub trait WebGLExtension: Sized

View file

@ -4,7 +4,6 @@
use super::wrapper::{TypedWebGLExtensionWrapper, WebGLExtensionWrapper};
use super::{ext, WebGLExtension, WebGLExtensionSpec};
use canvas_traits::webgl::WebGLVersion;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::ANGLEInstancedArraysBinding::ANGLEInstancedArraysConstants;
use crate::dom::bindings::codegen::Bindings::EXTTextureFilterAnisotropicBinding::EXTTextureFilterAnisotropicConstants;
@ -18,6 +17,7 @@ use crate::dom::oestexturefloat::OESTextureFloat;
use crate::dom::oestexturehalffloat::OESTextureHalfFloat;
use crate::dom::webglcolorbufferfloat::WEBGLColorBufferFloat;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use canvas_traits::webgl::WebGLVersion;
use fnv::{FnvHashMap, FnvHashSet};
use gleam::gl::{self, GLenum};
use js::jsapi::JSObject;

View file

@ -4,10 +4,10 @@
use super::types::TexImageTarget;
use super::WebGLValidator;
use canvas_traits::webgl::{TexDataType, TexFormat, WebGLError::*};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use crate::dom::webgltexture::WebGLTexture;
use canvas_traits::webgl::{TexDataType, TexFormat, WebGLError::*};
use std::{self, fmt};
/// The errors that the texImage* family of functions can generate.

View file

@ -2,8 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use canvas_traits::gl_enums;
use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants;
use canvas_traits::gl_enums;
gl_enums! {
pub enum TexImageTarget {

View file

@ -3,8 +3,6 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
use canvas_traits::webgl::webgl_channel;
use canvas_traits::webgl::{WebGLBufferId, WebGLCommand, WebGLError, WebGLResult};
use crate::dom::bindings::codegen::Bindings::WebGLBufferBinding;
use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants;
use crate::dom::bindings::inheritance::Castable;
@ -12,6 +10,8 @@ use crate::dom::bindings::reflector::{reflect_dom_object, DomObject};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglobject::WebGLObject;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use canvas_traits::webgl::webgl_channel;
use canvas_traits::webgl::{WebGLBufferId, WebGLCommand, WebGLError, WebGLResult};
use dom_struct::dom_struct;
use ipc_channel::ipc;
use std::cell::Cell;

View file

@ -3,8 +3,6 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
use canvas_traits::webgl::{webgl_channel, WebGLError, WebGLResult};
use canvas_traits::webgl::{WebGLCommand, WebGLFramebufferBindingRequest, WebGLFramebufferId};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::WebGLFramebufferBinding;
use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants;
@ -15,6 +13,8 @@ use crate::dom::webglobject::WebGLObject;
use crate::dom::webglrenderbuffer::WebGLRenderbuffer;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use crate::dom::webgltexture::WebGLTexture;
use canvas_traits::webgl::{webgl_channel, WebGLError, WebGLResult};
use canvas_traits::webgl::{WebGLCommand, WebGLFramebufferBindingRequest, WebGLFramebufferId};
use dom_struct::dom_struct;
use std::cell::Cell;
@ -531,11 +531,7 @@ impl WebGLFramebuffer {
Some(WebGLFramebufferAttachment::Texture {
texture: ref att_texture,
..
})
if texture.id() == att_texture.id() =>
{
true
},
}) if texture.id() == att_texture.id() => true,
_ => false,
}
};

View file

@ -3,8 +3,6 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
use canvas_traits::webgl::{webgl_channel, WebGLProgramId, WebGLResult};
use canvas_traits::webgl::{ActiveAttribInfo, ActiveUniformInfo, WebGLCommand, WebGLError};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::WebGLProgramBinding;
use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants;
@ -17,6 +15,8 @@ use crate::dom::webglobject::WebGLObject;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use crate::dom::webglshader::WebGLShader;
use crate::dom::webgluniformlocation::WebGLUniformLocation;
use canvas_traits::webgl::{webgl_channel, WebGLProgramId, WebGLResult};
use canvas_traits::webgl::{ActiveAttribInfo, ActiveUniformInfo, WebGLCommand, WebGLError};
use dom_struct::dom_struct;
use fnv::FnvHashSet;
use std::cell::{Cell, Ref};
@ -247,7 +247,7 @@ impl WebGLProgram {
match shader_slot.get() {
Some(ref attached_shader) if attached_shader.id() != shader.id() => {
return Err(WebGLError::InvalidOperation)
return Err(WebGLError::InvalidOperation);
},
None => return Err(WebGLError::InvalidOperation),
_ => {},

View file

@ -3,9 +3,6 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
use canvas_traits::webgl::{
is_gles, webgl_channel, WebGLCommand, WebGLError, WebGLRenderbufferId, WebGLResult,
};
use crate::dom::bindings::codegen::Bindings::EXTColorBufferHalfFloatBinding::EXTColorBufferHalfFloatConstants;
use crate::dom::bindings::codegen::Bindings::WEBGLColorBufferFloatBinding::WEBGLColorBufferFloatConstants;
use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextConstants;
@ -16,6 +13,9 @@ use crate::dom::bindings::reflector::{reflect_dom_object, DomObject};
use crate::dom::bindings::root::DomRoot;
use crate::dom::webglobject::WebGLObject;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use canvas_traits::webgl::{
is_gles, webgl_channel, WebGLCommand, WebGLError, WebGLRenderbufferId, WebGLResult,
};
use dom_struct::dom_struct;
use std::cell::Cell;

View file

@ -2,15 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
#[cfg(feature = "webgl_backtrace")]
use backtrace::Backtrace;
use canvas_traits::webgl::WebGLError::*;
use canvas_traits::webgl::{
webgl_channel, AlphaTreatment, DOMToTextureCommand, Parameter, TexDataType, TexFormat,
TexParameter, WebGLCommand, WebGLCommandBacktrace, WebGLContextShareMode, WebGLError,
WebGLFramebufferBindingRequest, WebGLMsg, WebGLMsgSender, WebGLProgramId, WebGLResult,
WebGLSLVersion, WebGLSender, WebGLVersion, WebVRCommand, YAxisTreatment,
};
use crate::dom::bindings::codegen::Bindings::ANGLEInstancedArraysBinding::ANGLEInstancedArraysConstants;
use crate::dom::bindings::codegen::Bindings::EXTBlendMinmaxBinding::EXTBlendMinmaxConstants;
use crate::dom::bindings::codegen::Bindings::OESVertexArrayObjectBinding::OESVertexArrayObjectConstants;
@ -55,6 +46,15 @@ use crate::dom::webgltexture::{TexParameterValue, WebGLTexture};
use crate::dom::webgluniformlocation::WebGLUniformLocation;
use crate::dom::webglvertexarrayobjectoes::WebGLVertexArrayObjectOES;
use crate::dom::window::Window;
#[cfg(feature = "webgl_backtrace")]
use backtrace::Backtrace;
use canvas_traits::webgl::WebGLError::*;
use canvas_traits::webgl::{
webgl_channel, AlphaTreatment, DOMToTextureCommand, Parameter, TexDataType, TexFormat,
TexParameter, WebGLCommand, WebGLCommandBacktrace, WebGLContextShareMode, WebGLError,
WebGLFramebufferBindingRequest, WebGLMsg, WebGLMsgSender, WebGLProgramId, WebGLResult,
WebGLSLVersion, WebGLSender, WebGLVersion, WebVRCommand, YAxisTreatment,
};
use dom_struct::dom_struct;
use euclid::{Point2D, Rect, Size2D};
use ipc_channel::ipc::{self, IpcSharedMemory};
@ -1913,9 +1913,10 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.11
fn Clear(&self, mask: u32) {
handle_potential_webgl_error!(self, self.validate_framebuffer(), return);
if mask & !(constants::DEPTH_BUFFER_BIT |
constants::STENCIL_BUFFER_BIT |
constants::COLOR_BUFFER_BIT) !=
if mask &
!(constants::DEPTH_BUFFER_BIT |
constants::STENCIL_BUFFER_BIT |
constants::COLOR_BUFFER_BIT) !=
0
{
return self.webgl_error(InvalidValue);

View file

@ -3,9 +3,6 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
use canvas_traits::webgl::{webgl_channel, WebGLVersion};
use canvas_traits::webgl::{WebGLCommand, WebGLError};
use canvas_traits::webgl::{WebGLResult, WebGLSLVersion, WebGLShaderId};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::WebGLShaderBinding;
use crate::dom::bindings::inheritance::Castable;
@ -17,6 +14,9 @@ use crate::dom::webgl_extensions::ext::oesstandardderivatives::OESStandardDeriva
use crate::dom::webgl_extensions::WebGLExtensions;
use crate::dom::webglobject::WebGLObject;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use canvas_traits::webgl::{webgl_channel, WebGLVersion};
use canvas_traits::webgl::{WebGLCommand, WebGLError};
use canvas_traits::webgl::{WebGLResult, WebGLSLVersion, WebGLShaderId};
use dom_struct::dom_struct;
use mozangle::shaders::{BuiltInResources, Output, ShaderValidator};
use offscreen_gl_context::GLLimits;

View file

@ -4,8 +4,6 @@
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
use canvas_traits::webgl::{webgl_channel, TexDataType, TexFormat, WebGLResult, WebGLTextureId};
use canvas_traits::webgl::{DOMToTextureCommand, WebGLCommand, WebGLError};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::EXTTextureFilterAnisotropicBinding::EXTTextureFilterAnisotropicConstants;
use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants;
@ -16,6 +14,8 @@ use crate::dom::bindings::root::DomRoot;
use crate::dom::webgl_validations::types::TexImageTarget;
use crate::dom::webglobject::WebGLObject;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use canvas_traits::webgl::{webgl_channel, TexDataType, TexFormat, WebGLResult, WebGLTextureId};
use canvas_traits::webgl::{DOMToTextureCommand, WebGLCommand, WebGLError};
use dom_struct::dom_struct;
use std::cell::Cell;
use std::cmp;

View file

@ -3,11 +3,11 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
use canvas_traits::webgl::WebGLProgramId;
use crate::dom::bindings::codegen::Bindings::WebGLUniformLocationBinding;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::window::Window;
use canvas_traits::webgl::WebGLProgramId;
use dom_struct::dom_struct;
#[dom_struct]

View file

@ -2,9 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use canvas_traits::webgl::{
ActiveAttribInfo, WebGLCommand, WebGLError, WebGLResult, WebGLVertexArrayId,
};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants;
use crate::dom::bindings::codegen::Bindings::WebGLVertexArrayObjectOESBinding;
@ -14,6 +11,9 @@ use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom};
use crate::dom::webglbuffer::WebGLBuffer;
use crate::dom::webglobject::WebGLObject;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use canvas_traits::webgl::{
ActiveAttribInfo, WebGLCommand, WebGLError, WebGLResult, WebGLVertexArrayId,
};
use dom_struct::dom_struct;
use ref_filter_map::ref_filter_map;
use std::cell::{Cell, Ref};

View file

@ -583,14 +583,12 @@ impl TaskOnce for MessageReceivedTask {
},
BinaryType::Arraybuffer => {
rooted!(in(cx) let mut array_buffer = ptr::null_mut::<JSObject>());
assert!(
ArrayBuffer::create(
cx,
CreateWith::Slice(&data),
array_buffer.handle_mut()
)
.is_ok()
);
assert!(ArrayBuffer::create(
cx,
CreateWith::Slice(&data),
array_buffer.handle_mut()
)
.is_ok());
(*array_buffer).to_jsval(cx, message.handle_mut());
},

View file

@ -2,10 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use app_units::Au;
use base64;
use bluetooth_traits::BluetoothRequest;
use canvas_traits::webgl::WebGLChan;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::DocumentBinding::{
DocumentMethods, DocumentReadyState,
@ -68,6 +64,10 @@ use crate::task_manager::TaskManager;
use crate::task_source::TaskSourceName;
use crate::timers::{IsInterval, TimerCallback};
use crate::webdriver_handlers::jsval_to_webdriver;
use app_units::Au;
use base64;
use bluetooth_traits::BluetoothRequest;
use canvas_traits::webgl::WebGLChan;
use crossbeam_channel::{unbounded, Sender, TryRecvError};
use cssparser::{Parser, ParserInput};
use devtools_traits::{ScriptToDevtoolsControlMsg, TimelineMarker, TimelineMarkerType};
@ -1747,16 +1747,16 @@ impl Window {
let old_url = doc.url().into_string();
let new_url = url.clone().into_string();
let task = task!(hashchange_event: move || {
let this = this.root();
let event = HashChangeEvent::new(
&this,
atom!("hashchange"),
false,
false,
old_url,
new_url);
event.upcast::<Event>().fire(this.upcast::<EventTarget>());
});
let this = this.root();
let event = HashChangeEvent::new(
&this,
atom!("hashchange"),
false,
false,
old_url,
new_url);
event.upcast::<Event>().fire(this.upcast::<EventTarget>());
});
// FIXME(nox): Why are errors silenced here?
let _ = self.script_chan.send(CommonScriptMsg::Task(
ScriptThreadEventCategory::DomEvent,

View file

@ -695,9 +695,7 @@ impl XMLHttpRequestMethods for XMLHttpRequest {
for param in mime.params() {
if param.0 == mime::CHARSET {
if !param.1.as_ref().eq_ignore_ascii_case(encoding) {
let new_params: Vec<
(Name, Name),
> = mime
let new_params: Vec<(Name, Name)> = mime
.params()
.filter(|p| p.0 != mime::CHARSET)
.map(|p| (p.0, p.1))
@ -829,7 +827,7 @@ impl XMLHttpRequestMethods for XMLHttpRequest {
// Step 1
match self.ready_state.get() {
XMLHttpRequestState::Loading | XMLHttpRequestState::Done => {
return Err(Error::InvalidState)
return Err(Error::InvalidState);
},
_ => {},
}