mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1485487: Add an assertion to ensure that DllServices::GetBinaryOrgName is not called on the Gecko main thread; r=mhowell
--HG-- extra : rebase_source : 51e91fd9fcac54decd083bd0943d4af9bcbd539e
This commit is contained in:
parent
f148747c8d
commit
fff6fb1ff1
@ -7,11 +7,13 @@
|
||||
#ifndef mozilla_glue_WindowsDllServices_h
|
||||
#define mozilla_glue_WindowsDllServices_h
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Authenticode.h"
|
||||
#include "mozilla/WindowsDllBlocklist.h"
|
||||
|
||||
#if defined(MOZILLA_INTERNAL_API)
|
||||
|
||||
#include "MainThreadUtils.h"
|
||||
#include "mozilla/SystemGroup.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsString.h"
|
||||
@ -42,7 +44,14 @@ public:
|
||||
mAuthenticode = aAuthenticode;
|
||||
}
|
||||
|
||||
// In debug builds, we override GetBinaryOrgName to add a Gecko-specific
|
||||
// assertion. OTOH, we normally do not want people overriding this function,
|
||||
// so we'll make it final in the release case, thus covering all bases.
|
||||
#if defined(DEBUG)
|
||||
UniquePtr<wchar_t[]> GetBinaryOrgName(const wchar_t* aFilePath) override
|
||||
#else
|
||||
UniquePtr<wchar_t[]> GetBinaryOrgName(const wchar_t* aFilePath) final
|
||||
#endif // defined(DEBUG)
|
||||
{
|
||||
if (!mAuthenticode) {
|
||||
return nullptr;
|
||||
@ -98,6 +107,16 @@ public:
|
||||
SystemGroup::Dispatch(TaskCategory::Other, runnable.forget());
|
||||
}
|
||||
|
||||
#if defined(DEBUG)
|
||||
UniquePtr<wchar_t[]> GetBinaryOrgName(const wchar_t* aFilePath) final
|
||||
{
|
||||
// This function may perform disk I/O, so we should never call it on the
|
||||
// main thread.
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
return detail::DllServicesBase::GetBinaryOrgName(aFilePath);
|
||||
}
|
||||
#endif // defined(DEBUG)
|
||||
|
||||
NS_INLINE_DECL_THREADSAFE_VIRTUAL_REFCOUNTING(DllServices)
|
||||
|
||||
protected:
|
||||
|
Loading…
Reference in New Issue
Block a user