2010-06-23 12:46:08 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* 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/. */
|
2010-06-23 12:46:08 -07:00
|
|
|
|
|
|
|
#include "IDBRequest.h"
|
|
|
|
|
2014-09-26 16:21:57 -07:00
|
|
|
#include "BackgroundChildImpl.h"
|
|
|
|
#include "IDBCursor.h"
|
|
|
|
#include "IDBDatabase.h"
|
|
|
|
#include "IDBEvents.h"
|
|
|
|
#include "IDBFactory.h"
|
|
|
|
#include "IDBIndex.h"
|
|
|
|
#include "IDBObjectStore.h"
|
|
|
|
#include "IDBTransaction.h"
|
2014-12-16 22:26:15 -08:00
|
|
|
#include "IndexedDatabaseManager.h"
|
2013-09-25 04:21:20 -07:00
|
|
|
#include "mozilla/ContentEvents.h"
|
2014-09-26 16:21:57 -07:00
|
|
|
#include "mozilla/ErrorResult.h"
|
2014-03-17 21:48:21 -07:00
|
|
|
#include "mozilla/EventDispatcher.h"
|
2014-12-16 22:26:15 -08:00
|
|
|
#include "mozilla/Move.h"
|
2014-10-08 09:15:22 -07:00
|
|
|
#include "mozilla/dom/DOMError.h"
|
2014-02-22 21:01:12 -08:00
|
|
|
#include "mozilla/dom/ErrorEventBinding.h"
|
2013-07-31 15:28:15 -07:00
|
|
|
#include "mozilla/dom/IDBOpenDBRequestBinding.h"
|
2014-07-01 02:09:46 -07:00
|
|
|
#include "mozilla/dom/ScriptSettings.h"
|
2014-09-26 16:21:57 -07:00
|
|
|
#include "nsCOMPtr.h"
|
2011-10-03 12:11:31 -07:00
|
|
|
#include "nsContentUtils.h"
|
2014-09-26 16:21:57 -07:00
|
|
|
#include "nsIScriptContext.h"
|
2012-06-29 09:48:34 -07:00
|
|
|
#include "nsJSUtils.h"
|
2010-08-26 13:57:25 -07:00
|
|
|
#include "nsPIDOMWindow.h"
|
2013-09-23 10:25:00 -07:00
|
|
|
#include "nsString.h"
|
2014-01-27 16:37:05 -08:00
|
|
|
#include "ReportInternalError.h"
|
2014-12-16 22:26:15 -08:00
|
|
|
#include "WorkerFeature.h"
|
|
|
|
#include "WorkerPrivate.h"
|
2010-06-23 12:46:08 -07:00
|
|
|
|
2014-10-15 21:56:52 -07:00
|
|
|
// Include this last to avoid path problems on Windows.
|
|
|
|
#include "ActorsChild.h"
|
|
|
|
|
2014-09-26 16:21:57 -07:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
namespace indexedDB {
|
2013-03-15 23:58:50 -07:00
|
|
|
|
2014-12-16 22:26:15 -08:00
|
|
|
using namespace mozilla::dom::workers;
|
2014-09-26 16:21:57 -07:00
|
|
|
using namespace mozilla::ipc;
|
2010-06-23 12:46:08 -07:00
|
|
|
|
2015-03-19 21:42:37 -07:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
NS_DEFINE_IID(kIDBRequestIID, PRIVATE_IDBREQUEST_IID);
|
|
|
|
|
|
|
|
} // anonymous namespace
|
|
|
|
|
2014-01-06 21:32:20 -08:00
|
|
|
IDBRequest::IDBRequest(IDBDatabase* aDatabase)
|
2014-09-26 16:21:57 -07:00
|
|
|
: IDBWrapperCache(aDatabase)
|
2010-11-10 15:26:03 -08:00
|
|
|
{
|
2014-09-26 16:21:57 -07:00
|
|
|
MOZ_ASSERT(aDatabase);
|
|
|
|
aDatabase->AssertIsOnOwningThread();
|
|
|
|
|
|
|
|
InitMembers();
|
2014-01-06 21:32:20 -08:00
|
|
|
}
|
2013-07-31 15:28:15 -07:00
|
|
|
|
2014-01-06 21:32:20 -08:00
|
|
|
IDBRequest::IDBRequest(nsPIDOMWindow* aOwner)
|
2014-09-26 16:21:57 -07:00
|
|
|
: IDBWrapperCache(aOwner)
|
2014-01-06 21:32:20 -08:00
|
|
|
{
|
2014-09-26 16:21:57 -07:00
|
|
|
InitMembers();
|
2010-11-10 15:26:03 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
IDBRequest::~IDBRequest()
|
|
|
|
{
|
2014-09-26 16:21:57 -07:00
|
|
|
AssertIsOnOwningThread();
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
|
|
|
|
void
|
|
|
|
IDBRequest::AssertIsOnOwningThread() const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(mOwningThread);
|
|
|
|
MOZ_ASSERT(PR_GetCurrentThread() == mOwningThread);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // DEBUG
|
|
|
|
|
|
|
|
void
|
|
|
|
IDBRequest::InitMembers()
|
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
|
|
|
mOwningThread = PR_GetCurrentThread();
|
|
|
|
#endif
|
|
|
|
AssertIsOnOwningThread();
|
|
|
|
|
|
|
|
mResultVal.setUndefined();
|
2014-10-15 21:56:52 -07:00
|
|
|
mLoggingSerialNumber = NextSerialNumber();
|
2014-09-26 16:21:57 -07:00
|
|
|
mErrorCode = NS_OK;
|
|
|
|
mLineNo = 0;
|
|
|
|
mHaveResultOrErrorCode = false;
|
2010-11-10 15:26:03 -08:00
|
|
|
}
|
|
|
|
|
2010-09-09 15:15:38 -07:00
|
|
|
// static
|
2010-08-26 13:57:25 -07:00
|
|
|
already_AddRefed<IDBRequest>
|
2013-11-04 04:57:53 -08:00
|
|
|
IDBRequest::Create(IDBDatabase* aDatabase,
|
2013-06-20 11:05:33 -07:00
|
|
|
IDBTransaction* aTransaction)
|
2010-06-23 12:46:08 -07:00
|
|
|
{
|
2014-09-26 16:21:57 -07:00
|
|
|
MOZ_ASSERT(aDatabase);
|
|
|
|
aDatabase->AssertIsOnOwningThread();
|
|
|
|
|
|
|
|
nsRefPtr<IDBRequest> request = new IDBRequest(aDatabase);
|
2014-11-13 18:20:38 -08:00
|
|
|
CaptureCaller(request->mFilename, &request->mLineNo);
|
2010-08-26 13:57:25 -07:00
|
|
|
|
2010-11-10 15:26:03 -08:00
|
|
|
request->mTransaction = aTransaction;
|
2013-11-04 04:57:53 -08:00
|
|
|
request->SetScriptOwner(aDatabase->GetScriptOwner());
|
|
|
|
|
2010-08-26 13:57:25 -07:00
|
|
|
return request.forget();
|
2010-06-23 12:46:08 -07:00
|
|
|
}
|
|
|
|
|
2013-08-22 22:17:10 -07:00
|
|
|
// static
|
|
|
|
already_AddRefed<IDBRequest>
|
|
|
|
IDBRequest::Create(IDBObjectStore* aSourceAsObjectStore,
|
2013-11-04 04:57:53 -08:00
|
|
|
IDBDatabase* aDatabase,
|
2013-08-22 22:17:10 -07:00
|
|
|
IDBTransaction* aTransaction)
|
|
|
|
{
|
2014-09-26 16:21:57 -07:00
|
|
|
MOZ_ASSERT(aSourceAsObjectStore);
|
|
|
|
aSourceAsObjectStore->AssertIsOnOwningThread();
|
|
|
|
|
2013-11-04 04:57:53 -08:00
|
|
|
nsRefPtr<IDBRequest> request = Create(aDatabase, aTransaction);
|
2013-08-22 22:17:10 -07:00
|
|
|
|
|
|
|
request->mSourceAsObjectStore = aSourceAsObjectStore;
|
|
|
|
|
|
|
|
return request.forget();
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
already_AddRefed<IDBRequest>
|
|
|
|
IDBRequest::Create(IDBIndex* aSourceAsIndex,
|
2013-11-04 04:57:53 -08:00
|
|
|
IDBDatabase* aDatabase,
|
2013-08-22 22:17:10 -07:00
|
|
|
IDBTransaction* aTransaction)
|
|
|
|
{
|
2014-09-26 16:21:57 -07:00
|
|
|
MOZ_ASSERT(aSourceAsIndex);
|
|
|
|
aSourceAsIndex->AssertIsOnOwningThread();
|
|
|
|
|
2013-11-04 04:57:53 -08:00
|
|
|
nsRefPtr<IDBRequest> request = Create(aDatabase, aTransaction);
|
2013-08-22 22:17:10 -07:00
|
|
|
|
|
|
|
request->mSourceAsIndex = aSourceAsIndex;
|
|
|
|
|
|
|
|
return request.forget();
|
|
|
|
}
|
|
|
|
|
2014-11-13 18:20:38 -08:00
|
|
|
// static
|
2014-10-15 21:56:52 -07:00
|
|
|
uint64_t
|
|
|
|
IDBRequest::NextSerialNumber()
|
|
|
|
{
|
|
|
|
BackgroundChildImpl::ThreadLocal* threadLocal =
|
|
|
|
BackgroundChildImpl::GetThreadLocalForCurrentThread();
|
|
|
|
MOZ_ASSERT(threadLocal);
|
|
|
|
|
|
|
|
ThreadLocal* idbThreadLocal = threadLocal->mIndexedDBThreadLocal;
|
|
|
|
MOZ_ASSERT(idbThreadLocal);
|
|
|
|
|
|
|
|
return idbThreadLocal->NextRequestSN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
IDBRequest::SetLoggingSerialNumber(uint64_t aLoggingSerialNumber)
|
|
|
|
{
|
|
|
|
AssertIsOnOwningThread();
|
|
|
|
MOZ_ASSERT(aLoggingSerialNumber > mLoggingSerialNumber);
|
|
|
|
|
|
|
|
mLoggingSerialNumber = aLoggingSerialNumber;
|
|
|
|
}
|
|
|
|
|
2014-11-13 18:20:38 -08:00
|
|
|
void
|
|
|
|
IDBRequest::CaptureCaller(nsAString& aFilename, uint32_t* aLineNo)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aFilename.IsEmpty());
|
|
|
|
MOZ_ASSERT(aLineNo);
|
|
|
|
|
|
|
|
ThreadsafeAutoJSContext cx;
|
2015-01-05 13:53:27 -08:00
|
|
|
nsJSUtils::GetCallingLocation(cx, aFilename, aLineNo);
|
2014-11-13 18:20:38 -08:00
|
|
|
}
|
|
|
|
|
2014-09-17 16:36:01 -07:00
|
|
|
void
|
2014-09-26 16:21:57 -07:00
|
|
|
IDBRequest::GetSource(
|
|
|
|
Nullable<OwningIDBObjectStoreOrIDBIndexOrIDBCursor>& aSource) const
|
2014-09-17 16:36:01 -07:00
|
|
|
{
|
2014-09-26 16:21:57 -07:00
|
|
|
AssertIsOnOwningThread();
|
2014-09-17 16:36:01 -07:00
|
|
|
|
2014-09-26 16:21:57 -07:00
|
|
|
MOZ_ASSERT_IF(mSourceAsObjectStore, !mSourceAsIndex);
|
|
|
|
MOZ_ASSERT_IF(mSourceAsIndex, !mSourceAsObjectStore);
|
|
|
|
MOZ_ASSERT_IF(mSourceAsCursor, mSourceAsObjectStore || mSourceAsIndex);
|
2014-09-17 16:36:01 -07:00
|
|
|
|
2014-09-26 16:21:57 -07:00
|
|
|
// Always check cursor first since cursor requests hold both the cursor and
|
|
|
|
// the objectStore or index the cursor came from.
|
|
|
|
if (mSourceAsCursor) {
|
|
|
|
aSource.SetValue().SetAsIDBCursor() = mSourceAsCursor;
|
|
|
|
} else if (mSourceAsObjectStore) {
|
2013-08-22 22:17:10 -07:00
|
|
|
aSource.SetValue().SetAsIDBObjectStore() = mSourceAsObjectStore;
|
|
|
|
} else if (mSourceAsIndex) {
|
|
|
|
aSource.SetValue().SetAsIDBIndex() = mSourceAsIndex;
|
|
|
|
} else {
|
|
|
|
aSource.SetNull();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-06 22:21:36 -08:00
|
|
|
void
|
|
|
|
IDBRequest::Reset()
|
|
|
|
{
|
2014-09-26 16:21:57 -07:00
|
|
|
AssertIsOnOwningThread();
|
|
|
|
|
|
|
|
mResultVal.setUndefined();
|
2011-01-06 22:21:36 -08:00
|
|
|
mHaveResultOrErrorCode = false;
|
2012-07-30 07:20:58 -07:00
|
|
|
mError = nullptr;
|
2011-01-06 22:21:36 -08:00
|
|
|
}
|
|
|
|
|
2012-04-11 14:55:21 -07:00
|
|
|
void
|
2014-09-26 16:21:57 -07:00
|
|
|
IDBRequest::DispatchNonTransactionError(nsresult aErrorCode)
|
2012-04-11 14:55:21 -07:00
|
|
|
{
|
2014-09-26 16:21:57 -07:00
|
|
|
AssertIsOnOwningThread();
|
|
|
|
MOZ_ASSERT(NS_FAILED(aErrorCode));
|
|
|
|
MOZ_ASSERT(NS_ERROR_GET_MODULE(aErrorCode) == NS_ERROR_MODULE_DOM_INDEXEDDB);
|
|
|
|
|
|
|
|
SetError(aErrorCode);
|
|
|
|
|
|
|
|
// Make an error event and fire it at the target.
|
|
|
|
nsCOMPtr<nsIDOMEvent> event =
|
|
|
|
CreateGenericEvent(this,
|
|
|
|
nsDependentString(kErrorEventType),
|
|
|
|
eDoesBubble,
|
|
|
|
eCancelable);
|
2014-12-16 22:26:15 -08:00
|
|
|
MOZ_ASSERT(event);
|
2012-06-01 10:21:12 -07:00
|
|
|
|
2014-09-26 16:21:57 -07:00
|
|
|
bool ignored;
|
|
|
|
if (NS_FAILED(DispatchEvent(event, &ignored))) {
|
|
|
|
NS_WARNING("Failed to dispatch event!");
|
2014-09-17 16:36:01 -07:00
|
|
|
}
|
2012-06-01 10:21:12 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
IDBRequest::SetError(nsresult aRv)
|
|
|
|
{
|
2014-09-26 16:21:57 -07:00
|
|
|
AssertIsOnOwningThread();
|
|
|
|
MOZ_ASSERT(NS_FAILED(aRv));
|
|
|
|
MOZ_ASSERT(NS_ERROR_GET_MODULE(aRv) == NS_ERROR_MODULE_DOM_INDEXEDDB);
|
|
|
|
MOZ_ASSERT(!mError);
|
2012-04-11 14:55:21 -07:00
|
|
|
|
2012-06-01 10:21:12 -07:00
|
|
|
mHaveResultOrErrorCode = true;
|
2014-09-26 16:21:57 -07:00
|
|
|
mError = new DOMError(GetOwner(), aRv);
|
2012-06-01 10:21:12 -07:00
|
|
|
mErrorCode = aRv;
|
|
|
|
|
2014-09-26 16:21:57 -07:00
|
|
|
mResultVal.setUndefined();
|
2012-06-01 10:21:12 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
2014-09-26 16:21:57 -07:00
|
|
|
|
2012-06-01 10:21:12 -07:00
|
|
|
nsresult
|
|
|
|
IDBRequest::GetErrorCode() const
|
|
|
|
{
|
2014-09-26 16:21:57 -07:00
|
|
|
AssertIsOnOwningThread();
|
|
|
|
MOZ_ASSERT(mHaveResultOrErrorCode);
|
|
|
|
|
2012-06-01 10:21:12 -07:00
|
|
|
return mErrorCode;
|
|
|
|
}
|
2014-09-26 16:21:57 -07:00
|
|
|
|
2014-12-16 22:26:15 -08:00
|
|
|
DOMError*
|
|
|
|
IDBRequest::GetErrorAfterResult() const
|
|
|
|
{
|
|
|
|
AssertIsOnOwningThread();
|
|
|
|
MOZ_ASSERT(mHaveResultOrErrorCode);
|
|
|
|
|
|
|
|
return mError;
|
|
|
|
}
|
|
|
|
|
2014-09-26 16:21:57 -07:00
|
|
|
#endif // DEBUG
|
2012-06-01 10:21:12 -07:00
|
|
|
|
2012-06-29 09:48:34 -07:00
|
|
|
void
|
2014-11-13 18:20:38 -08:00
|
|
|
IDBRequest::GetCallerLocation(nsAString& aFilename, uint32_t* aLineNo) const
|
2012-06-29 09:48:34 -07:00
|
|
|
{
|
2014-11-13 18:20:38 -08:00
|
|
|
AssertIsOnOwningThread();
|
|
|
|
MOZ_ASSERT(aLineNo);
|
2012-06-29 09:48:34 -07:00
|
|
|
|
2014-11-13 18:20:38 -08:00
|
|
|
aFilename = mFilename;
|
|
|
|
*aLineNo = mLineNo;
|
2012-06-29 09:48:34 -07:00
|
|
|
}
|
|
|
|
|
2014-09-26 16:21:57 -07:00
|
|
|
IDBRequestReadyState
|
2013-07-31 15:28:15 -07:00
|
|
|
IDBRequest::ReadyState() const
|
2010-06-23 12:46:08 -07:00
|
|
|
{
|
2014-09-26 16:21:57 -07:00
|
|
|
AssertIsOnOwningThread();
|
2011-10-20 09:10:56 -07:00
|
|
|
|
2014-09-26 16:21:57 -07:00
|
|
|
return IsPending() ?
|
|
|
|
IDBRequestReadyState::Pending :
|
|
|
|
IDBRequestReadyState::Done;
|
|
|
|
}
|
2014-09-13 09:12:19 -07:00
|
|
|
|
2014-09-26 16:21:57 -07:00
|
|
|
void
|
|
|
|
IDBRequest::SetSource(IDBCursor* aSource)
|
|
|
|
{
|
|
|
|
AssertIsOnOwningThread();
|
|
|
|
MOZ_ASSERT(aSource);
|
|
|
|
MOZ_ASSERT(mSourceAsObjectStore || mSourceAsIndex);
|
|
|
|
MOZ_ASSERT(!mSourceAsCursor);
|
|
|
|
|
|
|
|
mSourceAsCursor = aSource;
|
2010-06-23 12:46:08 -07:00
|
|
|
}
|
|
|
|
|
2013-07-31 15:28:15 -07:00
|
|
|
JSObject*
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 07:13:33 -07:00
|
|
|
IDBRequest::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
2010-12-09 18:14:09 -08:00
|
|
|
{
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 07:13:33 -07:00
|
|
|
return IDBRequestBinding::Wrap(aCx, this, aGivenProto);
|
2010-12-09 18:14:09 -08:00
|
|
|
}
|
|
|
|
|
2014-06-11 13:26:52 -07:00
|
|
|
void
|
|
|
|
IDBRequest::GetResult(JS::MutableHandle<JS::Value> aResult,
|
|
|
|
ErrorResult& aRv) const
|
2011-01-06 22:21:36 -08:00
|
|
|
{
|
2014-09-26 16:21:57 -07:00
|
|
|
AssertIsOnOwningThread();
|
2011-01-06 22:21:36 -08:00
|
|
|
|
|
|
|
if (!mHaveResultOrErrorCode) {
|
2014-09-26 16:21:57 -07:00
|
|
|
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
|
|
|
return;
|
2011-01-06 22:21:36 -08:00
|
|
|
}
|
|
|
|
|
2014-06-11 13:26:52 -07:00
|
|
|
JS::ExposeValueToActiveJS(mResultVal);
|
|
|
|
aResult.set(mResultVal);
|
2011-01-06 22:21:36 -08:00
|
|
|
}
|
|
|
|
|
2014-09-26 16:21:57 -07:00
|
|
|
void
|
|
|
|
IDBRequest::SetResultCallback(ResultCallback* aCallback)
|
2011-01-06 22:21:36 -08:00
|
|
|
{
|
2014-09-26 16:21:57 -07:00
|
|
|
AssertIsOnOwningThread();
|
|
|
|
MOZ_ASSERT(aCallback);
|
|
|
|
MOZ_ASSERT(!mHaveResultOrErrorCode);
|
|
|
|
MOZ_ASSERT(mResultVal.isUndefined());
|
|
|
|
MOZ_ASSERT(!mError);
|
|
|
|
|
|
|
|
// See if our window is still valid.
|
|
|
|
if (NS_WARN_IF(NS_FAILED(CheckInnerWindowCorrectness()))) {
|
|
|
|
SetError(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
AutoJSAPI autoJS;
|
|
|
|
Maybe<JSAutoCompartment> ac;
|
|
|
|
|
|
|
|
if (GetScriptOwner()) {
|
|
|
|
// If we have a script owner we want the SafeJSContext and then to enter the
|
|
|
|
// script owner's compartment.
|
|
|
|
autoJS.Init();
|
|
|
|
ac.emplace(autoJS.cx(), GetScriptOwner());
|
|
|
|
} else {
|
|
|
|
// Otherwise our owner is a window and we use that to initialize.
|
|
|
|
MOZ_ASSERT(GetOwner());
|
|
|
|
if (!autoJS.InitWithLegacyErrorReporting(GetOwner())) {
|
|
|
|
IDB_WARNING("Failed to initialize AutoJSAPI!");
|
|
|
|
SetError(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
JSContext* cx = autoJS.cx();
|
|
|
|
|
|
|
|
AssertIsRooted();
|
|
|
|
|
|
|
|
JS::Rooted<JS::Value> result(cx);
|
|
|
|
nsresult rv = aCallback->GetResult(cx, &result);
|
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
|
|
SetError(rv);
|
|
|
|
mResultVal.setUndefined();
|
|
|
|
} else {
|
|
|
|
mError = nullptr;
|
|
|
|
mResultVal = result;
|
|
|
|
}
|
|
|
|
|
|
|
|
mHaveResultOrErrorCode = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
DOMError*
|
|
|
|
IDBRequest::GetError(ErrorResult& aRv)
|
|
|
|
{
|
|
|
|
AssertIsOnOwningThread();
|
2011-01-06 22:21:36 -08:00
|
|
|
|
2011-01-26 17:53:02 -08:00
|
|
|
if (!mHaveResultOrErrorCode) {
|
2013-05-18 10:52:06 -07:00
|
|
|
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
|
|
|
return nullptr;
|
2011-01-06 22:21:36 -08:00
|
|
|
}
|
|
|
|
|
2013-05-18 10:52:06 -07:00
|
|
|
return mError;
|
|
|
|
}
|
|
|
|
|
2013-08-01 18:29:05 -07:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_CLASS(IDBRequest)
|
|
|
|
|
2012-01-24 02:03:37 -08:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(IDBRequest, IDBWrapperCache)
|
|
|
|
// Don't need NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS because
|
2014-03-31 23:13:50 -07:00
|
|
|
// DOMEventTargetHelper does it for us.
|
2013-08-22 22:17:10 -07:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSourceAsObjectStore)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSourceAsIndex)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSourceAsCursor)
|
2012-11-14 23:32:40 -08:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTransaction)
|
2013-05-27 13:43:09 -07:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mError)
|
2010-06-23 12:46:08 -07:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
|
|
|
|
2012-01-24 02:03:37 -08:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(IDBRequest, IDBWrapperCache)
|
2014-09-26 16:21:57 -07:00
|
|
|
tmp->mResultVal.setUndefined();
|
2013-08-22 22:17:10 -07:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK(mSourceAsObjectStore)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK(mSourceAsIndex)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK(mSourceAsCursor)
|
2012-11-14 23:32:40 -08:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK(mTransaction)
|
2013-05-27 13:43:09 -07:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK(mError)
|
2010-06-23 12:46:08 -07:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
|
|
|
|
2012-01-24 02:03:37 -08:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(IDBRequest, IDBWrapperCache)
|
|
|
|
// Don't need NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER because
|
2014-03-31 23:13:50 -07:00
|
|
|
// DOMEventTargetHelper does it for us.
|
2012-06-10 16:44:50 -07:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRACE_JSVAL_MEMBER_CALLBACK(mResultVal)
|
2011-01-06 22:21:36 -08:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
|
|
|
|
2010-06-23 12:46:08 -07:00
|
|
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(IDBRequest)
|
2015-03-19 21:42:37 -07:00
|
|
|
if (aIID.Equals(kIDBRequestIID)) {
|
|
|
|
foundInterface = this;
|
|
|
|
} else
|
2012-01-24 02:03:37 -08:00
|
|
|
NS_INTERFACE_MAP_END_INHERITING(IDBWrapperCache)
|
2010-06-23 12:46:08 -07:00
|
|
|
|
2012-01-24 02:03:37 -08:00
|
|
|
NS_IMPL_ADDREF_INHERITED(IDBRequest, IDBWrapperCache)
|
|
|
|
NS_IMPL_RELEASE_INHERITED(IDBRequest, IDBWrapperCache)
|
2010-06-23 12:46:08 -07:00
|
|
|
|
2010-11-10 15:26:03 -08:00
|
|
|
nsresult
|
2014-03-17 21:48:19 -07:00
|
|
|
IDBRequest::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
2010-11-10 15:26:03 -08:00
|
|
|
{
|
2014-09-26 16:21:57 -07:00
|
|
|
AssertIsOnOwningThread();
|
2011-01-06 22:21:36 -08:00
|
|
|
|
2011-10-17 07:59:28 -07:00
|
|
|
aVisitor.mCanHandle = true;
|
2010-11-10 15:26:03 -08:00
|
|
|
aVisitor.mParentTarget = mTransaction;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
class IDBOpenDBRequest::WorkerFeature final
|
2014-12-16 22:26:15 -08:00
|
|
|
: public mozilla::dom::workers::WorkerFeature
|
|
|
|
{
|
|
|
|
WorkerPrivate* mWorkerPrivate;
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit
|
|
|
|
WorkerFeature(WorkerPrivate* aWorkerPrivate)
|
|
|
|
: mWorkerPrivate(aWorkerPrivate)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aWorkerPrivate);
|
|
|
|
aWorkerPrivate->AssertIsOnWorkerThread();
|
|
|
|
|
|
|
|
MOZ_COUNT_CTOR(IDBOpenDBRequest::WorkerFeature);
|
|
|
|
}
|
|
|
|
|
|
|
|
~WorkerFeature()
|
|
|
|
{
|
|
|
|
mWorkerPrivate->AssertIsOnWorkerThread();
|
|
|
|
|
|
|
|
MOZ_COUNT_DTOR(IDBOpenDBRequest::WorkerFeature);
|
|
|
|
|
|
|
|
mWorkerPrivate->RemoveFeature(mWorkerPrivate->GetJSContext(), this);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
virtual bool
|
2015-03-21 09:28:04 -07:00
|
|
|
Notify(JSContext* aCx, Status aStatus) override;
|
2014-12-16 22:26:15 -08:00
|
|
|
};
|
|
|
|
|
2014-09-26 16:21:57 -07:00
|
|
|
IDBOpenDBRequest::IDBOpenDBRequest(IDBFactory* aFactory, nsPIDOMWindow* aOwner)
|
2014-01-06 21:32:20 -08:00
|
|
|
: IDBRequest(aOwner)
|
2014-09-26 16:21:57 -07:00
|
|
|
, mFactory(aFactory)
|
2013-07-31 15:28:15 -07:00
|
|
|
{
|
2014-09-26 16:21:57 -07:00
|
|
|
AssertIsOnOwningThread();
|
|
|
|
MOZ_ASSERT(aFactory);
|
|
|
|
|
|
|
|
// aOwner may be null.
|
2013-07-31 15:28:15 -07:00
|
|
|
}
|
|
|
|
|
2011-10-20 09:10:56 -07:00
|
|
|
IDBOpenDBRequest::~IDBOpenDBRequest()
|
2011-01-06 22:21:36 -08:00
|
|
|
{
|
2014-09-26 16:21:57 -07:00
|
|
|
AssertIsOnOwningThread();
|
2011-01-06 22:21:36 -08:00
|
|
|
}
|
|
|
|
|
2010-10-19 10:58:52 -07:00
|
|
|
// static
|
2011-10-20 09:10:56 -07:00
|
|
|
already_AddRefed<IDBOpenDBRequest>
|
2014-09-26 16:21:57 -07:00
|
|
|
IDBOpenDBRequest::CreateForWindow(IDBFactory* aFactory,
|
|
|
|
nsPIDOMWindow* aOwner,
|
|
|
|
JS::Handle<JSObject*> aScriptOwner)
|
2010-10-19 10:58:52 -07:00
|
|
|
{
|
2014-09-26 16:21:57 -07:00
|
|
|
MOZ_ASSERT(aFactory);
|
|
|
|
aFactory->AssertIsOnOwningThread();
|
|
|
|
MOZ_ASSERT(aOwner);
|
|
|
|
MOZ_ASSERT(aScriptOwner);
|
2012-08-29 17:50:28 -07:00
|
|
|
|
2014-09-26 16:21:57 -07:00
|
|
|
nsRefPtr<IDBOpenDBRequest> request = new IDBOpenDBRequest(aFactory, aOwner);
|
2014-11-13 18:20:38 -08:00
|
|
|
CaptureCaller(request->mFilename, &request->mLineNo);
|
2010-10-19 10:58:52 -07:00
|
|
|
|
2012-11-29 14:54:14 -08:00
|
|
|
request->SetScriptOwner(aScriptOwner);
|
2012-06-29 09:48:34 -07:00
|
|
|
|
2014-09-26 16:21:57 -07:00
|
|
|
return request.forget();
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
already_AddRefed<IDBOpenDBRequest>
|
|
|
|
IDBOpenDBRequest::CreateForJS(IDBFactory* aFactory,
|
|
|
|
JS::Handle<JSObject*> aScriptOwner)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aFactory);
|
|
|
|
aFactory->AssertIsOnOwningThread();
|
|
|
|
MOZ_ASSERT(aScriptOwner);
|
|
|
|
|
|
|
|
nsRefPtr<IDBOpenDBRequest> request = new IDBOpenDBRequest(aFactory, nullptr);
|
2014-11-13 18:20:38 -08:00
|
|
|
CaptureCaller(request->mFilename, &request->mLineNo);
|
2014-09-26 16:21:57 -07:00
|
|
|
|
|
|
|
request->SetScriptOwner(aScriptOwner);
|
2013-11-04 04:57:53 -08:00
|
|
|
|
2014-12-16 22:26:15 -08:00
|
|
|
if (!NS_IsMainThread()) {
|
|
|
|
WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
|
|
|
|
MOZ_ASSERT(workerPrivate);
|
|
|
|
|
|
|
|
workerPrivate->AssertIsOnWorkerThread();
|
|
|
|
|
|
|
|
JSContext* cx = workerPrivate->GetJSContext();
|
|
|
|
MOZ_ASSERT(cx);
|
|
|
|
|
|
|
|
nsAutoPtr<WorkerFeature> feature(new WorkerFeature(workerPrivate));
|
|
|
|
if (NS_WARN_IF(!workerPrivate->AddFeature(cx, feature))) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
request->mWorkerFeature = Move(feature);
|
|
|
|
}
|
|
|
|
|
2010-10-19 10:58:52 -07:00
|
|
|
return request.forget();
|
|
|
|
}
|
|
|
|
|
2011-01-06 22:21:36 -08:00
|
|
|
void
|
2011-10-20 09:10:56 -07:00
|
|
|
IDBOpenDBRequest::SetTransaction(IDBTransaction* aTransaction)
|
|
|
|
{
|
2014-09-26 16:21:57 -07:00
|
|
|
AssertIsOnOwningThread();
|
2012-06-01 10:21:12 -07:00
|
|
|
|
2014-09-26 16:21:57 -07:00
|
|
|
MOZ_ASSERT(!aTransaction || !mTransaction);
|
2012-06-01 10:21:12 -07:00
|
|
|
|
2011-10-20 09:10:56 -07:00
|
|
|
mTransaction = aTransaction;
|
|
|
|
}
|
|
|
|
|
2014-12-16 22:26:15 -08:00
|
|
|
void
|
|
|
|
IDBOpenDBRequest::NoteComplete()
|
|
|
|
{
|
|
|
|
AssertIsOnOwningThread();
|
|
|
|
MOZ_ASSERT_IF(!NS_IsMainThread(), mWorkerFeature);
|
|
|
|
|
|
|
|
// If we have a WorkerFeature installed on the worker then nulling this out
|
|
|
|
// will uninstall it from the worker.
|
|
|
|
mWorkerFeature = nullptr;
|
|
|
|
}
|
|
|
|
|
2013-08-01 18:29:05 -07:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_CLASS(IDBOpenDBRequest)
|
|
|
|
|
2011-10-20 09:10:56 -07:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(IDBOpenDBRequest,
|
2010-10-19 10:58:52 -07:00
|
|
|
IDBRequest)
|
2012-11-14 23:32:40 -08:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mFactory)
|
2010-10-19 10:58:52 -07:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
|
|
|
|
2011-10-20 09:10:56 -07:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(IDBOpenDBRequest,
|
2010-10-19 10:58:52 -07:00
|
|
|
IDBRequest)
|
2012-08-29 17:50:28 -07:00
|
|
|
// Don't unlink mFactory!
|
2010-10-19 10:58:52 -07:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
|
|
|
|
2011-10-20 09:10:56 -07:00
|
|
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(IDBOpenDBRequest)
|
2010-10-19 10:58:52 -07:00
|
|
|
NS_INTERFACE_MAP_END_INHERITING(IDBRequest)
|
|
|
|
|
2011-10-20 09:10:56 -07:00
|
|
|
NS_IMPL_ADDREF_INHERITED(IDBOpenDBRequest, IDBRequest)
|
|
|
|
NS_IMPL_RELEASE_INHERITED(IDBOpenDBRequest, IDBRequest)
|
2010-10-19 10:58:52 -07:00
|
|
|
|
2012-06-01 10:21:12 -07:00
|
|
|
nsresult
|
2014-03-17 21:48:20 -07:00
|
|
|
IDBOpenDBRequest::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
2012-06-01 10:21:12 -07:00
|
|
|
{
|
2014-12-16 22:26:15 -08:00
|
|
|
nsresult rv =
|
2015-03-19 21:42:37 -07:00
|
|
|
IndexedDatabaseManager::CommonPostHandleEvent(aVisitor, mFactory);
|
2014-12-16 22:26:15 -08:00
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
|
|
return rv;
|
|
|
|
}
|
2014-09-26 16:21:57 -07:00
|
|
|
|
2014-12-16 22:26:15 -08:00
|
|
|
return NS_OK;
|
2012-06-01 10:21:12 -07:00
|
|
|
}
|
2013-07-31 15:28:15 -07:00
|
|
|
|
|
|
|
JSObject*
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 07:13:33 -07:00
|
|
|
IDBOpenDBRequest::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
2013-07-31 15:28:15 -07:00
|
|
|
{
|
2014-09-26 16:21:57 -07:00
|
|
|
AssertIsOnOwningThread();
|
|
|
|
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 07:13:33 -07:00
|
|
|
return IDBOpenDBRequestBinding::Wrap(aCx, this, aGivenProto);
|
2013-07-31 15:28:15 -07:00
|
|
|
}
|
2014-09-26 16:21:57 -07:00
|
|
|
|
2014-12-16 22:26:15 -08:00
|
|
|
bool
|
|
|
|
IDBOpenDBRequest::
|
|
|
|
WorkerFeature::Notify(JSContext* aCx, Status aStatus)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(mWorkerPrivate);
|
|
|
|
mWorkerPrivate->AssertIsOnWorkerThread();
|
|
|
|
MOZ_ASSERT(aStatus > Running);
|
|
|
|
|
|
|
|
// There's nothing we can really do here at the moment...
|
|
|
|
NS_WARNING("Worker closing but IndexedDB is waiting to open a database!");
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-09-26 16:21:57 -07:00
|
|
|
} // namespace indexedDB
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|