diff options
21 files changed, 373 insertions, 861 deletions
diff --git a/components/script/dom/beforeunloadevent.rs b/components/script/dom/beforeunloadevent.rs new file mode 100644 index 00000000000..9257cbcafcb --- /dev/null +++ b/components/script/dom/beforeunloadevent.rs @@ -0,0 +1,67 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use dom::bindings::cell::DOMRefCell; +use dom::bindings::codegen::Bindings::BeforeUnloadEventBinding; +use dom::bindings::codegen::Bindings::BeforeUnloadEventBinding::BeforeUnloadEventMethods; +use dom::bindings::codegen::Bindings::EventBinding::EventMethods; +use dom::bindings::global::GlobalRef; +use dom::bindings::inheritance::Castable; +use dom::bindings::js::Root; +use dom::bindings::reflector::reflect_dom_object; +use dom::event::{Event, EventBubbles, EventCancelable}; +use string_cache::Atom; +use util::str::DOMString; + +// https://html.spec.whatwg.org/multipage/#beforeunloadevent +#[dom_struct] +pub struct BeforeUnloadEvent { + event: Event, + return_value: DOMRefCell<DOMString>, +} + +impl BeforeUnloadEvent { + fn new_inherited() -> BeforeUnloadEvent { + BeforeUnloadEvent { + event: Event::new_inherited(), + return_value: DOMRefCell::new(DOMString::new()), + } + } + + pub fn new_uninitialized(global: GlobalRef) -> Root<BeforeUnloadEvent> { + reflect_dom_object(box BeforeUnloadEvent::new_inherited(), + global, + BeforeUnloadEventBinding::Wrap) + } + + pub fn new(global: GlobalRef, + type_: Atom, + bubbles: EventBubbles, + cancelable: EventCancelable) -> Root<BeforeUnloadEvent> { + let ev = BeforeUnloadEvent::new_uninitialized(global); + { + let event = ev.upcast::<Event>(); + event.init_event(type_, bool::from(bubbles), + bool::from(cancelable)); + } + ev + } +} + +impl BeforeUnloadEventMethods for BeforeUnloadEvent { + // https://html.spec.whatwg.org/multipage/#dom-beforeunloadevent-returnvalue + fn ReturnValue(&self) -> DOMString { + self.return_value.borrow().clone() + } + + // https://html.spec.whatwg.org/multipage/#dom-beforeunloadevent-returnvalue + fn SetReturnValue(&self, value: DOMString) { + *self.return_value.borrow_mut() = value; + } + + // https://dom.spec.whatwg.org/#dom-event-istrusted + fn IsTrusted(&self) -> bool { + self.event.IsTrusted() + } +} diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index ddf23297282..9be03ab4c84 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -2795,6 +2795,9 @@ impl DocumentMethods for Document { // Step 5 elements } + + // https://html.spec.whatwg.org/multipage/#documentandelementeventhandlers + document_and_element_event_handlers!(); } fn update_with_current_time_ms(marker: &Cell<u64>) { diff --git a/components/script/dom/eventtarget.rs b/components/script/dom/eventtarget.rs index 3b20120628d..c8eecc8e65d 100644 --- a/components/script/dom/eventtarget.rs +++ b/components/script/dom/eventtarget.rs @@ -2,11 +2,14 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use dom::beforeunloadevent::BeforeUnloadEvent; use dom::bindings::callback::{CallbackContainer, ExceptionHandling, CallbackFunction}; use dom::bindings::cell::DOMRefCell; +use dom::bindings::codegen::Bindings::BeforeUnloadEventBinding::BeforeUnloadEventMethods; use dom::bindings::codegen::Bindings::ErrorEventBinding::ErrorEventMethods; use dom::bindings::codegen::Bindings::EventBinding::EventMethods; use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull; +use dom::bindings::codegen::Bindings::EventHandlerBinding::OnBeforeUnloadEventHandlerNonNull; use dom::bindings::codegen::Bindings::EventHandlerBinding::OnErrorEventHandlerNonNull; use dom::bindings::codegen::Bindings::EventListenerBinding::EventListener; use dom::bindings::codegen::Bindings::EventTargetBinding::EventTargetMethods; @@ -45,6 +48,7 @@ use util::str::DOMString; pub enum CommonEventHandler { EventHandler(Rc<EventHandlerNonNull>), ErrorEventHandler(Rc<OnErrorEventHandlerNonNull>), + BeforeUnloadEventHandler(Rc<OnBeforeUnloadEventHandlerNonNull>), } impl CommonEventHandler { @@ -52,6 +56,7 @@ impl CommonEventHandler { match *self { CommonEventHandler::EventHandler(ref handler) => &handler.parent, CommonEventHandler::ErrorEventHandler(ref handler) => &handler.parent, + CommonEventHandler::BeforeUnloadEventHandler(ref handler) => &handler.parent, } } } @@ -173,6 +178,27 @@ impl CompiledEventListener { None, None, None, None, exception_handle); } + CommonEventHandler::BeforeUnloadEventHandler(ref handler) => { + if let Some(event) = event.downcast::<BeforeUnloadEvent>() { + let rv = event.ReturnValue(); + + if let Ok(value) = handler.Call_(object, + event.upcast::<Event>(), + exception_handle) { + match value { + Some(value) => { + if rv.is_empty() { + event.SetReturnValue(value); + } + } + None => { + event.upcast::<Event>().PreventDefault(); + } + } + } + } + } + CommonEventHandler::EventHandler(ref handler) => { if let Ok(value) = handler.Call_(object, event, exception_handle) { let global = object.global(); @@ -183,7 +209,6 @@ impl CompiledEventListener { //Step 4 let should_cancel = match event.type_() { atom!("mouseover") => value.is_boolean() && value.to_boolean() == true, - atom!("beforeunload") => value.is_null(), _ => value.is_boolean() && value.to_boolean() == false }; if should_cancel { @@ -412,7 +437,12 @@ impl EventTarget { if is_error { Some(CommonEventHandler::ErrorEventHandler(OnErrorEventHandlerNonNull::new(funobj))) } else { - Some(CommonEventHandler::EventHandler(EventHandlerNonNull::new(funobj))) + if ty == &atom!("beforeunload") { + Some(CommonEventHandler::BeforeUnloadEventHandler( + OnBeforeUnloadEventHandlerNonNull::new(funobj))) + } else { + Some(CommonEventHandler::EventHandler(EventHandlerNonNull::new(funobj))) + } } } @@ -436,6 +466,16 @@ impl EventTarget { self.set_inline_event_listener(Atom::from(ty), event_listener); } + pub fn set_beforeunload_event_handler<T: CallbackContainer>(&self, ty: &str, + listener: Option<Rc<T>>) { + let event_listener = listener.map(|listener| + InlineEventListener::Compiled( + CommonEventHandler::BeforeUnloadEventHandler( + OnBeforeUnloadEventHandlerNonNull::new(listener.callback()))) + ); + self.set_inline_event_listener(Atom::from(ty), event_listener); + } + pub fn get_event_handler_common<T: CallbackContainer>(&self, ty: &str) -> Option<Rc<T>> { let listener = self.get_inline_event_listener(&Atom::from(ty)); listener.map(|listener| CallbackContainer::new(listener.parent().callback())) diff --git a/components/script/dom/htmlbodyelement.rs b/components/script/dom/htmlbodyelement.rs index 2fd18a00c08..536e3759fb3 100644 --- a/components/script/dom/htmlbodyelement.rs +++ b/components/script/dom/htmlbodyelement.rs @@ -4,7 +4,7 @@ use cssparser::RGBA; use dom::attr::{Attr, AttrValue}; -use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull; +use dom::bindings::codegen::Bindings::EventHandlerBinding::{EventHandlerNonNull, OnBeforeUnloadEventHandlerNonNull}; use dom::bindings::codegen::Bindings::HTMLBodyElementBinding::{self, HTMLBodyElementMethods}; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::inheritance::Castable; @@ -16,7 +16,6 @@ use dom::htmlelement::HTMLElement; use dom::node::{Node, document_from_node, window_from_node}; use dom::virtualmethods::VirtualMethods; use script_traits::ScriptMsg as ConstellationMsg; -use std::rc::Rc; use string_cache::Atom; use time; use url::Url; @@ -70,31 +69,14 @@ impl HTMLBodyElementMethods for HTMLBodyElement { // https://html.spec.whatwg.org/multipage/#dom-body-text make_legacy_color_setter!(SetText, "text"); - // https://html.spec.whatwg.org/multipage/#the-body-element - fn GetOnunload(&self) -> Option<Rc<EventHandlerNonNull>> { - window_from_node(self).GetOnunload() - } - - // https://html.spec.whatwg.org/multipage/#the-body-element - fn SetOnunload(&self, listener: Option<Rc<EventHandlerNonNull>>) { - window_from_node(self).SetOnunload(listener) - } - - // https://html.spec.whatwg.org/multipage/#the-body-element - fn GetOnstorage(&self) -> Option<Rc<EventHandlerNonNull>> { - window_from_node(self).GetOnstorage() - } - - // https://html.spec.whatwg.org/multipage/#the-body-element - fn SetOnstorage(&self, listener: Option<Rc<EventHandlerNonNull>>) { - window_from_node(self).SetOnstorage(listener) - } - // https://html.spec.whatwg.org/multipage/#dom-body-background make_getter!(Background, "background"); // https://html.spec.whatwg.org/multipage/#dom-body-background make_url_setter!(SetBackground, "background"); + + // https://html.spec.whatwg.org/multipage/#windoweventhandlers + window_event_handlers!(ForwardToWindow); } pub trait HTMLBodyElementLayoutHelpers { diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs index 3ad8f977869..7e310db8903 100644 --- a/components/script/dom/htmlelement.rs +++ b/components/script/dom/htmlelement.rs @@ -137,6 +137,9 @@ impl HTMLElementMethods for HTMLElement { // https://html.spec.whatwg.org/multipage/#globaleventhandlers global_event_handlers!(NoOnload); + // https://html.spec.whatwg.org/multipage/#documentandelementeventhandlers + document_and_element_event_handlers!(); + // https://html.spec.whatwg.org/multipage/#dom-dataset fn Dataset(&self) -> Root<DOMStringMap> { self.dataset.or_init(|| DOMStringMap::new(self)) @@ -196,6 +199,42 @@ impl HTMLElementMethods for HTMLElement { } } + // https://html.spec.whatwg.org/multipage/#handler-onfocus + fn GetOnfocus(&self) -> Option<Rc<EventHandlerNonNull>> { + if self.is_body_or_frameset() { + window_from_node(self).GetOnfocus() + } else { + self.upcast::<EventTarget>().get_event_handler_common("focus") + } + } + + // https://html.spec.whatwg.org/multipage/#handler-onfocus + fn SetOnfocus(&self, listener: Option<Rc<EventHandlerNonNull>>) { + if self.is_body_or_frameset() { + window_from_node(self).SetOnfocus(listener) + } else { + self.upcast::<EventTarget>().set_event_handler_common("focus", listener) + } + } + + // https://html.spec.whatwg.org/multipage/#handler-onscroll + fn GetOnscroll(&self) -> Option<Rc<EventHandlerNonNull>> { + if self.is_body_or_frameset() { + window_from_node(self).GetOnscroll() + } else { + self.upcast::<EventTarget>().get_event_handler_common("scroll") + } + } + + // https://html.spec.whatwg.org/multipage/#handler-onscroll + fn SetOnscroll(&self, listener: Option<Rc<EventHandlerNonNull>>) { + if self.is_body_or_frameset() { + window_from_node(self).SetOnscroll(listener) + } else { + self.upcast::<EventTarget>().set_event_handler_common("scroll", listener) + } + } + // https://html.spec.whatwg.org/multipage/#dom-click fn Click(&self) { if !self.upcast::<Element>().disabled_state() { diff --git a/components/script/dom/htmlframesetelement.rs b/components/script/dom/htmlframesetelement.rs index 92170a0baf4..df73bc893e9 100644 --- a/components/script/dom/htmlframesetelement.rs +++ b/components/script/dom/htmlframesetelement.rs @@ -2,11 +2,14 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use dom::bindings::codegen::Bindings::EventHandlerBinding::{EventHandlerNonNull, OnBeforeUnloadEventHandlerNonNull}; use dom::bindings::codegen::Bindings::HTMLFrameSetElementBinding; +use dom::bindings::codegen::Bindings::HTMLFrameSetElementBinding::HTMLFrameSetElementMethods; +use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::js::Root; use dom::document::Document; use dom::htmlelement::HTMLElement; -use dom::node::Node; +use dom::node::{Node, window_from_node}; use string_cache::Atom; use util::str::DOMString; @@ -33,3 +36,8 @@ impl HTMLFrameSetElement { Node::reflect_node(box element, document, HTMLFrameSetElementBinding::Wrap) } } + +impl HTMLFrameSetElementMethods for HTMLFrameSetElement { + // https://html.spec.whatwg.org/multipage/#windoweventhandlers + window_event_handlers!(ForwardToWindow); +} diff --git a/components/script/dom/macros.rs b/components/script/dom/macros.rs index cf93b72f985..78238dc09fd 100644 --- a/components/script/dom/macros.rs +++ b/components/script/dom/macros.rs @@ -321,6 +321,18 @@ macro_rules! define_event_handler( ) ); +macro_rules! define_window_owned_event_handler( + ($handler: ident, $event_type: ident, $getter: ident, $setter: ident) => ( + fn $getter(&self) -> Option<::std::rc::Rc<$handler>> { + window_from_node(self).$getter() + } + + fn $setter(&self, listener: Option<::std::rc::Rc<$handler>>) { + window_from_node(self).$setter(listener) + } + ) +); + macro_rules! event_handler( ($event_type: ident, $getter: ident, $setter: ident) => ( define_event_handler!(EventHandlerNonNull, $event_type, $getter, $setter, @@ -335,42 +347,158 @@ macro_rules! error_event_handler( ) ); +macro_rules! beforeunload_event_handler( + ($event_type: ident, $getter: ident, $setter: ident) => ( + define_event_handler!(OnBeforeUnloadEventHandlerNonNull, $event_type, + $getter, $setter, set_beforeunload_event_handler); + ) +); + +macro_rules! window_owned_event_handler( + ($event_type: ident, $getter: ident, $setter: ident) => ( + define_window_owned_event_handler!(EventHandlerNonNull, + $event_type, $getter, $setter); + ) +); + +macro_rules! window_owned_beforeunload_event_handler( + ($event_type: ident, $getter: ident, $setter: ident) => ( + define_window_owned_event_handler!(OnBeforeUnloadEventHandlerNonNull, + $event_type, $getter, $setter); + ) +); + // https://html.spec.whatwg.org/multipage/#globaleventhandlers // see webidls/EventHandler.webidl // As more methods get added, just update them here. macro_rules! global_event_handlers( () => ( event_handler!(blur, GetOnblur, SetOnblur); + event_handler!(focus, GetOnfocus, SetOnfocus); event_handler!(load, GetOnload, SetOnload); event_handler!(resize, GetOnresize, SetOnresize); + event_handler!(scroll, GetOnscroll, SetOnscroll); global_event_handlers!(NoOnload); ); (NoOnload) => ( event_handler!(abort, GetOnabort, SetOnabort); + event_handler!(cancel, GetOncancel, SetOncancel); event_handler!(canplay, GetOncanplay, SetOncanplay); event_handler!(canplaythrough, GetOncanplaythrough, SetOncanplaythrough); event_handler!(change, GetOnchange, SetOnchange); event_handler!(click, GetOnclick, SetOnclick); + event_handler!(close, GetOnclose, SetOnclose); + event_handler!(contextmenu, GetOncontextmenu, SetOncontextmenu); + event_handler!(cuechange, GetOncuechange, SetOncuechange); event_handler!(dblclick, GetOndblclick, SetOndblclick); + event_handler!(drag, GetOndrag, SetOndrag); + event_handler!(dragend, GetOndragend, SetOndragend); + event_handler!(dragenter, GetOndragenter, SetOndragenter); + event_handler!(dragexit, GetOndragexit, SetOndragexit); + event_handler!(dragleave, GetOndragleave, SetOndragleave); + event_handler!(dragover, GetOndragover, SetOndragover); + event_handler!(dragstart, GetOndragstart, SetOndragstart); + event_handler!(drop, GetOndrop, SetOndrop); + event_handler!(durationchange, GetOndurationchange, SetOndurationchange); event_handler!(emptied, GetOnemptied, SetOnemptied); + event_handler!(ended, GetOnended, SetOnended); error_event_handler!(error, GetOnerror, SetOnerror); event_handler!(input, GetOninput, SetOninput); + event_handler!(invalid, GetOninvalid, SetOninvalid); event_handler!(keydown, GetOnkeydown, SetOnkeydown); event_handler!(keypress, GetOnkeypress, SetOnkeypress); event_handler!(keyup, GetOnkeyup, SetOnkeyup); event_handler!(loadeddata, GetOnloadeddata, SetOnloadeddata); event_handler!(loadedmetata, GetOnloadedmetadata, SetOnloadedmetadata); + event_handler!(loadstart, GetOnloadstart, SetOnloadstart); + event_handler!(mousedown, GetOnmousedown, SetOnmousedown); + event_handler!(mouseenter, GetOnmouseenter, SetOnmouseenter); + event_handler!(mouseleave, GetOnmouseleave, SetOnmouseleave); + event_handler!(mousemove, GetOnmousemove, SetOnmousemove); + event_handler!(mouseout, GetOnmouseout, SetOnmouseout); event_handler!(mouseover, GetOnmouseover, SetOnmouseover); + event_handler!(mouseup, GetOnmouseup, SetOnmouseup); + event_handler!(wheel, GetOnwheel, SetOnwheel); event_handler!(pause, GetOnpause, SetOnpause); event_handler!(play, GetOnplay, SetOnplay); event_handler!(playing, GetOnplaying, SetOnplaying); event_handler!(progress, GetOnprogress, SetOnprogress); + event_handler!(ratechange, GetOnratechange, SetOnratechange); event_handler!(reset, GetOnreset, SetOnreset); + event_handler!(seeked, GetOnseeked, SetOnseeked); + event_handler!(seeking, GetOnseeking, SetOnseeking); + event_handler!(select, GetOnselect, SetOnselect); + event_handler!(show, GetOnshow, SetOnshow); + event_handler!(stalled, GetOnstalled, SetOnstalled); event_handler!(submit, GetOnsubmit, SetOnsubmit); event_handler!(suspend, GetOnsuspend, SetOnsuspend); event_handler!(timeupdate, GetOntimeupdate, SetOntimeupdate); event_handler!(toggle, GetOntoggle, SetOntoggle); + event_handler!(volumechange, GetOnvolumechange, SetOnvolumechange); event_handler!(waiting, GetOnwaiting, SetOnwaiting); ) ); + +// https://html.spec.whatwg.org/multipage/#windoweventhandlers +// see webidls/EventHandler.webidl +// As more methods get added, just update them here. +macro_rules! window_event_handlers( + () => ( + event_handler!(afterprint, GetOnafterprint, SetOnafterprint); + event_handler!(beforeprint, GetOnbeforeprint, SetOnbeforeprint); + beforeunload_event_handler!(beforeunload, GetOnbeforeunload, + SetOnbeforeunload); + event_handler!(hashchange, GetOnhashchange, SetOnhashchange); + event_handler!(languagechange, GetOnlanguagechange, + SetOnlanguagechange); + event_handler!(message, GetOnmessage, SetOnmessage); + event_handler!(offline, GetOnoffline, SetOnoffline); + event_handler!(online, GetOnonline, SetOnonline); + event_handler!(pagehide, GetOnpagehide, SetOnpagehide); + event_handler!(pageshow, GetOnpageshow, SetOnpageshow); + event_handler!(popstate, GetOnpopstate, SetOnpopstate); + event_handler!(rejectionhandled, GetOnrejectionhandled, + SetOnrejectionhandled); + event_handler!(storage, GetOnstorage, SetOnstorage); + event_handler!(unhandledrejection, GetOnunhandledrejection, + SetOnunhandledrejection); + event_handler!(unload, GetOnunload, SetOnunload); + ); + (ForwardToWindow) => ( + window_owned_event_handler!(afterprint, GetOnafterprint, + SetOnafterprint); + window_owned_event_handler!(beforeprint, GetOnbeforeprint, + SetOnbeforeprint); + window_owned_beforeunload_event_handler!(beforeunload, + GetOnbeforeunload, + SetOnbeforeunload); + window_owned_event_handler!(hashchange, GetOnhashchange, + SetOnhashchange); + window_owned_event_handler!(languagechange, GetOnlanguagechange, + SetOnlanguagechange); + window_owned_event_handler!(message, GetOnmessage, SetOnmessage); + window_owned_event_handler!(offline, GetOnoffline, SetOnoffline); + window_owned_event_handler!(online, GetOnonline, SetOnonline); + window_owned_event_handler!(pagehide, GetOnpagehide, SetOnpagehide); + window_owned_event_handler!(pageshow, GetOnpageshow, SetOnpageshow); + window_owned_event_handler!(popstate, GetOnpopstate, SetOnpopstate); + window_owned_event_handler!(rejectionhandled, GetOnrejectionhandled, + SetOnrejectionhandled); + window_owned_event_handler!(storage, GetOnstorage, SetOnstorage); + window_owned_event_handler!(unhandledrejection, GetOnunhandledrejection, + SetOnunhandledrejection); + window_owned_event_handler!(unload, GetOnunload, SetOnunload); + ); +); + +// https://html.spec.whatwg.org/multipage/#documentandelementeventhandlers +// see webidls/EventHandler.webidl +// As more methods get added, just update them here. +macro_rules! document_and_element_event_handlers( + () => ( + event_handler!(cut, GetOncut, SetOncut); + event_handler!(copy, GetOncopy, SetOncopy); + event_handler!(paste, GetOnpaste, SetOnpaste); + ) +); diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs index cfa41a1ae19..8d13c104aa1 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -211,6 +211,7 @@ pub mod types { pub mod activation; pub mod attr; +pub mod beforeunloadevent; mod create; #[allow(unsafe_code)] #[deny(missing_docs, non_snake_case)] diff --git a/components/script/dom/webidls/BeforeUnloadEvent.webidl b/components/script/dom/webidls/BeforeUnloadEvent.webidl new file mode 100644 index 00000000000..5e4a099725a --- /dev/null +++ b/components/script/dom/webidls/BeforeUnloadEvent.webidl @@ -0,0 +1,11 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +/* + * For more information on this interface please see + * https://html.spec.whatwg.org/multipage/#beforeunloadevent + */ + +interface BeforeUnloadEvent : Event { + attribute DOMString returnValue; +}; diff --git a/components/script/dom/webidls/Document.webidl b/components/script/dom/webidls/Document.webidl index b211fe7be58..b73d563bac7 100644 --- a/components/script/dom/webidls/Document.webidl +++ b/components/script/dom/webidls/Document.webidl @@ -138,6 +138,7 @@ partial /*sealed*/ interface Document { // also has obsolete members }; Document implements GlobalEventHandlers; +Document implements DocumentAndElementEventHandlers; // https://html.spec.whatwg.org/multipage/#Document-partial partial interface Document { diff --git a/components/script/dom/webidls/EventHandler.webidl b/components/script/dom/webidls/EventHandler.webidl index fa42b757cab..957fc0bd4dd 100644 --- a/components/script/dom/webidls/EventHandler.webidl +++ b/components/script/dom/webidls/EventHandler.webidl @@ -20,42 +20,99 @@ callback OnErrorEventHandlerNonNull = any ((Event or DOMString) event, optional optional any error); typedef OnErrorEventHandlerNonNull? OnErrorEventHandler; +[TreatNonObjectAsNull] +callback OnBeforeUnloadEventHandlerNonNull = DOMString? (Event event); +typedef OnBeforeUnloadEventHandlerNonNull? OnBeforeUnloadEventHandler; + // https://html.spec.whatwg.org/multipage/#globaleventhandlers [NoInterfaceObject] interface GlobalEventHandlers { attribute EventHandler onabort; attribute EventHandler onblur; + attribute EventHandler oncancel; attribute EventHandler oncanplay; attribute EventHandler oncanplaythrough; attribute EventHandler onchange; attribute EventHandler onclick; + attribute EventHandler onclose; + attribute EventHandler oncontextmenu; + attribute EventHandler oncuechange; attribute EventHandler ondblclick; + attribute EventHandler ondrag; + attribute EventHandler ondragend; + attribute EventHandler ondragenter; + attribute EventHandler ondragexit; + attribute EventHandler ondragleave; + attribute EventHandler ondragover; + attribute EventHandler ondragstart; + attribute EventHandler ondrop; + attribute EventHandler ondurationchange; attribute EventHandler onemptied; + attribute EventHandler onended; attribute OnErrorEventHandler onerror; + attribute EventHandler onfocus; attribute EventHandler oninput; + attribute EventHandler oninvalid; attribute EventHandler onkeydown; attribute EventHandler onkeypress; attribute EventHandler onkeyup; attribute EventHandler onload; attribute EventHandler onloadeddata; attribute EventHandler onloadedmetadata; + attribute EventHandler onloadstart; + attribute EventHandler onmousedown; + [LenientThis] attribute EventHandler onmouseenter; + [LenientThis] attribute EventHandler onmouseleave; + attribute EventHandler onmousemove; + attribute EventHandler onmouseout; attribute EventHandler onmouseover; + attribute EventHandler onmouseup; + attribute EventHandler onwheel; attribute EventHandler onpause; attribute EventHandler onplay; attribute EventHandler onplaying; attribute EventHandler onprogress; + attribute EventHandler onratechange; attribute EventHandler onreset; attribute EventHandler onresize; + attribute EventHandler onscroll; + attribute EventHandler onseeked; + attribute EventHandler onseeking; + attribute EventHandler onselect; + attribute EventHandler onshow; + attribute EventHandler onstalled; attribute EventHandler onsubmit; attribute EventHandler onsuspend; attribute EventHandler ontimeupdate; attribute EventHandler ontoggle; + attribute EventHandler onvolumechange; attribute EventHandler onwaiting; }; // https://html.spec.whatwg.org/multipage/#windoweventhandlers [NoInterfaceObject] interface WindowEventHandlers { - attribute EventHandler onunload; + attribute EventHandler onafterprint; + attribute EventHandler onbeforeprint; + attribute OnBeforeUnloadEventHandler onbeforeunload; + attribute EventHandler onhashchange; + attribute EventHandler onlanguagechange; + attribute EventHandler onmessage; + attribute EventHandler onoffline; + attribute EventHandler ononline; + attribute EventHandler onpagehide; + attribute EventHandler onpageshow; + attribute EventHandler onpopstate; + attribute EventHandler onrejectionhandled; attribute EventHandler onstorage; + attribute EventHandler onunhandledrejection; + attribute EventHandler onunload; +}; + +// https://html.spec.whatwg.org/multipage/#documentandelementeventhandlers +[NoInterfaceObject] +interface DocumentAndElementEventHandlers { + attribute EventHandler oncopy; + attribute EventHandler oncut; + attribute EventHandler onpaste; }; diff --git a/components/script/dom/webidls/HTMLElement.webidl b/components/script/dom/webidls/HTMLElement.webidl index 9778985dd40..19222109d63 100644 --- a/components/script/dom/webidls/HTMLElement.webidl +++ b/components/script/dom/webidls/HTMLElement.webidl @@ -54,5 +54,6 @@ partial interface HTMLElement { }; HTMLElement implements GlobalEventHandlers; +HTMLElement implements DocumentAndElementEventHandlers; HTMLElement implements ElementContentEditable; HTMLElement implements ElementCSSInlineStyle; diff --git a/components/script/dom/webidls/HTMLFrameSetElement.webidl b/components/script/dom/webidls/HTMLFrameSetElement.webidl index f35de93e545..5addd41d253 100644 --- a/components/script/dom/webidls/HTMLFrameSetElement.webidl +++ b/components/script/dom/webidls/HTMLFrameSetElement.webidl @@ -7,4 +7,5 @@ interface HTMLFrameSetElement : HTMLElement { // attribute DOMString cols; // attribute DOMString rows; }; -//HTMLFrameSetElement implements WindowEventHandlers; + +HTMLFrameSetElement implements WindowEventHandlers; diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index c9111ad15e5..829ff6313cd 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -7,7 +7,9 @@ use devtools_traits::{ScriptToDevtoolsControlMsg, TimelineMarker, TimelineMarker use dom::bindings::callback::ExceptionHandling; use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::DocumentBinding::{DocumentMethods, DocumentReadyState}; -use dom::bindings::codegen::Bindings::EventHandlerBinding::{EventHandlerNonNull, OnErrorEventHandlerNonNull}; +use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull; +use dom::bindings::codegen::Bindings::EventHandlerBinding::OnBeforeUnloadEventHandlerNonNull; +use dom::bindings::codegen::Bindings::EventHandlerBinding::OnErrorEventHandlerNonNull; use dom::bindings::codegen::Bindings::FunctionBinding::Function; use dom::bindings::codegen::Bindings::WindowBinding::{ScrollBehavior, ScrollToOptions}; use dom::bindings::codegen::Bindings::WindowBinding::{self, FrameRequestCallback, WindowMethods}; @@ -585,11 +587,8 @@ impl WindowMethods for Window { // https://html.spec.whatwg.org/multipage/#globaleventhandlers global_event_handlers!(); - // https://html.spec.whatwg.org/multipage/#handler-window-onunload - event_handler!(unload, GetOnunload, SetOnunload); - - // https://html.spec.whatwg.org/multipage/#handler-window-onstorage - event_handler!(storage, GetOnstorage, SetOnstorage); + // https://html.spec.whatwg.org/multipage/#windoweventhandlers + window_event_handlers!(); // https://developer.mozilla.org/en-US/docs/Web/API/Window/screen fn Screen(&self) -> Root<Screen> { diff --git a/tests/wpt/metadata/html/dom/interfaces.html.ini b/tests/wpt/metadata/html/dom/interfaces.html.ini index dd0d180c3bf..661e0438bd4 100644 --- a/tests/wpt/metadata/html/dom/interfaces.html.ini +++ b/tests/wpt/metadata/html/dom/interfaces.html.ini @@ -72,105 +72,12 @@ [Document interface: attribute onautocompleteerror] expected: FAIL - [Document interface: attribute oncancel] - expected: FAIL - - [Document interface: attribute onclose] - expected: FAIL - - [Document interface: attribute oncontextmenu] - expected: FAIL - - [Document interface: attribute oncuechange] - expected: FAIL - - [Document interface: attribute ondrag] - expected: FAIL - - [Document interface: attribute ondragend] - expected: FAIL - - [Document interface: attribute ondragenter] - expected: FAIL - - [Document interface: attribute ondragexit] - expected: FAIL - - [Document interface: attribute ondragleave] - expected: FAIL - - [Document interface: attribute ondragover] - expected: FAIL - - [Document interface: attribute ondragstart] - expected: FAIL - - [Document interface: attribute ondrop] - expected: FAIL - - [Document interface: attribute ondurationchange] - expected: FAIL - - [Document interface: attribute onended] - expected: FAIL - - [Document interface: attribute onfocus] - expected: FAIL - - [Document interface: attribute oninvalid] - expected: FAIL - - [Document interface: attribute onloadstart] - expected: FAIL - - [Document interface: attribute onmousedown] - expected: FAIL - - [Document interface: attribute onmouseenter] - expected: FAIL - - [Document interface: attribute onmouseleave] - expected: FAIL - - [Document interface: attribute onmousemove] - expected: FAIL - - [Document interface: attribute onmouseout] - expected: FAIL - - [Document interface: attribute onmouseup] - expected: FAIL - [Document interface: attribute onmousewheel] expected: FAIL - [Document interface: attribute onratechange] - expected: FAIL - - [Document interface: attribute onscroll] - expected: FAIL - - [Document interface: attribute onseeked] - expected: FAIL - - [Document interface: attribute onseeking] - expected: FAIL - - [Document interface: attribute onselect] - expected: FAIL - - [Document interface: attribute onshow] - expected: FAIL - [Document interface: attribute onsort] expected: FAIL - [Document interface: attribute onstalled] - expected: FAIL - - [Document interface: attribute onvolumechange] - expected: FAIL - [Stringification of iframe.contentDocument] expected: FAIL @@ -1089,156 +996,12 @@ [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onblur" with the proper type (96)] expected: FAIL - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "oncancel" with the proper type (97)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "oncanplay" with the proper type (98)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "oncanplaythrough" with the proper type (99)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onclose" with the proper type (102)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "oncontextmenu" with the proper type (103)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "oncuechange" with the proper type (104)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "ondblclick" with the proper type (105)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "ondrag" with the proper type (106)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "ondragend" with the proper type (107)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "ondragenter" with the proper type (108)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "ondragexit" with the proper type (109)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "ondragleave" with the proper type (110)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "ondragover" with the proper type (111)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "ondragstart" with the proper type (112)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "ondrop" with the proper type (113)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "ondurationchange" with the proper type (114)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onemptied" with the proper type (115)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onended" with the proper type (116)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onerror" with the proper type (117)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onfocus" with the proper type (118)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "oninvalid" with the proper type (120)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onloadeddata" with the proper type (125)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onloadedmetadata" with the proper type (126)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onloadstart" with the proper type (127)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onmousedown" with the proper type (128)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onmouseenter" with the proper type (129)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onmouseleave" with the proper type (130)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onmousemove" with the proper type (131)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onmouseout" with the proper type (132)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onmouseover" with the proper type (133)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onmouseup" with the proper type (134)] - expected: FAIL - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onmousewheel" with the proper type (135)] expected: FAIL - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onpause" with the proper type (136)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onplay" with the proper type (137)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onplaying" with the proper type (138)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onprogress" with the proper type (139)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onratechange" with the proper type (140)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onreset" with the proper type (141)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onresize" with the proper type (142)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onscroll" with the proper type (143)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onseeked" with the proper type (144)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onseeking" with the proper type (145)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onselect" with the proper type (146)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onshow" with the proper type (147)] - expected: FAIL - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onsort" with the proper type (148)] expected: FAIL - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onstalled" with the proper type (149)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onsuspend" with the proper type (151)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "ontimeupdate" with the proper type (152)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "ontoggle" with the proper type (153)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onvolumechange" with the proper type (154)] - expected: FAIL - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onwaiting" with the proper type (155)] expected: FAIL @@ -1560,105 +1323,12 @@ [HTMLElement interface: attribute onautocompleteerror] expected: FAIL - [HTMLElement interface: attribute oncancel] - expected: FAIL - - [HTMLElement interface: attribute onclose] - expected: FAIL - - [HTMLElement interface: attribute oncontextmenu] - expected: FAIL - - [HTMLElement interface: attribute oncuechange] - expected: FAIL - - [HTMLElement interface: attribute ondrag] - expected: FAIL - - [HTMLElement interface: attribute ondragend] - expected: FAIL - - [HTMLElement interface: attribute ondragenter] - expected: FAIL - - [HTMLElement interface: attribute ondragexit] - expected: FAIL - - [HTMLElement interface: attribute ondragleave] - expected: FAIL - - [HTMLElement interface: attribute ondragover] - expected: FAIL - - [HTMLElement interface: attribute ondragstart] - expected: FAIL - - [HTMLElement interface: attribute ondrop] - expected: FAIL - - [HTMLElement interface: attribute ondurationchange] - expected: FAIL - - [HTMLElement interface: attribute onended] - expected: FAIL - - [HTMLElement interface: attribute onfocus] - expected: FAIL - - [HTMLElement interface: attribute oninvalid] - expected: FAIL - - [HTMLElement interface: attribute onloadstart] - expected: FAIL - - [HTMLElement interface: attribute onmousedown] - expected: FAIL - - [HTMLElement interface: attribute onmouseenter] - expected: FAIL - - [HTMLElement interface: attribute onmouseleave] - expected: FAIL - - [HTMLElement interface: attribute onmousemove] - expected: FAIL - - [HTMLElement interface: attribute onmouseout] - expected: FAIL - - [HTMLElement interface: attribute onmouseup] - expected: FAIL - [HTMLElement interface: attribute onmousewheel] expected: FAIL - [HTMLElement interface: attribute onratechange] - expected: FAIL - - [HTMLElement interface: attribute onscroll] - expected: FAIL - - [HTMLElement interface: attribute onseeked] - expected: FAIL - - [HTMLElement interface: attribute onseeking] - expected: FAIL - - [HTMLElement interface: attribute onselect] - expected: FAIL - - [HTMLElement interface: attribute onshow] - expected: FAIL - [HTMLElement interface: attribute onsort] expected: FAIL - [HTMLElement interface: attribute onstalled] - expected: FAIL - - [HTMLElement interface: attribute onvolumechange] - expected: FAIL - [HTMLElement interface: document.createElement("noscript") must inherit property "translate" with the proper type (2)] expected: FAIL @@ -1740,105 +1410,12 @@ [HTMLElement interface: document.createElement("noscript") must inherit property "onautocompleteerror" with the proper type (34)] expected: FAIL - [HTMLElement interface: document.createElement("noscript") must inherit property "oncancel" with the proper type (36)] - expected: FAIL - - [HTMLElement interface: document.createElement("noscript") must inherit property "onclose" with the proper type (41)] - expected: FAIL - - [HTMLElement interface: document.createElement("noscript") must inherit property "oncontextmenu" with the proper type (42)] - expected: FAIL - - [HTMLElement interface: document.createElement("noscript") must inherit property "oncuechange" with the proper type (43)] - expected: FAIL - - [HTMLElement interface: document.createElement("noscript") must inherit property "ondrag" with the proper type (45)] - expected: FAIL - - [HTMLElement interface: document.createElement("noscript") must inherit property "ondragend" with the proper type (46)] - expected: FAIL - - [HTMLElement interface: document.createElement("noscript") must inherit property "ondragenter" with the proper type (47)] - expected: FAIL - - [HTMLElement interface: document.createElement("noscript") must inherit property "ondragexit" with the proper type (48)] - expected: FAIL - - [HTMLElement interface: document.createElement("noscript") must inherit property "ondragleave" with the proper type (49)] - expected: FAIL - - [HTMLElement interface: document.createElement("noscript") must inherit property "ondragover" with the proper type (50)] - expected: FAIL - - [HTMLElement interface: document.createElement("noscript") must inherit property "ondragstart" with the proper type (51)] - expected: FAIL - - [HTMLElement interface: document.createElement("noscript") must inherit property "ondrop" with the proper type (52)] - expected: FAIL - - [HTMLElement interface: document.createElement("noscript") must inherit property "ondurationchange" with the proper type (53)] - expected: FAIL - - [HTMLElement interface: document.createElement("noscript") must inherit property "onended" with the proper type (55)] - expected: FAIL - - [HTMLElement interface: document.createElement("noscript") must inherit property "onfocus" with the proper type (57)] - expected: FAIL - - [HTMLElement interface: document.createElement("noscript") must inherit property "oninvalid" with the proper type (59)] - expected: FAIL - - [HTMLElement interface: document.createElement("noscript") must inherit property "onloadstart" with the proper type (66)] - expected: FAIL - - [HTMLElement interface: document.createElement("noscript") must inherit property "onmousedown" with the proper type (67)] - expected: FAIL - - [HTMLElement interface: document.createElement("noscript") must inherit property "onmouseenter" with the proper type (68)] - expected: FAIL - - [HTMLElement interface: document.createElement("noscript") must inherit property "onmouseleave" with the proper type (69)] - expected: FAIL - - [HTMLElement interface: document.createElement("noscript") must inherit property "onmousemove" with the proper type (70)] - expected: FAIL - - [HTMLElement interface: document.createElement("noscript") must inherit property "onmouseout" with the proper type (71)] - expected: FAIL - - [HTMLElement interface: document.createElement("noscript") must inherit property "onmouseup" with the proper type (73)] - expected: FAIL - [HTMLElement interface: document.createElement("noscript") must inherit property "onmousewheel" with the proper type (74)] expected: FAIL - [HTMLElement interface: document.createElement("noscript") must inherit property "onratechange" with the proper type (79)] - expected: FAIL - - [HTMLElement interface: document.createElement("noscript") must inherit property "onscroll" with the proper type (82)] - expected: FAIL - - [HTMLElement interface: document.createElement("noscript") must inherit property "onseeked" with the proper type (83)] - expected: FAIL - - [HTMLElement interface: document.createElement("noscript") must inherit property "onseeking" with the proper type (84)] - expected: FAIL - - [HTMLElement interface: document.createElement("noscript") must inherit property "onselect" with the proper type (85)] - expected: FAIL - - [HTMLElement interface: document.createElement("noscript") must inherit property "onshow" with the proper type (86)] - expected: FAIL - [HTMLElement interface: document.createElement("noscript") must inherit property "onsort" with the proper type (87)] expected: FAIL - [HTMLElement interface: document.createElement("noscript") must inherit property "onstalled" with the proper type (88)] - expected: FAIL - - [HTMLElement interface: document.createElement("noscript") must inherit property "onvolumechange" with the proper type (93)] - expected: FAIL - [Element interface: document.createElement("noscript") must inherit property "query" with the proper type (34)] expected: FAIL @@ -1920,39 +1497,6 @@ [HTMLBodyElement interface: attribute aLink] expected: FAIL - [HTMLBodyElement interface: attribute onafterprint] - expected: FAIL - - [HTMLBodyElement interface: attribute onbeforeprint] - expected: FAIL - - [HTMLBodyElement interface: attribute onbeforeunload] - expected: FAIL - - [HTMLBodyElement interface: attribute onhashchange] - expected: FAIL - - [HTMLBodyElement interface: attribute onlanguagechange] - expected: FAIL - - [HTMLBodyElement interface: attribute onmessage] - expected: FAIL - - [HTMLBodyElement interface: attribute onoffline] - expected: FAIL - - [HTMLBodyElement interface: attribute ononline] - expected: FAIL - - [HTMLBodyElement interface: attribute onpagehide] - expected: FAIL - - [HTMLBodyElement interface: attribute onpageshow] - expected: FAIL - - [HTMLBodyElement interface: attribute onpopstate] - expected: FAIL - [HTMLBodyElement interface: document.createElement("body") must inherit property "link" with the proper type (1)] expected: FAIL @@ -1962,39 +1506,6 @@ [HTMLBodyElement interface: document.createElement("body") must inherit property "aLink" with the proper type (3)] expected: FAIL - [HTMLBodyElement interface: document.createElement("body") must inherit property "onafterprint" with the proper type (6)] - expected: FAIL - - [HTMLBodyElement interface: document.createElement("body") must inherit property "onbeforeprint" with the proper type (7)] - expected: FAIL - - [HTMLBodyElement interface: document.createElement("body") must inherit property "onbeforeunload" with the proper type (8)] - expected: FAIL - - [HTMLBodyElement interface: document.createElement("body") must inherit property "onhashchange" with the proper type (9)] - expected: FAIL - - [HTMLBodyElement interface: document.createElement("body") must inherit property "onlanguagechange" with the proper type (10)] - expected: FAIL - - [HTMLBodyElement interface: document.createElement("body") must inherit property "onmessage" with the proper type (11)] - expected: FAIL - - [HTMLBodyElement interface: document.createElement("body") must inherit property "onoffline" with the proper type (12)] - expected: FAIL - - [HTMLBodyElement interface: document.createElement("body") must inherit property "ononline" with the proper type (13)] - expected: FAIL - - [HTMLBodyElement interface: document.createElement("body") must inherit property "onpagehide" with the proper type (14)] - expected: FAIL - - [HTMLBodyElement interface: document.createElement("body") must inherit property "onpageshow" with the proper type (15)] - expected: FAIL - - [HTMLBodyElement interface: document.createElement("body") must inherit property "onpopstate" with the proper type (16)] - expected: FAIL - [HTMLHeadingElement interface: attribute align] expected: FAIL @@ -6207,21 +5718,6 @@ [Location interface: calling replace(DOMString) on window.location with too few arguments must throw TypeError] expected: FAIL - [BeforeUnloadEvent interface: existence and properties of interface object] - expected: FAIL - - [BeforeUnloadEvent interface object length] - expected: FAIL - - [BeforeUnloadEvent interface: existence and properties of interface prototype object] - expected: FAIL - - [BeforeUnloadEvent interface: existence and properties of interface prototype object's "constructor" property] - expected: FAIL - - [BeforeUnloadEvent interface: attribute returnValue] - expected: FAIL - [ApplicationCache interface: existence and properties of interface object] expected: FAIL @@ -6873,90 +6369,12 @@ [HTMLFrameSetElement interface: attribute rows] expected: FAIL - [HTMLFrameSetElement interface: attribute onafterprint] - expected: FAIL - - [HTMLFrameSetElement interface: attribute onbeforeprint] - expected: FAIL - - [HTMLFrameSetElement interface: attribute onbeforeunload] - expected: FAIL - - [HTMLFrameSetElement interface: attribute onhashchange] - expected: FAIL - - [HTMLFrameSetElement interface: attribute onlanguagechange] - expected: FAIL - - [HTMLFrameSetElement interface: attribute onmessage] - expected: FAIL - - [HTMLFrameSetElement interface: attribute onoffline] - expected: FAIL - - [HTMLFrameSetElement interface: attribute ononline] - expected: FAIL - - [HTMLFrameSetElement interface: attribute onpagehide] - expected: FAIL - - [HTMLFrameSetElement interface: attribute onpageshow] - expected: FAIL - - [HTMLFrameSetElement interface: attribute onpopstate] - expected: FAIL - - [HTMLFrameSetElement interface: attribute onstorage] - expected: FAIL - - [HTMLFrameSetElement interface: attribute onunload] - expected: FAIL - [HTMLFrameSetElement interface: document.createElement("frameset") must inherit property "cols" with the proper type (0)] expected: FAIL [HTMLFrameSetElement interface: document.createElement("frameset") must inherit property "rows" with the proper type (1)] expected: FAIL - [HTMLFrameSetElement interface: document.createElement("frameset") must inherit property "onafterprint" with the proper type (2)] - expected: FAIL - - [HTMLFrameSetElement interface: document.createElement("frameset") must inherit property "onbeforeprint" with the proper type (3)] - expected: FAIL - - [HTMLFrameSetElement interface: document.createElement("frameset") must inherit property "onbeforeunload" with the proper type (4)] - expected: FAIL - - [HTMLFrameSetElement interface: document.createElement("frameset") must inherit property "onhashchange" with the proper type (5)] - expected: FAIL - - [HTMLFrameSetElement interface: document.createElement("frameset") must inherit property "onlanguagechange" with the proper type (6)] - expected: FAIL - - [HTMLFrameSetElement interface: document.createElement("frameset") must inherit property "onmessage" with the proper type (7)] - expected: FAIL - - [HTMLFrameSetElement interface: document.createElement("frameset") must inherit property "onoffline" with the proper type (8)] - expected: FAIL - - [HTMLFrameSetElement interface: document.createElement("frameset") must inherit property "ononline" with the proper type (9)] - expected: FAIL - - [HTMLFrameSetElement interface: document.createElement("frameset") must inherit property "onpagehide" with the proper type (10)] - expected: FAIL - - [HTMLFrameSetElement interface: document.createElement("frameset") must inherit property "onpageshow" with the proper type (11)] - expected: FAIL - - [HTMLFrameSetElement interface: document.createElement("frameset") must inherit property "onpopstate" with the proper type (12)] - expected: FAIL - - [HTMLFrameSetElement interface: document.createElement("frameset") must inherit property "onstorage" with the proper type (13)] - expected: FAIL - - [HTMLFrameSetElement interface: document.createElement("frameset") must inherit property "onunload" with the proper type (14)] - expected: FAIL - [HTMLFrameElement interface: attribute name] expected: FAIL @@ -7674,105 +7092,12 @@ [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onautocompleteerror" with the proper type (96)] expected: FAIL - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "oncancel" with the proper type (98)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onclose" with the proper type (103)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "oncontextmenu" with the proper type (104)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "oncuechange" with the proper type (105)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "ondrag" with the proper type (107)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "ondragend" with the proper type (108)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "ondragenter" with the proper type (109)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "ondragexit" with the proper type (110)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "ondragleave" with the proper type (111)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "ondragover" with the proper type (112)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "ondragstart" with the proper type (113)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "ondrop" with the proper type (114)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "ondurationchange" with the proper type (115)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onended" with the proper type (117)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onfocus" with the proper type (119)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "oninvalid" with the proper type (121)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onloadstart" with the proper type (128)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onmousedown" with the proper type (129)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onmouseenter" with the proper type (130)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onmouseleave" with the proper type (131)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onmousemove" with the proper type (132)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onmouseout" with the proper type (133)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onmouseup" with the proper type (135)] - expected: FAIL - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onmousewheel" with the proper type (136)] expected: FAIL - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onratechange" with the proper type (141)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onscroll" with the proper type (144)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onseeked" with the proper type (145)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onseeking" with the proper type (146)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onselect" with the proper type (147)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onshow" with the proper type (148)] - expected: FAIL - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onsort" with the proper type (149)] expected: FAIL - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onstalled" with the proper type (150)] - expected: FAIL - - [Document interface: document.implementation.createDocument(null, "", null) must inherit property "onvolumechange" with the proper type (155)] - expected: FAIL - [HTMLAnchorElement interface: attribute origin] expected: FAIL @@ -7953,9 +7278,6 @@ [History interface object name] expected: FAIL - [BeforeUnloadEvent interface object name] - expected: FAIL - [ApplicationCache interface object name] expected: FAIL @@ -8172,105 +7494,12 @@ [Document interface: new Document() must inherit property "onautocompleteerror" with the proper type (96)] expected: FAIL - [Document interface: new Document() must inherit property "oncancel" with the proper type (98)] - expected: FAIL - - [Document interface: new Document() must inherit property "onclose" with the proper type (103)] - expected: FAIL - - [Document interface: new Document() must inherit property "oncontextmenu" with the proper type (104)] - expected: FAIL - - [Document interface: new Document() must inherit property "oncuechange" with the proper type (105)] - expected: FAIL - - [Document interface: new Document() must inherit property "ondrag" with the proper type (107)] - expected: FAIL - - [Document interface: new Document() must inherit property "ondragend" with the proper type (108)] - expected: FAIL - - [Document interface: new Document() must inherit property "ondragenter" with the proper type (109)] - expected: FAIL - - [Document interface: new Document() must inherit property "ondragexit" with the proper type (110)] - expected: FAIL - - [Document interface: new Document() must inherit property "ondragleave" with the proper type (111)] - expected: FAIL - - [Document interface: new Document() must inherit property "ondragover" with the proper type (112)] - expected: FAIL - - [Document interface: new Document() must inherit property "ondragstart" with the proper type (113)] - expected: FAIL - - [Document interface: new Document() must inherit property "ondrop" with the proper type (114)] - expected: FAIL - - [Document interface: new Document() must inherit property "ondurationchange" with the proper type (115)] - expected: FAIL - - [Document interface: new Document() must inherit property "onended" with the proper type (117)] - expected: FAIL - - [Document interface: new Document() must inherit property "onfocus" with the proper type (119)] - expected: FAIL - - [Document interface: new Document() must inherit property "oninvalid" with the proper type (121)] - expected: FAIL - - [Document interface: new Document() must inherit property "onloadstart" with the proper type (128)] - expected: FAIL - - [Document interface: new Document() must inherit property "onmousedown" with the proper type (129)] - expected: FAIL - - [Document interface: new Document() must inherit property "onmouseenter" with the proper type (130)] - expected: FAIL - - [Document interface: new Document() must inherit property "onmouseleave" with the proper type (131)] - expected: FAIL - - [Document interface: new Document() must inherit property "onmousemove" with the proper type (132)] - expected: FAIL - - [Document interface: new Document() must inherit property "onmouseout" with the proper type (133)] - expected: FAIL - - [Document interface: new Document() must inherit property "onmouseup" with the proper type (135)] - expected: FAIL - [Document interface: new Document() must inherit property "onmousewheel" with the proper type (136)] expected: FAIL - [Document interface: new Document() must inherit property "onratechange" with the proper type (141)] - expected: FAIL - - [Document interface: new Document() must inherit property "onscroll" with the proper type (144)] - expected: FAIL - - [Document interface: new Document() must inherit property "onseeked" with the proper type (145)] - expected: FAIL - - [Document interface: new Document() must inherit property "onseeking" with the proper type (146)] - expected: FAIL - - [Document interface: new Document() must inherit property "onselect" with the proper type (147)] - expected: FAIL - - [Document interface: new Document() must inherit property "onshow" with the proper type (148)] - expected: FAIL - [Document interface: new Document() must inherit property "onsort" with the proper type (149)] expected: FAIL - [Document interface: new Document() must inherit property "onstalled" with the proper type (150)] - expected: FAIL - - [Document interface: new Document() must inherit property "onvolumechange" with the proper type (155)] - expected: FAIL - [HTMLTableCellElement interface: attribute scope] expected: FAIL diff --git a/tests/wpt/metadata/html/semantics/embedded-content/media-elements/loading-the-media-resource/load-events-networkState.html.ini b/tests/wpt/metadata/html/semantics/embedded-content/media-elements/loading-the-media-resource/load-events-networkState.html.ini index 7ddea2d7d5c..357ef0f07d7 100644 --- a/tests/wpt/metadata/html/semantics/embedded-content/media-elements/loading-the-media-resource/load-events-networkState.html.ini +++ b/tests/wpt/metadata/html/semantics/embedded-content/media-elements/loading-the-media-resource/load-events-networkState.html.ini @@ -1,12 +1,6 @@ [load-events-networkState.html] type: testharness expected: TIMEOUT - [NETWORK_IDLE] - expected: TIMEOUT - - [NETWORK_LOADING] - expected: TIMEOUT [NETWORK_NO_SOURCE] expected: TIMEOUT - diff --git a/tests/wpt/metadata/html/semantics/embedded-content/media-elements/loading-the-media-resource/load-removes-queued-error-event.html.ini b/tests/wpt/metadata/html/semantics/embedded-content/media-elements/loading-the-media-resource/load-removes-queued-error-event.html.ini index 20cdf22dda3..62d34da092e 100644 --- a/tests/wpt/metadata/html/semantics/embedded-content/media-elements/loading-the-media-resource/load-removes-queued-error-event.html.ini +++ b/tests/wpt/metadata/html/semantics/embedded-content/media-elements/loading-the-media-resource/load-removes-queued-error-event.html.ini @@ -2,7 +2,7 @@ type: testharness expected: TIMEOUT [video error event] - expected: TIMEOUT + expected: FAIL [source error event] expected: TIMEOUT diff --git a/tests/wpt/metadata/html/semantics/embedded-content/media-elements/loading-the-media-resource/resource-selection-invoke-set-src-not-in-document.html.ini b/tests/wpt/metadata/html/semantics/embedded-content/media-elements/loading-the-media-resource/resource-selection-invoke-set-src-not-in-document.html.ini deleted file mode 100644 index b4b13f4b436..00000000000 --- a/tests/wpt/metadata/html/semantics/embedded-content/media-elements/loading-the-media-resource/resource-selection-invoke-set-src-not-in-document.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[resource-selection-invoke-set-src-not-in-document.html] - type: testharness - [invoking load by setting src on video not in a document] - expected: FAIL - diff --git a/tests/wpt/metadata/html/semantics/embedded-content/media-elements/loading-the-media-resource/resource-selection-invoke-set-src.html.ini b/tests/wpt/metadata/html/semantics/embedded-content/media-elements/loading-the-media-resource/resource-selection-invoke-set-src.html.ini deleted file mode 100644 index 7ee9523c423..00000000000 --- a/tests/wpt/metadata/html/semantics/embedded-content/media-elements/loading-the-media-resource/resource-selection-invoke-set-src.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[resource-selection-invoke-set-src.html] - type: testharness - [invoking load by setting src] - expected: FAIL - diff --git a/tests/wpt/metadata/html/webappapis/scripting/events/event-handler-attributes-body-window.html.ini b/tests/wpt/metadata/html/webappapis/scripting/events/event-handler-attributes-body-window.html.ini index d297e0c7497..73a352f1139 100644 --- a/tests/wpt/metadata/html/webappapis/scripting/events/event-handler-attributes-body-window.html.ini +++ b/tests/wpt/metadata/html/webappapis/scripting/events/event-handler-attributes-body-window.html.ini @@ -2,43 +2,3 @@ type: testharness [error] expected: FAIL - - [focus] - expected: FAIL - - [scroll] - expected: FAIL - - [afterprint] - expected: FAIL - - [beforeprint] - expected: FAIL - - [beforeunload] - expected: FAIL - - [hashchange] - expected: FAIL - - [languagechange] - expected: FAIL - - [message] - expected: FAIL - - [offline] - expected: FAIL - - [online] - expected: FAIL - - [pagehide] - expected: FAIL - - [pageshow] - expected: FAIL - - [popstate] - expected: FAIL - diff --git a/tests/wpt/mozilla/tests/mozilla/interfaces.html b/tests/wpt/mozilla/tests/mozilla/interfaces.html index 589c961a8ee..ac5d564bef8 100644 --- a/tests/wpt/mozilla/tests/mozilla/interfaces.html +++ b/tests/wpt/mozilla/tests/mozilla/interfaces.html @@ -62,6 +62,7 @@ var ecmaGlobals = [ // IMPORTANT: Do not change the list below without review from a DOM peer! var interfaceNamesInGlobalScope = [ "Attr", + "BeforeUnloadEvent", "Blob", "CanvasGradient", "CanvasRenderingContext2D", |