Bug 1631684 - Replace MOZ_MUST_USE with [[nodiscard]] in dom/indexedDB. r=dom-workers-and-storage-reviewers,sg

Also move MOZ_MUST_USE before function declarations' specifiers and return type. While clang and gcc's __attribute__((warn_unused_result)) can appear before, between, or after function specifiers and return types, the [[nodiscard]] attribute must precede the function specifiers.

Differential Revision: https://phabricator.services.mozilla.com/D71713
This commit is contained in:
Chris Peterson 2020-04-23 01:49:16 +00:00
Родитель da540f28d4
Коммит 843c954b43
19 изменённых файлов: 217 добавлений и 216 удалений

Просмотреть файл

@ -735,7 +735,7 @@ class BackgroundCursorChild final : public BackgroundCursorChildBase {
const Func& aHandleRecord); const Func& aHandleRecord);
template <typename... Args> template <typename... Args>
MOZ_MUST_USE RefPtr<IDBCursor> HandleIndividualCursorResponse( [[nodiscard]] RefPtr<IDBCursor> HandleIndividualCursorResponse(
bool aUseAsCurrentResult, Args&&... aArgs); bool aUseAsCurrentResult, Args&&... aArgs);
public: public:

Просмотреть файл

@ -422,7 +422,7 @@ struct FullDatabaseMetadata {
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(FullDatabaseMetadata) NS_INLINE_DECL_THREADSAFE_REFCOUNTING(FullDatabaseMetadata)
MOZ_MUST_USE SafeRefPtr<FullDatabaseMetadata> Duplicate() const; [[nodiscard]] SafeRefPtr<FullDatabaseMetadata> Duplicate() const;
private: private:
~FullDatabaseMetadata() = default; ~FullDatabaseMetadata() = default;
@ -5743,7 +5743,7 @@ class Factory final : public PBackgroundIDBFactoryParent {
#endif #endif
public: public:
static MOZ_MUST_USE RefPtr<Factory> Create(const LoggingInfo& aLoggingInfo); [[nodiscard]] static RefPtr<Factory> Create(const LoggingInfo& aLoggingInfo);
DatabaseLoggingInfo* GetLoggingInfo() const { DatabaseLoggingInfo* GetLoggingInfo() const {
AssertIsOnBackgroundThread(); AssertIsOnBackgroundThread();
@ -6012,7 +6012,7 @@ class Database final
mFactory.forget()); mFactory.forget());
} }
MOZ_MUST_USE SafeRefPtr<FileInfo> GetBlob(const IPCBlob& aID); [[nodiscard]] SafeRefPtr<FileInfo> GetBlob(const IPCBlob& aID);
void UnmapBlob(const nsID& aID); void UnmapBlob(const nsID& aID);
@ -6188,7 +6188,7 @@ class DatabaseFile final : public PBackgroundIDBDatabaseFileParent {
* been written to disk), then return an input stream. Otherwise, if mBlobImpl * been written to disk), then return an input stream. Otherwise, if mBlobImpl
* is null (because the contents have been written to disk), returns null. * is null (because the contents have been written to disk), returns null.
*/ */
MOZ_MUST_USE nsCOMPtr<nsIInputStream> GetInputStream(ErrorResult& rv) const; [[nodiscard]] nsCOMPtr<nsIInputStream> GetInputStream(ErrorResult& rv) const;
/** /**
* To be called upon successful copying of the stream GetInputStream() * To be called upon successful copying of the stream GetInputStream()
@ -6362,10 +6362,10 @@ class TransactionBase {
return NS_FAILED(mResultCode); return NS_FAILED(mResultCode);
} }
MOZ_MUST_USE RefPtr<FullObjectStoreMetadata> GetMetadataForObjectStoreId( [[nodiscard]] RefPtr<FullObjectStoreMetadata> GetMetadataForObjectStoreId(
IndexOrObjectStoreId aObjectStoreId) const; IndexOrObjectStoreId aObjectStoreId) const;
MOZ_MUST_USE RefPtr<FullIndexMetadata> GetMetadataForIndexId( [[nodiscard]] RefPtr<FullIndexMetadata> GetMetadataForIndexId(
FullObjectStoreMetadata* const aObjectStoreMetadata, FullObjectStoreMetadata* const aObjectStoreMetadata,
IndexOrObjectStoreId aIndexId) const; IndexOrObjectStoreId aIndexId) const;
@ -6642,7 +6642,7 @@ class MutableFile : public BackgroundMutableFileParentBase {
const SafeRefPtr<FileInfo> mFileInfo; const SafeRefPtr<FileInfo> mFileInfo;
public: public:
static MOZ_MUST_USE RefPtr<MutableFile> Create( [[nodiscard]] static RefPtr<MutableFile> Create(
nsIFile* aFile, SafeRefPtr<Database> aDatabase, nsIFile* aFile, SafeRefPtr<Database> aDatabase,
SafeRefPtr<FileInfo> aFileInfo); SafeRefPtr<FileInfo> aFileInfo);
@ -9098,9 +9098,9 @@ class MOZ_STACK_CLASS FileHelper final {
nsresult Init(); nsresult Init();
MOZ_MUST_USE nsCOMPtr<nsIFile> GetFile(const FileInfo& aFileInfo); [[nodiscard]] nsCOMPtr<nsIFile> GetFile(const FileInfo& aFileInfo);
MOZ_MUST_USE nsCOMPtr<nsIFile> GetJournalFile(const FileInfo& aFileInfo); [[nodiscard]] nsCOMPtr<nsIFile> GetJournalFile(const FileInfo& aFileInfo);
nsresult CreateFileFromStream(nsIFile& aFile, nsIFile& aJournalFile, nsresult CreateFileFromStream(nsIFile& aFile, nsIFile& aJournalFile,
nsIInputStream& aInputStream, bool aCompress); nsIInputStream& aInputStream, bool aCompress);

Просмотреть файл

@ -39,11 +39,11 @@ class FileManager final : public FileManagerBase<FileManager> {
static MutexType sMutex; static MutexType sMutex;
public: public:
static MOZ_MUST_USE nsCOMPtr<nsIFile> GetFileForId(nsIFile* aDirectory, [[nodiscard]] static nsCOMPtr<nsIFile> GetFileForId(nsIFile* aDirectory,
int64_t aId); int64_t aId);
static MOZ_MUST_USE nsCOMPtr<nsIFile> GetCheckedFileForId(nsIFile* aDirectory, [[nodiscard]] static nsCOMPtr<nsIFile> GetCheckedFileForId(
int64_t aId); nsIFile* aDirectory, int64_t aId);
static nsresult InitDirectory(nsIFile& aDirectory, nsIFile& aDatabaseFile, static nsresult InitDirectory(nsIFile& aDirectory, nsIFile& aDatabaseFile,
const nsACString& aOrigin, const nsACString& aOrigin,
@ -69,21 +69,21 @@ class FileManager final : public FileManagerBase<FileManager> {
nsresult Init(nsIFile* aDirectory, mozIStorageConnection* aConnection); nsresult Init(nsIFile* aDirectory, mozIStorageConnection* aConnection);
MOZ_MUST_USE nsCOMPtr<nsIFile> GetDirectory(); [[nodiscard]] nsCOMPtr<nsIFile> GetDirectory();
MOZ_MUST_USE nsCOMPtr<nsIFile> GetCheckedDirectory(); [[nodiscard]] nsCOMPtr<nsIFile> GetCheckedDirectory();
MOZ_MUST_USE nsCOMPtr<nsIFile> GetJournalDirectory(); [[nodiscard]] nsCOMPtr<nsIFile> GetJournalDirectory();
MOZ_MUST_USE nsCOMPtr<nsIFile> EnsureJournalDirectory(); [[nodiscard]] nsCOMPtr<nsIFile> EnsureJournalDirectory();
MOZ_MUST_USE nsresult SyncDeleteFile(int64_t aId); [[nodiscard]] nsresult SyncDeleteFile(int64_t aId);
// XXX When getting rid of FileHelper, this method should be removed/made // XXX When getting rid of FileHelper, this method should be removed/made
// private. // private.
MOZ_MUST_USE nsresult SyncDeleteFile(nsIFile& aFile, nsIFile& aJournalFile); [[nodiscard]] nsresult SyncDeleteFile(nsIFile& aFile, nsIFile& aJournalFile);
MOZ_MUST_USE nsresult AsyncDeleteFile(int64_t aFileId); [[nodiscard]] nsresult AsyncDeleteFile(int64_t aFileId);
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(FileManager) NS_INLINE_DECL_THREADSAFE_REFCOUNTING(FileManager)

Просмотреть файл

@ -27,7 +27,7 @@ class FileManagerBase {
using MutexType = StaticMutex; using MutexType = StaticMutex;
using AutoLock = mozilla::detail::BaseAutoLock<MutexType&>; using AutoLock = mozilla::detail::BaseAutoLock<MutexType&>;
MOZ_MUST_USE SafeRefPtr<FileInfo> GetFileInfo(int64_t aId) const { [[nodiscard]] SafeRefPtr<FileInfo> GetFileInfo(int64_t aId) const {
if (!AssertValid()) { if (!AssertValid()) {
// In release, the assertions are disabled. // In release, the assertions are disabled.
return nullptr; return nullptr;
@ -45,7 +45,7 @@ class FileManagerBase {
return {fileInfo, AcquireStrongRefFromRawPtr{}}; return {fileInfo, AcquireStrongRefFromRawPtr{}};
} }
MOZ_MUST_USE SafeRefPtr<FileInfo> CreateFileInfo() { [[nodiscard]] SafeRefPtr<FileInfo> CreateFileInfo() {
if (!AssertValid()) { if (!AssertValid()) {
// In release, the assertions are disabled. // In release, the assertions are disabled.
return nullptr; return nullptr;

Просмотреть файл

@ -78,19 +78,19 @@ class IDBCursor : public nsISupports, public nsWrapperCache {
bool mHaveValue : 1; bool mHaveValue : 1;
public: public:
static MOZ_MUST_USE RefPtr<IDBObjectStoreCursor> Create( [[nodiscard]] static RefPtr<IDBObjectStoreCursor> Create(
indexedDB::BackgroundCursorChild<Type::ObjectStore>* aBackgroundActor, indexedDB::BackgroundCursorChild<Type::ObjectStore>* aBackgroundActor,
Key aKey, StructuredCloneReadInfoChild&& aCloneInfo); Key aKey, StructuredCloneReadInfoChild&& aCloneInfo);
static MOZ_MUST_USE RefPtr<IDBObjectStoreKeyCursor> Create( [[nodiscard]] static RefPtr<IDBObjectStoreKeyCursor> Create(
indexedDB::BackgroundCursorChild<Type::ObjectStoreKey>* aBackgroundActor, indexedDB::BackgroundCursorChild<Type::ObjectStoreKey>* aBackgroundActor,
Key aKey); Key aKey);
static MOZ_MUST_USE RefPtr<IDBIndexCursor> Create( [[nodiscard]] static RefPtr<IDBIndexCursor> Create(
indexedDB::BackgroundCursorChild<Type::Index>* aBackgroundActor, Key aKey, indexedDB::BackgroundCursorChild<Type::Index>* aBackgroundActor, Key aKey,
Key aSortKey, Key aPrimaryKey, StructuredCloneReadInfoChild&& aCloneInfo); Key aSortKey, Key aPrimaryKey, StructuredCloneReadInfoChild&& aCloneInfo);
static MOZ_MUST_USE RefPtr<IDBIndexKeyCursor> Create( [[nodiscard]] static RefPtr<IDBIndexKeyCursor> Create(
indexedDB::BackgroundCursorChild<Type::IndexKey>* aBackgroundActor, indexedDB::BackgroundCursorChild<Type::IndexKey>* aBackgroundActor,
Key aKey, Key aSortKey, Key aPrimaryKey); Key aKey, Key aSortKey, Key aPrimaryKey);
@ -134,12 +134,12 @@ class IDBCursor : public nsISupports, public nsWrapperCache {
virtual void Advance(uint32_t aCount, ErrorResult& aRv) = 0; virtual void Advance(uint32_t aCount, ErrorResult& aRv) = 0;
virtual MOZ_MUST_USE RefPtr<IDBRequest> Update(JSContext* aCx, [[nodiscard]] virtual RefPtr<IDBRequest> Update(JSContext* aCx,
JS::Handle<JS::Value> aValue, JS::Handle<JS::Value> aValue,
ErrorResult& aRv) = 0; ErrorResult& aRv) = 0;
virtual MOZ_MUST_USE RefPtr<IDBRequest> Delete(JSContext* aCx, [[nodiscard]] virtual RefPtr<IDBRequest> Delete(JSContext* aCx,
ErrorResult& aRv) = 0; ErrorResult& aRv) = 0;
void ClearBackgroundActor() { void ClearBackgroundActor() {
AssertIsOnOwningThread(); AssertIsOnOwningThread();
@ -194,12 +194,12 @@ class IDBTypedCursor : public IDBCursor {
void Advance(uint32_t aCount, ErrorResult& aRv) final; void Advance(uint32_t aCount, ErrorResult& aRv) final;
MOZ_MUST_USE RefPtr<IDBRequest> Update(JSContext* aCx, [[nodiscard]] RefPtr<IDBRequest> Update(JSContext* aCx,
JS::Handle<JS::Value> aValue, JS::Handle<JS::Value> aValue,
ErrorResult& aRv) final; ErrorResult& aRv) final;
MOZ_MUST_USE RefPtr<IDBRequest> Delete(JSContext* aCx, [[nodiscard]] RefPtr<IDBRequest> Delete(JSContext* aCx,
ErrorResult& aRv) final; ErrorResult& aRv) final;
// nsWrapperCache // nsWrapperCache
JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) final; JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) final;

Просмотреть файл

@ -88,7 +88,7 @@ class IDBDatabase final : public DOMEventTargetHelper {
bool mIncreasedActiveDatabaseCount; bool mIncreasedActiveDatabaseCount;
public: public:
static MOZ_MUST_USE RefPtr<IDBDatabase> Create( [[nodiscard]] static RefPtr<IDBDatabase> Create(
IDBOpenDBRequest* aRequest, SafeRefPtr<IDBFactory> aFactory, IDBOpenDBRequest* aRequest, SafeRefPtr<IDBFactory> aFactory,
indexedDB::BackgroundDatabaseChild* aActor, indexedDB::BackgroundDatabaseChild* aActor,
UniquePtr<DatabaseSpec> aSpec); UniquePtr<DatabaseSpec> aSpec);
@ -113,7 +113,7 @@ class IDBDatabase final : public DOMEventTargetHelper {
uint64_t Version() const; uint64_t Version() const;
MOZ_MUST_USE RefPtr<Document> GetOwnerDocument() const; [[nodiscard]] RefPtr<Document> GetOwnerDocument() const;
void Close() { void Close() {
AssertIsOnOwningThread(); AssertIsOnOwningThread();
@ -173,16 +173,16 @@ class IDBDatabase final : public DOMEventTargetHelper {
void NoteFinishedMutableFile(IDBMutableFile* aMutableFile); void NoteFinishedMutableFile(IDBMutableFile* aMutableFile);
MOZ_MUST_USE RefPtr<DOMStringList> ObjectStoreNames() const; [[nodiscard]] RefPtr<DOMStringList> ObjectStoreNames() const;
MOZ_MUST_USE RefPtr<IDBObjectStore> CreateObjectStore( [[nodiscard]] RefPtr<IDBObjectStore> CreateObjectStore(
const nsAString& aName, const nsAString& aName,
const IDBObjectStoreParameters& aOptionalParameters, ErrorResult& aRv); const IDBObjectStoreParameters& aOptionalParameters, ErrorResult& aRv);
void DeleteObjectStore(const nsAString& name, ErrorResult& aRv); void DeleteObjectStore(const nsAString& name, ErrorResult& aRv);
// This will be called from the DOM. // This will be called from the DOM.
MOZ_MUST_USE RefPtr<IDBTransaction> Transaction( [[nodiscard]] RefPtr<IDBTransaction> Transaction(
JSContext* aCx, const StringOrStringSequence& aStoreNames, JSContext* aCx, const StringOrStringSequence& aStoreNames,
IDBTransactionMode aMode, ErrorResult& aRv); IDBTransactionMode aMode, ErrorResult& aRv);
@ -193,7 +193,7 @@ class IDBDatabase final : public DOMEventTargetHelper {
IMPL_EVENT_HANDLER(error) IMPL_EVENT_HANDLER(error)
IMPL_EVENT_HANDLER(versionchange) IMPL_EVENT_HANDLER(versionchange)
MOZ_MUST_USE RefPtr<IDBRequest> CreateMutableFile( [[nodiscard]] RefPtr<IDBRequest> CreateMutableFile(
JSContext* aCx, const nsAString& aName, const Optional<nsAString>& aType, JSContext* aCx, const nsAString& aName, const Optional<nsAString>& aType,
ErrorResult& aRv); ErrorResult& aRv);

Просмотреть файл

@ -45,10 +45,10 @@ extern const char16_t* kUpgradeNeededEventType;
extern const char16_t* kVersionChangeEventType; extern const char16_t* kVersionChangeEventType;
extern const char16_t* kCloseEventType; extern const char16_t* kCloseEventType;
MOZ_MUST_USE RefPtr<Event> CreateGenericEvent(EventTarget* aOwner, [[nodiscard]] RefPtr<Event> CreateGenericEvent(EventTarget* aOwner,
const nsDependentString& aType, const nsDependentString& aType,
Bubbles aBubbles, Bubbles aBubbles,
Cancelable aCancelable); Cancelable aCancelable);
} // namespace indexedDB } // namespace indexedDB
@ -57,15 +57,15 @@ class IDBVersionChangeEvent final : public Event {
Nullable<uint64_t> mNewVersion; Nullable<uint64_t> mNewVersion;
public: public:
static MOZ_MUST_USE RefPtr<IDBVersionChangeEvent> Create( [[nodiscard]] static RefPtr<IDBVersionChangeEvent> Create(
EventTarget* aOwner, const nsDependentString& aName, uint64_t aOldVersion, EventTarget* aOwner, const nsDependentString& aName, uint64_t aOldVersion,
uint64_t aNewVersion); uint64_t aNewVersion);
static MOZ_MUST_USE RefPtr<IDBVersionChangeEvent> Create( [[nodiscard]] static RefPtr<IDBVersionChangeEvent> Create(
EventTarget* aOwner, const nsDependentString& aName, EventTarget* aOwner, const nsDependentString& aName,
uint64_t aOldVersion); uint64_t aOldVersion);
static MOZ_MUST_USE RefPtr<IDBVersionChangeEvent> Constructor( [[nodiscard]] static RefPtr<IDBVersionChangeEvent> Constructor(
const GlobalObject& aGlobal, const nsAString& aType, const GlobalObject& aGlobal, const nsAString& aType,
const IDBVersionChangeEventInit& aOptions); const IDBVersionChangeEventInit& aOptions);
@ -86,7 +86,7 @@ class IDBVersionChangeEvent final : public Event {
~IDBVersionChangeEvent() = default; ~IDBVersionChangeEvent() = default;
static MOZ_MUST_USE RefPtr<IDBVersionChangeEvent> CreateInternal( [[nodiscard]] static RefPtr<IDBVersionChangeEvent> CreateInternal(
EventTarget* aOwner, const nsAString& aType, uint64_t aOldVersion, EventTarget* aOwner, const nsAString& aType, uint64_t aOldVersion,
const Nullable<uint64_t>& aNewVersion); const Nullable<uint64_t>& aNewVersion);
}; };

Просмотреть файл

@ -141,35 +141,35 @@ class IDBFactory final : public nsISupports, public nsWrapperCache {
bool IsChrome() const; bool IsChrome() const;
MOZ_MUST_USE RefPtr<IDBOpenDBRequest> Open(JSContext* aCx, [[nodiscard]] RefPtr<IDBOpenDBRequest> Open(JSContext* aCx,
const nsAString& aName, const nsAString& aName,
uint64_t aVersion, uint64_t aVersion,
CallerType aCallerType, CallerType aCallerType,
ErrorResult& aRv); ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBOpenDBRequest> Open(JSContext* aCx, [[nodiscard]] RefPtr<IDBOpenDBRequest> Open(JSContext* aCx,
const nsAString& aName, const nsAString& aName,
const IDBOpenDBOptions& aOptions, const IDBOpenDBOptions& aOptions,
CallerType aCallerType, CallerType aCallerType,
ErrorResult& aRv); ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBOpenDBRequest> DeleteDatabase( [[nodiscard]] RefPtr<IDBOpenDBRequest> DeleteDatabase(
JSContext* aCx, const nsAString& aName, const IDBOpenDBOptions& aOptions, JSContext* aCx, const nsAString& aName, const IDBOpenDBOptions& aOptions,
CallerType aCallerType, ErrorResult& aRv); CallerType aCallerType, ErrorResult& aRv);
int16_t Cmp(JSContext* aCx, JS::Handle<JS::Value> aFirst, int16_t Cmp(JSContext* aCx, JS::Handle<JS::Value> aFirst,
JS::Handle<JS::Value> aSecond, ErrorResult& aRv); JS::Handle<JS::Value> aSecond, ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBOpenDBRequest> OpenForPrincipal( [[nodiscard]] RefPtr<IDBOpenDBRequest> OpenForPrincipal(
JSContext* aCx, nsIPrincipal* aPrincipal, const nsAString& aName, JSContext* aCx, nsIPrincipal* aPrincipal, const nsAString& aName,
uint64_t aVersion, SystemCallerGuarantee, ErrorResult& aRv); uint64_t aVersion, SystemCallerGuarantee, ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBOpenDBRequest> OpenForPrincipal( [[nodiscard]] RefPtr<IDBOpenDBRequest> OpenForPrincipal(
JSContext* aCx, nsIPrincipal* aPrincipal, const nsAString& aName, JSContext* aCx, nsIPrincipal* aPrincipal, const nsAString& aName,
const IDBOpenDBOptions& aOptions, SystemCallerGuarantee, const IDBOpenDBOptions& aOptions, SystemCallerGuarantee,
ErrorResult& aRv); ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBOpenDBRequest> DeleteForPrincipal( [[nodiscard]] RefPtr<IDBOpenDBRequest> DeleteForPrincipal(
JSContext* aCx, nsIPrincipal* aPrincipal, const nsAString& aName, JSContext* aCx, nsIPrincipal* aPrincipal, const nsAString& aName,
const IDBOpenDBOptions& aOptions, SystemCallerGuarantee, const IDBOpenDBOptions& aOptions, SystemCallerGuarantee,
ErrorResult& aRv); ErrorResult& aRv);
@ -196,7 +196,7 @@ class IDBFactory final : public nsISupports, public nsWrapperCache {
static nsresult AllowedForWindowInternal(nsPIDOMWindowInner* aWindow, static nsresult AllowedForWindowInternal(nsPIDOMWindowInner* aWindow,
nsCOMPtr<nsIPrincipal>* aPrincipal); nsCOMPtr<nsIPrincipal>* aPrincipal);
MOZ_MUST_USE RefPtr<IDBOpenDBRequest> OpenInternal( [[nodiscard]] RefPtr<IDBOpenDBRequest> OpenInternal(
JSContext* aCx, nsIPrincipal* aPrincipal, const nsAString& aName, JSContext* aCx, nsIPrincipal* aPrincipal, const nsAString& aName,
const Optional<uint64_t>& aVersion, const Optional<uint64_t>& aVersion,
const Optional<StorageType>& aStorageType, bool aDeleting, const Optional<StorageType>& aStorageType, bool aDeleting,

Просмотреть файл

@ -58,8 +58,8 @@ class IDBFileHandle final : public DOMEventTargetHelper,
#endif #endif
public: public:
static MOZ_MUST_USE RefPtr<IDBFileHandle> Create(IDBMutableFile* aMutableFile, [[nodiscard]] static RefPtr<IDBFileHandle> Create(
FileMode aMode); IDBMutableFile* aMutableFile, FileMode aMode);
static IDBFileHandle* GetCurrent(); static IDBFileHandle* GetCurrent();
@ -151,40 +151,40 @@ class IDBFileHandle final : public DOMEventTargetHelper,
} }
} }
MOZ_MUST_USE RefPtr<IDBFileRequest> GetMetadata( [[nodiscard]] RefPtr<IDBFileRequest> GetMetadata(
const IDBFileMetadataParameters& aParameters, ErrorResult& aRv); const IDBFileMetadataParameters& aParameters, ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBFileRequest> ReadAsArrayBuffer(uint64_t aSize, [[nodiscard]] RefPtr<IDBFileRequest> ReadAsArrayBuffer(uint64_t aSize,
ErrorResult& aRv) { ErrorResult& aRv) {
AssertIsOnOwningThread(); AssertIsOnOwningThread();
return Read(aSize, false, VoidString(), aRv); return Read(aSize, false, VoidString(), aRv);
} }
MOZ_MUST_USE RefPtr<IDBFileRequest> ReadAsText(uint64_t aSize, [[nodiscard]] RefPtr<IDBFileRequest> ReadAsText(uint64_t aSize,
const nsAString& aEncoding, const nsAString& aEncoding,
ErrorResult& aRv) { ErrorResult& aRv) {
AssertIsOnOwningThread(); AssertIsOnOwningThread();
return Read(aSize, true, aEncoding, aRv); return Read(aSize, true, aEncoding, aRv);
} }
MOZ_MUST_USE RefPtr<IDBFileRequest> Write( [[nodiscard]] RefPtr<IDBFileRequest> Write(
const StringOrArrayBufferOrArrayBufferViewOrBlob& aValue, const StringOrArrayBufferOrArrayBufferViewOrBlob& aValue,
ErrorResult& aRv) { ErrorResult& aRv) {
AssertIsOnOwningThread(); AssertIsOnOwningThread();
return WriteOrAppend(aValue, false, aRv); return WriteOrAppend(aValue, false, aRv);
} }
MOZ_MUST_USE RefPtr<IDBFileRequest> Append( [[nodiscard]] RefPtr<IDBFileRequest> Append(
const StringOrArrayBufferOrArrayBufferViewOrBlob& aValue, const StringOrArrayBufferOrArrayBufferViewOrBlob& aValue,
ErrorResult& aRv) { ErrorResult& aRv) {
AssertIsOnOwningThread(); AssertIsOnOwningThread();
return WriteOrAppend(aValue, true, aRv); return WriteOrAppend(aValue, true, aRv);
} }
MOZ_MUST_USE RefPtr<IDBFileRequest> Truncate(const Optional<uint64_t>& aSize, [[nodiscard]] RefPtr<IDBFileRequest> Truncate(const Optional<uint64_t>& aSize,
ErrorResult& aRv); ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBFileRequest> Flush(ErrorResult& aRv); [[nodiscard]] RefPtr<IDBFileRequest> Flush(ErrorResult& aRv);
void Abort(ErrorResult& aRv); void Abort(ErrorResult& aRv);
@ -217,29 +217,29 @@ class IDBFileHandle final : public DOMEventTargetHelper,
bool CheckWindow(); bool CheckWindow();
MOZ_MUST_USE RefPtr<IDBFileRequest> Read(uint64_t aSize, bool aHasEncoding, [[nodiscard]] RefPtr<IDBFileRequest> Read(uint64_t aSize, bool aHasEncoding,
const nsAString& aEncoding, const nsAString& aEncoding,
ErrorResult& aRv); ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBFileRequest> WriteOrAppend( [[nodiscard]] RefPtr<IDBFileRequest> WriteOrAppend(
const StringOrArrayBufferOrArrayBufferViewOrBlob& aValue, bool aAppend, const StringOrArrayBufferOrArrayBufferViewOrBlob& aValue, bool aAppend,
ErrorResult& aRv); ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBFileRequest> WriteOrAppend(const nsAString& aValue, [[nodiscard]] RefPtr<IDBFileRequest> WriteOrAppend(const nsAString& aValue,
bool aAppend, bool aAppend,
ErrorResult& aRv); ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBFileRequest> WriteOrAppend(const ArrayBuffer& aValue, [[nodiscard]] RefPtr<IDBFileRequest> WriteOrAppend(const ArrayBuffer& aValue,
bool aAppend, bool aAppend,
ErrorResult& aRv); ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBFileRequest> WriteOrAppend( [[nodiscard]] RefPtr<IDBFileRequest> WriteOrAppend(
const ArrayBufferView& aValue, bool aAppend, ErrorResult& aRv); const ArrayBufferView& aValue, bool aAppend, ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBFileRequest> WriteOrAppend(Blob& aValue, bool aAppend, [[nodiscard]] RefPtr<IDBFileRequest> WriteOrAppend(Blob& aValue, bool aAppend,
ErrorResult& aRv); ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBFileRequest> WriteInternal( [[nodiscard]] RefPtr<IDBFileRequest> WriteInternal(
const FileRequestData& aData, uint64_t aDataLength, bool aAppend, const FileRequestData& aData, uint64_t aDataLength, bool aAppend,
ErrorResult& aRv); ErrorResult& aRv);

Просмотреть файл

@ -32,8 +32,8 @@ class IDBFileRequest final : public DOMRequest {
public: public:
class ResultCallback; class ResultCallback;
static MOZ_MUST_USE RefPtr<IDBFileRequest> Create(IDBFileHandle* aFileHandle, [[nodiscard]] static RefPtr<IDBFileRequest> Create(IDBFileHandle* aFileHandle,
bool aWrapAsDOMRequest); bool aWrapAsDOMRequest);
void SetEncoding(const nsAString& aEncoding) { void SetEncoding(const nsAString& aEncoding) {
mEncoding = aEncoding; mEncoding = aEncoding;

Просмотреть файл

@ -55,7 +55,7 @@ class IDBIndex final : public nsISupports, public nsWrapperCache {
NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(IDBIndex) NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(IDBIndex)
static MOZ_MUST_USE RefPtr<IDBIndex> Create( [[nodiscard]] static RefPtr<IDBIndex> Create(
IDBObjectStore* aObjectStore, const indexedDB::IndexMetadata& aMetadata); IDBObjectStore* aObjectStore, const indexedDB::IndexMetadata& aMetadata);
int64_t Id() const { int64_t Id() const {
@ -94,37 +94,37 @@ class IDBIndex final : public nsISupports, public nsWrapperCache {
void GetKeyPath(JSContext* aCx, JS::MutableHandle<JS::Value> aResult, void GetKeyPath(JSContext* aCx, JS::MutableHandle<JS::Value> aResult,
ErrorResult& aRv); ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> OpenCursor(JSContext* aCx, [[nodiscard]] RefPtr<IDBRequest> OpenCursor(JSContext* aCx,
JS::Handle<JS::Value> aRange, JS::Handle<JS::Value> aRange,
IDBCursorDirection aDirection, IDBCursorDirection aDirection,
ErrorResult& aRv); ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> OpenKeyCursor(JSContext* aCx, [[nodiscard]] RefPtr<IDBRequest> OpenKeyCursor(JSContext* aCx,
JS::Handle<JS::Value> aRange, JS::Handle<JS::Value> aRange,
IDBCursorDirection aDirection, IDBCursorDirection aDirection,
ErrorResult& aRv); ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> Get(JSContext* aCx, [[nodiscard]] RefPtr<IDBRequest> Get(JSContext* aCx,
JS::Handle<JS::Value> aKey, JS::Handle<JS::Value> aKey,
ErrorResult& aRv); ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> GetKey(JSContext* aCx, [[nodiscard]] RefPtr<IDBRequest> GetKey(JSContext* aCx,
JS::Handle<JS::Value> aKey,
ErrorResult& aRv);
[[nodiscard]] RefPtr<IDBRequest> Count(JSContext* aCx,
JS::Handle<JS::Value> aKey, JS::Handle<JS::Value> aKey,
ErrorResult& aRv); ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> Count(JSContext* aCx, [[nodiscard]] RefPtr<IDBRequest> GetAll(JSContext* aCx,
JS::Handle<JS::Value> aKey, JS::Handle<JS::Value> aKey,
ErrorResult& aRv); const Optional<uint32_t>& aLimit,
ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> GetAll(JSContext* aCx, [[nodiscard]] RefPtr<IDBRequest> GetAllKeys(JSContext* aCx,
JS::Handle<JS::Value> aKey, JS::Handle<JS::Value> aKey,
const Optional<uint32_t>& aLimit, const Optional<uint32_t>& aLimit,
ErrorResult& aRv); ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> GetAllKeys(JSContext* aCx,
JS::Handle<JS::Value> aKey,
const Optional<uint32_t>& aLimit,
ErrorResult& aRv);
void RefreshMetadata(bool aMayDelete); void RefreshMetadata(bool aMayDelete);
@ -154,15 +154,15 @@ class IDBIndex final : public nsISupports, public nsWrapperCache {
~IDBIndex(); ~IDBIndex();
MOZ_MUST_USE RefPtr<IDBRequest> GetInternal(bool aKeyOnly, JSContext* aCx, [[nodiscard]] RefPtr<IDBRequest> GetInternal(bool aKeyOnly, JSContext* aCx,
JS::Handle<JS::Value> aKey, JS::Handle<JS::Value> aKey,
ErrorResult& aRv); ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> GetAllInternal( [[nodiscard]] RefPtr<IDBRequest> GetAllInternal(
bool aKeysOnly, JSContext* aCx, JS::Handle<JS::Value> aKey, bool aKeysOnly, JSContext* aCx, JS::Handle<JS::Value> aKey,
const Optional<uint32_t>& aLimit, ErrorResult& aRv); const Optional<uint32_t>& aLimit, ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> OpenCursorInternal( [[nodiscard]] RefPtr<IDBRequest> OpenCursorInternal(
bool aKeysOnly, JSContext* aCx, JS::Handle<JS::Value> aRange, bool aKeysOnly, JSContext* aCx, JS::Handle<JS::Value> aRange,
IDBCursorDirection aDirection, ErrorResult& aRv); IDBCursorDirection aDirection, ErrorResult& aRv);
}; };

Просмотреть файл

@ -54,28 +54,28 @@ class IDBKeyRange : public nsISupports {
static void FromJSVal(JSContext* aCx, JS::Handle<JS::Value> aVal, static void FromJSVal(JSContext* aCx, JS::Handle<JS::Value> aVal,
RefPtr<IDBKeyRange>* aKeyRange, ErrorResult& aRv); RefPtr<IDBKeyRange>* aKeyRange, ErrorResult& aRv);
static MOZ_MUST_USE RefPtr<IDBKeyRange> FromSerialized( [[nodiscard]] static RefPtr<IDBKeyRange> FromSerialized(
const indexedDB::SerializedKeyRange& aKeyRange); const indexedDB::SerializedKeyRange& aKeyRange);
static MOZ_MUST_USE RefPtr<IDBKeyRange> Only(const GlobalObject& aGlobal, [[nodiscard]] static RefPtr<IDBKeyRange> Only(const GlobalObject& aGlobal,
JS::Handle<JS::Value> aValue, JS::Handle<JS::Value> aValue,
ErrorResult& aRv);
static MOZ_MUST_USE RefPtr<IDBKeyRange> LowerBound(
const GlobalObject& aGlobal, JS::Handle<JS::Value> aValue, bool aOpen,
ErrorResult& aRv);
static MOZ_MUST_USE RefPtr<IDBKeyRange> UpperBound(
const GlobalObject& aGlobal, JS::Handle<JS::Value> aValue, bool aOpen,
ErrorResult& aRv);
static MOZ_MUST_USE RefPtr<IDBKeyRange> Bound(const GlobalObject& aGlobal,
JS::Handle<JS::Value> aLower,
JS::Handle<JS::Value> aUpper,
bool aLowerOpen,
bool aUpperOpen,
ErrorResult& aRv); ErrorResult& aRv);
[[nodiscard]] static RefPtr<IDBKeyRange> LowerBound(
const GlobalObject& aGlobal, JS::Handle<JS::Value> aValue, bool aOpen,
ErrorResult& aRv);
[[nodiscard]] static RefPtr<IDBKeyRange> UpperBound(
const GlobalObject& aGlobal, JS::Handle<JS::Value> aValue, bool aOpen,
ErrorResult& aRv);
[[nodiscard]] static RefPtr<IDBKeyRange> Bound(const GlobalObject& aGlobal,
JS::Handle<JS::Value> aLower,
JS::Handle<JS::Value> aUpper,
bool aLowerOpen,
bool aUpperOpen,
ErrorResult& aRv);
void AssertIsOnOwningThread() const { NS_ASSERT_OWNINGTHREAD(IDBKeyRange); } void AssertIsOnOwningThread() const { NS_ASSERT_OWNINGTHREAD(IDBKeyRange); }
void ToSerialized(indexedDB::SerializedKeyRange& aKeyRange) const; void ToSerialized(indexedDB::SerializedKeyRange& aKeyRange) const;
@ -125,7 +125,7 @@ class IDBLocaleAwareKeyRange final : public IDBKeyRange {
~IDBLocaleAwareKeyRange(); ~IDBLocaleAwareKeyRange();
public: public:
static MOZ_MUST_USE RefPtr<IDBLocaleAwareKeyRange> Bound( [[nodiscard]] static RefPtr<IDBLocaleAwareKeyRange> Bound(
const GlobalObject& aGlobal, JS::Handle<JS::Value> aLower, const GlobalObject& aGlobal, JS::Handle<JS::Value> aLower,
JS::Handle<JS::Value> aUpper, bool aLowerOpen, bool aUpperOpen, JS::Handle<JS::Value> aUpper, bool aLowerOpen, bool aUpperOpen,
ErrorResult& aRv); ErrorResult& aRv);

Просмотреть файл

@ -109,7 +109,7 @@ class IDBMutableFile final : public DOMEventTargetHelper {
IDBDatabase* Database() const; IDBDatabase* Database() const;
MOZ_MUST_USE RefPtr<IDBFileHandle> Open(FileMode aMode, ErrorResult& aError); [[nodiscard]] RefPtr<IDBFileHandle> Open(FileMode aMode, ErrorResult& aError);
IMPL_EVENT_HANDLER(abort) IMPL_EVENT_HANDLER(abort)
IMPL_EVENT_HANDLER(error) IMPL_EVENT_HANDLER(error)

Просмотреть файл

@ -95,7 +95,7 @@ class IDBObjectStore final : public nsISupports, public nsWrapperCache {
bool Clone(JSContext* aCx); bool Clone(JSContext* aCx);
}; };
static MOZ_MUST_USE RefPtr<IDBObjectStore> Create( [[nodiscard]] static RefPtr<IDBObjectStore> Create(
SafeRefPtr<IDBTransaction> aTransaction, ObjectStoreSpec& aSpec); SafeRefPtr<IDBTransaction> aTransaction, ObjectStoreSpec& aSpec);
static void AppendIndexUpdateInfo(int64_t aIndexID, const KeyPath& aKeyPath, static void AppendIndexUpdateInfo(int64_t aIndexID, const KeyPath& aKeyPath,
@ -148,7 +148,7 @@ class IDBObjectStore final : public nsISupports, public nsWrapperCache {
void GetKeyPath(JSContext* aCx, JS::MutableHandle<JS::Value> aResult, void GetKeyPath(JSContext* aCx, JS::MutableHandle<JS::Value> aResult,
ErrorResult& aRv); ErrorResult& aRv);
MOZ_MUST_USE RefPtr<DOMStringList> IndexNames(); [[nodiscard]] RefPtr<DOMStringList> IndexNames();
const IDBTransaction& TransactionRef() const { const IDBTransaction& TransactionRef() const {
AssertIsOnOwningThread(); AssertIsOnOwningThread();
@ -174,65 +174,66 @@ class IDBObjectStore final : public nsISupports, public nsWrapperCache {
return AsRefPtr(mTransaction.clonePtr()); return AsRefPtr(mTransaction.clonePtr());
} }
MOZ_MUST_USE RefPtr<IDBRequest> Add(JSContext* aCx, [[nodiscard]] RefPtr<IDBRequest> Add(JSContext* aCx,
JS::Handle<JS::Value> aValue, JS::Handle<JS::Value> aValue,
JS::Handle<JS::Value> aKey, JS::Handle<JS::Value> aKey,
ErrorResult& aRv); ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> Put(JSContext* aCx, [[nodiscard]] RefPtr<IDBRequest> Put(JSContext* aCx,
JS::Handle<JS::Value> aValue, JS::Handle<JS::Value> aValue,
JS::Handle<JS::Value> aKey, JS::Handle<JS::Value> aKey,
ErrorResult& aRv); ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> Delete(JSContext* aCx, [[nodiscard]] RefPtr<IDBRequest> Delete(JSContext* aCx,
JS::Handle<JS::Value> aKey, JS::Handle<JS::Value> aKey,
ErrorResult& aRv); ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> Get(JSContext* aCx, [[nodiscard]] RefPtr<IDBRequest> Get(JSContext* aCx,
JS::Handle<JS::Value> aKey, JS::Handle<JS::Value> aKey,
ErrorResult& aRv); ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> GetKey(JSContext* aCx, [[nodiscard]] RefPtr<IDBRequest> GetKey(JSContext* aCx,
JS::Handle<JS::Value> aKey, JS::Handle<JS::Value> aKey,
ErrorResult& aRv); ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> Clear(JSContext* aCx, ErrorResult& aRv); [[nodiscard]] RefPtr<IDBRequest> Clear(JSContext* aCx, ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBIndex> CreateIndex( [[nodiscard]] RefPtr<IDBIndex> CreateIndex(
const nsAString& aName, const StringOrStringSequence& aKeyPath, const nsAString& aName, const StringOrStringSequence& aKeyPath,
const IDBIndexParameters& aOptionalParameters, ErrorResult& aRv); const IDBIndexParameters& aOptionalParameters, ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBIndex> Index(const nsAString& aName, ErrorResult& aRv); [[nodiscard]] RefPtr<IDBIndex> Index(const nsAString& aName,
ErrorResult& aRv);
void DeleteIndex(const nsAString& aName, ErrorResult& aRv); void DeleteIndex(const nsAString& aName, ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> Count(JSContext* aCx, [[nodiscard]] RefPtr<IDBRequest> Count(JSContext* aCx,
JS::Handle<JS::Value> aKey,
ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> GetAll(JSContext* aCx,
JS::Handle<JS::Value> aKey, JS::Handle<JS::Value> aKey,
const Optional<uint32_t>& aLimit,
ErrorResult& aRv); ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> GetAllKeys(JSContext* aCx, [[nodiscard]] RefPtr<IDBRequest> GetAll(JSContext* aCx,
JS::Handle<JS::Value> aKey, JS::Handle<JS::Value> aKey,
const Optional<uint32_t>& aLimit, const Optional<uint32_t>& aLimit,
ErrorResult& aRv); ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> OpenCursor(JSContext* aCx, [[nodiscard]] RefPtr<IDBRequest> GetAllKeys(JSContext* aCx,
JS::Handle<JS::Value> aRange, JS::Handle<JS::Value> aKey,
IDBCursorDirection aDirection, const Optional<uint32_t>& aLimit,
ErrorResult& aRv); ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> OpenCursor(JSContext* aCx, [[nodiscard]] RefPtr<IDBRequest> OpenCursor(JSContext* aCx,
IDBCursorDirection aDirection, JS::Handle<JS::Value> aRange,
ErrorResult& aRv); IDBCursorDirection aDirection,
ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> OpenKeyCursor(JSContext* aCx, [[nodiscard]] RefPtr<IDBRequest> OpenCursor(JSContext* aCx,
JS::Handle<JS::Value> aRange, IDBCursorDirection aDirection,
IDBCursorDirection aDirection, ErrorResult& aRv);
ErrorResult& aRv);
[[nodiscard]] RefPtr<IDBRequest> OpenKeyCursor(JSContext* aCx,
JS::Handle<JS::Value> aRange,
IDBCursorDirection aDirection,
ErrorResult& aRv);
void RefreshSpec(bool aMayDelete); void RefreshSpec(bool aMayDelete);
@ -265,26 +266,26 @@ class IDBObjectStore final : public nsISupports, public nsWrapperCache {
nsTArray<IndexUpdateInfo>& aUpdateInfoArray, nsTArray<IndexUpdateInfo>& aUpdateInfoArray,
ErrorResult& aRv); ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> AddOrPut(JSContext* aCx, [[nodiscard]] RefPtr<IDBRequest> AddOrPut(JSContext* aCx,
ValueWrapper& aValueWrapper, ValueWrapper& aValueWrapper,
JS::Handle<JS::Value> aKey, JS::Handle<JS::Value> aKey,
bool aOverwrite, bool aFromCursor, bool aOverwrite, bool aFromCursor,
ErrorResult& aRv); ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> DeleteInternal(JSContext* aCx, [[nodiscard]] RefPtr<IDBRequest> DeleteInternal(JSContext* aCx,
JS::Handle<JS::Value> aKey, JS::Handle<JS::Value> aKey,
bool aFromCursor, bool aFromCursor,
ErrorResult& aRv); ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> GetInternal(bool aKeyOnly, JSContext* aCx, [[nodiscard]] RefPtr<IDBRequest> GetInternal(bool aKeyOnly, JSContext* aCx,
JS::Handle<JS::Value> aKey, JS::Handle<JS::Value> aKey,
ErrorResult& aRv); ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> GetAllInternal( [[nodiscard]] RefPtr<IDBRequest> GetAllInternal(
bool aKeysOnly, JSContext* aCx, JS::Handle<JS::Value> aKey, bool aKeysOnly, JSContext* aCx, JS::Handle<JS::Value> aKey,
const Optional<uint32_t>& aLimit, ErrorResult& aRv); const Optional<uint32_t>& aLimit, ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> OpenCursorInternal( [[nodiscard]] RefPtr<IDBRequest> OpenCursorInternal(
bool aKeysOnly, JSContext* aCx, JS::Handle<JS::Value> aRange, bool aKeysOnly, JSContext* aCx, JS::Handle<JS::Value> aRange,
IDBCursorDirection aDirection, ErrorResult& aRv); IDBCursorDirection aDirection, ErrorResult& aRv);
}; };

Просмотреть файл

@ -65,15 +65,15 @@ class IDBRequest : public DOMEventTargetHelper {
public: public:
class ResultCallback; class ResultCallback;
static MOZ_MUST_USE RefPtr<IDBRequest> Create( [[nodiscard]] static RefPtr<IDBRequest> Create(
JSContext* aCx, IDBDatabase* aDatabase, JSContext* aCx, IDBDatabase* aDatabase,
SafeRefPtr<IDBTransaction> aTransaction); SafeRefPtr<IDBTransaction> aTransaction);
static MOZ_MUST_USE RefPtr<IDBRequest> Create( [[nodiscard]] static RefPtr<IDBRequest> Create(
JSContext* aCx, IDBObjectStore* aSource, IDBDatabase* aDatabase, JSContext* aCx, IDBObjectStore* aSource, IDBDatabase* aDatabase,
SafeRefPtr<IDBTransaction> aTransaction); SafeRefPtr<IDBTransaction> aTransaction);
static MOZ_MUST_USE RefPtr<IDBRequest> Create( [[nodiscard]] static RefPtr<IDBRequest> Create(
JSContext* aCx, IDBIndex* aSource, IDBDatabase* aDatabase, JSContext* aCx, IDBIndex* aSource, IDBDatabase* aDatabase,
SafeRefPtr<IDBTransaction> aTransaction); SafeRefPtr<IDBTransaction> aTransaction);
@ -207,7 +207,7 @@ class IDBOpenDBRequest final : public IDBRequest {
bool mIncreasedActiveDatabaseCount; bool mIncreasedActiveDatabaseCount;
public: public:
static MOZ_MUST_USE RefPtr<IDBOpenDBRequest> Create( [[nodiscard]] static RefPtr<IDBOpenDBRequest> Create(
JSContext* aCx, SafeRefPtr<IDBFactory> aFactory, JSContext* aCx, SafeRefPtr<IDBFactory> aFactory,
nsIGlobalObject* aGlobal); nsIGlobalObject* aGlobal);

Просмотреть файл

@ -122,13 +122,13 @@ class IDBTransaction final
#endif #endif
public: public:
static MOZ_MUST_USE SafeRefPtr<IDBTransaction> CreateVersionChange( [[nodiscard]] static SafeRefPtr<IDBTransaction> CreateVersionChange(
IDBDatabase* aDatabase, IDBDatabase* aDatabase,
indexedDB::BackgroundVersionChangeTransactionChild* aActor, indexedDB::BackgroundVersionChangeTransactionChild* aActor,
IDBOpenDBRequest* aOpenRequest, int64_t aNextObjectStoreId, IDBOpenDBRequest* aOpenRequest, int64_t aNextObjectStoreId,
int64_t aNextIndexId); int64_t aNextIndexId);
static MOZ_MUST_USE SafeRefPtr<IDBTransaction> Create( [[nodiscard]] static SafeRefPtr<IDBTransaction> Create(
JSContext* aCx, IDBDatabase* aDatabase, JSContext* aCx, IDBDatabase* aDatabase,
const nsTArray<nsString>& aObjectStoreNames, Mode aMode); const nsTArray<nsString>& aObjectStoreNames, Mode aMode);
@ -275,7 +275,7 @@ class IDBTransaction final
return mObjectStoreNames; return mObjectStoreNames;
} }
MOZ_MUST_USE RefPtr<IDBObjectStore> CreateObjectStore( [[nodiscard]] RefPtr<IDBObjectStore> CreateObjectStore(
indexedDB::ObjectStoreSpec& aSpec); indexedDB::ObjectStoreSpec& aSpec);
void DeleteObjectStore(int64_t aObjectStoreId); void DeleteObjectStore(int64_t aObjectStoreId);
@ -331,8 +331,8 @@ class IDBTransaction final
DOMException* GetError() const; DOMException* GetError() const;
MOZ_MUST_USE RefPtr<IDBObjectStore> ObjectStore(const nsAString& aName, [[nodiscard]] RefPtr<IDBObjectStore> ObjectStore(const nsAString& aName,
ErrorResult& aRv); ErrorResult& aRv);
void Commit(ErrorResult& aRv); void Commit(ErrorResult& aRv);
@ -342,7 +342,7 @@ class IDBTransaction final
IMPL_EVENT_HANDLER(complete) IMPL_EVENT_HANDLER(complete)
IMPL_EVENT_HANDLER(error) IMPL_EVENT_HANDLER(error)
MOZ_MUST_USE RefPtr<DOMStringList> ObjectStoreNames() const; [[nodiscard]] RefPtr<DOMStringList> ObjectStoreNames() const;
// EventTarget // EventTarget
void GetEventTargetParent(EventChainPreVisitor& aVisitor) override; void GetEventTargetParent(EventChainPreVisitor& aVisitor) override;

Просмотреть файл

@ -60,7 +60,7 @@ using namespace mozilla::ipc;
class FileManagerInfo { class FileManagerInfo {
public: public:
MOZ_MUST_USE SafeRefPtr<FileManager> GetFileManager( [[nodiscard]] SafeRefPtr<FileManager> GetFileManager(
PersistenceType aPersistenceType, const nsAString& aName) const; PersistenceType aPersistenceType, const nsAString& aName) const;
void AddFileManager(SafeRefPtr<FileManager> aFileManager); void AddFileManager(SafeRefPtr<FileManager> aFileManager);

Просмотреть файл

@ -104,7 +104,7 @@ class IndexedDatabaseManager final {
void ClearBackgroundActor(); void ClearBackgroundActor();
MOZ_MUST_USE SafeRefPtr<FileManager> GetFileManager( [[nodiscard]] SafeRefPtr<FileManager> GetFileManager(
PersistenceType aPersistenceType, const nsACString& aOrigin, PersistenceType aPersistenceType, const nsACString& aOrigin,
const nsAString& aDatabaseName); const nsAString& aDatabaseName);

Просмотреть файл

@ -31,7 +31,7 @@ class TestFileManager final : public FileManagerBase<TestFileManager> {
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(TestFileManager) NS_INLINE_DECL_THREADSAFE_REFCOUNTING(TestFileManager)
MOZ_MUST_USE nsresult AsyncDeleteFile(const int64_t aFileId) { [[nodiscard]] nsresult AsyncDeleteFile(const int64_t aFileId) {
MOZ_RELEASE_ASSERT(!mFileInfos.Contains(aFileId)); MOZ_RELEASE_ASSERT(!mFileInfos.Contains(aFileId));
if (mStats) { if (mStats) {
@ -41,7 +41,7 @@ class TestFileManager final : public FileManagerBase<TestFileManager> {
return NS_OK; return NS_OK;
} }
MOZ_MUST_USE nsresult SyncDeleteFile(const int64_t aFileId) { [[nodiscard]] nsresult SyncDeleteFile(const int64_t aFileId) {
MOZ_RELEASE_ASSERT(!mFileInfos.Contains(aFileId)); MOZ_RELEASE_ASSERT(!mFileInfos.Contains(aFileId));
if (mStats) { if (mStats) {