Bug 824986 - Move DOMRequest and subclasses to Paris bindings; r=khuey

This commit is contained in:
Ms2ger 2013-03-17 09:51:36 +01:00
parent 4ec472b450
commit 1dad3019dc
40 changed files with 379 additions and 283 deletions

View File

@ -6,7 +6,6 @@
XPIDL_SOURCES += [
'nsIActivityProxy.idl',
'nsIActivityUIGlue.idl',
'nsIDOMActivity.idl',
'nsIDOMActivityHandlerDescription.idl',
'nsIDOMActivityOptions.idl',
'nsIDOMActivityRequestHandler.idl',

View File

@ -4,17 +4,16 @@
#include "nsISupports.idl"
interface nsIDOMMozActivity;
interface nsIDOMMozActivityOptions;
interface nsIDOMWindow;
/**
* Implemented by @mozilla.org/dom/activities/proxy;1
*/
[scriptable, uuid(3f9e0695-f466-4111-a8fa-ed5c0751c42b)]
[scriptable, uuid(c7a258f7-26a6-46c6-a887-a6c936034f98)]
interface nsIActivityProxy : nsISupports
{
void startActivity(in nsIDOMMozActivity activity,
void startActivity(in nsISupports /* MozActivity */ activity,
in nsIDOMMozActivityOptions options,
in nsIDOMWindow window);
void cleanup();

View File

@ -1,14 +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 "nsIDOMDOMRequest.idl"
/**
* The constructor will accept a nsIDOMActivityOptions parameter.
*/
[scriptable, builtinclass, uuid(1f59cd9a-b8b5-4a98-bd2a-897b73584946)]
interface nsIDOMMozActivity : nsIDOMDOMRequest
{
};

View File

@ -4,25 +4,16 @@
#include "Activity.h"
#include "mozilla/dom/MozActivityBinding.h"
#include "nsContentUtils.h"
#include "nsDOMClassInfo.h"
#include "nsIConsoleService.h"
#include "nsIDocShell.h"
#include "nsIDocument.h"
#include "nsIDOMActivityOptions.h"
using namespace mozilla::dom;
#ifdef MOZ_SYS_MSG
DOMCI_DATA(MozActivity, Activity)
#endif
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(Activity)
NS_INTERFACE_MAP_ENTRY(nsIDOMMozActivity)
NS_INTERFACE_MAP_ENTRY(nsIJSNativeInitializer)
#ifdef MOZ_SYS_MSG
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozActivity)
#endif
NS_INTERFACE_MAP_END_INHERITING(DOMRequest)
NS_IMPL_ADDREF_INHERITED(Activity, DOMRequest)
@ -34,19 +25,24 @@ NS_IMPL_CYCLE_COLLECTION_INHERITED_1(Activity, DOMRequest,
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(Activity, DOMRequest)
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMETHODIMP
Activity::Initialize(nsISupports* aOwner,
JSContext* aContext,
JSObject* aObject,
uint32_t aArgc,
JS::Value* aArgv)
/* virtual */ JSObject*
Activity::WrapObject(JSContext* aCx, JSObject* aScope)
{
return MozActivityBinding::Wrap(aCx, aScope, this);
}
nsresult
Activity::Initialize(nsISupports* aOwner,
nsIDOMMozActivityOptions* aOptions)
{
MOZ_ASSERT(aOptions);
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aOwner);
NS_ENSURE_TRUE(window, NS_ERROR_UNEXPECTED);
Init(window);
nsCOMPtr<nsIDocument> document = do_QueryInterface(window->GetExtantDoc());
nsCOMPtr<nsIDocument> document = window->GetExtantDoc();
bool isActive;
window->GetDocShell()->GetIsActive(&isActive);
@ -69,27 +65,13 @@ Activity::Initialize(nsISupports* aOwner,
return NS_OK;
}
// We expect a single argument, which is a nsIDOMMozActivityOptions.
if (aArgc != 1 || !aArgv[0].isObject()) {
return NS_ERROR_INVALID_ARG;
}
nsCOMPtr<nsISupports> tmp;
nsContentUtils::XPConnect()->WrapJS(aContext, aArgv[0].toObjectOrNull(),
NS_GET_IID(nsIDOMMozActivityOptions),
getter_AddRefs(tmp));
nsCOMPtr<nsIDOMMozActivityOptions> options = do_QueryInterface(tmp);
if (!options) {
return NS_ERROR_INVALID_ARG;
}
// Instantiate a JS proxy that will do the child <-> parent communication
// with the JS implementation of the backend.
nsresult rv;
mProxy = do_CreateInstance("@mozilla.org/dom/activities/proxy;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
mProxy->StartActivity(this, options, window);
mProxy->StartActivity(static_cast<nsIDOMDOMRequest*>(this), aOptions, window);
return NS_OK;
}
@ -106,5 +88,6 @@ Activity::Activity()
// Unfortunately we must explicitly declare the default constructor in order
// to prevent an implicitly deleted constructor in DOMRequest compile error
// in GCC 4.6.
MOZ_ASSERT(IsDOMBinding());
}

View File

@ -5,10 +5,9 @@
#ifndef mozilla_dom_activities_Activity_h
#define mozilla_dom_activities_Activity_h
#include "nsIDOMActivity.h"
#include "nsIActivityProxy.h"
#include "DOMRequest.h"
#include "nsIJSNativeInitializer.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "nsIActivityProxy.h"
#define NS_DOMACTIVITY_CID \
{0x1c5b0930, 0xc90c, 0x4e9c, {0xaf, 0x4e, 0xb0, 0xb7, 0xa6, 0x59, 0xb4, 0xed}}
@ -18,24 +17,40 @@
namespace mozilla {
namespace dom {
class Activity : public nsIDOMMozActivity
, public nsIJSNativeInitializer // In order to get a window for the DOMRequest
, public DOMRequest
class Activity : public DOMRequest
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMMOZACTIVITY
NS_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetHelper::)
NS_FORWARD_NSIDOMDOMREQUEST(DOMRequest::)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(Activity, DOMRequest)
// nsIJSNativeInitializer
NS_IMETHOD Initialize(nsISupports* aOwner, JSContext* aContext,
JSObject* aObject, uint32_t aArgc, jsval* aArgv);
virtual JSObject*
WrapObject(JSContext* aCx, JSObject* aScope) MOZ_OVERRIDE;
static bool PrefEnabled()
{
#ifdef MOZ_SYS_MSG
return true;
#else
return false;
#endif
}
static already_AddRefed<Activity>
Constructor(const GlobalObject& aOwner,
nsIDOMMozActivityOptions* aOptions,
ErrorResult& aRv)
{
nsRefPtr<Activity> activity = new Activity();
aRv = activity->Initialize(aOwner.Get(), aOptions);
return activity.forget();
}
Activity();
protected:
nsresult Initialize(nsISupports* aOwner,
nsIDOMMozActivityOptions* aOptions);
nsCOMPtr<nsIActivityProxy> mProxy;
~Activity();

View File

@ -7,6 +7,7 @@
#include "DOMCursor.h"
#include "nsIDOMClassInfo.h"
#include "nsError.h"
#include "mozilla/dom/DOMCursorBinding.h"
DOMCI_DATA(DOMCursor, mozilla::dom::DOMCursor)
@ -64,24 +65,37 @@ DOMCursor::FireDone()
NS_IMETHODIMP
DOMCursor::GetDone(bool *aDone)
{
*aDone = mFinished;
*aDone = Done();
return NS_OK;
}
NS_IMETHODIMP
DOMCursor::Continue()
{
ErrorResult rv;
Continue(rv);
return rv.ErrorCode();
}
void
DOMCursor::Continue(ErrorResult& aRv)
{
MOZ_ASSERT(mCallback, "If you're creating your own cursor class with no callback, you should override Continue()");
// We need to have a result here because we must be in a 'success' state.
if (mResult == JSVAL_VOID) {
return NS_ERROR_DOM_INVALID_STATE_ERR;
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return;
}
Reset();
mCallback->HandleContinue();
}
return NS_OK;
/* virtual */ JSObject*
DOMCursor::WrapObject(JSContext* aCx, JSObject* aScope)
{
return DOMCursorBinding::Wrap(aCx, aScope, this);
}
} // namespace dom

View File

@ -16,8 +16,8 @@
namespace mozilla {
namespace dom {
class DOMCursor : public nsIDOMDOMCursor
, public DOMRequest
class DOMCursor : public DOMRequest
, public nsIDOMDOMCursor
{
public:
NS_DECL_ISUPPORTS_INHERITED
@ -25,13 +25,23 @@ public:
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(DOMCursor,
DOMRequest)
DOMCursor() MOZ_DELETE;
DOMCursor(nsIDOMWindow* aWindow, nsICursorContinueCallback *aCallback);
virtual JSObject*
WrapObject(JSContext* aCx, JSObject* aScope) MOZ_OVERRIDE;
bool Done() const
{
return mFinished;
}
virtual void Continue(ErrorResult& aRv);
void Reset();
void FireDone();
private:
DOMCursor() MOZ_DELETE;
nsCOMPtr<nsICursorContinueCallback> mCallback;
bool mFinished;
};

View File

@ -25,6 +25,7 @@ DOMRequest::DOMRequest(nsIDOMWindow* aWindow)
, mDone(false)
, mRooted(false)
{
SetIsDOMBinding();
Init(aWindow);
}
@ -35,6 +36,7 @@ DOMRequest::DOMRequest()
, mDone(false)
, mRooted(false)
{
SetIsDOMBinding();
}
void
@ -75,14 +77,29 @@ NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
NS_IMPL_ADDREF_INHERITED(DOMRequest, nsDOMEventTargetHelper)
NS_IMPL_RELEASE_INHERITED(DOMRequest, nsDOMEventTargetHelper)
/* virtual */ JSObject*
DOMRequest::WrapObject(JSContext* aCx, JSObject* aScope)
{
return DOMRequestBinding::Wrap(aCx, aScope, this);
}
NS_IMPL_EVENT_HANDLER(DOMRequest, success)
NS_IMPL_EVENT_HANDLER(DOMRequest, error)
NS_IMETHODIMP
DOMRequest::GetReadyState(nsAString& aReadyState)
{
mDone ? aReadyState.AssignLiteral("done") :
aReadyState.AssignLiteral("pending");
DOMRequestReadyState readyState = ReadyState();
switch (readyState) {
case DOMRequestReadyStateValues::Pending:
aReadyState.AssignLiteral("pending");
break;
case DOMRequestReadyStateValues::Done:
aReadyState.AssignLiteral("done");
break;
default:
MOZ_NOT_REACHED("Unrecognized readyState.");
}
return NS_OK;
}
@ -90,21 +107,14 @@ DOMRequest::GetReadyState(nsAString& aReadyState)
NS_IMETHODIMP
DOMRequest::GetResult(jsval* aResult)
{
NS_ASSERTION(mDone || mResult == JSVAL_VOID,
"Result should be undefined when pending");
*aResult = mResult;
*aResult = Result();
return NS_OK;
}
NS_IMETHODIMP
DOMRequest::GetError(nsIDOMDOMError** aError)
{
NS_ASSERTION(mDone || !mError,
"Error should be null when pending");
NS_IF_ADDREF(*aError = mError);
NS_IF_ADDREF(*aError = GetError());
return NS_OK;
}

View File

@ -11,6 +11,7 @@
#include "nsIDOMDOMError.h"
#include "nsDOMEventTargetHelper.h"
#include "mozilla/Attributes.h"
#include "mozilla/dom/DOMRequestBinding.h"
#include "nsCOMPtr.h"
@ -34,6 +35,40 @@ public:
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(DOMRequest,
nsDOMEventTargetHelper)
// WrapperCache
nsPIDOMWindow* GetParentObject() const
{
return GetOwner();
}
virtual JSObject*
WrapObject(JSContext* aCx, JSObject* aScope) MOZ_OVERRIDE;
// WebIDL Interface
DOMRequestReadyState ReadyState() const
{
return mDone ? DOMRequestReadyStateValues::Done
: DOMRequestReadyStateValues::Pending;
}
JS::Value Result(JSContext* = nullptr) const
{
NS_ASSERTION(mDone || mResult == JSVAL_VOID,
"Result should be undefined when pending");
return mResult;
}
nsIDOMDOMError* GetError() const
{
NS_ASSERTION(mDone || !mError,
"Error should be null when pending");
return mError;
}
IMPL_EVENT_HANDLER(success)
IMPL_EVENT_HANDLER(error)
void FireSuccess(jsval aResult);
void FireError(const nsAString& aError);
void FireError(nsresult aError);

View File

@ -285,8 +285,6 @@
#include "nsDOMFile.h"
#include "nsDOMFileReader.h"
#include "ArchiveReader.h"
#include "ArchiveRequest.h"
#include "nsIDOMDesktopNotification.h"
#include "nsIDOMNavigatorDesktopNotification.h"
@ -376,7 +374,6 @@ using mozilla::dom::workers::ResolveWorkerClasses;
#include "nsIAsyncScrollEventDetail.h"
#include "nsIDOMGlobalObjectConstructor.h"
#include "nsIDOMCanvasRenderingContext2D.h"
#include "FileRequest.h"
#include "LockedFile.h"
#include "GeneratedEvents.h"
#include "nsDebug.h"
@ -384,10 +381,6 @@ using mozilla::dom::workers::ResolveWorkerClasses;
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/Likely.h"
#ifdef MOZ_SYS_MSG
#include "mozilla/dom/Activity.h"
#endif
#ifdef MOZ_TIME_MANAGER
#include "TimeManager.h"
#endif
@ -921,8 +914,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(FileReader, nsEventTargetSH,
EVENTTARGET_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(ArchiveRequest, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(ModalContentWindow, nsWindowSH,
DEFAULT_SCRIPTABLE_FLAGS |
@ -937,9 +928,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
NS_DEFINE_CLASSINFO_DATA(DeviceStorage, nsEventTargetSH,
EVENTTARGET_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(DeviceStorageCursor, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(GeoGeolocation, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
@ -1134,14 +1122,8 @@ static nsDOMClassInfoData sClassInfoData[] = {
NS_DEFINE_CLASSINFO_DATA(AsyncScrollEventDetail, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(FileRequest, nsEventTargetSH,
EVENTTARGET_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(LockedFile, nsEventTargetSH,
EVENTTARGET_SCRIPTABLE_FLAGS)
#ifdef MOZ_SYS_MSG
NS_DEFINE_CLASSINFO_DATA(MozActivity, nsEventTargetSH,
EVENTTARGET_SCRIPTABLE_FLAGS)
#endif
#ifdef MOZ_TIME_MANAGER
NS_DEFINE_CLASSINFO_DATA(MozTimeManager, nsDOMGenericSH,
@ -1169,9 +1151,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
NS_DEFINE_CONTRACT_CTOR(FileReader, NS_FILEREADER_CONTRACTID)
NS_DEFINE_CONTRACT_CTOR(XSLTProcessor,
"@mozilla.org/document-transformer;1?type=xslt")
#ifdef MOZ_SYS_MSG
NS_DEFINE_CONTRACT_CTOR(MozActivity, NS_DOMACTIVITY_CONTRACTID)
#endif
#undef NS_DEFINE_CONTRACT_CTOR
@ -1228,9 +1207,6 @@ static const nsConstructorFuncMapData kConstructorFuncMap[] =
NS_DEFINE_CONSTRUCTOR_FUNC_DATA(MozSmsFilter, SmsFilter::NewSmsFilter)
NS_DEFINE_CONSTRUCTOR_FUNC_DATA(FileReader, FileReaderCtor)
NS_DEFINE_CONSTRUCTOR_FUNC_DATA(XSLTProcessor, XSLTProcessorCtor)
#ifdef MOZ_SYS_MSG
NS_DEFINE_CONSTRUCTOR_FUNC_DATA(MozActivity, MozActivityCtor)
#endif
};
#undef NS_DEFINE_CONSTRUCTOR_FUNC_DATA
#undef NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA
@ -2452,11 +2428,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIInterfaceRequestor)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(ArchiveRequest, nsIDOMArchiveRequest)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMArchiveRequest)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMRequest)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(ModalContentWindow, nsIDOMWindow)
DOM_CLASSINFO_WINDOW_MAP_ENTRIES(nsGlobalWindow::HasIndexedDBSupport())
DOM_CLASSINFO_MAP_ENTRY(nsIDOMModalContentWindow)
@ -2477,12 +2448,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(DeviceStorageCursor, nsIDOMDOMCursor)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMCursor)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMRequest)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(GeoGeolocation, nsIDOMGeoGeolocation)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMGeoGeolocation)
DOM_CLASSINFO_MAP_END
@ -2832,24 +2797,10 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIAsyncScrollEventDetail)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(FileRequest, nsIDOMFileRequest)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMFileRequest)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMRequest)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(LockedFile, nsIDOMLockedFile)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMLockedFile)
DOM_CLASSINFO_MAP_END
#ifdef MOZ_SYS_MSG
DOM_CLASSINFO_MAP_BEGIN(MozActivity, nsIDOMMozActivity)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozActivity)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMRequest)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
DOM_CLASSINFO_MAP_END
#endif
#ifdef MOZ_TIME_MANAGER
DOM_CLASSINFO_MAP_BEGIN(MozTimeManager, nsIDOMMozTimeManager)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozTimeManager)
@ -4920,13 +4871,6 @@ ConstructorEnabled(const nsGlobalNameStruct *aStruct, nsGlobalWindow *aWin)
}
}
// Don't expose ArchiveRequest unless user has explicitly enabled it
if (aStruct->mDOMClassInfoID == eDOMClassInfo_ArchiveRequest_id) {
if (!dom::file::ArchiveReader::PrefEnabled()) {
return false;
}
}
return true;
}

