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);
template <typename... Args>
MOZ_MUST_USE RefPtr<IDBCursor> HandleIndividualCursorResponse(
[[nodiscard]] RefPtr<IDBCursor> HandleIndividualCursorResponse(
bool aUseAsCurrentResult, Args&&... aArgs);
public:

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

@ -422,7 +422,7 @@ struct FullDatabaseMetadata {
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(FullDatabaseMetadata)
MOZ_MUST_USE SafeRefPtr<FullDatabaseMetadata> Duplicate() const;
[[nodiscard]] SafeRefPtr<FullDatabaseMetadata> Duplicate() const;
private:
~FullDatabaseMetadata() = default;
@ -5743,7 +5743,7 @@ class Factory final : public PBackgroundIDBFactoryParent {
#endif
public:
static MOZ_MUST_USE RefPtr<Factory> Create(const LoggingInfo& aLoggingInfo);
[[nodiscard]] static RefPtr<Factory> Create(const LoggingInfo& aLoggingInfo);
DatabaseLoggingInfo* GetLoggingInfo() const {
AssertIsOnBackgroundThread();
@ -6012,7 +6012,7 @@ class Database final
mFactory.forget());
}
MOZ_MUST_USE SafeRefPtr<FileInfo> GetBlob(const IPCBlob& aID);
[[nodiscard]] SafeRefPtr<FileInfo> GetBlob(const IPCBlob& 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
* 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()
@ -6362,10 +6362,10 @@ class TransactionBase {
return NS_FAILED(mResultCode);
}
MOZ_MUST_USE RefPtr<FullObjectStoreMetadata> GetMetadataForObjectStoreId(
[[nodiscard]] RefPtr<FullObjectStoreMetadata> GetMetadataForObjectStoreId(
IndexOrObjectStoreId aObjectStoreId) const;
MOZ_MUST_USE RefPtr<FullIndexMetadata> GetMetadataForIndexId(
[[nodiscard]] RefPtr<FullIndexMetadata> GetMetadataForIndexId(
FullObjectStoreMetadata* const aObjectStoreMetadata,
IndexOrObjectStoreId aIndexId) const;
@ -6642,7 +6642,7 @@ class MutableFile : public BackgroundMutableFileParentBase {
const SafeRefPtr<FileInfo> mFileInfo;
public:
static MOZ_MUST_USE RefPtr<MutableFile> Create(
[[nodiscard]] static RefPtr<MutableFile> Create(
nsIFile* aFile, SafeRefPtr<Database> aDatabase,
SafeRefPtr<FileInfo> aFileInfo);
@ -9098,9 +9098,9 @@ class MOZ_STACK_CLASS FileHelper final {
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,
nsIInputStream& aInputStream, bool aCompress);

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

@ -39,11 +39,11 @@ class FileManager final : public FileManagerBase<FileManager> {
static MutexType sMutex;
public:
static MOZ_MUST_USE nsCOMPtr<nsIFile> GetFileForId(nsIFile* aDirectory,
int64_t aId);
[[nodiscard]] static nsCOMPtr<nsIFile> GetFileForId(nsIFile* aDirectory,
int64_t aId);
static MOZ_MUST_USE nsCOMPtr<nsIFile> GetCheckedFileForId(nsIFile* aDirectory,
int64_t aId);
[[nodiscard]] static nsCOMPtr<nsIFile> GetCheckedFileForId(
nsIFile* aDirectory, int64_t aId);
static nsresult InitDirectory(nsIFile& aDirectory, nsIFile& aDatabaseFile,
const nsACString& aOrigin,
@ -69,21 +69,21 @@ class FileManager final : public FileManagerBase<FileManager> {
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
// 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)

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

@ -27,7 +27,7 @@ class FileManagerBase {
using MutexType = StaticMutex;
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()) {
// In release, the assertions are disabled.
return nullptr;
@ -45,7 +45,7 @@ class FileManagerBase {
return {fileInfo, AcquireStrongRefFromRawPtr{}};
}
MOZ_MUST_USE SafeRefPtr<FileInfo> CreateFileInfo() {
[[nodiscard]] SafeRefPtr<FileInfo> CreateFileInfo() {
if (!AssertValid()) {
// In release, the assertions are disabled.
return nullptr;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -109,7 +109,7 @@ class IDBMutableFile final : public DOMEventTargetHelper {
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(error)

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

@ -95,7 +95,7 @@ class IDBObjectStore final : public nsISupports, public nsWrapperCache {
bool Clone(JSContext* aCx);
};
static MOZ_MUST_USE RefPtr<IDBObjectStore> Create(
[[nodiscard]] static RefPtr<IDBObjectStore> Create(
SafeRefPtr<IDBTransaction> aTransaction, ObjectStoreSpec& aSpec);
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,
ErrorResult& aRv);
MOZ_MUST_USE RefPtr<DOMStringList> IndexNames();
[[nodiscard]] RefPtr<DOMStringList> IndexNames();
const IDBTransaction& TransactionRef() const {
AssertIsOnOwningThread();
@ -174,65 +174,66 @@ class IDBObjectStore final : public nsISupports, public nsWrapperCache {
return AsRefPtr(mTransaction.clonePtr());
}
MOZ_MUST_USE RefPtr<IDBRequest> Add(JSContext* aCx,
JS::Handle<JS::Value> aValue,
JS::Handle<JS::Value> aKey,
ErrorResult& aRv);
[[nodiscard]] RefPtr<IDBRequest> Add(JSContext* aCx,
JS::Handle<JS::Value> aValue,
JS::Handle<JS::Value> aKey,
ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> Put(JSContext* aCx,
JS::Handle<JS::Value> aValue,
JS::Handle<JS::Value> aKey,
ErrorResult& aRv);
[[nodiscard]] RefPtr<IDBRequest> Put(JSContext* aCx,
JS::Handle<JS::Value> aValue,
JS::Handle<JS::Value> aKey,
ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> Delete(JSContext* aCx,
JS::Handle<JS::Value> aKey,
ErrorResult& aRv);
[[nodiscard]] RefPtr<IDBRequest> Delete(JSContext* aCx,
JS::Handle<JS::Value> aKey,
ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> Get(JSContext* aCx,
JS::Handle<JS::Value> aKey,
ErrorResult& aRv);
[[nodiscard]] RefPtr<IDBRequest> Get(JSContext* aCx,
JS::Handle<JS::Value> aKey,
ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> GetKey(JSContext* aCx,
JS::Handle<JS::Value> aKey,
ErrorResult& aRv);
[[nodiscard]] RefPtr<IDBRequest> GetKey(JSContext* aCx,
JS::Handle<JS::Value> aKey,
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 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);
MOZ_MUST_USE RefPtr<IDBRequest> Count(JSContext* aCx,
JS::Handle<JS::Value> aKey,
ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> GetAll(JSContext* aCx,
[[nodiscard]] RefPtr<IDBRequest> Count(JSContext* aCx,
JS::Handle<JS::Value> aKey,
const Optional<uint32_t>& aLimit,
ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> GetAllKeys(JSContext* aCx,
JS::Handle<JS::Value> aKey,
const Optional<uint32_t>& aLimit,
ErrorResult& aRv);
[[nodiscard]] RefPtr<IDBRequest> GetAll(JSContext* aCx,
JS::Handle<JS::Value> aKey,
const Optional<uint32_t>& aLimit,
ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> OpenCursor(JSContext* aCx,
JS::Handle<JS::Value> aRange,
IDBCursorDirection aDirection,
ErrorResult& aRv);
[[nodiscard]] RefPtr<IDBRequest> GetAllKeys(JSContext* aCx,
JS::Handle<JS::Value> aKey,
const Optional<uint32_t>& aLimit,
ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> OpenCursor(JSContext* aCx,
IDBCursorDirection aDirection,
ErrorResult& aRv);
[[nodiscard]] RefPtr<IDBRequest> OpenCursor(JSContext* aCx,
JS::Handle<JS::Value> aRange,
IDBCursorDirection aDirection,
ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> OpenKeyCursor(JSContext* aCx,
JS::Handle<JS::Value> aRange,
IDBCursorDirection aDirection,
ErrorResult& aRv);
[[nodiscard]] RefPtr<IDBRequest> OpenCursor(JSContext* aCx,
IDBCursorDirection aDirection,
ErrorResult& aRv);
[[nodiscard]] RefPtr<IDBRequest> OpenKeyCursor(JSContext* aCx,
JS::Handle<JS::Value> aRange,
IDBCursorDirection aDirection,
ErrorResult& aRv);
void RefreshSpec(bool aMayDelete);
@ -265,26 +266,26 @@ class IDBObjectStore final : public nsISupports, public nsWrapperCache {
nsTArray<IndexUpdateInfo>& aUpdateInfoArray,
ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> AddOrPut(JSContext* aCx,
ValueWrapper& aValueWrapper,
JS::Handle<JS::Value> aKey,
bool aOverwrite, bool aFromCursor,
ErrorResult& aRv);
[[nodiscard]] RefPtr<IDBRequest> AddOrPut(JSContext* aCx,
ValueWrapper& aValueWrapper,
JS::Handle<JS::Value> aKey,
bool aOverwrite, bool aFromCursor,
ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> DeleteInternal(JSContext* aCx,
JS::Handle<JS::Value> aKey,
bool aFromCursor,
ErrorResult& aRv);
[[nodiscard]] RefPtr<IDBRequest> DeleteInternal(JSContext* aCx,
JS::Handle<JS::Value> aKey,
bool aFromCursor,
ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> GetInternal(bool aKeyOnly, JSContext* aCx,
JS::Handle<JS::Value> aKey,
ErrorResult& aRv);
[[nodiscard]] RefPtr<IDBRequest> GetInternal(bool aKeyOnly, JSContext* aCx,
JS::Handle<JS::Value> aKey,
ErrorResult& aRv);
MOZ_MUST_USE RefPtr<IDBRequest> GetAllInternal(
[[nodiscard]] RefPtr<IDBRequest> GetAllInternal(
bool aKeysOnly, JSContext* aCx, JS::Handle<JS::Value> aKey,
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,
IDBCursorDirection aDirection, ErrorResult& aRv);
};

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

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

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

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

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

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

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

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

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

@ -31,7 +31,7 @@ class TestFileManager final : public FileManagerBase<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));
if (mStats) {
@ -41,7 +41,7 @@ class TestFileManager final : public FileManagerBase<TestFileManager> {
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));
if (mStats) {