Move indexedDB implementation to dom/indexedDB, add more interfaces and stub implementations, integrate with DOMClassInfo.

--HG--
rename : dom/src/storage/IDBRequest.cpp => dom/indexedDB/IDBRequest.cpp
rename : dom/src/storage/IDBRequest.h => dom/indexedDB/IDBRequest.h
rename : dom/interfaces/storage/nsIIDBRequest.idl => dom/indexedDB/nsIIDBRequest.idl
rename : dom/interfaces/storage/nsIIndexedDatabaseRequest.idl => dom/indexedDB/nsIIndexedDatabaseRequest.idl
rename : dom/tests/mochitest/indexeddb/Makefile.in => dom/indexedDB/test/Makefile.in
rename : dom/tests/mochitest/indexeddb/test_property_on_window.html => dom/indexedDB/test/test_property_on_window.html
This commit is contained in:
Ben Turner 2010-04-22 21:38:51 -07:00
parent 211b480d36
commit 5c39e117e7
30 changed files with 1255 additions and 61 deletions

View File

@ -49,6 +49,7 @@
#include "nsPIDOMWindow.h"
#include "nsIScriptGlobalObject.h"
#include "nsIEventListenerManager.h"
#include "nsIScriptContext.h"
class nsDOMEventListenerWrapper : public nsIDOMEventListener
{

View File

@ -80,6 +80,7 @@ DIRS += \
src \
locales \
plugins \
indexedDB \
$(NULL)
ifdef ENABLE_TESTS

View File

@ -466,6 +466,11 @@
#include "nsIEventListenerService.h"
#include "mozilla/dom/indexedDB/IndexedDatabaseRequest.h"
#include "mozilla/dom/indexedDB/IDBRequest.h"
#include "mozilla/dom/indexedDB/IDBDatabaseError.h"
#include "mozilla/dom/indexedDB/IDBDatabaseRequest.h"
static NS_DEFINE_CID(kDOMSOF_CID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
static const char kDOMStringBundleURL[] =
@ -1371,6 +1376,15 @@ static nsDOMClassInfoData sClassInfoData[] = {
NS_DEFINE_CLASSINFO_DATA(FormData, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(IndexedDatabaseRequest, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(IDBRequest, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(IDBDatabaseRequest, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(IDBDatabaseError, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
};
// Objects that should be constructable through |new Name();|
@ -3800,6 +3814,23 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMFormData)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(IndexedDatabaseRequest, nsIIndexedDatabaseRequest)
DOM_CLASSINFO_MAP_ENTRY(nsIIndexedDatabaseRequest)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(IDBRequest, nsIIDBRequest)
DOM_CLASSINFO_MAP_ENTRY(nsIIDBRequest)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(IDBDatabaseRequest, nsIIDBDatabaseRequest)
DOM_CLASSINFO_MAP_ENTRY(nsIIDBDatabaseRequest)
DOM_CLASSINFO_MAP_ENTRY(nsIIDBDatabase)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(IDBDatabaseError, nsIIDBDatabaseError)
DOM_CLASSINFO_MAP_ENTRY(nsIIDBDatabaseError)
DOM_CLASSINFO_MAP_END
#ifdef NS_DEBUG
{
PRUint32 i = NS_ARRAY_LENGTH(sClassInfoData);

View File

@ -466,3 +466,8 @@ DOMCI_CLASS(EventListenerInfo)
DOMCI_CLASS(TransitionEvent)
DOMCI_CLASS(FormData)
DOMCI_CLASS(IndexedDatabaseRequest)
DOMCI_CLASS(IDBRequest)
DOMCI_CLASS(IDBDatabaseRequest)
DOMCI_CLASS(IDBDatabaseError)

View File

@ -209,6 +209,8 @@
#endif
#include "prlog.h"
#include "mozilla/dom/indexedDB/IndexedDatabaseRequest.h"
#ifdef PR_LOGGING
static PRLogModuleInfo* gDOMLeakPRLog;
#endif
@ -7480,10 +7482,13 @@ nsGlobalWindow::GetLocalStorage(nsIDOMStorage ** aLocalStorage)
return NS_OK;
}
NS_IMETHODIMP
nsGlobalWindow::GetIndexedDB(nsIIndexedDatabaseRequest** _indexedDB)
nsGlobalWindow::GetIndexedDB(nsIIndexedDatabaseRequest** _retval)
{
*_indexedDB = nsnull;
nsCOMPtr<nsIIndexedDatabaseRequest> indexedDB =
mozilla::dom::indexedDB::IndexedDatabaseRequest::Create();
NS_ENSURE_TRUE(indexedDB, NS_ERROR_FAILURE);
indexedDB.forget(_retval);
return NS_OK;
}

View File

@ -0,0 +1,84 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Indexed Database.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Ben Turner <bent.mozilla@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "IDBDatabaseError.h"
#include "nsDOMClassInfo.h"
#include "nsDOMClassInfoID.h"
USING_INDEXEDDB_NAMESPACE
NS_IMPL_ADDREF(IDBDatabaseError)
NS_IMPL_RELEASE(IDBDatabaseError)
NS_INTERFACE_MAP_BEGIN(IDBDatabaseError)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIIDBDatabaseError)
NS_INTERFACE_MAP_ENTRY(nsIIDBDatabaseError)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(IDBDatabaseError)
NS_INTERFACE_MAP_END
DOMCI_DATA(IDBDatabaseError, IDBDatabaseError)
NS_IMETHODIMP
IDBDatabaseError::GetCode(PRUint16* aCode)
{
*aCode = mCode;
return NS_OK;
}
NS_IMETHODIMP
IDBDatabaseError::SetCode(PRUint16 aCode)
{
mCode = aCode;
return NS_OK;
}
NS_IMETHODIMP
IDBDatabaseError::GetMessage(nsAString& aMessage)
{
aMessage.Assign(mMessage);
return NS_OK;
}
NS_IMETHODIMP
IDBDatabaseError::SetMessage(const nsAString& aMessage)
{
mMessage.Assign(aMessage);
return NS_OK;
}

View File

@ -0,0 +1,76 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Indexed Database.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Ben Turner <bent.mozilla@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef mozilla_dom_indexeddb_idbdatabaseerror_h__
#define mozilla_dom_indexeddb_idbdatabaseerror_h__
#include "mozilla/dom/indexedDB/IndexedDatabase.h"
#include "nsIIDBDatabaseError.h"
#include "nsStringGlue.h"
BEGIN_INDEXEDDB_NAMESPACE
class IDBRequest;
class IDBDatabaseError : public nsIIDBDatabaseError
{
friend class IDBRequest;
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIIDBDATABASEERROR
protected:
// Only called by IDBRequest.
IDBDatabaseError(PRUint16 aCode,
const nsAString& aMessage)
: mCode(aCode),
mMessage(aMessage)
{ }
protected:
PRUint16 mCode;
nsString mMessage;
};
END_INDEXEDDB_NAMESPACE
#endif // mozilla_dom_indexeddb_idbdatabaseerror_h__

View File

@ -0,0 +1,219 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Indexed Database.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Ben Turner <bent.mozilla@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "IDBDatabaseRequest.h"
#include "nsDOMClassInfo.h"
#include "IDBRequest.h"
USING_INDEXEDDB_NAMESPACE
namespace {
const PRUint32 kDefaultTimeoutMS = 5000;
} // anonymous namespace
IDBDatabaseRequest::IDBDatabaseRequest()
{
}
NS_IMPL_ADDREF(IDBDatabaseRequest)
NS_IMPL_RELEASE(IDBDatabaseRequest)
NS_INTERFACE_MAP_BEGIN(IDBDatabaseRequest)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIIDBDatabaseRequest)
NS_INTERFACE_MAP_ENTRY(nsIIDBDatabaseRequest)
NS_INTERFACE_MAP_ENTRY(nsIIDBDatabase)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(IDBDatabaseRequest)
NS_INTERFACE_MAP_END
DOMCI_DATA(IDBDatabaseRequest, IDBDatabaseRequest)
NS_IMETHODIMP
IDBDatabaseRequest::GetName(nsAString& aName)
{
NS_NOTYETIMPLEMENTED("Implement me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
IDBDatabaseRequest::GetDescription(nsAString& aDescription)
{
NS_NOTYETIMPLEMENTED("Implement me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
IDBDatabaseRequest::GetVersion(nsAString& aVersion)
{
NS_NOTYETIMPLEMENTED("Implement me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
IDBDatabaseRequest::GetObjectStores(nsIDOMDOMStringList** aObjectStores)
{
NS_NOTYETIMPLEMENTED("Implement me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
IDBDatabaseRequest::GetIndexes(nsIDOMDOMStringList** aIndexes)
{
NS_NOTYETIMPLEMENTED("Implement me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
IDBDatabaseRequest::GetCurrentTransaction(nsIIDBTransaction** aTransaction)
{
NS_NOTYETIMPLEMENTED("Implement me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
IDBDatabaseRequest::CreateObjectStore(const nsAString& aName,
const nsAString& aKeyPath,
PRBool aAutoIncrement,
nsIIDBRequest** _retval)
{
NS_NOTYETIMPLEMENTED("Implement me!");
nsCOMPtr<nsIIDBRequest> request(new IDBRequest(this));
request.forget(_retval);
return NS_OK;
}
NS_IMETHODIMP
IDBDatabaseRequest::OpenObjectStore(const nsAString& aName,
PRUint16 aMode,
nsIIDBRequest** _retval)
{
NS_NOTYETIMPLEMENTED("Implement me!");
nsCOMPtr<nsIIDBRequest> request(new IDBRequest(this));
request.forget(_retval);
return NS_OK;
}
NS_IMETHODIMP
IDBDatabaseRequest::CreateIndex(const nsAString& aName,
const nsAString& aStoreName,
const nsAString& aKeyPath,
PRBool aUnique,
nsIIDBRequest** _retval)
{
NS_NOTYETIMPLEMENTED("Implement me!");
nsCOMPtr<nsIIDBRequest> request(new IDBRequest(this));
request.forget(_retval);
return NS_OK;
}
NS_IMETHODIMP
IDBDatabaseRequest::OpenIndex(const nsAString& aName,
nsIIDBRequest** _retval)
{
NS_NOTYETIMPLEMENTED("Implement me!");
nsCOMPtr<nsIIDBRequest> request(new IDBRequest(this));
request.forget(_retval);
return NS_OK;
}
NS_IMETHODIMP
IDBDatabaseRequest::RemoveObjectStore(const nsAString& aStoreName,
nsIIDBRequest** _retval)
{
NS_NOTYETIMPLEMENTED("Implement me!");
nsCOMPtr<nsIIDBRequest> request(new IDBRequest(this));
request.forget(_retval);
return NS_OK;
}
NS_IMETHODIMP
IDBDatabaseRequest::RemoveIndex(const nsAString& aIndexName,
nsIIDBRequest** _retval)
{
NS_NOTYETIMPLEMENTED("Implement me!");
nsCOMPtr<nsIIDBRequest> request(new IDBRequest(this));
request.forget(_retval);
return NS_OK;
}
NS_IMETHODIMP
IDBDatabaseRequest::SetVersion(const nsAString& aVersion,
nsIIDBRequest** _retval)
{
NS_NOTYETIMPLEMENTED("Implement me!");
nsCOMPtr<nsIIDBRequest> request(new IDBRequest(this));
request.forget(_retval);
return NS_OK;
}
NS_IMETHODIMP
IDBDatabaseRequest::OpenTransaction(nsIDOMDOMStringList* aStoreNames,
PRUint32 aTimeout,
PRUint8 aArgCount,
nsIIDBRequest** _retval)
{
NS_NOTYETIMPLEMENTED("Implement me!");
if (aArgCount < 2) {
aTimeout = kDefaultTimeoutMS;
}
nsCOMPtr<nsIIDBRequest> request(new IDBRequest(this));
request.forget(_retval);
return NS_OK;
}

View File

@ -0,0 +1,62 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Indexed Database.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Ben Turner <bent.mozilla@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef mozilla_dom_indexeddb_idbdatabaserequest_h__
#define mozilla_dom_indexeddb_idbdatabaserequest_h__
#include "mozilla/dom/indexedDB/IndexedDatabase.h"
#include "nsIIDBDatabaseRequest.h"
BEGIN_INDEXEDDB_NAMESPACE
class IDBDatabaseRequest : public nsIIDBDatabaseRequest
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIIDBDATABASE
NS_DECL_NSIIDBDATABASEREQUEST
protected:
IDBDatabaseRequest();
};
END_INDEXEDDB_NAMESPACE
#endif // mozilla_dom_indexeddb_idbdatabaserequest_h__

View File

@ -13,15 +13,16 @@
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Indexed Database code.
* The Original Code is Indexed Database.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Shawn Wilsher <me@shawnwilsher.com>
* Ben Turner <bent.mozilla@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -38,12 +39,15 @@
* ***** END LICENSE BLOCK ***** */
#include "IDBRequest.h"
#include "nsString.h"
#include "nsIScriptContext.h"
namespace mozilla {
namespace dom {
namespace idb {
#include "nsIScriptContext.h"
#include "nsIVariant.h"
#include "nsComponentManagerUtils.h"
#include "nsDOMClassInfo.h"
#include "nsStringGlue.h"
USING_INDEXEDDB_NAMESPACE
////////////////////////////////////////////////////////////////////////////////
//// Request
@ -51,43 +55,86 @@ namespace idb {
#define SUCCESS_EVT_STR "success"
#define ERROR_EVT_STR "error"
Request::Request()
: mReadyState(INITIAL)
IDBRequest::IDBRequest(nsISupports* aSource)
: mReadyState(INITIAL),
mSource(aSource)
{
NS_ASSERTION(mSource, "Null source!");
}
IDBRequest::~IDBRequest()
{
if (mListenerManager) {
mListenerManager->Disconnect();
}
}
nsresult
IDBRequest::SetResult(nsISupports* aResult)
{
if (!mResult) {
mResult = do_CreateInstance(NS_VARIANT_CONTRACTID);
NS_ENSURE_TRUE(mResult, NS_ERROR_FAILURE);
}
return mResult->SetAsISupports(aResult);
}
////////////////////////////////////////////////////////////////////////////////
//// nsIIDBRequest
NS_IMETHODIMP
Request::GetReadyState(PRUint16* aReadyState)
IDBRequest::Abort()
{
NS_NOTYETIMPLEMENTED("Implement me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
IDBRequest::GetReadyState(PRUint16* aReadyState)
{
*aReadyState = mReadyState;
return NS_OK;
}
NS_IMETHODIMP
Request::SetOnsuccess(nsIDOMEventListener* aSuccessListener)
IDBRequest::GetError(nsIIDBDatabaseError** aError)
{
nsCOMPtr<nsIIDBDatabaseError> error(mError);
error.forget(aError);
return NS_OK;
}
NS_IMETHODIMP
IDBRequest::GetResult(nsIVariant** aResult)
{
nsCOMPtr<nsIVariant> result(mResult);
result.forget(aResult);
return NS_OK;
}
NS_IMETHODIMP
IDBRequest::SetOnsuccess(nsIDOMEventListener* aSuccessListener)
{
return RemoveAddEventListener(NS_LITERAL_STRING(SUCCESS_EVT_STR),
mOnSuccessListener, aSuccessListener);
}
NS_IMETHODIMP
Request::GetOnsuccess(nsIDOMEventListener** aSuccessListener)
IDBRequest::GetOnsuccess(nsIDOMEventListener** aSuccessListener)
{
return GetInnerEventListener(mOnSuccessListener, aSuccessListener);
}
NS_IMETHODIMP
Request::SetOnerror(nsIDOMEventListener* aErrorListener)
IDBRequest::SetOnerror(nsIDOMEventListener* aErrorListener)
{
return RemoveAddEventListener(NS_LITERAL_STRING(ERROR_EVT_STR),
mOnErrorListener, aErrorListener);
}
NS_IMETHODIMP
Request::GetOnerror(nsIDOMEventListener** aErrorListener)
IDBRequest::GetOnerror(nsIDOMEventListener** aErrorListener)
{
return GetInnerEventListener(mOnErrorListener, aErrorListener);
}
@ -95,27 +142,26 @@ Request::GetOnerror(nsIDOMEventListener** aErrorListener)
////////////////////////////////////////////////////////////////////////////////
//// nsISupports
NS_IMPL_CYCLE_COLLECTION_CLASS(Request)
NS_IMPL_CYCLE_COLLECTION_CLASS(IDBRequest)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(Request,
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(IDBRequest,
nsDOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnSuccessListener)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnErrorListener)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(Request,
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(IDBRequest,
nsDOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnSuccessListener)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnErrorListener)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(Request)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(IDBRequest)
NS_INTERFACE_MAP_ENTRY(nsIIDBRequest)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(IDBRequest)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
NS_IMPL_ADDREF_INHERITED(Request, nsDOMEventTargetHelper)
NS_IMPL_RELEASE_INHERITED(Request, nsDOMEventTargetHelper)
NS_IMPL_ADDREF_INHERITED(IDBRequest, nsDOMEventTargetHelper)
NS_IMPL_RELEASE_INHERITED(IDBRequest, nsDOMEventTargetHelper)
} // namespace idb
} // namepsace dom
} // namespace mozilla
DOMCI_DATA(IDBRequest, IDBRequest)

View File

@ -13,15 +13,16 @@
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Indexed Database code.
* The Original Code is Indexed Database.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Shawn Wilsher <me@shawnwilsher.com>
* Ben Turner <bent.mozilla@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -37,40 +38,53 @@
*
* ***** END LICENSE BLOCK ***** */
#ifndef mozilla_dom_idb_request_h__
#define mozilla_dom_idb_request_h__
#ifndef mozilla_dom_indexeddb_idbrequest_h__
#define mozilla_dom_indexeddb_idbrequest_h__
#include "mozilla/dom/indexedDB/IndexedDatabase.h"
#include "mozilla/dom/indexedDB/IDBDatabaseError.h"
#include "nsIIDBRequest.h"
#include "nsIVariant.h"
#include "nsDOMEventTargetHelper.h"
#include "nsCycleCollectionParticipant.h"
#include "nsAutoPtr.h"
#include "nsCOMPtr.h"
namespace mozilla {
namespace dom {
namespace idb {
BEGIN_INDEXEDDB_NAMESPACE
class Request : public nsDOMEventTargetHelper
, public nsIIDBRequest
class IndexedDatabaseRequest;
class IDBDatabaseRequest;
class IDBRequest : public nsDOMEventTargetHelper,
public nsIIDBRequest
{
friend class IndexedDatabaseRequest;
friend class IDBDatabaseRequest;
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIIDBREQUEST
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(Request,
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(IDBRequest,
nsDOMEventTargetHelper)
Request();
nsresult SetResult(nsISupports* aResult);
protected:
IDBRequest(nsISupports* aSource);
~IDBRequest();
protected:
PRUint16 mReadyState;
private:
nsRefPtr<nsDOMEventListenerWrapper> mOnSuccessListener;
nsRefPtr<nsDOMEventListenerWrapper> mOnErrorListener;
nsRefPtr<IDBDatabaseError> mError;
nsCOMPtr<nsIWritableVariant> mResult;
nsCOMPtr<nsISupports> mSource;
};
} // namespace idb
} // namepsace dom
} // namespace mozilla
END_INDEXEDDB_NAMESPACE
#endif // mozilla_dom_idb_request_h__
#endif // mozilla_dom_indexeddb_idbrequest_h__

View File

@ -0,0 +1,55 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Indexed Database.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Shawn Wilsher <me@shawnwilsher.com>
* Ben Turner <bent.mozilla@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef mozilla_dom_indexeddb_indexeddatabase_h__
#define mozilla_dom_indexeddb_indexeddatabase_h__
#include "nsIProgrammingLanguage.h"
#define BEGIN_INDEXEDDB_NAMESPACE \
namespace mozilla { namespace dom { namespace indexedDB {
#define END_INDEXEDDB_NAMESPACE \
} /* namespace indexedDB */ } /* namepsace dom */ } /* namespace mozilla */
#define USING_INDEXEDDB_NAMESPACE \
using namespace mozilla::dom::indexedDB;
#endif // mozilla_dom_indexeddb_indexeddatabase_h__

View File

@ -0,0 +1,87 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Indexed Database.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Ben Turner <bent.mozilla@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "IndexedDatabaseRequest.h"
#include "nsDOMClassInfo.h"
#include "IDBRequest.h"
USING_INDEXEDDB_NAMESPACE
// static
already_AddRefed<nsIIndexedDatabaseRequest>
IndexedDatabaseRequest::Create()
{
nsCOMPtr<nsIIndexedDatabaseRequest> request(new IndexedDatabaseRequest());
return request.forget();
}
IndexedDatabaseRequest::IndexedDatabaseRequest()
{
}
NS_IMPL_ADDREF(IndexedDatabaseRequest)
NS_IMPL_RELEASE(IndexedDatabaseRequest)
NS_INTERFACE_MAP_BEGIN(IndexedDatabaseRequest)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIIndexedDatabaseRequest)
NS_INTERFACE_MAP_ENTRY(nsIIndexedDatabaseRequest)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(IndexedDatabaseRequest)
NS_INTERFACE_MAP_END
DOMCI_DATA(IndexedDatabaseRequest, IndexedDatabaseRequest)
NS_IMETHODIMP
IndexedDatabaseRequest::Open(const nsAString& aName,
const nsAString& aDescription,
PRBool aModifyDatabase,
PRUint8 aArgCount,
nsIIDBRequest** _retval)
{
if (aArgCount < 3) {
// aModifyDatabase defaults to true.
aModifyDatabase = PR_TRUE;
}
nsCOMPtr<nsIIDBRequest> request(new IDBRequest(this));
request.forget(_retval);
return NS_OK;
}

View File

@ -0,0 +1,66 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Indexed Database.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Ben Turner <bent.mozilla@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef mozilla_dom_indexeddb_indexeddatabaserequest_h__
#define mozilla_dom_indexeddb_indexeddatabaserequest_h__
#include "mozilla/dom/indexedDB/IndexedDatabase.h"
#include "nsIIndexedDatabaseRequest.h"
#include "nsCOMPtr.h"
BEGIN_INDEXEDDB_NAMESPACE
class IndexedDatabaseRequest : public nsIIndexedDatabaseRequest
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIINDEXEDDATABASEREQUEST
static already_AddRefed<nsIIndexedDatabaseRequest> Create();
protected:
// Only called by Create().
IndexedDatabaseRequest();
};
END_INDEXEDDB_NAMESPACE
#endif // mozilla_dom_indexeddb_indexeddatabaserequest_h__

90
dom/indexedDB/Makefile.in Normal file
View File

@ -0,0 +1,90 @@
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Indexed Database.
#
# The Initial Developer of the Original Code is
# The Mozilla Foundation.
# Portions created by the Initial Developer are Copyright (C) 2010
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Shawn Wilsher <me@shawnwilsher.com>
# Ben Turner <bent.mozilla@gmail.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = dom
LIBRARY_NAME = domindexedDB_s
XPIDL_MODULE = domindexedDB
LIBXUL_LIBRARY = 1
FORCE_STATIC_LIB = 1
EXPORTS_NAMESPACES = mozilla/dom/indexedDB
CPPSRCS = \
IDBDatabaseError.cpp \
IDBDatabaseRequest.cpp \
IDBRequest.cpp \
IndexedDatabaseRequest.cpp \
$(NULL)
EXPORTS_mozilla/dom/indexedDB = \
IDBDatabaseError.h \
IDBDatabaseRequest.h \
IDBRequest.h \
IndexedDatabase.h \
IndexedDatabaseRequest.h \
$(NULL)
LOCAL_INCLUDES = \
-I$(topsrcdir)/dom/base \
-I$(topsrcdir)/content/events/src
$(NULL)
DEFINES += -D_IMPL_NS_LAYOUT
XPIDLSRCS = \
nsIIDBDatabase.idl \
nsIIDBDatabaseError.idl \
nsIIDBDatabaseRequest.idl \
nsIIDBRequest.idl \
nsIIDBTransaction.idl \
nsIIDBTransactionRequest.idl \
nsIIndexedDatabaseRequest.idl \
$(NULL)
ifdef ENABLE_TESTS
DIRS += test
endif
include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1,64 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Indexed Database.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Ben Turner <bent.mozilla@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface nsIDOMDOMStringList;
interface nsIIDBTransaction;
/**
* IDBDatabase interface. See
* http://dev.w3.org/2006/webapi/WebSimpleDB/#idl-def-IDBDatabase for more
* information.
*/
[scriptable, uuid(828a5080-6912-4e4d-afe0-57846788eb2e)]
interface nsIIDBDatabase : nsISupports
{
readonly attribute DOMString name;
readonly attribute DOMString description;
readonly attribute DOMString version;
readonly attribute nsIDOMDOMStringList objectStores;
readonly attribute nsIDOMDOMStringList indexes;
readonly attribute nsIIDBTransaction currentTransaction;
};

View File

@ -0,0 +1,64 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Indexed Database.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Ben Turner <bent.mozilla@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
/**
* IDBDatabaseError interface. See
* http://dev.w3.org/2006/webapi/WebSimpleDB/#idl-def-IDBDatabaseError for more
* information.
*/
[scriptable, uuid(7369d3ad-8742-4642-a538-e93bfcf896b3)]
interface nsIIDBDatabaseError : nsISupports
{
const unsigned short UNKNOWN_ERR = 0;
const unsigned short NON_TRANSIENT_ERR = 1;
const unsigned short NOT_FOUND_ERR = 2;
const unsigned short CONSTRAINT_ERR = 3;
const unsigned short DATA_ERR = 4;
const unsigned short NOT_ALLOWED_ERR = 5;
const unsigned short SERIAL_ERR = 11;
const unsigned short RECOVERABLE_ERR = 21;
const unsigned short TRANSIENT_ERR = 31;
const unsigned short TIMEOUT_ERR = 32;
const unsigned short DEADLOCK_ERR = 33;
attribute unsigned short code;
attribute DOMString message;
};

View File

@ -0,0 +1,87 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Indexed Database.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Ben Turner <bent.mozilla@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsIIDBDatabase.idl"
interface nsIDOMDOMStringList;
interface nsIIDBRequest;
/**
* IDBDatabaseRequest interface. See
* http://dev.w3.org/2006/webapi/WebSimpleDB/#idl-def-IDBDatabaseRequest for
* more information.
*/
[scriptable, uuid(8f475c0a-e332-41ba-ba27-156370a63486)]
interface nsIIDBDatabaseRequest : nsIIDBDatabase
{
nsIIDBRequest
createObjectStore(in DOMString name,
in DOMString keyPath,
[optional /* false */] in boolean autoIncrement);
const unsigned short READ_WRITE = 0;
const unsigned short READ_ONLY = 1;
const unsigned short SNAPSHOT_READ = 2;
nsIIDBRequest
openObjectStore(in DOMString name,
[optional /* READ_WRITE */] in unsigned short mode);
nsIIDBRequest
createIndex(in DOMString name,
in DOMString storeName,
in DOMString keyPath,
[optional /* false */] in boolean unique);
nsIIDBRequest
openIndex(in DOMString name);
nsIIDBRequest
removeObjectStore(in DOMString storeName);
nsIIDBRequest
removeIndex(in DOMString indexName);
nsIIDBRequest
setVersion(in DOMString version);
[optional_argc]
nsIIDBRequest
openTransaction([optional /* null */]in nsIDOMDOMStringList storeNames,
[optional /* 5000ms */] in unsigned long timeout);
};

View File

@ -13,15 +13,16 @@
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Indexed Database code.
* The Original Code is Indexed Database.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Shawn Wilsher <me@shawnwilsher.com>
* Ben Turner <bent.mozilla@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -38,9 +39,10 @@
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface nsIDOMEventListener;
interface nsIIDBDatabaseError;
interface nsIVariant;
interface nsIDOMEventListener;
/**
* IDBReqeust interface. See
@ -51,7 +53,8 @@ interface nsIDOMEventListener;
// TODO inherit from nsIEventTarget when the spec is updated.
interface nsIIDBRequest : nsISupports
{
void abort();
void
abort();
const unsigned short INITIAL = 0;
const unsigned short LOADING = 1;

View File

@ -0,0 +1,55 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Indexed Database.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Ben Turner <bent.mozilla@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface nsIIDBDatabase;
/**
* IDBDTransaction interface. See
* http://dev.w3.org/2006/webapi/WebSimpleDB/#idl-def-IDBDTransaction for more
* information.
*/
[scriptable, uuid(00c3f651-f4bf-416b-9dc4-759135a35fa9)]
interface nsIIDBTransaction : nsISupports
{
attribute boolean static;
attribute nsIIDBDatabase db;
};

View File

@ -0,0 +1,57 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Indexed Database.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Ben Turner <bent.mozilla@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsIIDBTransaction.idl"
interface nsIIDBRequest;
/**
* IDBDTransactionRequest interface. See
* http://dev.w3.org/2006/webapi/WebSimpleDB/#idl-def-IDBDTransactionRequest for
* more information.
*/
[scriptable, uuid(073f5f2e-fecc-4f96-bba2-d8a90532c926)]
interface nsIIDBTransactionRequest : nsIIDBTransaction
{
nsIIDBRequest
abort();
nsIIDBRequest
commit();
};

View File

@ -13,15 +13,16 @@
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Indexed Database code.
* The Original Code is Indexed Database.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Shawn Wilsher <me@shawnwilsher.com>
* Ben Turner <bent.mozilla@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -39,6 +40,8 @@
#include "nsISupports.idl"
interface nsIIDBRequest;
/**
* Interface that defines the indexedDB property on a window. See
* http://dev.w3.org/2006/webapi/WebSimpleDB/#idl-def-IndexedDatabaseRequest
@ -47,4 +50,9 @@
[scriptable, uuid(043161e0-93b8-43b4-94d8-f34046d679b4)]
interface nsIIndexedDatabaseRequest : nsISupports
{
[optional_argc]
nsIIDBRequest
open(in DOMString name,
in DOMString description,
[optional /* true */] in boolean modifyDatabase);
};

View File

@ -14,7 +14,7 @@
# The Original Code is Indexed Database Test Code.
#
# The Initial Developer of the Original Code is
# Mozilla Foundation.
# The Mozilla Foundation.
# Portions created by the Initial Developer are Copyright (C) 2010
# the Initial Developer. All Rights Reserved.
#
@ -35,11 +35,11 @@
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../../..
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = dom/tests/mochitest/indexeddb
relativesrcdir = dom/src/indexeddb/test
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk

View File

@ -63,8 +63,6 @@ SDK_XPIDLSRCS = \
nsIDOMStorageItem.idl \
nsIDOMStorageList.idl \
nsIDOMStorageWindow.idl \
nsIIndexedDatabaseRequest.idl \
nsIIDBRequest.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -35,13 +35,21 @@
#
# ***** END LICENSE BLOCK *****
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = jsurl events storage offline json geolocation threads
DIRS = \
jsurl \
events \
storage \
offline \
json \
geolocation \
threads \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -53,7 +53,6 @@ CPPSRCS = \
nsDOMStorageDBWrapper.cpp \
nsDOMStoragePersistentDB.cpp \
nsDOMStorageMemoryDB.cpp \
IDBRequest.cpp \
$(NULL)
# we don't want the shared lib, but we want to force the creation of a static lib.

View File

@ -56,7 +56,6 @@ DIRS += \
localstorage \
sessionstorage \
storageevent \
indexeddb \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -383,6 +383,15 @@ members = [
'nsIDOMNSHTMLTextAreaElement.textLength',
'nsIDOMNSHTMLTextAreaElement.wrap',
# dom/interfaces/indexedDB
'nsIIDBDatabase.*',
'nsIIDBDatabaseError.*',
'nsIIDBDatabaseRequest.*',
'nsIIDBRequest.*',
'nsIIDBTransaction.*',
'nsIIDBTransactionRequest.*',
'nsIIndexedDatabaseRequest.*',
# dom/interfaces/json - None.
# All 4 methods of nsIJSON call GetCurrentNativeCallContext.

View File

@ -105,6 +105,7 @@ SHARED_LIBRARY_LIBS = \
$(DEPTH)/dom/src/offline/$(LIB_PREFIX)jsdomoffline_s.$(LIB_SUFFIX) \
$(DEPTH)/dom/src/geolocation/$(LIB_PREFIX)jsdomgeolocation_s.$(LIB_SUFFIX) \
$(DEPTH)/dom/src/threads/$(LIB_PREFIX)domthreads_s.$(LIB_SUFFIX) \
$(DEPTH)/dom/indexedDB/$(LIB_PREFIX)domindexedDB_s.$(LIB_SUFFIX) \
$(DEPTH)/editor/libeditor/text/$(LIB_PREFIX)texteditor_s.$(LIB_SUFFIX) \
$(DEPTH)/editor/libeditor/base/$(LIB_PREFIX)editorbase_s.$(LIB_SUFFIX) \
$(DEPTH)/parser/html/$(LIB_PREFIX)html5p_s.$(LIB_SUFFIX) \