aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/storageevent.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/storageevent.rs')
-rw-r--r--components/script/dom/storageevent.rs43
1 files changed, 39 insertions, 4 deletions
diff --git a/components/script/dom/storageevent.rs b/components/script/dom/storageevent.rs
index a50c1267585..b1da211f1c1 100644
--- a/components/script/dom/storageevent.rs
+++ b/components/script/dom/storageevent.rs
@@ -8,13 +8,14 @@ use crate::dom::bindings::codegen::Bindings::StorageEventBinding;
use crate::dom::bindings::codegen::Bindings::StorageEventBinding::StorageEventMethods;
use crate::dom::bindings::error::Fallible;
use crate::dom::bindings::inheritance::Castable;
-use crate::dom::bindings::reflector::reflect_dom_object;
+use crate::dom::bindings::reflector::reflect_dom_object2;
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
use crate::dom::bindings::str::{DOMString, USVString};
use crate::dom::event::{Event, EventBubbles, EventCancelable};
use crate::dom::storage::Storage;
use crate::dom::window::Window;
use dom_struct::dom_struct;
+use js::rust::HandleObject;
use servo_atoms::Atom;
#[dom_struct]
@@ -47,9 +48,14 @@ impl StorageEvent {
}
pub fn new_uninitialized(window: &Window, url: DOMString) -> DomRoot<StorageEvent> {
- reflect_dom_object(
+ Self::new_uninitialized_with_proto(window, None, url)
+ }
+
+ fn new_uninitialized_with_proto(window: &Window, proto: Option<HandleObject>, url: DOMString) -> DomRoot<StorageEvent> {
+ reflect_dom_object2(
Box::new(StorageEvent::new_inherited(None, None, None, url, None)),
window,
+ proto,
)
}
@@ -64,7 +70,33 @@ impl StorageEvent {
url: DOMString,
storageArea: Option<&Storage>,
) -> DomRoot<StorageEvent> {
- let ev = reflect_dom_object(
+ Self::new_with_proto(
+ global,
+ None,
+ type_,
+ bubbles,
+ cancelable,
+ key,
+ oldValue,
+ newValue,
+ url,
+ storageArea,
+ )
+ }
+
+ fn new_with_proto(
+ global: &Window,
+ proto: Option<HandleObject>,
+ type_: Atom,
+ bubbles: EventBubbles,
+ cancelable: EventCancelable,
+ key: Option<DOMString>,
+ oldValue: Option<DOMString>,
+ newValue: Option<DOMString>,
+ url: DOMString,
+ storageArea: Option<&Storage>,
+ ) -> DomRoot<StorageEvent> {
+ let ev = reflect_dom_object2(
Box::new(StorageEvent::new_inherited(
key,
oldValue,
@@ -73,6 +105,7 @@ impl StorageEvent {
storageArea,
)),
global,
+ proto,
);
{
let event = ev.upcast::<Event>();
@@ -83,6 +116,7 @@ impl StorageEvent {
pub fn Constructor(
global: &Window,
+ proto: Option<HandleObject>,
type_: DOMString,
init: &StorageEventBinding::StorageEventInit,
) -> Fallible<DomRoot<StorageEvent>> {
@@ -93,8 +127,9 @@ impl StorageEvent {
let storageArea = init.storageArea.as_deref();
let bubbles = EventBubbles::from(init.parent.bubbles);
let cancelable = EventCancelable::from(init.parent.cancelable);
- let event = StorageEvent::new(
+ let event = StorageEvent::new_with_proto(
global,
+ proto,
Atom::from(type_),
bubbles,
cancelable,