зеркало из https://github.com/mozilla/gecko-dev.git
Bug 777278 - Implement nsIDOMStorageEvent using event implementation codegen, r=mayhemer
This commit is contained in:
Родитель
420a8918fe
Коммит
99f05d8922
|
@ -866,8 +866,7 @@ nsEventDispatcher::CreateEvent(nsPresContext* aPresContext,
|
|||
if (aEventType.LowerCaseEqualsLiteral("mozsmsevent"))
|
||||
return NS_NewDOMSmsEvent(aDOMEvent, aPresContext, nullptr);
|
||||
if (aEventType.LowerCaseEqualsLiteral("storageevent")) {
|
||||
NS_ADDREF(*aDOMEvent = static_cast<nsDOMEvent*>(new nsDOMStorageEvent()));
|
||||
return NS_OK;
|
||||
return NS_NewDOMStorageEvent(aDOMEvent, aPresContext, nsnull);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1371,8 +1371,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
|||
nsIXPCScriptable::WANT_NEWENUMERATE)
|
||||
NS_DEFINE_CLASSINFO_DATA(StorageItem, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(StorageEvent, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(DOMParser, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
@ -1748,13 +1746,6 @@ NS_DEFINE_EVENT_CTOR(MozWifiConnectionInfoEvent)
|
|||
#include "GeneratedEvents.h"
|
||||
#undef MOZ_GENERATED_EVENT_LIST
|
||||
|
||||
nsresult
|
||||
NS_DOMStorageEventCtor(nsISupports** aInstancePtrResult)
|
||||
{
|
||||
nsDOMStorageEvent* e = new nsDOMStorageEvent();
|
||||
return CallQueryInterface(e, aInstancePtrResult);
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_XMLHttpRequestCtor(nsISupports** aInstancePtrResult)
|
||||
{
|
||||
|
@ -1782,7 +1773,6 @@ static const nsConstructorFuncMapData kConstructorFuncMap[] =
|
|||
NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(Event)
|
||||
NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(UIEvent)
|
||||
NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(MouseEvent)
|
||||
NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(StorageEvent)
|
||||
#ifdef MOZ_B2G_RIL
|
||||
NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(MozWifiStatusChangeEvent)
|
||||
NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(MozWifiConnectionInfoEvent)
|
||||
|
@ -3930,11 +3920,6 @@ nsDOMClassInfo::Init()
|
|||
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_NO_CLASS_IF(DOMParser, nsIDOMParser)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMParser)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMParserJS)
|
||||
|
|
|
@ -341,7 +341,6 @@ DOMCI_CLASS(XPathResult)
|
|||
DOMCI_CLASS(StorageObsolete)
|
||||
DOMCI_CLASS(Storage)
|
||||
DOMCI_CLASS(StorageItem)
|
||||
DOMCI_CLASS(StorageEvent)
|
||||
|
||||
// DOMParser, XMLSerializer
|
||||
DOMCI_CLASS(DOMParser)
|
||||
|
|
|
@ -197,7 +197,7 @@
|
|||
#include "nsFrameLoader.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsXPCOMCID.h"
|
||||
|
||||
#include "GeneratedEvents.h"
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
#include "mozIThirdPartyUtil.h"
|
||||
|
||||
|
@ -9016,7 +9016,8 @@ nsGlobalWindow::CloneStorageEvent(const nsAString& aType,
|
|||
aEvent->GetUrl(url);
|
||||
aEvent->GetStorageArea(getter_AddRefs(storageArea));
|
||||
|
||||
aEvent = new nsDOMStorageEvent();
|
||||
NS_NewDOMStorageEvent(getter_AddRefs(domEvent), nsnull, nsnull);
|
||||
aEvent = do_QueryInterface(domEvent);
|
||||
return aEvent->InitStorageEvent(aType, canBubble, cancelable,
|
||||
key, oldValue, newValue,
|
||||
url, storageArea);
|
||||
|
|
|
@ -38,6 +38,7 @@ using mozilla::dom::ContentChild;
|
|||
#include "nsThreadUtils.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "DictionaryHelpers.h"
|
||||
#include "GeneratedEvents.h"
|
||||
|
||||
// calls FlushAndDeleteTemporaryTables(false)
|
||||
#define NS_DOMSTORAGE_FLUSH_TIMER_TOPIC "domstorage-flush-timer"
|
||||
|
@ -1893,7 +1894,9 @@ nsDOMStorage2::BroadcastChangeNotification(const nsSubstring &aKey,
|
|||
const nsSubstring &aNewValue)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDOMStorageEvent> event = new nsDOMStorageEvent();
|
||||
nsCOMPtr<nsIDOMEvent> domEvent;
|
||||
NS_NewDOMStorageEvent(getter_AddRefs(domEvent), nsnull, nsnull);
|
||||
nsCOMPtr<nsIDOMStorageEvent> event = do_QueryInterface(domEvent);
|
||||
rv = event->InitStorageEvent(NS_LITERAL_STRING("storage"),
|
||||
false,
|
||||
false,
|
||||
|
@ -2079,97 +2082,3 @@ nsDOMStorageItem::ToString(nsAString& aStr)
|
|||
return GetValue(aStr);
|
||||
}
|
||||
|
||||
// Cycle collection implementation for nsDOMStorageEvent
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMStorageEvent)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsDOMStorageEvent, nsDOMEvent)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mStorageArea)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsDOMStorageEvent, nsDOMEvent)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mStorageArea)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsDOMStorageEvent, nsDOMEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDOMStorageEvent, nsDOMEvent)
|
||||
|
||||
DOMCI_DATA(StorageEvent, nsDOMStorageEvent)
|
||||
|
||||
// QueryInterface implementation for nsDOMStorageEvent
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMStorageEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMStorageEvent)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(StorageEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
|
||||
|
||||
|
||||
/* readonly attribute DOMString key; */
|
||||
NS_IMETHODIMP nsDOMStorageEvent::GetKey(nsAString & aKey)
|
||||
{
|
||||
aKey = mKey;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute DOMString oldValue; */
|
||||
NS_IMETHODIMP nsDOMStorageEvent::GetOldValue(nsAString & aOldValue)
|
||||
{
|
||||
aOldValue = mOldValue;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute DOMString newValue; */
|
||||
NS_IMETHODIMP nsDOMStorageEvent::GetNewValue(nsAString & aNewValue)
|
||||
{
|
||||
aNewValue = mNewValue;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute DOMString url; */
|
||||
NS_IMETHODIMP nsDOMStorageEvent::GetUrl(nsAString & aUrl)
|
||||
{
|
||||
aUrl = mUrl;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMStorage storageArea; */
|
||||
NS_IMETHODIMP nsDOMStorageEvent::GetStorageArea(nsIDOMStorage * *aStorageArea)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aStorageArea);
|
||||
|
||||
NS_IF_ADDREF(*aStorageArea = mStorageArea);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void initStorageEvent (in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString keyArg, in DOMString oldValueArg, in DOMString newValueArg, in DOMString urlArg, in nsIDOMStorage storageAreaArg); */
|
||||
NS_IMETHODIMP nsDOMStorageEvent::InitStorageEvent(const nsAString & typeArg,
|
||||
bool canBubbleArg,
|
||||
bool cancelableArg,
|
||||
const nsAString & keyArg,
|
||||
const nsAString & oldValueArg,
|
||||
const nsAString & newValueArg,
|
||||
const nsAString & urlArg,
|
||||
nsIDOMStorage *storageAreaArg)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
rv = InitEvent(typeArg, canBubbleArg, cancelableArg);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mKey = keyArg;
|
||||
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;
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -500,37 +500,6 @@ protected:
|
|||
nsRefPtr<DOMStorageBase> mStorage;
|
||||
};
|
||||
|
||||
class nsDOMStorageEvent : public nsDOMEvent,
|
||||
public nsIDOMStorageEvent
|
||||
{
|
||||
public:
|
||||
nsDOMStorageEvent()
|
||||
: nsDOMEvent(nullptr, nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~nsDOMStorageEvent()
|
||||
{
|
||||
}
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewDOMStorage2(nsISupports* aOuter, REFNSIID aIID, void** aResult);
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ dictionaries = [
|
|||
[ 'MouseEventInit', 'nsIDOMMouseEvent.idl' ],
|
||||
[ 'IDBObjectStoreParameters', 'nsIIDBDatabase.idl' ],
|
||||
[ 'IDBIndexParameters', 'nsIIDBObjectStore.idl' ],
|
||||
[ 'StorageEventInit', 'nsIDOMStorageEvent.idl' ],
|
||||
[ 'BlobPropertyBag', 'nsIDOMFile.idl' ],
|
||||
[ 'MutationObserverInit', 'nsIDOMMutationObserver.idl' ],
|
||||
[ 'WifiConnectionInfoEventInit', 'nsIWifiEventInits.idl' ],
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
<name>Init dictionary for the event constructor. """
|
||||
|
||||
simple_events = [
|
||||
'StorageEvent',
|
||||
'DeviceProximityEvent',
|
||||
'MozSettingsEvent',
|
||||
'UserProximityEvent',
|
||||
|
|
Загрузка…
Ссылка в новой задаче