From afc187cc3f907947453b428f857acf16b2b0774e Mon Sep 17 00:00:00 2001 From: athenian200 Date: Tue, 1 Oct 2019 06:07:31 -0500 Subject: MoonchildProductions#1251 - Part 1: Restore initial Solaris support, fixed up. Compared with what Pale Moon had for Solaris originally, this is mostly the same zero point I started patching from, but I've made the following changes here after reviewing all this initial code I never looked at closely before. 1. In package-manifest.in for both Basilisk and Pale Moon, I've made the SPARC code for libfreebl not interefere with the x86 code, use the proper build flags, and also updated it to allow a SPARC64 build which is more likely to be used than the 32-bit SPARC code we had there. 2. See Mozilla bug #832272 and the old rules.mk patch from around Firefox 30 in oracle/solaris-userland. I believe they screwed up NSINSTALL on Solaris when they were trying to streamline the NSS buildsystem, because they started having unexplained issues with it around that time after Firefox 22 that they never properly resolved until Mozilla began building NSS with gyp files. I'm actually not even sure how relevant the thing they broke actually is to Solaris at this point, bug 665509 is so old it predates Firefox itself and goes back to the Mozilla suite days. I believe $(INSTALL) -t was wrong, and they meant $(NSINSTALL) -t because that makes more sense and is closer to what was there originally. It's what they have for WINNT, and it's possible a fix more like that could serve for Solaris as well. Alternatively, we could get rid of all these half-broken Makefiles and start building NSS with gyp files like Mozilla did. 3. I've completely cut out support for the Sun compiler and taken into account the reality that everyone builds Firefox (and therefore its forks) with GCC now on Solaris. This alone helped clean up a lot of the uglier parts of the code. 4. I've updated all remaining SOLARIS build flags to the newer XP_SOLARIS, because the SOLARIS flag is no longer set when building Solaris. 5. I've confirmed the workaround in gtxFontconfigFonts.cpp is no longer necessary. The Solaris people got impatient about implementing a half-baked patch for a fontconfig feature that wasn't ready yet back in 2009, and somehow convinced Mozilla to patch their software to work around it when really they should have just fixed or removed their broken fontconfig patch. The feature they wanted has since been implemented properly, and no version of Solaris still uses the broken patch that required this fix. If anyone had ever properly audited this code, it would have been removed a long time ago. --- toolkit/components/osfile/modules/osfile_unix_back.jsm | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'toolkit/components') diff --git a/toolkit/components/osfile/modules/osfile_unix_back.jsm b/toolkit/components/osfile/modules/osfile_unix_back.jsm index bf5c66b8d..7c2c6f28d 100644 --- a/toolkit/components/osfile/modules/osfile_unix_back.jsm +++ b/toolkit/components/osfile/modules/osfile_unix_back.jsm @@ -585,10 +585,18 @@ } else if (Const._STAT_VER != undefined) { const ver = Const._STAT_VER; let xstat_name, lxstat_name, fxstat_name; - // Linux, all widths - xstat_name = "__xstat"; - lxstat_name = "__lxstat"; - fxstat_name = "__fxstat"; + if (OS.Constants.Sys.Name == "SunOS") { + // Solaris + xstat_name = "_xstat"; + lxstat_name = "_lxstat"; + fxstat_name = "_fxstat"; + } else { + + // Linux, all widths + xstat_name = "__xstat"; + lxstat_name = "__lxstat"; + fxstat_name = "__fxstat"; + } let Stat = {}; libc.declareLazyFFI(Stat, "xstat", -- cgit v1.2.3 From 4105ebb6ed85aaffec5e4469a939945fb9eea066 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Tue, 1 Oct 2019 18:28:10 -0500 Subject: MoonchildProductions#1251 - Part 4: Core build system changes, lots of libevent/IPC junk. This is mostly ifdefs, but as you can see, Solaris is actually a lot like Linux. They're both more SysV than BSD at core, and most of the differences have more to do with Solaris not using glibc than anything else. I still need to audit a lot of these changes and understand why they're needed and what the alternative approaches are. After this patch, most of the core functionality needed to build Solaris is here. --- toolkit/components/terminator/nsTerminator.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'toolkit/components') diff --git a/toolkit/components/terminator/nsTerminator.cpp b/toolkit/components/terminator/nsTerminator.cpp index 91e872821..007885b8d 100644 --- a/toolkit/components/terminator/nsTerminator.cpp +++ b/toolkit/components/terminator/nsTerminator.cpp @@ -385,7 +385,11 @@ nsTerminator::StartWatchdog() } UniquePtr options(new Options()); +#if !defined(XP_SOLARIS) const PRIntervalTime ticksDuration = PR_MillisecondsToInterval(1000); +#else + const PRIntervalTime ticksDuration = 1000; +#endif options->crashAfterTicks = crashAfterMS / ticksDuration; DebugOnly watchdogThread = CreateSystemThread(RunWatchdog, -- cgit v1.2.3 From 687a798e6dedacb8b42826debcd8e89baa69ce94 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Sat, 19 Oct 2019 14:24:49 -0500 Subject: MoonchildProductions#1251 - Part 27: Fix ifdef style. This should do it for all the commits to files I changed, but while I'm in here I could probably go ahead and turn ALL the singular if defined statements into ifdef statements by using grep/find on the tree. On the other hand, perhaps we should do that as a separate issue so that this doesn't become a case of scope creep. --- toolkit/components/terminator/nsTerminator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'toolkit/components') diff --git a/toolkit/components/terminator/nsTerminator.cpp b/toolkit/components/terminator/nsTerminator.cpp index 007885b8d..9f6a90b57 100644 --- a/toolkit/components/terminator/nsTerminator.cpp +++ b/toolkit/components/terminator/nsTerminator.cpp @@ -30,7 +30,7 @@ #include "nsIObserverService.h" #include "nsIPrefService.h" -#if defined(XP_WIN) +#ifdef XP_WIN #include #else #include @@ -385,7 +385,7 @@ nsTerminator::StartWatchdog() } UniquePtr options(new Options()); -#if !defined(XP_SOLARIS) +#ifdef XP_SOLARIS const PRIntervalTime ticksDuration = PR_MillisecondsToInterval(1000); #else const PRIntervalTime ticksDuration = 1000; -- cgit v1.2.3 From 60c83971fb19dea49beab3a02c8913f75f62ad09 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Fri, 8 Nov 2019 10:49:03 +0100 Subject: Issue #1263 - Part 1: Remove DiskSpaceWatcher --- .../diskspacewatcher/DiskSpaceWatcher.cpp | 158 --------------------- .../components/diskspacewatcher/DiskSpaceWatcher.h | 32 ----- toolkit/components/diskspacewatcher/moz.build | 23 --- .../diskspacewatcher/nsIDiskSpaceWatcher.idl | 25 ---- toolkit/components/moz.build | 1 - 5 files changed, 239 deletions(-) delete mode 100644 toolkit/components/diskspacewatcher/DiskSpaceWatcher.cpp delete mode 100644 toolkit/components/diskspacewatcher/DiskSpaceWatcher.h delete mode 100644 toolkit/components/diskspacewatcher/moz.build delete mode 100644 toolkit/components/diskspacewatcher/nsIDiskSpaceWatcher.idl (limited to 'toolkit/components') diff --git a/toolkit/components/diskspacewatcher/DiskSpaceWatcher.cpp b/toolkit/components/diskspacewatcher/DiskSpaceWatcher.cpp deleted file mode 100644 index 7f3b8cd08..000000000 --- a/toolkit/components/diskspacewatcher/DiskSpaceWatcher.cpp +++ /dev/null @@ -1,158 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "DiskSpaceWatcher.h" -#include "nsIObserverService.h" -#include "nsXULAppAPI.h" -#include "mozilla/Hal.h" -#include "mozilla/ModuleUtils.h" -#include "mozilla/Preferences.h" -#include "mozilla/ClearOnShutdown.h" -#include "mozilla/Services.h" - -#define NS_DISKSPACEWATCHER_CID \ - { 0xab218518, 0xf197, 0x4fb4, { 0x8b, 0x0f, 0x8b, 0xb3, 0x4d, 0xf2, 0x4b, 0xf4 } } - -using namespace mozilla; - -StaticRefPtr gDiskSpaceWatcher; - -NS_IMPL_ISUPPORTS(DiskSpaceWatcher, nsIDiskSpaceWatcher, nsIObserver) - -uint64_t DiskSpaceWatcher::sFreeSpace = 0; -bool DiskSpaceWatcher::sIsDiskFull = false; - -DiskSpaceWatcher::DiskSpaceWatcher() -{ - MOZ_ASSERT(NS_IsMainThread()); - MOZ_ASSERT(!gDiskSpaceWatcher); -} - -DiskSpaceWatcher::~DiskSpaceWatcher() -{ - MOZ_ASSERT(!gDiskSpaceWatcher); -} - -already_AddRefed -DiskSpaceWatcher::FactoryCreate() -{ - if (!XRE_IsParentProcess()) { - return nullptr; - } - - MOZ_ASSERT(NS_IsMainThread()); - - if (!Preferences::GetBool("disk_space_watcher.enabled", false)) { - return nullptr; - } - - if (!gDiskSpaceWatcher) { - gDiskSpaceWatcher = new DiskSpaceWatcher(); - ClearOnShutdown(&gDiskSpaceWatcher); - } - - RefPtr service = gDiskSpaceWatcher.get(); - return service.forget(); -} - -NS_IMETHODIMP -DiskSpaceWatcher::Observe(nsISupports* aSubject, const char* aTopic, - const char16_t* aData) -{ - MOZ_ASSERT(NS_IsMainThread()); - - if (!strcmp(aTopic, "profile-after-change")) { - nsCOMPtr observerService = - mozilla::services::GetObserverService(); - observerService->AddObserver(this, "profile-before-change", false); - mozilla::hal::StartDiskSpaceWatcher(); - return NS_OK; - } - - if (!strcmp(aTopic, "profile-before-change")) { - nsCOMPtr observerService = - mozilla::services::GetObserverService(); - observerService->RemoveObserver(this, "profile-before-change"); - mozilla::hal::StopDiskSpaceWatcher(); - return NS_OK; - } - - MOZ_ASSERT(false, "DiskSpaceWatcher got unexpected topic!"); - return NS_ERROR_UNEXPECTED; -} - -NS_IMETHODIMP DiskSpaceWatcher::GetIsDiskFull(bool* aIsDiskFull) -{ - *aIsDiskFull = sIsDiskFull; - return NS_OK; -} - -// GetFreeSpace is a macro on windows, and that messes up with the c++ -// compiler. -#ifdef XP_WIN -#undef GetFreeSpace -#endif -NS_IMETHODIMP DiskSpaceWatcher::GetFreeSpace(uint64_t* aFreeSpace) -{ - *aFreeSpace = sFreeSpace; - return NS_OK; -} - -// static -void DiskSpaceWatcher::UpdateState(bool aIsDiskFull, uint64_t aFreeSpace) -{ - MOZ_ASSERT(NS_IsMainThread()); - if (!gDiskSpaceWatcher) { - return; - } - - nsCOMPtr observerService = - mozilla::services::GetObserverService(); - - sIsDiskFull = aIsDiskFull; - sFreeSpace = aFreeSpace; - - if (!observerService) { - return; - } - - const char16_t stateFull[] = { 'f', 'u', 'l', 'l', 0 }; - const char16_t stateFree[] = { 'f', 'r', 'e', 'e', 0 }; - - nsCOMPtr subject; - CallQueryInterface(gDiskSpaceWatcher.get(), getter_AddRefs(subject)); - MOZ_ASSERT(subject); - observerService->NotifyObservers(subject, - DISKSPACEWATCHER_OBSERVER_TOPIC, - sIsDiskFull ? stateFull : stateFree); - return; -} - -NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(DiskSpaceWatcher, - DiskSpaceWatcher::FactoryCreate) - -NS_DEFINE_NAMED_CID(NS_DISKSPACEWATCHER_CID); - -static const mozilla::Module::CIDEntry kDiskSpaceWatcherCIDs[] = { - { &kNS_DISKSPACEWATCHER_CID, false, nullptr, DiskSpaceWatcherConstructor }, - { nullptr } -}; - -static const mozilla::Module::ContractIDEntry kDiskSpaceWatcherContracts[] = { - { "@mozilla.org/toolkit/disk-space-watcher;1", &kNS_DISKSPACEWATCHER_CID }, - { nullptr } -}; - -static const mozilla::Module::CategoryEntry kDiskSpaceWatcherCategories[] = { - { nullptr } -}; - -static const mozilla::Module kDiskSpaceWatcherModule = { - mozilla::Module::kVersion, - kDiskSpaceWatcherCIDs, - kDiskSpaceWatcherContracts, - kDiskSpaceWatcherCategories -}; - -NSMODULE_DEFN(DiskSpaceWatcherModule) = &kDiskSpaceWatcherModule; diff --git a/toolkit/components/diskspacewatcher/DiskSpaceWatcher.h b/toolkit/components/diskspacewatcher/DiskSpaceWatcher.h deleted file mode 100644 index 6559af3cd..000000000 --- a/toolkit/components/diskspacewatcher/DiskSpaceWatcher.h +++ /dev/null @@ -1,32 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef __DISKSPACEWATCHER_H__ - -#include "nsIDiskSpaceWatcher.h" -#include "nsIObserver.h" -#include "nsCOMPtr.h" - -class DiskSpaceWatcher final : public nsIDiskSpaceWatcher, - public nsIObserver -{ -public: - NS_DECL_ISUPPORTS - NS_DECL_NSIDISKSPACEWATCHER - NS_DECL_NSIOBSERVER - - static already_AddRefed - FactoryCreate(); - - static void UpdateState(bool aIsDiskFull, uint64_t aFreeSpace); - -private: - DiskSpaceWatcher(); - ~DiskSpaceWatcher(); - - static uint64_t sFreeSpace; - static bool sIsDiskFull; -}; - -#endif // __DISKSPACEWATCHER_H__ diff --git a/toolkit/components/diskspacewatcher/moz.build b/toolkit/components/diskspacewatcher/moz.build deleted file mode 100644 index 168af46a6..000000000 --- a/toolkit/components/diskspacewatcher/moz.build +++ /dev/null @@ -1,23 +0,0 @@ -# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -XPIDL_SOURCES += [ - 'nsIDiskSpaceWatcher.idl', -] - -EXPORTS += [ - 'DiskSpaceWatcher.h' -] - -XPIDL_MODULE = 'diskspacewatcher' - -SOURCES = [ - 'DiskSpaceWatcher.cpp', -] - -include('/ipc/chromium/chromium-config.mozbuild') - -FINAL_LIBRARY = 'xul' diff --git a/toolkit/components/diskspacewatcher/nsIDiskSpaceWatcher.idl b/toolkit/components/diskspacewatcher/nsIDiskSpaceWatcher.idl deleted file mode 100644 index a9c60ca9f..000000000 --- a/toolkit/components/diskspacewatcher/nsIDiskSpaceWatcher.idl +++ /dev/null @@ -1,25 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsISupports.idl" - -%{ C++ -#ifdef XP_WIN -#undef GetFreeSpace -#endif -%} - -[scriptable, uuid(3aceba74-2ed5-4e99-8fe4-06e90e2b8ef0)] -interface nsIDiskSpaceWatcher : nsISupports -{ - readonly attribute bool isDiskFull; // True if we are low on disk space. - readonly attribute unsigned long long freeSpace; // The free space currently available. -}; - -%{ C++ -#define DISKSPACEWATCHER_CONTRACTID "@mozilla.org/toolkit/disk-space-watcher;1" - -// The data for this notification will be either 'free' or 'full'. -#define DISKSPACEWATCHER_OBSERVER_TOPIC "disk-space-watcher" -%} diff --git a/toolkit/components/moz.build b/toolkit/components/moz.build index 3f17bfb6d..d9dae12d1 100644 --- a/toolkit/components/moz.build +++ b/toolkit/components/moz.build @@ -24,7 +24,6 @@ DIRS += [ 'contextualidentity', 'cookie', 'crashmonitor', - 'diskspacewatcher', 'downloads', 'exthelper', 'filewatcher', -- cgit v1.2.3