Backed out 3 changesets (bug 1837907) for causing xpc failures on toolkit/mozapps/update/tests/unit_base_updater/marSuccessPartialWhileBackgroundTaskRunning.js

Backed out changeset 28174e34160b (bug 1837907)
Backed out changeset a883cbc99803 (bug 1837907)
Backed out changeset 7a2134520f7c (bug 1837907)
This commit is contained in:
Sandor Molnar 2023-11-15 19:33:12 +02:00
parent ec89f35c95
commit 8f0b907808
3 changed files with 8 additions and 57 deletions

View File

@ -115,6 +115,7 @@ static struct sigaction SIGQUIT_oldact;
static struct sigaction SIGILL_oldact;
static struct sigaction SIGABRT_oldact;
static struct sigaction SIGSEGV_oldact;
static struct sigaction SIGTERM_oldact;
void nsProfileLock::FatalSignalHandler(int signo
# ifdef SA_SIGINFO
@ -147,6 +148,9 @@ void nsProfileLock::FatalSignalHandler(int signo
case SIGSEGV:
oldact = &SIGSEGV_oldact;
break;
case SIGTERM:
oldact = &SIGTERM_oldact;
break;
default:
MOZ_ASSERT_UNREACHABLE("bad signo");
break;
@ -383,6 +387,7 @@ nsresult nsProfileLock::LockWithSymlink(nsIFile* aLockFile,
CATCH_SIGNAL(SIGILL);
CATCH_SIGNAL(SIGABRT);
CATCH_SIGNAL(SIGSEGV);
CATCH_SIGNAL(SIGTERM);
# undef CATCH_SIGNAL
}

View File

@ -45,7 +45,6 @@ using mozilla::widget::ScreenHelperGTK;
using mozilla::widget::ScreenManager;
#define NOTIFY_TOKEN 0xFA
#define QUIT_TOKEN 0xFB
LazyLogModule gWidgetLog("Widget");
LazyLogModule gWidgetDragLog("WidgetDrag");
@ -57,8 +56,6 @@ LazyLogModule gClipboardLog("WidgetClipboard");
static GPollFunc sPollFunc;
nsAppShell* sAppShell = nullptr;
// Wrapper function to disable hang monitoring while waiting in poll().
static gint PollWrapper(GPollFD* aUfds, guint aNfsd, gint aTimeout) {
if (aTimeout == 0) {
@ -145,17 +142,9 @@ gboolean nsAppShell::EventProcessorCallback(GIOChannel* source,
unsigned char c;
Unused << read(self->mPipeFDs[0], &c, 1);
switch (c) {
case NOTIFY_TOKEN:
self->NativeEventCallback();
break;
case QUIT_TOKEN:
self->Exit();
break;
default:
NS_ASSERTION(false, "wrong token");
break;
}
NS_ASSERTION(c == (unsigned char)NOTIFY_TOKEN, "wrong token");
self->NativeEventCallback();
return TRUE;
}
@ -301,34 +290,6 @@ void nsAppShell::StopDBusListening() {
}
#endif
void nsAppShell::TermSignalHandler(int signo) {
if (signo != SIGTERM) {
NS_WARNING("Wrong signal!");
return;
}
sAppShell->ScheduleQuitEvent();
}
void nsAppShell::InstallTermSignalHandler() {
if (!XRE_IsParentProcess() || PR_GetEnv("MOZ_DISABLE_SIG_HANDLER")) {
return;
}
struct sigaction act = {}, oldact;
act.sa_handler = TermSignalHandler;
sigfillset(&act.sa_mask);
if (NS_WARN_IF(sigaction(SIGTERM, nullptr, &oldact) != 0)) {
return;
}
if (oldact.sa_handler != SIG_DFL) {
NS_WARNING("SIGTERM signal handler is already set?");
}
sigaction(SIGTERM, &act, nullptr);
sAppShell = this;
}
nsresult nsAppShell::Init() {
mozilla::hal::Init();
@ -452,17 +413,7 @@ void nsAppShell::ScheduleNativeEventCallback() {
Unused << write(mPipeFDs[1], buf, 1);
}
void nsAppShell::ScheduleQuitEvent() {
unsigned char buf[] = {QUIT_TOKEN};
Unused << write(mPipeFDs[1], buf, 1);
}
bool nsAppShell::ProcessNextNativeEvent(bool mayWait) {
static std::once_flag onceFlag;
std::call_once(onceFlag, [self = MOZ_KnownLive(this)] {
self->InstallTermSignalHandler();
});
if (mSuspendNativeCount) {
return false;
}

View File

@ -48,11 +48,6 @@ class nsAppShell : public nsBaseAppShell {
static gboolean EventProcessorCallback(GIOChannel* source,
GIOCondition condition, gpointer data);
void InstallTermSignalHandler();
static void TermSignalHandler(int signo);
void ScheduleQuitEvent();
int mPipeFDs[2];
unsigned mTag;