View File

@ -177,7 +177,6 @@ DOMCI_CLASS(OfflineResourceList)
DOMCI_CLASS(Blob)
DOMCI_CLASS(File)
DOMCI_CLASS(FileReader)
DOMCI_CLASS(ArchiveRequest)
// DOM modal content window class, almost identical to Window
DOMCI_CLASS(ModalContentWindow)
@ -190,7 +189,6 @@ DOMCI_CLASS(DataContainerEvent)
DOMCI_CLASS(MessageEvent)
DOMCI_CLASS(DeviceStorage)
DOMCI_CLASS(DeviceStorageCursor)
// Geolocation
DOMCI_CLASS(GeoGeolocation)
@ -303,13 +301,8 @@ DOMCI_CLASS(DOMCursor)
DOMCI_CLASS(OpenWindowEventDetail)
DOMCI_CLASS(AsyncScrollEventDetail)
DOMCI_CLASS(FileRequest)
DOMCI_CLASS(LockedFile)
#ifdef MOZ_SYS_MSG
DOMCI_CLASS(MozActivity)
#endif
#ifdef MOZ_TIME_MANAGER
DOMCI_CLASS(MozTimeManager)
#endif

View File

@ -78,6 +78,10 @@
DOMInterfaces = {
'MozActivity': {
'nativeType': 'mozilla::dom::Activity',
},
'AnimationEvent': {
'nativeType': 'nsDOMAnimationEvent',
},
@ -86,6 +90,10 @@ DOMInterfaces = {
'nativeType': 'mozilla::dom::file::ArchiveReader',
},
'ArchiveRequest': {
'nativeType': 'mozilla::dom::file::ArchiveRequest',
},
'AudioChannelManager': {
'nativeType': 'mozilla::dom::system::AudioChannelManager',
'headerFile': 'AudioChannelManager.h'
@ -318,6 +326,10 @@ DOMInterfaces = {
'implicitJSContext' : [ 'undo', 'redo', 'transact' ]
}],
'FileRequest': {
'nativeType': 'mozilla::dom::file::DOMFileRequest',
},
'FormData': [
{
'nativeType': 'nsFormData'
@ -1275,13 +1287,14 @@ def addExternalHTMLElement(element):
addExternalHTMLElement('HTMLFormElement')
addExternalHTMLElement('HTMLVideoElement')
addExternalIface('ArchiveRequest')
addExternalIface('ActivityOptions', nativeType='nsIDOMMozActivityOptions',
headerFile='nsIDOMActivityOptions.h')
addExternalIface('Attr')
addExternalIface('CanvasGradient', headerFile='nsIDOMCanvasRenderingContext2D.h')
addExternalIface('CanvasPattern', headerFile='nsIDOMCanvasRenderingContext2D.h')
addExternalIface('Counter')
addExternalIface('CSSRule')
addExternalIface('DOMRequest')
addExternalIface('DOMError')
addExternalIface('DOMStringList')
addExternalIface('File')
addExternalIface('HitRegionOptions', nativeType='nsISupports')

View File

@ -34,6 +34,7 @@ CPPSRCS = \
EXPORTS = \
DeviceStorage.h \
nsDeviceStorage.h \
$(NULL)
LOCAL_INCLUDES = \

View File

@ -2,19 +2,20 @@
* 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 "mozilla/Attributes.h"
#include "mozilla/DebugOnly.h"
#include "base/basictypes.h"
#include "nsDeviceStorage.h"
#include "mozilla/Attributes.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/DeviceStorageCursorBinding.h"
#include "mozilla/dom/devicestorage/PDeviceStorageRequestChild.h"
#include "mozilla/dom/ipc/Blob.h"
#include "mozilla/dom/PBrowserChild.h"
#include "mozilla/dom/PContentPermissionRequestChild.h"
#include "mozilla/dom/PermissionMessageUtils.h"
#include "mozilla/Preferences.h"
#include "mozilla/Services.h"
#include "nsAutoPtr.h"
#include "nsDOMEvent.h"
@ -28,20 +29,16 @@
#include "nsNetUtil.h"
#include "nsCycleCollectionParticipant.h"
#include "nsIPrincipal.h"
#include "mozilla/Preferences.h"
#include "nsJSUtils.h"
#include "DictionaryHelpers.h"
#include "mozilla/Attributes.h"
#include "nsContentUtils.h"
#include "nsXULAppAPI.h"
#include "TabChild.h"
#include "DeviceStorageRequestChild.h"
#include "nsIDOMDeviceStorageChangeEvent.h"
#include "nsCRT.h"
#include "mozilla/Services.h"
#include "nsIObserverService.h"
#include "GeneratedEvents.h"
#include "mozilla/dom/PermissionMessageUtils.h"
#include "nsIMIMEService.h"
#include "nsCExternalHandlerService.h"
#include "nsIPermissionManager.h"
@ -1072,12 +1069,8 @@ private:
nsRefPtr<DOMRequest> mRequest;
};
DOMCI_DATA(DeviceStorageCursor, nsDOMDeviceStorageCursor)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMDeviceStorageCursor)
NS_INTERFACE_MAP_ENTRY(nsIDOMDOMCursor)
NS_INTERFACE_MAP_ENTRY(nsIContentPermissionRequest)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(DeviceStorageCursor)
NS_INTERFACE_MAP_END_INHERITING(DOMCursor)
NS_IMPL_ADDREF_INHERITED(nsDOMDeviceStorageCursor, DOMCursor)
@ -1180,11 +1173,18 @@ nsDOMDeviceStorageCursor::Allow()
return NS_OK;
}
NS_IMETHODIMP
nsDOMDeviceStorageCursor::Continue()
/* virtual */ JSObject*
nsDOMDeviceStorageCursor::WrapObject(JSContext* aCx, JSObject* aScope)
{
return DeviceStorageCursorBinding::Wrap(aCx, aScope, this);
}
void
nsDOMDeviceStorageCursor::Continue(ErrorResult& aRv)
{
if (!mOkToCallContinue) {
return NS_ERROR_UNEXPECTED;
aRv.Throw(NS_ERROR_UNEXPECTED);
return;
}
if (mRooted) {
@ -1200,7 +1200,6 @@ nsDOMDeviceStorageCursor::Continue()
event->Continue();
mOkToCallContinue = false;
return NS_OK;
}
bool

View File

@ -28,8 +28,11 @@ class nsPIDOMWindow;
#include "mozilla/Mutex.h"
#include "prtime.h"
#include "DeviceStorage.h"
#include "mozilla/dom/devicestorage/DeviceStorageRequestChild.h"
#include "DeviceStorageRequestChild.h"
namespace mozilla {
class ErrorResult;
} // namespace mozilla
#define POST_ERROR_EVENT_FILE_EXISTS "NoModificationAllowedError"
#define POST_ERROR_EVENT_FILE_DOES_NOT_EXIST "NotFoundError"
@ -97,9 +100,8 @@ public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSICONTENTPERMISSIONREQUEST
// nsIDOMDOMCursor interface.
// We use DOMCursor::GetDone.
NS_IMETHOD Continue() MOZ_OVERRIDE;
// DOMCursor
virtual void Continue(mozilla::ErrorResult& aRv) MOZ_OVERRIDE;
nsDOMDeviceStorageCursor(nsIDOMWindow* aWindow,
nsIPrincipal* aPrincipal,

View File

@ -171,7 +171,7 @@ ArchiveReader::RequestReady(ArchiveRequest* aRequest)
aRequest->ReaderReady(mData.fileList, mData.status);
}
already_AddRefed<nsIDOMArchiveRequest>
already_AddRefed<ArchiveRequest>
ArchiveReader::GetFilenames()
{
nsRefPtr<ArchiveRequest> request = GenerateArchiveRequest();
@ -180,7 +180,7 @@ ArchiveReader::GetFilenames()
return request.forget();
}
already_AddRefed<nsIDOMArchiveRequest>
already_AddRefed<ArchiveRequest>
ArchiveReader::GetFile(const nsAString& filename)
{
nsRefPtr<ArchiveRequest> request = GenerateArchiveRequest();
@ -189,7 +189,7 @@ ArchiveReader::GetFile(const nsAString& filename)
return request.forget();
}
already_AddRefed<nsIDOMArchiveRequest>
already_AddRefed<ArchiveRequest>
ArchiveReader::GetFiles()
{
nsRefPtr<ArchiveRequest> request = GenerateArchiveRequest();

View File

@ -16,8 +16,6 @@
#include "nsIDOMFile.h"
#include "mozilla/Attributes.h"
class nsIDOMArchiveRequest;
namespace mozilla {
namespace dom {
class ArchiveReaderOptions;
@ -53,9 +51,9 @@ public:
virtual JSObject*
WrapObject(JSContext* aCx, JSObject* aScope) MOZ_OVERRIDE;
already_AddRefed<nsIDOMArchiveRequest> GetFilenames();
already_AddRefed<nsIDOMArchiveRequest> GetFile(const nsAString& filename);
already_AddRefed<nsIDOMArchiveRequest> GetFiles();
already_AddRefed<ArchiveRequest> GetFilenames();
already_AddRefed<ArchiveRequest> GetFile(const nsAString& filename);
already_AddRefed<ArchiveRequest> GetFiles();
nsresult GetInputStream(nsIInputStream** aInputStream);
nsresult GetSize(uint64_t* aSize);

View File

@ -6,6 +6,7 @@
#include "ArchiveRequest.h"
#include "mozilla/dom/ArchiveRequestBinding.h"
#include "nsContentUtils.h"
#include "nsLayoutStatics.h"
#include "nsEventDispatcher.h"
@ -51,6 +52,8 @@ ArchiveRequest::ArchiveRequest(nsIDOMWindow* aWindow,
: DOMRequest(aWindow),
mArchiveReader(aReader)
{
MOZ_ASSERT(aReader);
MOZ_COUNT_CTOR(ArchiveRequest);
nsLayoutStatics::AddRef();
@ -73,14 +76,18 @@ ArchiveRequest::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
return NS_OK;
}
NS_IMETHODIMP
ArchiveRequest::GetReader(nsISupports** aArchiveReader)
/* virtual */ JSObject*
ArchiveRequest::WrapObject(JSContext* aCx, JSObject* aScope)
{
return ArchiveRequestBinding::Wrap(aCx, aScope, this);
}
ArchiveReader*
ArchiveRequest::Reader() const
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
nsCOMPtr<nsISupports> archiveReader(mArchiveReader);
archiveReader.forget(aArchiveReader);
return NS_OK;
return mArchiveReader;
}
// Here the request is processed:
@ -267,8 +274,6 @@ NS_IMPL_CYCLE_COLLECTION_INHERITED_1(ArchiveRequest, DOMRequest,
mArchiveReader)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(ArchiveRequest)
NS_INTERFACE_MAP_ENTRY(nsIDOMArchiveRequest)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(ArchiveRequest)
NS_INTERFACE_MAP_END_INHERITING(DOMRequest)
NS_IMPL_ADDREF_INHERITED(ArchiveRequest, DOMRequest)

View File

@ -7,7 +7,6 @@
#ifndef mozilla_dom_file_domarchiverequest_h__
#define mozilla_dom_file_domarchiverequest_h__
#include "nsIDOMArchiveRequest.h"
#include "ArchiveReader.h"
#include "DOMRequest.h"
@ -20,15 +19,21 @@ BEGIN_FILE_NAMESPACE
* This is the ArchiveRequest that handles any operation
* related to ArchiveReader
*/
class ArchiveRequest : public mozilla::dom::DOMRequest,
public nsIDOMArchiveRequest
class ArchiveRequest : public mozilla::dom::DOMRequest
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMARCHIVEREQUEST
static bool PrefEnabled()
{
return ArchiveReader::PrefEnabled();
}
virtual JSObject*
WrapObject(JSContext* aCx, JSObject* aScope) MOZ_OVERRIDE;
ArchiveReader* Reader() const;
NS_DECL_ISUPPORTS_INHERITED
NS_FORWARD_NSIDOMDOMREQUEST(DOMRequest::)
NS_FORWARD_NSIDOMEVENTTARGET_NOPREHANDLEEVENT(DOMRequest::)
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ArchiveRequest, DOMRequest)
ArchiveRequest(nsIDOMWindow* aWindow,

View File

@ -0,0 +1,30 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* 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 "DOMFileRequest.h"
#include "mozilla/dom/FileRequestBinding.h"
#include "LockedFile.h"
USING_FILE_NAMESPACE
DOMFileRequest::DOMFileRequest(nsIDOMWindow* aWindow)
: FileRequest(aWindow)
{
}
/* virtual */ JSObject*
DOMFileRequest::WrapObject(JSContext* aCx, JSObject* aScope)
{
return FileRequestBinding::Wrap(aCx, aScope, this);
}
nsIDOMLockedFile*
DOMFileRequest::GetLockedFile() const
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
return mLockedFile;
}

30
dom/file/DOMFileRequest.h Normal file
View File

@ -0,0 +1,30 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* 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/. */
#ifndef mozilla_dom_file_DOMFileRequest_h
#define mozilla_dom_file_DOMFileRequest_h
#include "FileRequest.h"
class nsIDOMLockedFile;
BEGIN_FILE_NAMESPACE
class DOMFileRequest : public FileRequest
{
public:
DOMFileRequest(nsIDOMWindow* aWindow);
virtual JSObject*
WrapObject(JSContext* aCx, JSObject* aScope) MOZ_OVERRIDE;
nsIDOMLockedFile* GetLockedFile() const;
IMPL_EVENT_HANDLER(progress)
};
END_FILE_NAMESPACE
#endif // mozilla_dom_file_DOMFileRequest_h

View File

@ -133,12 +133,12 @@ NS_IMETHODIMP
FileHandle::GetFile(nsIDOMDOMRequest** _retval)
{
ErrorResult rv;
nsCOMPtr<nsIDOMDOMRequest> request = GetFile(rv);
nsRefPtr<DOMRequest> request = GetFile(rv);
request.forget(_retval);
return rv.ErrorCode();
}
already_AddRefed<nsIDOMDOMRequest>
already_AddRefed<DOMRequest>
FileHandle::GetFile(ErrorResult& aError)
{
MOZ_ASSERT(NS_IsMainThread());
@ -170,8 +170,7 @@ FileHandle::GetFile(ErrorResult& aError)
return nullptr;
}
nsRefPtr<DOMRequest> domRequest = request.forget();
return domRequest.forget();
return request.forget();
}
NS_IMETHODIMP_(int64_t)

View File

@ -21,6 +21,12 @@
class nsIDOMFile;
class nsIFileStorage;
namespace mozilla {
namespace dom {
class DOMRequest;
} // namespace dom
} // namespace mozilla
BEGIN_FILE_NAMESPACE
class FileService;
@ -61,7 +67,7 @@ public:
aType = mType;
}
already_AddRefed<nsIDOMLockedFile> Open(FileMode aMode, ErrorResult& aError);
already_AddRefed<nsIDOMDOMRequest> GetFile(ErrorResult& aError);
already_AddRefed<DOMRequest> GetFile(ErrorResult& aError);
IMPL_EVENT_HANDLER(abort)
IMPL_EVENT_HANDLER(error)

View File

@ -8,6 +8,7 @@
#include "nsIJSContextStack.h"
#include "DOMFileRequest.h"
#include "nsContentUtils.h"
#include "nsEventDispatcher.h"
#include "nsError.h"
@ -19,7 +20,7 @@
USING_FILE_NAMESPACE
FileRequest::FileRequest(nsIDOMWindow* aWindow)
: DOMRequest(aWindow), mIsFileRequest(true)
: DOMRequest(aWindow)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
}
@ -37,9 +38,13 @@ FileRequest::Create(nsIDOMWindow* aOwner,
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
nsRefPtr<FileRequest> request = new FileRequest(aOwner);
nsRefPtr<FileRequest> request;
if (aIsFileRequest) {
request = new DOMFileRequest(aOwner);
} else {
request = new FileRequest(aOwner);
}
request->mLockedFile = aLockedFile;
request->mIsFileRequest = aIsFileRequest;
return request.forget();
}
@ -97,32 +102,15 @@ FileRequest::NotifyHelperCompleted(FileHelper* aFileHelper)
return NS_OK;
}
NS_IMETHODIMP
FileRequest::GetLockedFile(nsIDOMLockedFile** aLockedFile)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
nsCOMPtr<nsIDOMLockedFile> lockedFile(mLockedFile);
lockedFile.forget(aLockedFile);
return NS_OK;
}
NS_IMPL_CYCLE_COLLECTION_INHERITED_1(FileRequest, DOMRequest,
mLockedFile)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(FileRequest)
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIDOMFileRequest, mIsFileRequest)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO_CONDITIONAL(FileRequest, mIsFileRequest)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO_CONDITIONAL(DOMRequest, !mIsFileRequest)
NS_INTERFACE_MAP_END_INHERITING(DOMRequest)
NS_IMPL_ADDREF_INHERITED(FileRequest, DOMRequest)
NS_IMPL_RELEASE_INHERITED(FileRequest, DOMRequest)
DOMCI_DATA(FileRequest, FileRequest)
NS_IMPL_EVENT_HANDLER(FileRequest, progress)
void
FileRequest::FireProgressEvent(uint64_t aLoaded, uint64_t aTotal)
{

View File

@ -9,8 +9,6 @@
#include "FileCommon.h"
#include "nsIDOMFileRequest.h"
#include "DOMRequest.h"
BEGIN_FILE_NAMESPACE
@ -18,14 +16,10 @@ BEGIN_FILE_NAMESPACE
class FileHelper;
class LockedFile;
class FileRequest : public mozilla::dom::DOMRequest,
public nsIDOMFileRequest
class FileRequest : public mozilla::dom::DOMRequest
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMFILEREQUEST
NS_FORWARD_NSIDOMDOMREQUEST(DOMRequest::)
NS_FORWARD_NSIDOMEVENTTARGET_NOPREHANDLEEVENT(DOMRequest::)
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FileRequest, DOMRequest)
static already_AddRefed<FileRequest>
@ -44,7 +38,7 @@ public:
nsresult
NotifyHelperCompleted(FileHelper* aFileHelper);
private:
protected:
FileRequest(nsIDOMWindow* aWindow);
~FileRequest();
@ -52,7 +46,6 @@ private:
FireProgressEvent(uint64_t aLoaded, uint64_t aTotal);
nsRefPtr<LockedFile> mLockedFile;
bool mIsFileRequest;
};
END_FILE_NAMESPACE

