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

Expose PageTransitionEvent only in Window

  • Loading branch information
nox committed Jan 21, 2017
commit bd5ffd2833f5fd37a40409f39e4cf4de17ba3bf1
@@ -2622,7 +2622,7 @@ impl DocumentMethods for Document {
"mouseevent" | "mouseevents" =>
Ok(Root::upcast(MouseEvent::new_uninitialized(&self.window))),
"pagetransitionevent" =>
Ok(Root::upcast(PageTransitionEvent::new_uninitialized(self.window.upcast()))),
Ok(Root::upcast(PageTransitionEvent::new_uninitialized(&self.window))),
"popstateevent" =>
Ok(Root::upcast(PopStateEvent::new_uninitialized(self.window.upcast()))),
"progressevent" =>
@@ -11,7 +11,7 @@ use dom::bindings::js::Root;
use dom::bindings::reflector::reflect_dom_object;
use dom::bindings::str::DOMString;
use dom::event::Event;
use dom::globalscope::GlobalScope;
use dom::window::Window;
use servo_atoms::Atom;
use std::cell::Cell;

@@ -30,19 +30,19 @@ impl PageTransitionEvent {
}
}

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

pub fn new(global: &GlobalScope,
pub fn new(window: &Window,
type_: Atom,
bubbles: bool,
cancelable: bool,
persisted: bool)
-> Root<PageTransitionEvent> {
let ev = PageTransitionEvent::new_uninitialized(global);
let ev = PageTransitionEvent::new_uninitialized(window);
ev.persisted.set(persisted);
{
let event = ev.upcast::<Event>();
@@ -51,11 +51,11 @@ impl PageTransitionEvent {
ev
}

pub fn Constructor(global: &GlobalScope,
pub fn Constructor(window: &Window,
type_: DOMString,
init: &PageTransitionEventBinding::PageTransitionEventInit)
-> Fallible<Root<PageTransitionEvent>> {
Ok(PageTransitionEvent::new(global,
Ok(PageTransitionEvent::new(window,
Atom::from(type_),
init.parent.bubbles,
init.parent.cancelable,
@@ -3,7 +3,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

// https://html.spec.whatwg.org/multipage/#the-pagetransitionevent-interface
[Constructor(DOMString type, optional PageTransitionEventInit eventInitDict), Exposed=(Window,Worker)]
[Constructor(DOMString type, optional PageTransitionEventInit eventInitDict),
Exposed=Window]
interface PageTransitionEvent : Event {
readonly attribute boolean persisted;
};
@@ -6,6 +6,3 @@
[The PopStateEvent interface object should not be exposed.]
expected: FAIL

[The PageTransitionEvent interface object should not be exposed.]
expected: FAIL

@@ -37,7 +37,6 @@ test_interfaces([
"MessageEvent",
"MimeType",
"MimeTypeArray",
"PageTransitionEvent",
"Performance",
"PerformanceTiming",
"Plugin",
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.