mirror of
https://github.com/servo/servo.git
synced 2025-06-20 07:08:59 +01:00
Fix #6674
This commit is contained in:
parent
681b11c08b
commit
68d574bc32
2 changed files with 8 additions and 5 deletions
|
@ -10,7 +10,7 @@ use dom::bindings::error::Fallible;
|
|||
use dom::bindings::global::GlobalRef;
|
||||
use dom::bindings::js::Root;
|
||||
use dom::bindings::utils::reflect_dom_object;
|
||||
use dom::event::{Event, EventTypeId};
|
||||
use dom::event::{Event, EventTypeId, EventBubbles, EventCancelable};
|
||||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
|
@ -37,14 +37,14 @@ impl ProgressEvent {
|
|||
}
|
||||
}
|
||||
pub fn new(global: GlobalRef, type_: DOMString,
|
||||
can_bubble: bool, cancelable: bool,
|
||||
can_bubble: EventBubbles, cancelable: EventCancelable,
|
||||
length_computable: bool, loaded: u64, total: u64) -> Root<ProgressEvent> {
|
||||
let ev = reflect_dom_object(box ProgressEvent::new_inherited(length_computable, loaded, total),
|
||||
global,
|
||||
ProgressEventBinding::Wrap);
|
||||
{
|
||||
let event = EventCast::from_ref(ev.r());
|
||||
event.InitEvent(type_, can_bubble, cancelable);
|
||||
event.InitEvent(type_, can_bubble == EventBubbles::Bubbles, cancelable == EventCancelable::Cancelable);
|
||||
}
|
||||
ev
|
||||
}
|
||||
|
@ -52,7 +52,10 @@ impl ProgressEvent {
|
|||
type_: DOMString,
|
||||
init: &ProgressEventBinding::ProgressEventInit)
|
||||
-> Fallible<Root<ProgressEvent>> {
|
||||
let ev = ProgressEvent::new(global, type_, init.parent.bubbles, init.parent.cancelable,
|
||||
let bubbles = if init.parent.bubbles {EventBubbles::Bubbles} else {EventBubbles::DoesNotBubble};
|
||||
let cancelable = if init.parent.cancelable {EventCancelable::Cancelable}
|
||||
else {EventCancelable::NotCancelable};
|
||||
let ev = ProgressEvent::new(global, type_, bubbles, cancelable,
|
||||
init.lengthComputable, init.loaded, init.total);
|
||||
Ok(ev)
|
||||
}
|
||||
|
|
|
@ -942,7 +942,7 @@ impl<'a> PrivateXMLHttpRequestHelpers for &'a XMLHttpRequest {
|
|||
let global = self.global.root();
|
||||
let upload_target = self.upload.root();
|
||||
let progressevent = ProgressEvent::new(global.r(),
|
||||
type_, false, false,
|
||||
type_, EventBubbles::DoesNotBubble, EventCancelable::NotCancelable,
|
||||
total.is_some(), loaded,
|
||||
total.unwrap_or(0));
|
||||
let target = if upload {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue