servo: Merge #10831 - "storageevent" argument for Document::createEvent (from mskrzypkows:storageevent); r=Ms2ger
authorMaciej Skrzypkowski <m.skrzypkows@samsung.com>
Mon, 25 Apr 2016 03:44:24 -0700
changeset 338615 15dfa0b3a848b4a48a25c9e1d253979a288f6874
parent 338614 338b3f6d0b64202b72c1b628f4efa2f17412101e
child 338616 cd28a3249a6a5a876806f6d10ba8702dec6f6000
push id31307
push usergszorc@mozilla.com
push dateSat, 04 Feb 2017 00:59:06 +0000
treeherdermozilla-central@94079d43835f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMs2ger
servo: Merge #10831 - "storageevent" argument for Document::createEvent (from mskrzypkows:storageevent); r=Ms2ger Fixes #10736 Source-Repo: https://github.com/servo/servo Source-Revision: 8bf732e633cc63dd56a8b6a9f503d694e4b569fe
servo/components/script/dom/document.rs
servo/components/script/dom/storageevent.rs
--- a/servo/components/script/dom/document.rs
+++ b/servo/components/script/dom/document.rs
@@ -65,16 +65,17 @@ use dom::location::Location;
 use dom::messageevent::MessageEvent;
 use dom::mouseevent::MouseEvent;
 use dom::node::{self, CloneChildrenFlag, Node, NodeDamage, window_from_node};
 use dom::nodeiterator::NodeIterator;
 use dom::nodelist::NodeList;
 use dom::processinginstruction::ProcessingInstruction;
 use dom::range::Range;
 use dom::servohtmlparser::{ParserRoot, ParserRef, MutNullableParserField};
+use dom::storageevent::StorageEvent;
 use dom::stylesheetlist::StyleSheetList;
 use dom::text::Text;
 use dom::touch::Touch;
 use dom::touchevent::TouchEvent;
 use dom::touchlist::TouchList;
 use dom::treewalker::TreeWalker;
 use dom::uievent::UIEvent;
 use dom::webglcontextevent::WebGLContextEvent;
@@ -2166,16 +2167,18 @@ impl DocumentMethods for Document {
                     TouchEvent::new_uninitialized(&self.window,
                         &TouchList::new(&self.window, &[]),
                         &TouchList::new(&self.window, &[]),
                         &TouchList::new(&self.window, &[]),
                     )
                 )),
             "webglcontextevent" =>
                 Ok(Root::upcast(WebGLContextEvent::new_uninitialized(GlobalRef::Window(&self.window)))),
+            "storageevent" =>
+                Ok(Root::upcast(StorageEvent::new_uninitialized(&self.window, self.URL()))),
             _ =>
                 Err(Error::NotSupported),
         }
     }
 
     // https://html.spec.whatwg.org/multipage/#dom-document-lastmodified
     fn LastModified(&self) -> DOMString {
         match self.last_modified {
--- a/servo/components/script/dom/storageevent.rs
+++ b/servo/components/script/dom/storageevent.rs
@@ -7,16 +7,17 @@ use dom::bindings::codegen::Bindings::St
 use dom::bindings::codegen::Bindings::StorageEventBinding::{StorageEventMethods};
 use dom::bindings::error::Fallible;
 use dom::bindings::global::GlobalRef;
 use dom::bindings::inheritance::Castable;
 use dom::bindings::js::{JS, MutNullableHeap, Root, RootedReference};
 use dom::bindings::reflector::reflect_dom_object;
 use dom::event::{Event, EventBubbles, EventCancelable};
 use dom::storage::Storage;
+use dom::window::Window;
 use string_cache::Atom;
 use util::str::DOMString;
 
 #[dom_struct]
 pub struct StorageEvent {
     event: Event,
     key: Option<DOMString>,
     oldValue: Option<DOMString>,
@@ -37,16 +38,23 @@ impl StorageEvent {
             key: key,
             oldValue: oldValue,
             newValue: newValue,
             url: url,
             storageArea: MutNullableHeap::new(storageArea)
         }
     }
 
+    pub fn new_uninitialized(window: &Window,
+                             url: DOMString) -> Root<StorageEvent> {
+        reflect_dom_object(box StorageEvent::new_inherited(None, None, None, url, None),
+                           GlobalRef::Window(window),
+                           StorageEventBinding::Wrap)
+    }
+
     pub fn new(global: GlobalRef,
                type_: Atom,
                bubbles: EventBubbles,
                cancelable: EventCancelable,
                key: Option<DOMString>,
                oldValue: Option<DOMString>,
                newValue: Option<DOMString>,
                url: DOMString,