author | Olli Pettay <Olli.Pettay@helsinki.fi> |
Thu, 08 Mar 2012 23:27:05 +0200 | |
changeset 88518 | 08809a43e082ca2b6d00bccd352b873bda140aba |
parent 88517 | 9ddf749edcf2c4d7482829329beb63e9134b2464 |
child 88519 | db2954a4c62f71ebd57ebecbc225f6910b1d9367 |
child 88592 | 2ea21a51d22a43b5228d85e1c4a8a0a814c0664f |
push id | 22204 |
push user | opettay@mozilla.com |
push date | Thu, 08 Mar 2012 21:36:13 +0000 |
treeherder | mozilla-central@08809a43e082 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | sicking, kyle |
bugs | 730891 |
milestone | 13.0a1 |
first release with | nightly linux32
08809a43e082
/
13.0a1
/
20120309031057
/
files
nightly linux64
08809a43e082
/
13.0a1
/
20120309031057
/
files
nightly mac
08809a43e082
/
13.0a1
/
20120309031057
/
files
nightly win32
08809a43e082
/
13.0a1
/
20120309031057
/
files
nightly win64
08809a43e082
/
13.0a1
/
20120309031057
/
files
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
releases | nightly linux32
13.0a1
/
20120309031057
/
pushlog to previous
nightly linux64
13.0a1
/
20120309031057
/
pushlog to previous
nightly mac
13.0a1
/
20120309031057
/
pushlog to previous
nightly win32
13.0a1
/
20120309031057
/
pushlog to previous
nightly win64
13.0a1
/
20120309031057
/
pushlog to previous
|
--- a/content/events/test/test_eventctors.html +++ b/content/events/test/test_eventctors.html @@ -321,20 +321,58 @@ ok(e.type, "hello", "Wrong event type!") ok(!e.isTrusted, "Event shouldn't be trusted!"); 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!"); -// UIEvent +// StorageEvent try { - e = new UIEvent(); + e = new StorageEvent(); +} catch(exp) { + ex = true; +} +ok(ex, "First parameter is required!"); +ex = false; + +e = new StorageEvent("hello"); +ok(e.type, "hello", "Wrong event type!"); +ok(!e.isTrusted, "Event shouldn't be trusted!"); +ok(!e.bubbles, "Event shouldn't bubble!"); +ok(!e.cancelable, "Event shouldn't be cancelable!"); +is(e.key, "", "key should be ''"); +is(e.oldValue, null, "oldValue should be null"); +is(e.newValue, null, "newValue should be null"); +is(e.url, "", "url should be ''"); +document.dispatchEvent(e); +is(receivedEvent, e, "Wrong event!"); + +e = new StorageEvent("hello", + { bubbles: true, cancelable: true, key: "key", + oldValue: "oldValue", newValue: "newValue", url: "url", + storageArea: localStorage }); +ok(e.type, "hello", "Wrong event type!"); +ok(!e.isTrusted, "Event shouldn't be trusted!"); +ok(e.bubbles, "Event should bubble!"); +ok(e.cancelable, "Event should be cancelable!"); +is(e.key, "key", "Wrong value"); +is(e.oldValue, "oldValue", "Wrong value"); +is(e.newValue, "newValue", "Wrong value"); +is(e.url, "url", "Wrong value"); +is(e.storageArea, localStorage, "Wrong value"); +document.dispatchEvent(e); +is(receivedEvent, e, "Wrong event!"); + +// MouseEvent + +try { + e = new MouseEvent(); } catch(exp) { ex = true; } ok(ex, "First parameter is required!"); ex = false; e = new MouseEvent("hello"); ok(e.type, "hello", "Wrong event type!");
--- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -1670,16 +1670,22 @@ static const nsContractIDMapData kConstr NS_DEFINE_EVENT_CTOR(Event) NS_DEFINE_EVENT_CTOR(CustomEvent) NS_DEFINE_EVENT_CTOR(PopStateEvent) NS_DEFINE_EVENT_CTOR(HashChangeEvent) NS_DEFINE_EVENT_CTOR(PageTransitionEvent) NS_DEFINE_EVENT_CTOR(CloseEvent) NS_DEFINE_EVENT_CTOR(UIEvent) NS_DEFINE_EVENT_CTOR(MouseEvent) +nsresult +NS_DOMStorageEventCtor(nsISupports** aInstancePtrResult) +{ + nsDOMStorageEvent* e = new nsDOMStorageEvent(); + return CallQueryInterface(e, aInstancePtrResult); +} struct nsConstructorFuncMapData { PRInt32 mDOMClassInfoID; nsDOMConstructorFunc mConstructorFunc; }; #define NS_DEFINE_CONSTRUCTOR_FUNC_DATA(_class, _func) \ @@ -1695,16 +1701,17 @@ static const nsConstructorFuncMapData kC NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(Event) NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(CustomEvent) NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(PopStateEvent) NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(HashChangeEvent) NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(PageTransitionEvent) NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(CloseEvent) NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(UIEvent) NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(MouseEvent) + NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(StorageEvent) NS_DEFINE_CONSTRUCTOR_FUNC_DATA(MozSmsFilter, sms::SmsFilter::NewSmsFilter) }; nsIXPConnect *nsDOMClassInfo::sXPConnect = nsnull; nsIScriptSecurityManager *nsDOMClassInfo::sSecMan = nsnull; bool nsDOMClassInfo::sIsInitialized = false; bool nsDOMClassInfo::sDisableDocumentAllSupport = false; bool nsDOMClassInfo::sDisableGlobalScopePollutionSupport = false; @@ -3890,16 +3897,17 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_BEGIN(StorageItem, nsIDOMStorageItem) DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageItem) DOM_CLASSINFO_MAP_ENTRY(nsIDOMToString) DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_BEGIN(StorageEvent, nsIDOMStorageEvent) DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageEvent) + DOM_CLASSINFO_EVENT_MAP_ENTRIES DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_BEGIN(StorageEventObsolete, nsIDOMStorageEventObsolete) DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageEventObsolete) DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(DOMParser, nsIDOMParser) DOM_CLASSINFO_MAP_ENTRY(nsIDOMParser)
--- a/dom/interfaces/storage/nsIDOMStorageEvent.idl +++ b/dom/interfaces/storage/nsIDOMStorageEvent.idl @@ -89,8 +89,18 @@ interface nsIDOMStorageEvent : nsIDOMEve in boolean canBubbleArg, in boolean cancelableArg, in DOMString keyArg, in DOMString oldValueArg, in DOMString newValueArg, in DOMString urlArg, in nsIDOMStorage storageAreaArg); }; + +[scriptable, uuid(6335e5b5-13ce-4c8a-b452-5c5895f4e90e)] +interface nsIStorageEventInit : nsIEventInit +{ + attribute DOMString key; + attribute DOMString oldValue; + attribute DOMString newValue; + attribute DOMString url; + attribute nsIDOMStorage storageArea; +};
--- a/dom/src/storage/nsDOMStorage.cpp +++ b/dom/src/storage/nsDOMStorage.cpp @@ -69,16 +69,17 @@ using mozilla::dom::StorageChild; #include "nsIOfflineCacheUpdate.h" #include "nsIJSContextStack.h" #include "nsIPrivateBrowsingService.h" #include "nsDOMString.h" #include "nsNetCID.h" #include "mozilla/Preferences.h" #include "nsThreadUtils.h" #include "mozilla/Telemetry.h" +#include "DictionaryHelpers.h" // calls FlushAndDeleteTemporaryTables(false) #define NS_DOMSTORAGE_FLUSH_TIMER_TOPIC "domstorage-flush-timer" // calls FlushAndDeleteTemporaryTables(true) #define NS_DOMSTORAGE_FLUSH_FORCE_TOPIC "domstorage-flush-force" using namespace mozilla; @@ -2385,16 +2386,29 @@ NS_IMETHODIMP nsDOMStorageEvent::InitSto mOldValue = oldValueArg; mNewValue = newValueArg; mUrl = urlArg; mStorageArea = storageAreaArg; return NS_OK; } +nsresult +nsDOMStorageEvent::InitFromCtor(const nsAString& aType, + JSContext* aCx, jsval* aVal) +{ + mozilla::dom::StorageEventInit d; + d.oldValue.SetIsVoid(true); + d.newValue.SetIsVoid(true); + nsresult rv = d.Init(aCx, aVal); + NS_ENSURE_SUCCESS(rv, rv); + return InitStorageEvent(aType, d.bubbles, d.cancelable, d.key, d.oldValue, + d.newValue, d.url, d.storageArea); +} + // Obsolete globalStorage event DOMCI_DATA(StorageEventObsolete, nsDOMStorageEventObsolete) // QueryInterface implementation for nsDOMStorageEventObsolete NS_INTERFACE_MAP_BEGIN(nsDOMStorageEventObsolete) NS_INTERFACE_MAP_ENTRY(nsIDOMStorageEventObsolete) NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(StorageEventObsolete)
--- a/dom/src/storage/nsDOMStorage.h +++ b/dom/src/storage/nsDOMStorage.h @@ -595,16 +595,18 @@ public: nsresult Init(); NS_DECL_ISUPPORTS_INHERITED NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMStorageEvent, nsDOMEvent) NS_DECL_NSIDOMSTORAGEEVENT NS_FORWARD_NSIDOMEVENT(nsDOMEvent::) + virtual nsresult InitFromCtor(const nsAString& aType, + JSContext* aCx, jsval* aVal); protected: nsString mKey; nsString mOldValue; nsString mNewValue; nsString mUrl; nsCOMPtr<nsIDOMStorage> mStorageArea; };
--- a/js/xpconnect/src/dictionary_helper_gen.conf +++ b/js/xpconnect/src/dictionary_helper_gen.conf @@ -4,17 +4,18 @@ dictionaries = [ [ 'nsICustomEventInit', 'nsIDOMCustomEvent.idl' ], [ 'nsIPopStateEventInit', 'nsIDOMPopStateEvent.idl' ], [ 'nsIHashChangeEventInit', 'nsIDOMHashChangeEvent.idl' ], [ 'nsIPageTransitionEventInit', 'nsIDOMPageTransitionEvent.idl' ], [ 'nsICloseEventInit', 'nsIDOMCloseEvent.idl' ], [ 'nsIUIEventInit', 'nsIDOMUIEvent.idl' ], [ 'nsIMouseEventInit', 'nsIDOMMouseEvent.idl' ], [ 'nsIIDBObjectStoreParameters', 'nsIIDBDatabase.idl' ], - [ 'nsIIDBIndexParameters', 'nsIIDBObjectStore.idl' ] + [ 'nsIIDBIndexParameters', 'nsIIDBObjectStore.idl' ], + [ 'nsIStorageEventInit', 'nsIDOMStorageEvent.idl' ] ] # include file names special_includes = [ 'nsContentUtils.h', 'nsIXPConnect.h' ]
--- a/js/xpconnect/src/dictionary_helper_gen.py +++ b/js/xpconnect/src/dictionary_helper_gen.py @@ -315,33 +315,18 @@ def write_header(iface, fd): for member in iface.members: if isinstance(member, xpidl.Attribute): attributes.append(member) fd.write("class %s" % dict_name(iface.name)) if iface.base != "nsISupports": fd.write(" : public %s" % dict_name(iface.base)) fd.write("\n{\npublic:\n") - fd.write(" %s()" % dict_name(iface.name)) - - if iface.base != "nsISupports" or len(attributes) > 0: - fd.write(" :\n") - - if iface.base != "nsISupports": - fd.write(" %s()" % dict_name(iface.base)) - if len(attributes) > 0: - fd.write(",\n") - - for i in range(len(attributes)): - fd.write(" %s(%s)" % (attributes[i].name, init_value(attributes[i]))) - if i < (len(attributes) - 1): - fd.write(",") - fd.write("\n") - - fd.write(" {}\n\n") + fd.write(" %s();\n" % dict_name(iface.name)) + fd.write(" ~%s();\n\n" % dict_name(iface.name)) fd.write(" // If aCx or aVal is null, NS_OK is returned and \n" " // dictionary will use the default values. \n" " nsresult Init(JSContext* aCx, const jsval* aVal);\n") fd.write("\n") for member in attributes: @@ -350,16 +335,35 @@ def write_header(iface, fd): fd.write("};\n\n") def write_cpp(iface, fd): attributes = [] for member in iface.members: if isinstance(member, xpidl.Attribute): attributes.append(member) + fd.write("%s::%s()" % (dict_name(iface.name), dict_name(iface.name))) + + if iface.base != "nsISupports" or len(attributes) > 0: + fd.write(" :\n") + + if iface.base != "nsISupports": + fd.write(" %s()" % dict_name(iface.base)) + if len(attributes) > 0: + fd.write(",\n") + + for i in range(len(attributes)): + fd.write(" %s(%s)" % (attributes[i].name, init_value(attributes[i]))) + if i < (len(attributes) - 1): + fd.write(",") + fd.write("\n") + + fd.write(" {}\n\n") + fd.write("%s::~%s() {}\n\n" % (dict_name(iface.name), dict_name(iface.name))) + fd.write("static nsresult\n%s_InitInternal(%s& aDict, %s* aIfaceObject, JSContext* aCx, JSObject* aObj)\n" % (dict_name(iface.name), dict_name(iface.name), iface.name)) fd.write("{\n") if iface.base != "nsISupports": fd.write(" nsresult rv = %s_InitInternal(aDict, aIfaceObject, aCx, aObj);\n" % dict_name(iface.base)) fd.write(" NS_ENSURE_SUCCESS(rv, rv);\n")