Bug 1687561 - Disable the skeleton UI permanently-ish if we crash during it r=mconley,emalysz

This will disable the skeleton UI if we crash while setting it up, and further
the error will propagate up and get reported via telemetry on the next run.
This is important because we don't have anything like the crash reporter set up
by the time we want to start showing the skeleton UI.

Differential Revision: https://phabricator.services.mozilla.com/D102355
This commit is contained in:
Doug Thayer 2021-01-26 16:10:28 +00:00
Родитель bfdaa1612c
Коммит c22b2b6c3f
4 изменённых файлов: 35 добавлений и 4 удалений

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

@ -99,6 +99,7 @@ add_task(async function testPersistsNecessaryValuesOnChange() {
"SearchbarCSSSpan",
"Theme",
"Flags",
"Progress",
];
// Remove all of the registry values to ensure old tests aren't giving us false

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

@ -185,6 +185,7 @@ static const wchar_t* sSearchbarRegSuffix = L"|SearchbarCSSSpan";
static const wchar_t* sSpringsCSSRegSuffix = L"|SpringsCSSSpan";
static const wchar_t* sThemeRegSuffix = L"|Theme";
static const wchar_t* sFlagsRegSuffix = L"|Flags";
static const wchar_t* sProgressSuffix = L"|Progress";
struct LoadedCoTaskMemFreeDeleter {
void operator()(void* ptr) {
@ -1860,10 +1861,6 @@ static Result<Ok, PreXULSkeletonUIError> CreateAndStorePreXULSkeletonUIImpl(
return Err(PreXULSkeletonUIError::Ineligible);
}
bool explicitProfile = false;
MOZ_TRY(ValidateCmdlineArguments(argc, argv, &explicitProfile));
MOZ_TRY(ValidateEnvVars());
HKEY regKey;
MOZ_TRY_VAR(regKey, OpenPreXULSkeletonUIRegKey());
AutoCloseRegKey closeKey(regKey);
@ -1871,6 +1868,28 @@ static Result<Ok, PreXULSkeletonUIError> CreateAndStorePreXULSkeletonUIImpl(
UniquePtr<wchar_t[]> binPath;
MOZ_TRY_VAR(binPath, GetBinaryPath());
std::wstring regProgressName =
GetRegValueName(binPath.get(), sProgressSuffix);
auto progressResult = ReadRegUint(regKey, regProgressName);
if (!progressResult.isErr() &&
progressResult.unwrap() !=
static_cast<uint32_t>(PreXULSkeletonUIProgress::Completed)) {
return Err(PreXULSkeletonUIError::CrashedOnce);
}
MOZ_TRY(
WriteRegUint(regKey, regProgressName,
static_cast<uint32_t>(PreXULSkeletonUIProgress::Started)));
auto writeCompletion = MakeScopeExit([&] {
Unused << WriteRegUint(
regKey, regProgressName,
static_cast<uint32_t>(PreXULSkeletonUIProgress::Completed));
});
bool explicitProfile = false;
MOZ_TRY(ValidateCmdlineArguments(argc, argv, &explicitProfile));
MOZ_TRY(ValidateEnvVars());
auto enabledResult =
ReadRegBool(regKey, GetRegValueName(binPath.get(), sEnabledRegSuffix));
if (enabledResult.isErr()) {

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

@ -90,6 +90,7 @@ enum class PreXULSkeletonUIError : uint32_t {
FailedGettingDC,
FailedBlitting,
FailedFillingBottomRect,
CrashedOnce,
Unknown,
};
@ -138,6 +139,8 @@ inline const wchar_t* GetPreXULSkeletonUIErrorString(
return L"FailedBlitting";
case PreXULSkeletonUIError::FailedFillingBottomRect:
return L"FailedFillingBottomRect";
case PreXULSkeletonUIError::CrashedOnce:
return L"CrashedOnce";
case PreXULSkeletonUIError::Unknown:
return L"Unknown";
}
@ -146,6 +149,11 @@ inline const wchar_t* GetPreXULSkeletonUIErrorString(
return L"Unknown";
}
enum class PreXULSkeletonUIProgress : uint32_t {
Started,
Completed,
};
MFBT_API void CreateAndStorePreXULSkeletonUI(HINSTANCE hInstance, int argc,
char** argv);
MFBT_API Result<HWND, PreXULSkeletonUIError> ConsumePreXULSkeletonUIHandle();

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

@ -5374,6 +5374,9 @@ startup:
FailedFillingBottomRect:
We failed filling the solid color of the main browser below the
browser chrome.
CrashedOnce:
At some point the skeleton UI crashed, so we've disabled it for the
user.
Unknown:
An unknown error occurred - this generally should not happen.
expires: "92"