mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Expose PopStateEvent only in Window
This commit is contained in:
parent
bd5ffd2833
commit
1f8106a1dc
5 changed files with 10 additions and 13 deletions
|
@ -2624,7 +2624,7 @@ impl DocumentMethods for Document {
|
||||||
"pagetransitionevent" =>
|
"pagetransitionevent" =>
|
||||||
Ok(Root::upcast(PageTransitionEvent::new_uninitialized(&self.window))),
|
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))),
|
||||||
"progressevent" =>
|
"progressevent" =>
|
||||||
Ok(Root::upcast(ProgressEvent::new_uninitialized(self.window.upcast()))),
|
Ok(Root::upcast(ProgressEvent::new_uninitialized(self.window.upcast()))),
|
||||||
"storageevent" => {
|
"storageevent" => {
|
||||||
|
|
|
@ -11,7 +11,7 @@ use dom::bindings::js::{MutHeapJSVal, 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 js::jsapi::{HandleValue, JSContext};
|
use js::jsapi::{HandleValue, JSContext};
|
||||||
use js::jsval::JSVal;
|
use js::jsval::JSVal;
|
||||||
use servo_atoms::Atom;
|
use servo_atoms::Atom;
|
||||||
|
@ -32,19 +32,19 @@ impl PopStateEvent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_uninitialized(global: &GlobalScope) -> Root<PopStateEvent> {
|
pub fn new_uninitialized(window: &Window) -> Root<PopStateEvent> {
|
||||||
reflect_dom_object(box PopStateEvent::new_inherited(),
|
reflect_dom_object(box PopStateEvent::new_inherited(),
|
||||||
global,
|
window,
|
||||||
PopStateEventBinding::Wrap)
|
PopStateEventBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(global: &GlobalScope,
|
pub fn new(window: &Window,
|
||||||
type_: Atom,
|
type_: Atom,
|
||||||
bubbles: bool,
|
bubbles: bool,
|
||||||
cancelable: bool,
|
cancelable: bool,
|
||||||
state: HandleValue)
|
state: HandleValue)
|
||||||
-> Root<PopStateEvent> {
|
-> Root<PopStateEvent> {
|
||||||
let ev = PopStateEvent::new_uninitialized(global);
|
let ev = PopStateEvent::new_uninitialized(window);
|
||||||
ev.state.set(state.get());
|
ev.state.set(state.get());
|
||||||
{
|
{
|
||||||
let event = ev.upcast::<Event>();
|
let event = ev.upcast::<Event>();
|
||||||
|
@ -54,11 +54,11 @@ impl PopStateEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
pub fn Constructor(global: &GlobalScope,
|
pub fn Constructor(window: &Window,
|
||||||
type_: DOMString,
|
type_: DOMString,
|
||||||
init: &PopStateEventBinding::PopStateEventInit)
|
init: &PopStateEventBinding::PopStateEventInit)
|
||||||
-> Fallible<Root<PopStateEvent>> {
|
-> Fallible<Root<PopStateEvent>> {
|
||||||
Ok(PopStateEvent::new(global,
|
Ok(PopStateEvent::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-popstateevent-interface
|
// https://html.spec.whatwg.org/multipage/#the-popstateevent-interface
|
||||||
[Constructor(DOMString type, optional PopStateEventInit eventInitDict), Exposed=(Window,Worker)]
|
[Constructor(DOMString type, optional PopStateEventInit eventInitDict),
|
||||||
|
Exposed=Window]
|
||||||
interface PopStateEvent : Event {
|
interface PopStateEvent : Event {
|
||||||
readonly attribute any state;
|
readonly attribute any state;
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,6 +3,3 @@
|
||||||
[The Location interface object should not be exposed.]
|
[The Location interface object should not be exposed.]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[The PopStateEvent interface object should not be exposed.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,6 @@ test_interfaces([
|
||||||
"PerformanceTiming",
|
"PerformanceTiming",
|
||||||
"Plugin",
|
"Plugin",
|
||||||
"PluginArray",
|
"PluginArray",
|
||||||
"PopStateEvent",
|
|
||||||
"ProgressEvent",
|
"ProgressEvent",
|
||||||
"Request",
|
"Request",
|
||||||
"Response",
|
"Response",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue