Bug 736058, support createEvent('StorageEvent'), r=sicking
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Sun, 18 Mar 2012 20:55:46 +0200
changeset 89773 58a2cd0203ee663095d387d3f1d12399b6803435
parent 89772 e65d031e513421f5468ff3855600bc8f471fde45
child 89774 cdb48177f24593e0a4b9bc11309d06f6cad4471f
push id7315
push usermbrubeck@mozilla.com
push dateMon, 19 Mar 2012 23:46:39 +0000
treeherdermozilla-inbound@d223f6c586a9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssicking
bugs736058
milestone14.0a1
first release with
nightly linux32
58a2cd0203ee / 14.0a1 / 20120319031122 / files
nightly linux64
58a2cd0203ee / 14.0a1 / 20120319031122 / files
nightly mac
58a2cd0203ee / 14.0a1 / 20120319031122 / files
nightly win32
58a2cd0203ee / 14.0a1 / 20120319031122 / files
nightly win64
58a2cd0203ee / 14.0a1 / 20120319031122 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 736058, support createEvent('StorageEvent'), r=sicking
content/events/src/Makefile.in
content/events/src/nsEventDispatcher.cpp
content/events/test/test_eventctors.html
--- a/content/events/src/Makefile.in
+++ b/content/events/src/Makefile.in
@@ -108,16 +108,17 @@ include $(topsrcdir)/config/rules.mk
 
 LOCAL_INCLUDES	+= \
              -I$(srcdir)/../../base/src \
              -I$(srcdir)/../../html/content/src \
              -I$(srcdir)/../../html/base/src \
              -I$(srcdir)/../../xul/content/src \
              -I$(srcdir)/../../xml/content/src \
              -I$(srcdir)/../../../dom/base \
+             -I$(srcdir)/../../../dom/src/storage \
              -I$(srcdir)/../../../layout/generic \
              -I$(srcdir)/../../../layout/xul/base/src \
              -I$(srcdir)/../../../layout/xul/base/src/tree/src \
              $(NULL)
 
 DEFINES += -D_IMPL_NS_LAYOUT
 
 ifdef MOZ_JSDEBUGGER
--- a/content/events/src/nsEventDispatcher.cpp
+++ b/content/events/src/nsEventDispatcher.cpp
@@ -48,16 +48,17 @@
 #include NEW_H
 #include "nsFixedSizeAllocator.h"
 #include "nsINode.h"
 #include "nsPIDOMWindow.h"
 #include "nsDOMPopStateEvent.h"
 #include "nsDOMHashChangeEvent.h"
 #include "nsFrameLoader.h"
 #include "nsDOMTouchEvent.h"
+#include "nsDOMStorage.h"
 
 #define NS_TARGET_CHAIN_FORCE_CONTENT_DISPATCH  (1 << 0)
 #define NS_TARGET_CHAIN_WANTS_WILL_HANDLE_EVENT (1 << 1)
 #define NS_TARGET_CHAIN_MAY_HAVE_MANAGER        (1 << 2)
 
 static nsEventTargetChainItem* gCachedETCI = nsnull;
 
 // nsEventTargetChainItem represents a single item in the event target chain.
@@ -908,11 +909,16 @@ nsEventDispatcher::CreateEvent(nsPresCon
       nsDOMTouchEvent::PrefEnabled())
     return NS_NewDOMTouchEvent(aDOMEvent, aPresContext, nsnull);
   if (aEventType.LowerCaseEqualsLiteral("hashchangeevent"))
     return NS_NewDOMHashChangeEvent(aDOMEvent, aPresContext, nsnull);
   if (aEventType.LowerCaseEqualsLiteral("customevent"))
     return NS_NewDOMCustomEvent(aDOMEvent, aPresContext, nsnull);
   if (aEventType.LowerCaseEqualsLiteral("mozsmsevent"))
     return NS_NewDOMSmsEvent(aDOMEvent, aPresContext, nsnull);
+  if (aEventType.LowerCaseEqualsLiteral("storageevent")) {
+    NS_ADDREF(*aDOMEvent = static_cast<nsDOMEvent*>(new nsDOMStorageEvent()));
+    return NS_OK;
+  }
+    
 
   return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
 }
--- a/content/events/test/test_eventctors.html
+++ b/content/events/test/test_eventctors.html
@@ -323,16 +323,19 @@ ok(e.bubbles, "Event should bubble!");
 ok(e.cancelable, "Event should be cancelable!");
 is(e.detail, 1, "detail should be 1");
 is(e.view, window, "view should be window");
 document.dispatchEvent(e);
 is(receivedEvent, e, "Wrong event!");
 
 // StorageEvent
 
+e = document.createEvent("StorageEvent");
+ok(e, "Should have created an event!");
+
 try {
   e = new StorageEvent();
 } catch(exp) {
   ex = true;
 }
 ok(ex, "First parameter is required!");
 ex = false;