diff options
4 files changed, 10 insertions, 30 deletions
diff --git a/components/script/dom/closeevent.rs b/components/script/dom/closeevent.rs index 141902b88c1..190a7eb63b2 100644 --- a/components/script/dom/closeevent.rs +++ b/components/script/dom/closeevent.rs @@ -33,6 +33,12 @@ impl CloseEvent { } } + pub fn new_uninitialized(global: GlobalRef) -> Root<CloseEvent> { + reflect_dom_object(box CloseEvent::new_inherited(false, 0, DOMString::new()), + global, + CloseEventBinding::Wrap) + } + pub fn new(global: GlobalRef, type_: Atom, bubbles: EventBubbles, @@ -66,6 +72,7 @@ impl CloseEvent { init.code, init.reason.clone())) } + } impl CloseEventMethods for CloseEvent { diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index d422e9bd278..08c8dc6e29a 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -32,6 +32,7 @@ use dom::bindings::trace::RootedVec; use dom::bindings::xmlname::XMLName::InvalidXMLName; use dom::bindings::xmlname::{validate_and_extract, namespace_from_domstring, xml_name_type}; use dom::browsingcontext::BrowsingContext; +use dom::closeevent::CloseEvent; use dom::comment::Comment; use dom::customevent::CustomEvent; use dom::documentfragment::DocumentFragment; @@ -2190,6 +2191,8 @@ impl DocumentMethods for Document { Ok(Root::upcast(FocusEvent::new_uninitialized(GlobalRef::Window(&self.window)))), "errorevent" => Ok(Root::upcast(ErrorEvent::new_uninitialized(GlobalRef::Window(&self.window)))), + "closeevent" => + Ok(Root::upcast(CloseEvent::new_uninitialized(GlobalRef::Window(&self.window)))), _ => Err(Error::NotSupported), } diff --git a/tests/wpt/metadata/dom/nodes/Document-createEvent.html.ini b/tests/wpt/metadata/dom/nodes/Document-createEvent.html.ini index c40d8e327c9..0fd08c4242c 100644 --- a/tests/wpt/metadata/dom/nodes/Document-createEvent.html.ini +++ b/tests/wpt/metadata/dom/nodes/Document-createEvent.html.ini @@ -37,30 +37,6 @@ [createEvent('BEFOREUNLOADEVENT') should be initialized correctly.] expected: FAIL - [CloseEvent should be an alias for CloseEvent.] - bug: https://github.com/servo/servo/issues/10737 - expected: FAIL - - [createEvent('CloseEvent') should be initialized correctly.] - bug: https://github.com/servo/servo/issues/10737 - expected: FAIL - - [closeevent should be an alias for CloseEvent.] - bug: https://github.com/servo/servo/issues/10737 - expected: FAIL - - [createEvent('closeevent') should be initialized correctly.] - bug: https://github.com/servo/servo/issues/10737 - expected: FAIL - - [CLOSEEVENT should be an alias for CloseEvent.] - bug: https://github.com/servo/servo/issues/10737 - expected: FAIL - - [createEvent('CLOSEEVENT') should be initialized correctly.] - bug: https://github.com/servo/servo/issues/10737 - expected: FAIL - [CompositionEvent should be an alias for CompositionEvent.] expected: FAIL diff --git a/tests/wpt/web-platform-tests/websockets/interfaces/CloseEvent/historical.html b/tests/wpt/web-platform-tests/websockets/interfaces/CloseEvent/historical.html index 3b7b9e9f30a..24528a86fb0 100644 --- a/tests/wpt/web-platform-tests/websockets/interfaces/CloseEvent/historical.html +++ b/tests/wpt/web-platform-tests/websockets/interfaces/CloseEvent/historical.html @@ -6,12 +6,6 @@ <div id=log></div> <script> test(function() { - assert_throws("NotSupportedError", function() { - document.createEvent("CloseEvent") - }); -}, "createEvent(\"CloseEvent\")"); - -test(function() { assert_false("initCloseEvent" in CloseEvent.prototype); assert_false("initCloseEvent" in new CloseEvent('close')); }, "initCloseEvent"); |