Bug 1857687 - Disable thread safety analysis on a few problematic functions. r=nika,necko-reviewers,valentin

The functions return a reference to a value that is normally protected
by a lock in an unlocked manner, but they do so on purpose.

One of them can be annotated with the lock that is being held when it's
called, though, so we do that.

Differential Revision: https://phabricator.services.mozilla.com/D191707
This commit is contained in:
Mike Hommey 2023-10-26 20:13:22 +00:00
Родитель d9a5545618
Коммит ac55867690
3 изменённых файлов: 6 добавлений и 3 удалений

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

@ -47,7 +47,10 @@ class ServiceWorkerRegistrarTest : public ServiceWorkerRegistrar {
RegisterServiceWorkerInternal(aData);
}
nsTArray<ServiceWorkerRegistrationData>& TestGetData() { return mData; }
nsTArray<ServiceWorkerRegistrationData>& TestGetData()
MOZ_NO_THREAD_SAFETY_ANALYSIS {
return mData;
}
};
already_AddRefed<nsIFile> GetFile() {

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

@ -81,7 +81,7 @@ class XMLHttpRequestStringBuffer final {
private:
~XMLHttpRequestStringBuffer() = default;
nsString& UnsafeData() { return mData; }
nsString& UnsafeData() MOZ_NO_THREAD_SAFETY_ANALYSIS { return mData; }
Mutex mMutex;

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

@ -40,7 +40,7 @@ class nsHttpRequestHead {
// The following function is only used in HttpChannelParent to avoid
// copying headers. If you use it be careful to do it only under
// nsHttpRequestHead lock!!!
const nsHttpHeaderArray& Headers() const;
const nsHttpHeaderArray& Headers() const MOZ_REQUIRES(mRecursiveMutex);
void Enter() const MOZ_CAPABILITY_ACQUIRE(mRecursiveMutex) {
mRecursiveMutex.Lock();
}