diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-11-10 11:39:27 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-11-10 11:39:27 +0100 |
commit | 974a481d12bf430891725bd3662876358e57e11a (patch) | |
tree | cad011151456251fef2f1b8d02ef4b4e45fad61a /toolkit/xre | |
parent | 6bd66b1728eeddb058066edda740aaeb2ceaec23 (diff) | |
parent | 736d25cbec4541186ed46c935c117ce4d1c7f3bb (diff) | |
download | UXP-974a481d12bf430891725bd3662876358e57e11a.tar UXP-974a481d12bf430891725bd3662876358e57e11a.tar.gz UXP-974a481d12bf430891725bd3662876358e57e11a.tar.lz UXP-974a481d12bf430891725bd3662876358e57e11a.tar.xz UXP-974a481d12bf430891725bd3662876358e57e11a.zip |
Merge branch 'master' into js-modules
# Conflicts:
# modules/libpref/init/all.js
Diffstat (limited to 'toolkit/xre')
-rw-r--r-- | toolkit/xre/moz.build | 1 | ||||
-rw-r--r-- | toolkit/xre/nsAndroidStartup.cpp | 1 | ||||
-rw-r--r-- | toolkit/xre/nsAppRunner.cpp | 117 | ||||
-rw-r--r-- | toolkit/xre/nsEmbedFunctions.cpp | 1 | ||||
-rw-r--r-- | toolkit/xre/nsSigHandlers.cpp | 9 | ||||
-rw-r--r-- | toolkit/xre/nsUpdateDriver.cpp | 50 | ||||
-rw-r--r-- | toolkit/xre/nsX11ErrorHandler.cpp | 1 | ||||
-rw-r--r-- | toolkit/xre/nsXREDirProvider.cpp | 21 |
8 files changed, 42 insertions, 159 deletions
diff --git a/toolkit/xre/moz.build b/toolkit/xre/moz.build index 55b59ca83..072bd9ff9 100644 --- a/toolkit/xre/moz.build +++ b/toolkit/xre/moz.build @@ -145,7 +145,6 @@ LOCAL_INCLUDES += [ '/dom/base', '/dom/ipc', '/testing/gtest/mozilla', - '/toolkit/crashreporter', '/xpcom/build', ] diff --git a/toolkit/xre/nsAndroidStartup.cpp b/toolkit/xre/nsAndroidStartup.cpp index 47b9ec6e5..68ad75c01 100644 --- a/toolkit/xre/nsAndroidStartup.cpp +++ b/toolkit/xre/nsAndroidStartup.cpp @@ -17,7 +17,6 @@ #include "nsIFile.h" #include "nsAppRunner.h" #include "APKOpen.h" -#include "nsExceptionHandler.h" #define LOG(args...) __android_log_print(ANDROID_LOG_INFO, MOZ_APP_NAME, args) diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index 40f9ead79..035d35a9d 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -2173,9 +2173,9 @@ SelectProfile(nsIProfileLock* *aResult, nsIToolkitProfileService* aProfileSvc, n return ShowProfileManager(aProfileSvc, aNative); } -#ifndef MOZ_DEV_EDITION - // If the only existing profile is the dev-edition-profile and this is not - // Developer Edition, then no valid profiles were found. + // Dev edition leftovers: + // If the only existing profile is the dev-edition-profile, + // then no valid profiles were found. if (count == 1) { nsCOMPtr<nsIToolkitProfile> deProfile; // GetSelectedProfile will auto-select the only profile if there's just one @@ -2186,7 +2186,6 @@ SelectProfile(nsIProfileLock* *aResult, nsIToolkitProfileService* aProfileSvc, n count = 0; } } -#endif if (!count) { gDoMigration = true; @@ -2195,25 +2194,15 @@ SelectProfile(nsIProfileLock* *aResult, nsIToolkitProfileService* aProfileSvc, n // create a default profile nsCOMPtr<nsIToolkitProfile> profile; nsresult rv = aProfileSvc->CreateProfile(nullptr, // choose a default dir for us -#ifdef MOZ_DEV_EDITION - NS_LITERAL_CSTRING("dev-edition-default"), -#else NS_LITERAL_CSTRING("default"), -#endif getter_AddRefs(profile)); if (NS_SUCCEEDED(rv)) { -#ifndef MOZ_DEV_EDITION aProfileSvc->SetDefaultProfile(profile); -#endif aProfileSvc->Flush(); rv = profile->Lock(nullptr, aResult); if (NS_SUCCEEDED(rv)) { if (aProfileName) -#ifdef MOZ_DEV_EDITION - aProfileName->AssignLiteral("dev-edition-default"); -#else aProfileName->AssignLiteral("default"); -#endif return NS_OK; } } @@ -2462,7 +2451,7 @@ RemoveComponentRegistries(nsIFile* aProfileDir, nsIFile* aLocalProfileDir, if (!file) return false; -#if defined(XP_UNIX) || defined(XP_BEOS) +#if defined(XP_UNIX) #define PLATFORM_FASL_SUFFIX ".mfasl" #elif defined(XP_WIN) #define PLATFORM_FASL_SUFFIX ".mfl" @@ -4130,9 +4119,12 @@ XRE_InitCommandLine(int aArgc, char* aArgv[]) #endif const char *path = nullptr; - ArgResult ar = CheckArg("greomni", false, &path); + ArgResult ar = CheckArg("greomni", true, &path); if (ar == ARG_BAD) { - PR_fprintf(PR_STDERR, "Error: argument --greomni requires a path argument\n"); + PR_fprintf(PR_STDERR, + "Error: argument --greomni requires a path argument or the " + "--osint argument was specified with the --greomni argument " + "which is invalid.\n"); return NS_ERROR_FAILURE; } @@ -4146,9 +4138,12 @@ XRE_InitCommandLine(int aArgc, char* aArgv[]) return rv; } - ar = CheckArg("appomni", false, &path); + ar = CheckArg("appomni", true, &path); if (ar == ARG_BAD) { - PR_fprintf(PR_STDERR, "Error: argument --appomni requires a path argument\n"); + PR_fprintf(PR_STDERR, + "Error: argument --appomni requires a path argument or the " + "--osint argument was specified with the --appomni argument " + "which is invalid.\n"); return NS_ERROR_FAILURE; } @@ -4226,9 +4221,6 @@ PRTimeToSeconds(PRTime t_usec) } #endif -const char* kForceEnableE10sPref = "browser.tabs.remote.force-enable"; -const char* kForceDisableE10sPref = "browser.tabs.remote.force-disable"; - uint32_t MultiprocessBlockPolicy() { if (gMultiprocessBlockPolicyInitialized) { @@ -4236,50 +4228,6 @@ MultiprocessBlockPolicy() { } gMultiprocessBlockPolicyInitialized = true; - /** - * Avoids enabling e10s if there are add-ons installed. - */ - bool addonsCanDisable = Preferences::GetBool("extensions.e10sBlocksEnabling", false); - bool disabledByAddons = Preferences::GetBool("extensions.e10sBlockedByAddons", false); - - if (addonsCanDisable && disabledByAddons) { - gMultiprocessBlockPolicy = kE10sDisabledForAddons; - } - -#if defined(XP_WIN) - bool disabledForA11y = false; - /** - * Avoids enabling e10s if accessibility has recently loaded. Performs the - * following checks: - * 1) Checks a pref indicating if a11y loaded in the last session. This pref - * is set in nsBrowserGlue.js. If a11y was loaded in the last session we - * do not enable e10s in this session. - * 2) Accessibility stores a last run date (PR_IntervalNow) when it is - * initialized (see nsBaseWidget.cpp). We check if this pref exists and - * compare it to now. If a11y hasn't run in an extended period of time or - * if the date pref does not exist we load e10s. - */ - disabledForA11y = Preferences::GetBool(kAccessibilityLoadedLastSessionPref, false); - if (!disabledForA11y && - Preferences::HasUserValue(kAccessibilityLastRunDatePref)) { - #define ONE_WEEK_IN_SECONDS (60*60*24*7) - uint32_t a11yRunDate = Preferences::GetInt(kAccessibilityLastRunDatePref, 0); - MOZ_ASSERT(0 != a11yRunDate); - // If a11y hasn't run for a period of time, clear the pref and load e10s - uint32_t now = PRTimeToSeconds(PR_Now()); - uint32_t difference = now - a11yRunDate; - if (difference > ONE_WEEK_IN_SECONDS || !a11yRunDate) { - Preferences::ClearUser(kAccessibilityLastRunDatePref); - } else { - disabledForA11y = true; - } - } - - if (disabledForA11y) { - gMultiprocessBlockPolicy = kE10sDisabledForAccessibility; - } -#endif - // We do not support E10S, block by policy. gMultiprocessBlockPolicy = kE10sForceDisabled; @@ -4294,55 +4242,24 @@ mozilla::BrowserTabsRemoteAutostart() } gBrowserTabsRemoteAutostartInitialized = true; - // If we're in the content process, we are running E10S. - if (XRE_IsContentProcess()) { - gBrowserTabsRemoteAutostart = true; - return gBrowserTabsRemoteAutostart; - } - bool optInPref = Preferences::GetBool("browser.tabs.remote.autostart", false); bool trialPref = Preferences::GetBool("browser.tabs.remote.autostart.2", false); bool prefEnabled = optInPref || trialPref; int status; - if (optInPref) { - status = kE10sEnabledByUser; - } else if (trialPref) { - status = kE10sEnabledByDefault; - } else { - status = kE10sDisabledByUser; - } if (prefEnabled) { uint32_t blockPolicy = MultiprocessBlockPolicy(); if (blockPolicy != 0) { status = blockPolicy; } else { - gBrowserTabsRemoteAutostart = true; + MOZ_CRASH("e10s force enabled bypassing policy -- unsupported configuration"); } - } - - // Uber override pref for manual testing purposes - if (Preferences::GetBool(kForceEnableE10sPref, false)) { - gBrowserTabsRemoteAutostart = true; - prefEnabled = true; - status = kE10sEnabledByUser; - } - - // Uber override pref for emergency blocking - if (gBrowserTabsRemoteAutostart && - (Preferences::GetBool(kForceDisableE10sPref, false) || - EnvHasValue("MOZ_FORCE_DISABLE_E10S"))) { - gBrowserTabsRemoteAutostart = false; - status = kE10sForceDisabled; + } else { + status = kE10sDisabledByUser; } gBrowserTabsRemoteStatus = status; - mozilla::Telemetry::Accumulate(mozilla::Telemetry::E10S_STATUS, status); - if (prefEnabled) { - mozilla::Telemetry::Accumulate(mozilla::Telemetry::E10S_BLOCKED_FROM_RUNNING, - !gBrowserTabsRemoteAutostart); - } return gBrowserTabsRemoteAutostart; } diff --git a/toolkit/xre/nsEmbedFunctions.cpp b/toolkit/xre/nsEmbedFunctions.cpp index 3757dec2f..52b443770 100644 --- a/toolkit/xre/nsEmbedFunctions.cpp +++ b/toolkit/xre/nsEmbedFunctions.cpp @@ -32,7 +32,6 @@ #include "nsAppRunner.h" #include "nsAutoRef.h" #include "nsDirectoryServiceDefs.h" -#include "nsExceptionHandler.h" #include "nsString.h" #include "nsThreadUtils.h" #include "nsJSUtils.h" diff --git a/toolkit/xre/nsSigHandlers.cpp b/toolkit/xre/nsSigHandlers.cpp index 098d9ae7e..660af4522 100644 --- a/toolkit/xre/nsSigHandlers.cpp +++ b/toolkit/xre/nsSigHandlers.cpp @@ -32,7 +32,7 @@ #endif #endif -#if defined(SOLARIS) +#ifdef XP_SOLARIS #include <sys/resource.h> #include <ucontext.h> #endif @@ -198,7 +198,7 @@ static void fpehandler(int signum, siginfo_t *si, void *context) *mxcsr &= ~SSE_STATUS_FLAGS; /* clear all pending SSE exceptions */ #endif #endif -#ifdef SOLARIS +#ifdef XP_SOLARIS ucontext_t *uc = (ucontext_t *)context; #if defined(__i386) @@ -286,7 +286,7 @@ void InstallSignalHandlers(const char *aProgname) } #endif -#if defined(SOLARIS) +#ifdef XP_SOLARIS #define NOFILES 512 // Boost Solaris file descriptors @@ -308,7 +308,8 @@ void InstallSignalHandlers(const char *aProgname) #endif //DEBUG } } -#endif //SOLARIS +#endif //XP_SOLARIS + #if defined(MOZ_WIDGET_GTK) && (GLIB_MAJOR_VERSION > 2 || (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION >= 6)) const char *assertString = PR_GetEnv("XPCOM_DEBUG_BREAK"); diff --git a/toolkit/xre/nsUpdateDriver.cpp b/toolkit/xre/nsUpdateDriver.cpp index ab0bdf005..be11fb158 100644 --- a/toolkit/xre/nsUpdateDriver.cpp +++ b/toolkit/xre/nsUpdateDriver.cpp @@ -75,21 +75,26 @@ GetUpdateLog() #endif static nsresult -GetCurrentWorkingDir(char *buf, size_t size) +GetCurrentWorkingDir(nsACString& aOutPath) { // Cannot use NS_GetSpecialDirectory because XPCOM is not yet initialized. - // This code is duplicated from xpcom/io/SpecialSystemDirectory.cpp: - + + // Just in case junk has been passed in. + aOutPath.Truncate(); + #if defined(XP_WIN) wchar_t wpath[MAX_PATH]; - if (!_wgetcwd(wpath, size)) + if (!_wgetcwd(wpath, ArrayLength(wpath))) return NS_ERROR_FAILURE; - NS_ConvertUTF16toUTF8 path(wpath); - strncpy(buf, path.get(), size); + CopyUTF16toUTF8(nsDependentString(wpath), aOutPath); #else - if(!getcwd(buf, size)) + char path[MAXPATHLEN]; + if (!getcwd(path, ArrayLength(path))) { return NS_ERROR_FAILURE; + } + aOutPath = path; #endif + return NS_OK; } @@ -212,10 +217,8 @@ GetStatusFileContents(nsIFile *statusFile, char (&buf)[Size]) typedef enum { eNoUpdateAction, ePendingUpdate, - ePendingService, ePendingElevate, eAppliedUpdate, - eAppliedService, } UpdateStatus; /** @@ -233,22 +236,14 @@ GetUpdateStatus(nsIFile* dir, nsCOMPtr<nsIFile> &statusFile) char buf[32]; if (GetStatusFileContents(statusFile, buf)) { const char kPending[] = "pending"; - const char kPendingService[] = "pending-service"; const char kPendingElevate[] = "pending-elevate"; const char kApplied[] = "applied"; - const char kAppliedService[] = "applied-service"; if (!strncmp(buf, kPendingElevate, sizeof(kPendingElevate) - 1)) { return ePendingElevate; } - if (!strncmp(buf, kPendingService, sizeof(kPendingService) - 1)) { - return ePendingService; - } if (!strncmp(buf, kPending, sizeof(kPending) - 1)) { return ePendingUpdate; } - if (!strncmp(buf, kAppliedService, sizeof(kAppliedService) - 1)) { - return eAppliedService; - } if (!strncmp(buf, kApplied, sizeof(kApplied) - 1)) { return eAppliedUpdate; } @@ -545,8 +540,8 @@ SwitchToUpdatedApp(nsIFile *greDir, nsIFile *updateDir, return; // Get the current working directory. - char workingDirPath[MAXPATHLEN]; - rv = GetCurrentWorkingDir(workingDirPath, sizeof(workingDirPath)); + nsAutoCString workingDirPath; + rv = GetCurrentWorkingDir(workingDirPath); if (NS_FAILED(rv)) return; @@ -575,7 +570,7 @@ SwitchToUpdatedApp(nsIFile *greDir, nsIFile *updateDir, argv[3] = (char*) applyToDir.get(); argv[4] = (char*) pid.get(); if (appArgc) { - argv[5] = workingDirPath; + argv[5] = (char*) workingDirPath.get(); argv[6] = (char*) appFilePath.get(); for (int i = 1; i < appArgc; ++i) argv[6 + i] = appArgv[i]; @@ -753,16 +748,13 @@ ApplyUpdate(nsIFile *greDir, nsIFile *updateDir, nsIFile *statusFile, } // Get the current working directory. - char workingDirPath[MAXPATHLEN]; - rv = GetCurrentWorkingDir(workingDirPath, sizeof(workingDirPath)); + nsAutoCString workingDirPath; + rv = GetCurrentWorkingDir(workingDirPath); if (NS_FAILED(rv)) return; // We used to write out "Applying" to the update.status file here. // Instead we do this from within the updater application now. - // This is so that we don't overwrite the status of pending-service - // in the Windows case. This change was made for all platforms so - // that it stays consistent across all OS. // On platforms where we are not calling execv, we may need to make the // updater executable wait for the calling process to exit. Otherwise, the @@ -799,7 +791,7 @@ ApplyUpdate(nsIFile *greDir, nsIFile *updateDir, nsIFile *statusFile, argv[3] = (char*) applyToDir.get(); argv[4] = (char*) pid.get(); if (restart && appArgc) { - argv[5] = workingDirPath; + argv[5] = (char*) workingDirPath.get(); argv[6] = (char*) appFilePath.get(); for (int i = 1; i < appArgc; ++i) argv[6 + i] = appArgv[i]; @@ -969,17 +961,15 @@ ProcessUpdates(nsIFile *greDir, nsIFile *appDir, nsIFile *updRootDir, } break; } - // Intentional fallthrough to ePendingUpdate and ePendingService. + // Intentional fallthrough to ePendingUpdate. MOZ_FALLTHROUGH; } - case ePendingUpdate: - case ePendingService: { + case ePendingUpdate: { ApplyUpdate(greDir, updatesDir, statusFile, appDir, argc, argv, restart, isOSUpdate, osApplyToDir, pid); break; } case eAppliedUpdate: - case eAppliedService: // An update was staged and needs to be switched so the updated application // is used. SwitchToUpdatedApp(greDir, updatesDir, appDir, argc, argv); diff --git a/toolkit/xre/nsX11ErrorHandler.cpp b/toolkit/xre/nsX11ErrorHandler.cpp index 0fb0d29c5..9a6888adf 100644 --- a/toolkit/xre/nsX11ErrorHandler.cpp +++ b/toolkit/xre/nsX11ErrorHandler.cpp @@ -7,7 +7,6 @@ #include "prenv.h" #include "nsXULAppAPI.h" -#include "nsExceptionHandler.h" #include "nsDebug.h" #include "mozilla/X11Util.h" diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp index d904cb83a..265652477 100644 --- a/toolkit/xre/nsXREDirProvider.cpp +++ b/toolkit/xre/nsXREDirProvider.cpp @@ -953,27 +953,6 @@ nsXREDirProvider::DoStartup() else mode = 2; } - mozilla::Telemetry::Accumulate(mozilla::Telemetry::SAFE_MODE_USAGE, mode); - - // Telemetry about number of profiles. - nsCOMPtr<nsIToolkitProfileService> profileService = - do_GetService("@mozilla.org/toolkit/profile-service;1"); - if (profileService) { - nsCOMPtr<nsISimpleEnumerator> profiles; - rv = profileService->GetProfiles(getter_AddRefs(profiles)); - if (NS_WARN_IF(NS_FAILED(rv))) { - return rv; - } - - uint32_t count = 0; - nsCOMPtr<nsISupports> profile; - while (NS_SUCCEEDED(profiles->GetNext(getter_AddRefs(profile)))) { - ++count; - } - - mozilla::Telemetry::Accumulate(mozilla::Telemetry::NUMBER_OF_PROFILES, - count); - } obsSvc->NotifyObservers(nullptr, "profile-initial-state", nullptr); } |