Bug 1031051: Part 12 - Migrate DeviceStorageChangeEvent to the WebIDL code generator. r=smaug

This commit is contained in:
Kyle Huey 2014-06-30 16:02:03 -07:00
parent f9a248ddf8
commit 24d6a0be33
7 changed files with 23 additions and 54 deletions

View File

@ -11,6 +11,7 @@
#include "mozilla/DebugOnly.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/DeviceStorageBinding.h"
#include "mozilla/dom/DeviceStorageChangeEvent.h"
#include "mozilla/dom/DeviceStorageFileSystem.h"
#include "mozilla/dom/devicestorage/PDeviceStorageRequestChild.h"
#include "mozilla/dom/Directory.h"
@ -47,7 +48,6 @@
#include "TabChild.h"
#include "DeviceStorageFileDescriptor.h"
#include "DeviceStorageRequestChild.h"
#include "nsIDOMDeviceStorageChangeEvent.h"
#include "nsCRT.h"
#include "nsIObserverService.h"
#include "GeneratedEvents.h"
@ -4196,21 +4196,19 @@ nsDOMDeviceStorage::DispatchMountChangeEvent(nsAString& aVolumeStatus)
}
mLastStatus = aVolumeStatus;
nsCOMPtr<nsIDOMEvent> event;
NS_NewDOMDeviceStorageChangeEvent(getter_AddRefs(event), this,
nullptr, nullptr);
DeviceStorageChangeEventInit init;
init.mBubbles = true;
init.mCancelable = false;
init.mPath = mStorageName;
init.mReason = aVolumeStatus;
nsCOMPtr<nsIDOMDeviceStorageChangeEvent> ce = do_QueryInterface(event);
nsresult rv = ce->InitDeviceStorageChangeEvent(NS_LITERAL_STRING("change"),
true, false,
mStorageName,
aVolumeStatus);
if (NS_FAILED(rv)) {
return;
}
nsRefPtr<DeviceStorageChangeEvent> event =
DeviceStorageChangeEvent::Constructor(this, NS_LITERAL_STRING("change"),
init);
event->SetTrusted(true);
bool ignore;
DispatchEvent(ce, &ignore);
DispatchEvent(event, &ignore);
}
#endif
@ -4286,24 +4284,19 @@ nsDOMDeviceStorage::Notify(const char* aReason, DeviceStorageFile* aFile)
return NS_OK;
}
nsCOMPtr<nsIDOMEvent> event;
NS_NewDOMDeviceStorageChangeEvent(getter_AddRefs(event), this,
nullptr, nullptr);
DeviceStorageChangeEventInit init;
init.mBubbles = true;
init.mCancelable = false;
aFile->GetFullPath(init.mPath);
init.mReason.AssignWithConversion(aReason);
nsCOMPtr<nsIDOMDeviceStorageChangeEvent> ce = do_QueryInterface(event);
nsString reason;
reason.AssignWithConversion(aReason);
nsString fullPath;
aFile->GetFullPath(fullPath);
nsresult rv = ce->InitDeviceStorageChangeEvent(NS_LITERAL_STRING("change"),
true, false, fullPath,
reason);
NS_ENSURE_SUCCESS(rv, rv);
nsRefPtr<DeviceStorageChangeEvent> event =
DeviceStorageChangeEvent::Constructor(this, NS_LITERAL_STRING("change"),
init);
event->SetTrusted(true);
bool ignore;
DispatchEvent(ce, &ignore);
DispatchEvent(event, &ignore);
return NS_OK;
}

View File

@ -6,7 +6,6 @@
XPIDL_SOURCES += [
'nsIDOMDeviceStorage.idl',
'nsIDOMDeviceStorageChangeEvent.idl',
]
XPIDL_MODULE = 'dom_devicestorage'

View File

@ -1,20 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "domstubs.idl"
#include "nsIDOMEvent.idl"
[uuid(30eaf0b9-8f3f-49fe-818e-7b7d9fbf8f95), 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;
};

View File

@ -4,7 +4,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
[Constructor(DOMString type, optional DeviceStorageChangeEventInit eventInitDict), HeaderFile="GeneratedEventClasses.h"]
[Constructor(DOMString type, optional DeviceStorageChangeEventInit eventInitDict)]
interface DeviceStorageChangeEvent : Event
{
readonly attribute DOMString? path;

View File

@ -635,6 +635,7 @@ GENERATED_EVENTS_WEBIDL_FILES = [
'DeviceLightEvent.webidl',
'DeviceOrientationEvent.webidl',
'DeviceProximityEvent.webidl',
'DeviceStorageChangeEvent.webidl',
'DownloadEvent.webidl',
'ErrorEvent.webidl',
'HashChangeEvent.webidl',

View File

@ -16,7 +16,6 @@ simple_events = [
#ifdef MOZ_WEBSPEECH
'SpeechSynthesisEvent',
#endif
'DeviceStorageChangeEvent',
#ifdef MOZ_WEBSPEECH
'SpeechRecognitionEvent',
#endif

View File

@ -31,7 +31,6 @@
#endif
#include "nsIDOMDataTransfer.h"
#include "nsIDOMDeviceStorage.h"
#include "nsIDOMDeviceStorageChangeEvent.h"
#include "nsIDOMDOMCursor.h"
#include "nsIDOMDOMException.h"
#include "nsIDOMDOMRequest.h"
@ -179,7 +178,6 @@
#include "mozilla/dom/DataContainerEventBinding.h"
#include "mozilla/dom/DataTransferBinding.h"
#include "mozilla/dom/DeviceStorageBinding.h"
#include "mozilla/dom/DeviceStorageChangeEventBinding.h"
#include "mozilla/dom/DOMCursorBinding.h"
#include "mozilla/dom/DOMExceptionBinding.h"
#include "mozilla/dom/DOMParserBinding.h"
@ -379,7 +377,6 @@ const ComponentsInterfaceShimEntry kComponentsInterfaceShimMap[] =
DEFINE_SHIM(DataContainerEvent),
DEFINE_SHIM(DataTransfer),
DEFINE_SHIM(DeviceStorage),
DEFINE_SHIM(DeviceStorageChangeEvent),
DEFINE_SHIM(DOMCursor),
DEFINE_SHIM(DOMException),
DEFINE_SHIM(DOMRequest),