mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1031051: Part 12 - Migrate DeviceStorageChangeEvent to the WebIDL code generator. r=smaug
This commit is contained in:
parent
f9a248ddf8
commit
24d6a0be33
@ -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;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
XPIDL_SOURCES += [
|
||||
'nsIDOMDeviceStorage.idl',
|
||||
'nsIDOMDeviceStorageChangeEvent.idl',
|
||||
]
|
||||
|
||||
XPIDL_MODULE = 'dom_devicestorage'
|
||||
|
@ -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;
|
||||
};
|
@ -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;
|
||||
|
@ -635,6 +635,7 @@ GENERATED_EVENTS_WEBIDL_FILES = [
|
||||
'DeviceLightEvent.webidl',
|
||||
'DeviceOrientationEvent.webidl',
|
||||
'DeviceProximityEvent.webidl',
|
||||
'DeviceStorageChangeEvent.webidl',
|
||||
'DownloadEvent.webidl',
|
||||
'ErrorEvent.webidl',
|
||||
'HashChangeEvent.webidl',
|
||||
|
@ -16,7 +16,6 @@ simple_events = [
|
||||
#ifdef MOZ_WEBSPEECH
|
||||
'SpeechSynthesisEvent',
|
||||
#endif
|
||||
'DeviceStorageChangeEvent',
|
||||
#ifdef MOZ_WEBSPEECH
|
||||
'SpeechRecognitionEvent',
|
||||
#endif
|
||||
|
@ -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),
|
||||
|
Loading…
Reference in New Issue
Block a user