Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various events-related improvements #15133

Merged
merged 10 commits into from Jan 21, 2017
Next

Expose BeforeUnloadEvent only in Window

  • Loading branch information
nox committed Jan 21, 2017
commit e3980e6235a870506844becedb3493aba54b1c7c
@@ -13,7 +13,7 @@ use dom::bindings::js::Root;
use dom::bindings::reflector::reflect_dom_object;
use dom::bindings::str::DOMString;
use dom::event::{Event, EventBubbles, EventCancelable};
use dom::globalscope::GlobalScope;
use dom::window::Window;
use servo_atoms::Atom;

// https://html.spec.whatwg.org/multipage/#beforeunloadevent
@@ -31,17 +31,17 @@ impl BeforeUnloadEvent {
}
}

pub fn new_uninitialized(global: &GlobalScope) -> Root<BeforeUnloadEvent> {
pub fn new_uninitialized(window: &Window) -> Root<BeforeUnloadEvent> {
reflect_dom_object(box BeforeUnloadEvent::new_inherited(),
global,
window,
BeforeUnloadEventBinding::Wrap)
}

pub fn new(global: &GlobalScope,
pub fn new(window: &Window,
type_: Atom,
bubbles: EventBubbles,
cancelable: EventCancelable) -> Root<BeforeUnloadEvent> {
let ev = BeforeUnloadEvent::new_uninitialized(global);
let ev = BeforeUnloadEvent::new_uninitialized(window);
{
let event = ev.upcast::<Event>();
event.init_event(type_, bool::from(bubbles),
@@ -6,7 +6,7 @@
* https://html.spec.whatwg.org/multipage/#beforeunloadevent
*/

[Exposed=(Window,Worker)]
[Exposed=Window]
interface BeforeUnloadEvent : Event {
attribute DOMString returnValue;
};
@@ -7,7 +7,6 @@ importScripts("interfaces.js");

// IMPORTANT: Do not change the list below without review from a DOM peer!
test_interfaces([
"BeforeUnloadEvent",
"Blob",
"CloseEvent",
"CSSStyleDeclaration",
@@ -16,6 +16,7 @@ var unexpected = [
"DrawingStyle",
"CanvasGradient",
"CanvasPattern",
"BeforeUnloadEvent",
"PopStateEvent",
"HashChangeEvent",
"PageTransitionEvent",
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.