Implement the "progressevent" argument to Document::createEvent

This commit is contained in:
Stephen (Ziyun) Li 2016-04-25 21:28:17 -04:00
parent 81f6e70a62
commit 889579c6de
No known key found for this signature in database
GPG key ID: 87FCA03CDF6996FD
4 changed files with 14 additions and 24 deletions

View file

@ -68,6 +68,7 @@ use dom::node::{self, CloneChildrenFlag, Node, NodeDamage, window_from_node};
use dom::nodeiterator::NodeIterator;
use dom::nodelist::NodeList;
use dom::processinginstruction::ProcessingInstruction;
use dom::progressevent::ProgressEvent;
use dom::range::Range;
use dom::servohtmlparser::{ParserRoot, ParserRef, MutNullableParserField};
use dom::storageevent::StorageEvent;
@ -2183,6 +2184,8 @@ impl DocumentMethods for Document {
Ok(Root::upcast(WebGLContextEvent::new_uninitialized(GlobalRef::Window(&self.window)))),
"storageevent" =>
Ok(Root::upcast(StorageEvent::new_uninitialized(&self.window, self.URL()))),
"progressevent" =>
Ok(Root::upcast(ProgressEvent::new_uninitialized(&self.window))),
_ =>
Err(Error::NotSupported),
}

View file

@ -11,6 +11,7 @@ use dom::bindings::inheritance::Castable;
use dom::bindings::js::Root;
use dom::bindings::reflector::reflect_dom_object;
use dom::event::{Event, EventBubbles, EventCancelable};
use dom::window::Window;
use string_cache::Atom;
use util::str::DOMString;
@ -31,6 +32,11 @@ impl ProgressEvent {
total: total
}
}
pub fn new_uninitialized(window: &Window) -> Root<ProgressEvent> {
reflect_dom_object(box ProgressEvent::new_inherited(false, 0, 0),
GlobalRef::Window(window),
ProgressEventBinding::Wrap)
}
pub fn new(global: GlobalRef, type_: Atom,
can_bubble: EventBubbles, cancelable: EventCancelable,
length_computable: bool, loaded: u64, total: u64) -> Root<ProgressEvent> {

View file

@ -0,0 +1,5 @@
[ProgressEvent.html]
type: testharness
bug: https://github.com/servo/servo/issues/10740
[document.createEvent() should not work with ProgressEvent.]
expected: FAIL

View file

@ -253,30 +253,6 @@
[createEvent('POPSTATEEVENT') should be initialized correctly.]
expected: FAIL
[ProgressEvent should be an alias for ProgressEvent.]
bug: https://github.com/servo/servo/issues/10740
expected: FAIL
[createEvent('ProgressEvent') should be initialized correctly.]
bug: https://github.com/servo/servo/issues/10740
expected: FAIL
[progressevent should be an alias for ProgressEvent.]
bug: https://github.com/servo/servo/issues/10740
expected: FAIL
[createEvent('progressevent') should be initialized correctly.]
bug: https://github.com/servo/servo/issues/10740
expected: FAIL
[PROGRESSEVENT should be an alias for ProgressEvent.]
bug: https://github.com/servo/servo/issues/10740
expected: FAIL
[createEvent('PROGRESSEVENT') should be initialized correctly.]
bug: https://github.com/servo/servo/issues/10740
expected: FAIL
[SVGZoomEvent should be an alias for SVGZoomEvent.]
expected: FAIL