mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Bug 779864 - onchange notifications of DeviceStorage should use code generator. r=smaug
This commit is contained in:
parent
e24b224aa5
commit
990ea4cf4e
@ -420,7 +420,6 @@
|
||||
|
||||
// Device Storage
|
||||
#include "nsIDOMDeviceStorage.h"
|
||||
#include "nsIDOMDeviceStorageChangeEvent.h"
|
||||
#include "nsIDOMDeviceStorageCursor.h"
|
||||
|
||||
// Drag and drop
|
||||
@ -1440,9 +1439,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
||||
NS_DEFINE_CLASSINFO_DATA(DeviceStorage, nsEventTargetSH,
|
||||
EVENTTARGET_SCRIPTABLE_FLAGS)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(DeviceStorageChangeEvent, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(DeviceStorageCursor, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
@ -4043,11 +4039,6 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(DeviceStorageChangeEvent, nsIDOMDeviceStorageChangeEvent)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDeviceStorageChangeEvent)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEvent)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(DeviceStorageCursor, nsIDOMDeviceStorageCursor)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDeviceStorageCursor)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMRequest)
|
||||
|
@ -385,7 +385,6 @@ DOMCI_CLASS(DataContainerEvent)
|
||||
DOMCI_CLASS(MessageEvent)
|
||||
|
||||
DOMCI_CLASS(DeviceStorage)
|
||||
DOMCI_CLASS(DeviceStorageChangeEvent)
|
||||
DOMCI_CLASS(DeviceStorageCursor)
|
||||
|
||||
// Geolocation
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "nsCRT.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "GeneratedEvents.h"
|
||||
|
||||
// Microsoft's API Name hackery sucks
|
||||
#undef CreateEvent
|
||||
@ -438,92 +439,6 @@ jsval StringToJsval(nsPIDOMWindow* aWindow, nsAString& aString)
|
||||
return result;
|
||||
}
|
||||
|
||||
class nsDOMDeviceStorageChangeEvent : public nsDOMEvent, public nsIDOMDeviceStorageChangeEvent
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_FORWARD_NSIDOMEVENT(nsDOMEvent::)
|
||||
NS_DECL_NSIDOMDEVICESTORAGECHANGEEVENT
|
||||
|
||||
nsDOMDeviceStorageChangeEvent();
|
||||
|
||||
virtual nsresult InitFromCtor(const nsAString& aType,
|
||||
JSContext* aCx,
|
||||
jsval* aVal);
|
||||
|
||||
NS_IMETHOD Init(const nsAString & aEventTypeArg,
|
||||
bool aCanBubbleArg,
|
||||
bool aCancelableArg,
|
||||
nsAString& aPath,
|
||||
nsAString& aReason);
|
||||
|
||||
private:
|
||||
~nsDOMDeviceStorageChangeEvent();
|
||||
|
||||
protected:
|
||||
nsString mPath;
|
||||
nsString mReason;
|
||||
};
|
||||
|
||||
DOMCI_DATA(DeviceStorageChangeEvent, nsDOMDeviceStorageChangeEvent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsDOMDeviceStorageChangeEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMDeviceStorageChangeEvent)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(DeviceStorageChangeEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsDOMDeviceStorageChangeEvent, nsDOMEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDOMDeviceStorageChangeEvent, nsDOMEvent)
|
||||
|
||||
nsDOMDeviceStorageChangeEvent::nsDOMDeviceStorageChangeEvent()
|
||||
: nsDOMEvent(nullptr, nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
nsDOMDeviceStorageChangeEvent::~nsDOMDeviceStorageChangeEvent()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMDeviceStorageChangeEvent::Init(const nsAString & aEventTypeArg,
|
||||
bool aCanBubbleArg,
|
||||
bool aCancelableArg,
|
||||
nsAString& aPath,
|
||||
nsAString& aReason)
|
||||
{
|
||||
nsresult rv = nsDOMEvent::InitEvent(aEventTypeArg, aCanBubbleArg, aCancelableArg);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mPath = aPath;
|
||||
mReason = aReason;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMDeviceStorageChangeEvent::InitFromCtor(const nsAString& aType,
|
||||
JSContext* aCx,
|
||||
jsval* aVal)
|
||||
{
|
||||
mozilla::dom::DeviceStorageChangeEventInit d;
|
||||
nsresult rv = d.Init(aCx, aVal);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return Init(aType, d.bubbles, d.cancelable, d.path, d.reason);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMDeviceStorageChangeEvent::GetPath(nsAString & aPath)
|
||||
{
|
||||
aPath = mPath;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMDeviceStorageChangeEvent::GetReason(nsAString & aReason)
|
||||
{
|
||||
aReason = mReason;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
class DeviceStorageCursorRequest MOZ_FINAL
|
||||
: public nsIContentPermissionRequest
|
||||
, public PCOMContentPermissionRequestChild
|
||||
@ -1668,16 +1583,18 @@ nsDOMDeviceStorage::Update(const char* aReason, nsIFile* aFile)
|
||||
nsAString::size_type len = rootpath.Length() + 1; // +1 for the trailing /
|
||||
nsDependentSubstring newPath (fullpath, len, fullpath.Length() - len);
|
||||
|
||||
nsRefPtr<nsDOMDeviceStorageChangeEvent> event = new nsDOMDeviceStorageChangeEvent();
|
||||
nsCOMPtr<nsIDOMEvent> event;
|
||||
NS_NewDOMDeviceStorageChangeEvent(getter_AddRefs(event), nullptr, nullptr);
|
||||
|
||||
nsCOMPtr<nsIDOMDeviceStorageChangeEvent> ce = do_QueryInterface(event);
|
||||
|
||||
nsString reason;
|
||||
reason.AssignWithConversion(aReason);
|
||||
rv = event->Init(NS_LITERAL_STRING("change"), true, false, newPath, reason);
|
||||
rv = ce->InitDeviceStorageChangeEvent(NS_LITERAL_STRING("change"), true, false, newPath, reason);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIDOMDeviceStorageChangeEvent> e = event.get();
|
||||
|
||||
bool ignore;
|
||||
DispatchEvent(e, &ignore);
|
||||
DispatchEvent(ce, &ignore);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,13 @@
|
||||
[scriptable, uuid(468304d6-aab6-4e1e-8ab2-569d9e703431), builtinclass]
|
||||
interface nsIDOMDeviceStorageChangeEvent : nsIDOMEvent
|
||||
{
|
||||
|
||||
[noscript] void initDeviceStorageChangeEvent(in DOMString eventTypeArg,
|
||||
in boolean canBubbleArg,
|
||||
in boolean cancelableArg,
|
||||
in DOMString path,
|
||||
in DOMString reason);
|
||||
|
||||
readonly attribute DOMString path;
|
||||
readonly attribute DOMString reason;
|
||||
};
|
||||
|
@ -17,7 +17,6 @@ dictionaries = [
|
||||
[ 'DOMFileMetadataParameters', 'nsIDOMLockedFile.idl' ],
|
||||
[ 'XMLHttpRequestParameters', 'nsIXMLHttpRequest.idl' ],
|
||||
[ 'DeviceStorageEnumerationParameters', 'nsIDOMDeviceStorage.idl' ],
|
||||
[ 'DeviceStorageChangeEventInit', 'nsIDOMDeviceStorageChangeEvent.idl' ],
|
||||
[ 'CameraSize', 'nsIDOMCameraManager.idl' ],
|
||||
[ 'CameraRegion', 'nsIDOMCameraManager.idl' ],
|
||||
[ 'CameraPosition', 'nsIDOMCameraManager.idl' ],
|
||||
|
@ -20,7 +20,8 @@ simple_events = [
|
||||
'MozContactChangeEvent',
|
||||
'DeviceOrientationEvent',
|
||||
'DeviceLightEvent',
|
||||
'MozApplicationEvent'
|
||||
'MozApplicationEvent',
|
||||
'DeviceStorageChangeEvent'
|
||||
]
|
||||
|
||||
""" include file names """
|
||||
|
Loading…
Reference in New Issue
Block a user