View File

@ -533,7 +533,7 @@ LockedFile::SetLocation(JSContext* aCx,
NS_IMETHODIMP
LockedFile::GetMetadata(const jsval& aParameters,
JSContext* aCx,
nsIDOMFileRequest** _retval)
nsISupports** _retval)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
@ -570,14 +570,15 @@ LockedFile::GetMetadata(const jsval& aParameters,
nsresult rv = helper->Enqueue();
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_FILEHANDLE_UNKNOWN_ERR);
fileRequest.forget(_retval);
nsRefPtr<nsIDOMDOMRequest> request = fileRequest.forget();
request.forget(_retval);
return NS_OK;
}
NS_IMETHODIMP
LockedFile::ReadAsArrayBuffer(uint64_t aSize,
JSContext* aCx,
nsIDOMFileRequest** _retval)
nsISupports** _retval)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
@ -612,14 +613,15 @@ LockedFile::ReadAsArrayBuffer(uint64_t aSize,
mLocation += aSize;
fileRequest.forget(_retval);
nsRefPtr<nsIDOMDOMRequest> request = fileRequest.forget();
request.forget(_retval);
return NS_OK;
}
NS_IMETHODIMP
LockedFile::ReadAsText(uint64_t aSize,
const nsAString& aEncoding,
nsIDOMFileRequest** _retval)
nsISupports** _retval)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
@ -654,14 +656,15 @@ LockedFile::ReadAsText(uint64_t aSize,
mLocation += aSize;
fileRequest.forget(_retval);
nsRefPtr<nsIDOMDOMRequest> request = fileRequest.forget();
request.forget(_retval);
return NS_OK;
}
NS_IMETHODIMP
LockedFile::Write(const jsval& aValue,
JSContext* aCx,
nsIDOMFileRequest** _retval)
nsISupports** _retval)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
@ -671,7 +674,7 @@ LockedFile::Write(const jsval& aValue,
NS_IMETHODIMP
LockedFile::Append(const jsval& aValue,
JSContext* aCx,
nsIDOMFileRequest** _retval)
nsISupports** _retval)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
@ -681,7 +684,7 @@ LockedFile::Append(const jsval& aValue,
NS_IMETHODIMP
LockedFile::Truncate(uint64_t aSize,
uint8_t aOptionalArgCount,
nsIDOMFileRequest** _retval)
nsISupports** _retval)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
@ -724,12 +727,13 @@ LockedFile::Truncate(uint64_t aSize,
mLocation = aSize;
}
fileRequest.forget(_retval);
nsRefPtr<nsIDOMDOMRequest> request = fileRequest.forget();
request.forget(_retval);
return NS_OK;
}
NS_IMETHODIMP
LockedFile::Flush(nsIDOMFileRequest** _retval)
LockedFile::Flush(nsISupports** _retval)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
@ -754,7 +758,8 @@ LockedFile::Flush(nsIDOMFileRequest** _retval)
nsresult rv = helper->Enqueue();
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_FILEHANDLE_UNKNOWN_ERR);
fileRequest.forget(_retval);
nsRefPtr<nsIDOMDOMRequest> request = fileRequest.forget();
request.forget(_retval);
return NS_OK;
}
@ -837,7 +842,7 @@ LockedFile::OpenInputStream(bool aWholeFile, uint64_t aStart, uint64_t aLength,
nsresult
LockedFile::WriteOrAppend(const jsval& aValue,
JSContext* aCx,
nsIDOMFileRequest** _retval,
nsISupports** _retval,
bool aAppend)
{
if (!IsOpen()) {
@ -886,7 +891,8 @@ LockedFile::WriteOrAppend(const jsval& aValue,
mLocation += inputLength;
}
fileRequest.forget(_retval);
nsRefPtr<nsIDOMDOMRequest> request = fileRequest.forget();
request.forget(_retval);
return NS_OK;
}

View File

@ -107,7 +107,7 @@ private:
nsresult
WriteOrAppend(const jsval& aValue, JSContext* aCx,
nsIDOMFileRequest** _retval, bool aAppend);
nsISupports** _retval, bool aAppend);
nsresult
Finish();

View File

@ -24,6 +24,7 @@ EXPORTS_NAMESPACES = mozilla/dom/file
CPPSRCS = \
AsyncHelper.cpp \
DOMFileHandle.cpp \
DOMFileRequest.cpp \
File.cpp \
FileHandle.cpp \
FileHelper.cpp \
@ -46,6 +47,7 @@ EXPORTS = \
EXPORTS_mozilla/dom/file = \
DOMFileHandle.h \
DOMFileRequest.h \
File.h \
FileCommon.h \
FileHandle.h \

View File

@ -6,9 +6,7 @@
TEST_DIRS += ['test']
XPIDL_SOURCES += [
'nsIDOMArchiveRequest.idl',
'nsIDOMFileHandle.idl',
'nsIDOMFileRequest.idl',
'nsIDOMLockedFile.idl',
]

View File

@ -1,15 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* 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 "nsIDOMDOMRequest.idl"
interface nsIDOMArchiveReader;
[scriptable, builtinclass, uuid(cb72a719-f07d-4271-a120-16e9148a8699)]
interface nsIDOMArchiveRequest : nsIDOMDOMRequest
{
readonly attribute nsISupports /* ArchiveReader */ reader;
};

View File

@ -1,18 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* 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 "nsIDOMDOMRequest.idl"
interface nsIDOMEventListener;
interface nsIDOMLockedFile;
[scriptable, builtinclass, uuid(6733d649-0acb-487d-8a7d-f102ac4419e9)]
interface nsIDOMFileRequest : nsIDOMDOMRequest
{
readonly attribute nsIDOMLockedFile lockedFile;
[implicit_jscontext] attribute jsval onprogress;
};

View File

@ -8,7 +8,6 @@
interface nsIDOMEventListener;
interface nsIDOMFileHandle;
interface nsIDOMFileRequest;
dictionary DOMFileMetadataParameters
{
@ -16,7 +15,7 @@ dictionary DOMFileMetadataParameters
boolean lastModified;
};
[scriptable, builtinclass, uuid(589e0d26-20b5-4355-ac1e-9c6fd0dd83f2)]
[scriptable, builtinclass, uuid(a09cdc35-6b1e-42ce-95bb-f8f10a354202)]
interface nsIDOMLockedFile : nsISupports
{
readonly attribute nsIDOMFileHandle fileHandle;
@ -30,31 +29,31 @@ interface nsIDOMLockedFile : nsISupports
attribute jsval location;
[implicit_jscontext]
nsIDOMFileRequest
nsISupports /* FileRequest */
getMetadata(/* DOMFileMetadataParameters */
[optional /* all */] in jsval parameters);
[implicit_jscontext]
nsIDOMFileRequest
nsISupports /* FileRequest */
readAsArrayBuffer(in unsigned long long size);
nsIDOMFileRequest
nsISupports /* FileRequest */
readAsText(in unsigned long long size,
[optional] in DOMString encoding);
[implicit_jscontext]
nsIDOMFileRequest
nsISupports /* FileRequest */
write(in jsval value);
[implicit_jscontext]
nsIDOMFileRequest
nsISupports /* FileRequest */
append(in jsval value);
[optional_argc]
nsIDOMFileRequest
nsISupports /* FileRequest */
truncate([optional] in unsigned long long size);
nsIDOMFileRequest
nsISupports /* FileRequest */
flush();
void

View File

@ -3,8 +3,6 @@
* 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/. */
interface ArchiveRequest;
[PrefControlled,
Constructor(Blob blob, optional ArchiveReaderOptions options)]
interface ArchiveReader {

View File

@ -0,0 +1,9 @@
/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* 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/. */
interface ArchiveRequest : DOMRequest {
readonly attribute ArchiveReader reader;
};

View File

@ -0,0 +1,10 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
interface DOMCursor : DOMRequest {
readonly attribute boolean done;
[Throws]
void continue();
};

View File

@ -0,0 +1,21 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
interface DOMError;
interface Window;
enum DOMRequestReadyState { "pending", "done" };
interface DOMRequest : EventTarget {
readonly attribute DOMRequestReadyState readyState;
readonly attribute any result;
readonly attribute DOMError? error;
[SetterThrows]
attribute EventHandler onsuccess;
[SetterThrows]
attribute EventHandler onerror;
};

View File

@ -0,0 +1,14 @@
/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* 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/. */
interface LockedFile;
interface FileRequest : DOMRequest {
readonly attribute LockedFile? lockedFile;
[SetterThrows]
attribute EventHandler onprogress;
};

View File

@ -0,0 +1,11 @@
/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* 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/. */
interface ActivityOptions;
[PrefControlled, Constructor(ActivityOptions options)]
interface MozActivity : DOMRequest {
};

View File

@ -11,6 +11,7 @@ generated_webidl_files = \
webidl_files = \
AnimationEvent.webidl \
ArchiveReader.webidl \
ArchiveRequest.webidl \
AudioBuffer.webidl \
AudioBufferSourceNode.webidl \
AudioContext.webidl \
@ -40,8 +41,10 @@ webidl_files = \
Document.webidl \
DocumentFragment.webidl \
DocumentType.webidl \
DOMCursor.webidl \
DOMImplementation.webidl \
DOMParser.webidl \
DOMRequest.webidl \
DOMSettableTokenList.webidl \
DOMStringMap.webidl \
DOMTokenList.webidl \
@ -58,6 +61,7 @@ webidl_files = \
FileHandle.webidl \
FileList.webidl \
FileReaderSync.webidl \
FileRequest.webidl \
FormData.webidl \
Function.webidl \
GainNode.webidl \
@ -127,6 +131,7 @@ webidl_files = \
Location.webidl \
MediaStream.webidl \
MessageEvent.webidl \
MozActivity.webidl \
MutationEvent.webidl \
MutationObserver.webidl \
Node.webidl \

View File

@ -221,7 +221,6 @@ members = [
'nsIDOMDOMError.*',
# dom/file
'nsIDOMFileRequest.*',
'nsIDOMLockedFile.*',
]