mirror of
https://github.com/servo/servo.git
synced 2025-07-31 03:00:29 +01:00
Expose PageTransitionEvent only in Window
This commit is contained in:
parent
ba0bf3a066
commit
bd5ffd2833
5 changed files with 10 additions and 13 deletions
|
@ -2622,7 +2622,7 @@ impl DocumentMethods for Document {
|
||||||
"mouseevent" | "mouseevents" =>
|
"mouseevent" | "mouseevents" =>
|
||||||
Ok(Root::upcast(MouseEvent::new_uninitialized(&self.window))),
|
Ok(Root::upcast(MouseEvent::new_uninitialized(&self.window))),
|
||||||
"pagetransitionevent" =>
|
"pagetransitionevent" =>
|
||||||
Ok(Root::upcast(PageTransitionEvent::new_uninitialized(self.window.upcast()))),
|
Ok(Root::upcast(PageTransitionEvent::new_uninitialized(&self.window))),
|
||||||
"popstateevent" =>
|
"popstateevent" =>
|
||||||
Ok(Root::upcast(PopStateEvent::new_uninitialized(self.window.upcast()))),
|
Ok(Root::upcast(PopStateEvent::new_uninitialized(self.window.upcast()))),
|
||||||
"progressevent" =>
|
"progressevent" =>
|
||||||
|
|
|
@ -11,7 +11,7 @@ use dom::bindings::js::Root;
|
||||||
use dom::bindings::reflector::reflect_dom_object;
|
use dom::bindings::reflector::reflect_dom_object;
|
||||||
use dom::bindings::str::DOMString;
|
use dom::bindings::str::DOMString;
|
||||||
use dom::event::Event;
|
use dom::event::Event;
|
||||||
use dom::globalscope::GlobalScope;
|
use dom::window::Window;
|
||||||
use servo_atoms::Atom;
|
use servo_atoms::Atom;
|
||||||
use std::cell::Cell;
|
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(),
|
reflect_dom_object(box PageTransitionEvent::new_inherited(),
|
||||||
global,
|
window,
|
||||||
PageTransitionEventBinding::Wrap)
|
PageTransitionEventBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(global: &GlobalScope,
|
pub fn new(window: &Window,
|
||||||
type_: Atom,
|
type_: Atom,
|
||||||
bubbles: bool,
|
bubbles: bool,
|
||||||
cancelable: bool,
|
cancelable: bool,
|
||||||
persisted: bool)
|
persisted: bool)
|
||||||
-> Root<PageTransitionEvent> {
|
-> Root<PageTransitionEvent> {
|
||||||
let ev = PageTransitionEvent::new_uninitialized(global);
|
let ev = PageTransitionEvent::new_uninitialized(window);
|
||||||
ev.persisted.set(persisted);
|
ev.persisted.set(persisted);
|
||||||
{
|
{
|
||||||
let event = ev.upcast::<Event>();
|
let event = ev.upcast::<Event>();
|
||||||
|
@ -51,11 +51,11 @@ impl PageTransitionEvent {
|
||||||
ev
|
ev
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn Constructor(global: &GlobalScope,
|
pub fn Constructor(window: &Window,
|
||||||
type_: DOMString,
|
type_: DOMString,
|
||||||
init: &PageTransitionEventBinding::PageTransitionEventInit)
|
init: &PageTransitionEventBinding::PageTransitionEventInit)
|
||||||
-> Fallible<Root<PageTransitionEvent>> {
|
-> Fallible<Root<PageTransitionEvent>> {
|
||||||
Ok(PageTransitionEvent::new(global,
|
Ok(PageTransitionEvent::new(window,
|
||||||
Atom::from(type_),
|
Atom::from(type_),
|
||||||
init.parent.bubbles,
|
init.parent.bubbles,
|
||||||
init.parent.cancelable,
|
init.parent.cancelable,
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#the-pagetransitionevent-interface
|
// 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 {
|
interface PageTransitionEvent : Event {
|
||||||
readonly attribute boolean persisted;
|
readonly attribute boolean persisted;
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,6 +6,3 @@
|
||||||
[The PopStateEvent interface object should not be exposed.]
|
[The PopStateEvent interface object should not be exposed.]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[The PageTransitionEvent interface object should not be exposed.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,6 @@ test_interfaces([
|
||||||
"MessageEvent",
|
"MessageEvent",
|
||||||
"MimeType",
|
"MimeType",
|
||||||
"MimeTypeArray",
|
"MimeTypeArray",
|
||||||
"PageTransitionEvent",
|
|
||||||
"Performance",
|
"Performance",
|
||||||
"PerformanceTiming",
|
"PerformanceTiming",
|
||||||
"Plugin",
|
"Plugin",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue