Bug 1522830: Part 5 - Provide a launcher result type that unconditionally includes file and line info; r=mhowell

`LauncherResult` only includes file and line info when built into the launcher
process. Now that there will be `xul.dll`-based code calling into launcher
process startup, this would create an ABI mismatch.

This patch creates a new type, `LauncherResultWithLineInfo`, that
unconditionally includes the file and line so that APIs called by both `xul`
and non-`xul` code can have the same ABI for both.

Differential Revision: https://phabricator.services.mozilla.com/D53677

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Aaron Klotz 2019-12-05 21:53:41 +00:00
parent c15ae2a867
commit e27c1bca50
3 changed files with 21 additions and 13 deletions

View File

@ -23,8 +23,8 @@ extern "C" IMAGE_DOS_HEADER __ImageBase;
namespace mozilla {
LauncherVoidResult InitializeDllBlocklistOOP(const wchar_t* aFullImagePath,
HANDLE aChildProcess) {
LauncherVoidResultWithLineInfo InitializeDllBlocklistOOP(
const wchar_t* aFullImagePath, HANDLE aChildProcess) {
CrossProcessDllInterceptor intcpt(aChildProcess);
intcpt.Init(L"ntdll.dll");

View File

@ -13,8 +13,8 @@
namespace mozilla {
LauncherVoidResult InitializeDllBlocklistOOP(const wchar_t* aFullImagePath,
HANDLE aChildProcess);
LauncherVoidResultWithLineInfo InitializeDllBlocklistOOP(
const wchar_t* aFullImagePath, HANDLE aChildProcess);
} // namespace mozilla

View File

@ -190,15 +190,6 @@ class WindowsError final {
template <typename T>
using WindowsErrorResult = Result<T, WindowsError>;
#if defined(MOZILLA_INTERNAL_API)
template <typename T>
using LauncherResult = WindowsErrorResult<T>;
using WindowsErrorType = WindowsError;
#else
struct LauncherError {
LauncherError(const char* aFile, int aLine, WindowsError aWin32Error)
: mFile(aFile), mLine(aLine), mError(aWin32Error) {}
@ -220,15 +211,32 @@ struct LauncherError {
bool operator!=(const WindowsError& aOther) const { return mError != aOther; }
};
#if defined(MOZILLA_INTERNAL_API)
template <typename T>
using LauncherResult = WindowsErrorResult<T>;
template <typename T>
using LauncherResultWithLineInfo = Result<T, LauncherError>;
using WindowsErrorType = WindowsError;
#else
template <typename T>
using LauncherResult = Result<T, LauncherError>;
template <typename T>
using LauncherResultWithLineInfo = LauncherResult<T>;
using WindowsErrorType = LauncherError;
#endif // defined(MOZILLA_INTERNAL_API)
using LauncherVoidResult = LauncherResult<Ok>;
using LauncherVoidResultWithLineInfo = LauncherResultWithLineInfo<Ok>;
#if defined(MOZILLA_INTERNAL_API)
# define LAUNCHER_ERROR_GENERIC() \