diff options
Diffstat (limited to 'toolkit/xre')
-rw-r--r-- | toolkit/xre/moz.build | 2 | ||||
-rw-r--r-- | toolkit/xre/nsAndroidStartup.cpp | 9 | ||||
-rw-r--r-- | toolkit/xre/nsAppRunner.cpp | 638 | ||||
-rw-r--r-- | toolkit/xre/nsEmbedFunctions.cpp | 103 | ||||
-rw-r--r-- | toolkit/xre/nsWindowsWMain.cpp | 4 | ||||
-rw-r--r-- | toolkit/xre/nsX11ErrorHandler.cpp | 12 | ||||
-rw-r--r-- | toolkit/xre/nsXREDirProvider.cpp | 10 | ||||
-rw-r--r-- | toolkit/xre/test/win/TestDllInterceptor.cpp | 5 |
8 files changed, 24 insertions, 759 deletions
diff --git a/toolkit/xre/moz.build b/toolkit/xre/moz.build index dd15dc0bd..7ada19d41 100644 --- a/toolkit/xre/moz.build +++ b/toolkit/xre/moz.build @@ -136,7 +136,7 @@ DEFINES['GRE_MILESTONE'] = CONFIG['GRE_MILESTONE'] for var in ('APP_VERSION', 'APP_ID'): DEFINES[var] = CONFIG['MOZ_%s' % var] -if CONFIG['MOZ_BUILD_APP'] == 'browser': +if CONFIG['MOZ_PHOENIX']: DEFINES['MOZ_BUILD_APP_IS_BROWSER'] = True LOCAL_INCLUDES += [ diff --git a/toolkit/xre/nsAndroidStartup.cpp b/toolkit/xre/nsAndroidStartup.cpp index a88c58e5d..47b9ec6e5 100644 --- a/toolkit/xre/nsAndroidStartup.cpp +++ b/toolkit/xre/nsAndroidStartup.cpp @@ -26,15 +26,6 @@ GeckoStart(JNIEnv* env, char* data, const nsXREAppData* appData) { mozilla::jni::SetGeckoThreadEnv(env); -#ifdef MOZ_CRASHREPORTER - const struct mapping_info *info = getLibraryMapping(); - while (info->name) { - CrashReporter::AddLibraryMapping(info->name, info->base, - info->len, info->offset); - info++; - } -#endif - if (!data) { LOG("Failed to get arguments for GeckoStart\n"); return; diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index 4979e1652..b65a4093f 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -98,7 +98,6 @@ #include <intrin.h> #include <math.h> #include "cairo/cairo-features.h" -#include "mozilla/WindowsVersion.h" #include "mozilla/mscom/MainThreadRuntime.h" #include "mozilla/widget/AudioSession.h" @@ -191,17 +190,6 @@ #include "jprof.h" #endif -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" -#include "nsICrashReporter.h" -#define NS_CRASHREPORTER_CONTRACTID "@mozilla.org/toolkit/crash-reporter;1" -#include "nsIPrefService.h" -#include "nsIMemoryInfoDumper.h" -#if defined(XP_LINUX) && !defined(ANDROID) -#include "mozilla/widget/LSBUtils.h" -#endif -#endif - #include "base/command_line.h" #include "GTestRunner.h" @@ -647,10 +635,6 @@ class nsXULAppInfo : public nsIXULAppInfo, #ifdef XP_WIN public nsIWinAppHelper, #endif -#ifdef MOZ_CRASHREPORTER - public nsICrashReporter, - public nsIFinishDumpingCallback, -#endif public nsIXULRuntime { @@ -661,10 +645,6 @@ public: NS_DECL_NSIXULAPPINFO NS_DECL_NSIXULRUNTIME NS_DECL_NSIOBSERVER -#ifdef MOZ_CRASHREPORTER - NS_DECL_NSICRASHREPORTER - NS_DECL_NSIFINISHDUMPINGCALLBACK -#endif #ifdef XP_WIN NS_DECL_NSIWINAPPHELPER #endif @@ -677,10 +657,6 @@ NS_INTERFACE_MAP_BEGIN(nsXULAppInfo) #ifdef XP_WIN NS_INTERFACE_MAP_ENTRY(nsIWinAppHelper) #endif -#ifdef MOZ_CRASHREPORTER - NS_INTERFACE_MAP_ENTRY(nsICrashReporter) - NS_INTERFACE_MAP_ENTRY(nsIFinishDumpingCallback) -#endif NS_INTERFACE_MAP_ENTRY(nsIPlatformInfo) NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIXULAppInfo, gAppData || XRE_IsContentProcess()) @@ -1005,12 +981,7 @@ nsXULAppInfo::GetReplacedLockTime(PRTime *aReplacedLockTime) NS_IMETHODIMP nsXULAppInfo::GetLastRunCrashID(nsAString &aLastRunCrashID) { -#ifdef MOZ_CRASHREPORTER - CrashReporter::GetLastRunCrashID(aLastRunCrashID); - return NS_OK; -#else return NS_ERROR_NOT_IMPLEMENTED; -#endif } NS_IMETHODIMP @@ -1118,219 +1089,6 @@ nsXULAppInfo::GetUserCanElevate(bool *aUserCanElevate) } #endif -#ifdef MOZ_CRASHREPORTER -NS_IMETHODIMP -nsXULAppInfo::GetEnabled(bool *aEnabled) -{ - *aEnabled = CrashReporter::GetEnabled(); - return NS_OK; -} - -NS_IMETHODIMP -nsXULAppInfo::SetEnabled(bool aEnabled) -{ - if (aEnabled) { - if (CrashReporter::GetEnabled()) { - // no point in erroring for double-enabling - return NS_OK; - } - - nsCOMPtr<nsIFile> greBinDir; - NS_GetSpecialDirectory(NS_GRE_BIN_DIR, getter_AddRefs(greBinDir)); - if (!greBinDir) { - return NS_ERROR_FAILURE; - } - - nsCOMPtr<nsIFile> xreBinDirectory = do_QueryInterface(greBinDir); - if (!xreBinDirectory) { - return NS_ERROR_FAILURE; - } - - return CrashReporter::SetExceptionHandler(xreBinDirectory, true); - } - else { - if (!CrashReporter::GetEnabled()) { - // no point in erroring for double-disabling - return NS_OK; - } - - return CrashReporter::UnsetExceptionHandler(); - } -} - -NS_IMETHODIMP -nsXULAppInfo::GetServerURL(nsIURL** aServerURL) -{ - if (!CrashReporter::GetEnabled()) - return NS_ERROR_NOT_INITIALIZED; - - nsAutoCString data; - if (!CrashReporter::GetServerURL(data)) { - return NS_ERROR_FAILURE; - } - nsCOMPtr<nsIURI> uri; - NS_NewURI(getter_AddRefs(uri), data); - if (!uri) - return NS_ERROR_FAILURE; - - nsCOMPtr<nsIURL> url; - url = do_QueryInterface(uri); - NS_ADDREF(*aServerURL = url); - - return NS_OK; -} - -NS_IMETHODIMP -nsXULAppInfo::SetServerURL(nsIURL* aServerURL) -{ - bool schemeOk; - // only allow https or http URLs - nsresult rv = aServerURL->SchemeIs("https", &schemeOk); - NS_ENSURE_SUCCESS(rv, rv); - if (!schemeOk) { - rv = aServerURL->SchemeIs("http", &schemeOk); - NS_ENSURE_SUCCESS(rv, rv); - - if (!schemeOk) - return NS_ERROR_INVALID_ARG; - } - nsAutoCString spec; - rv = aServerURL->GetSpec(spec); - NS_ENSURE_SUCCESS(rv, rv); - - return CrashReporter::SetServerURL(spec); -} - -NS_IMETHODIMP -nsXULAppInfo::GetMinidumpPath(nsIFile** aMinidumpPath) -{ - if (!CrashReporter::GetEnabled()) - return NS_ERROR_NOT_INITIALIZED; - - nsAutoString path; - if (!CrashReporter::GetMinidumpPath(path)) - return NS_ERROR_FAILURE; - - nsresult rv = NS_NewLocalFile(path, false, aMinidumpPath); - NS_ENSURE_SUCCESS(rv, rv); - return NS_OK; -} - -NS_IMETHODIMP -nsXULAppInfo::SetMinidumpPath(nsIFile* aMinidumpPath) -{ - nsAutoString path; - nsresult rv = aMinidumpPath->GetPath(path); - NS_ENSURE_SUCCESS(rv, rv); - return CrashReporter::SetMinidumpPath(path); -} - -NS_IMETHODIMP -nsXULAppInfo::AnnotateCrashReport(const nsACString& key, - const nsACString& data) -{ - return CrashReporter::AnnotateCrashReport(key, data); -} - -NS_IMETHODIMP -nsXULAppInfo::AppendAppNotesToCrashReport(const nsACString& data) -{ - return CrashReporter::AppendAppNotesToCrashReport(data); -} - -NS_IMETHODIMP -nsXULAppInfo::RegisterAppMemory(uint64_t pointer, - uint64_t len) -{ - return CrashReporter::RegisterAppMemory((void *)pointer, len); -} - -NS_IMETHODIMP -nsXULAppInfo::WriteMinidumpForException(void* aExceptionInfo) -{ -#ifdef XP_WIN32 - return CrashReporter::WriteMinidumpForException(static_cast<EXCEPTION_POINTERS*>(aExceptionInfo)); -#else - return NS_ERROR_NOT_IMPLEMENTED; -#endif -} - -NS_IMETHODIMP -nsXULAppInfo::AppendObjCExceptionInfoToAppNotes(void* aException) -{ -#ifdef XP_MACOSX - return CrashReporter::AppendObjCExceptionInfoToAppNotes(aException); -#else - return NS_ERROR_NOT_IMPLEMENTED; -#endif -} - -NS_IMETHODIMP -nsXULAppInfo::GetSubmitReports(bool* aEnabled) -{ - return CrashReporter::GetSubmitReports(aEnabled); -} - -NS_IMETHODIMP -nsXULAppInfo::SetSubmitReports(bool aEnabled) -{ - return CrashReporter::SetSubmitReports(aEnabled); -} - -NS_IMETHODIMP -nsXULAppInfo::UpdateCrashEventsDir() -{ - CrashReporter::UpdateCrashEventsDir(); - return NS_OK; -} - -NS_IMETHODIMP -nsXULAppInfo::SaveMemoryReport() -{ - if (!CrashReporter::GetEnabled()) { - return NS_ERROR_NOT_INITIALIZED; - } - nsCOMPtr<nsIFile> file; - nsresult rv = CrashReporter::GetDefaultMemoryReportFile(getter_AddRefs(file)); - if (NS_WARN_IF(NS_FAILED(rv))) { - return rv; - } - - nsString path; - file->GetPath(path); - - nsCOMPtr<nsIMemoryInfoDumper> dumper = - do_GetService("@mozilla.org/memory-info-dumper;1"); - if (NS_WARN_IF(!dumper)) { - return NS_ERROR_UNEXPECTED; - } - - rv = dumper->DumpMemoryReportsToNamedFile(path, this, file, true /* anonymize */); - if (NS_WARN_IF(NS_FAILED(rv))) { - return rv; - } - return NS_OK; -} - -NS_IMETHODIMP -nsXULAppInfo::SetTelemetrySessionId(const nsACString& id) -{ - CrashReporter::SetTelemetrySessionId(id); - return NS_OK; -} - -// This method is from nsIFInishDumpingCallback. -NS_IMETHODIMP -nsXULAppInfo::Callback(nsISupports* aData) -{ - nsCOMPtr<nsIFile> file = do_QueryInterface(aData); - MOZ_ASSERT(file); - - CrashReporter::SetMemoryReportFile(file); - return NS_OK; -} -#endif - static const nsXULAppInfo kAppInfo; static nsresult AppInfoConstructor(nsISupports* aOuter, REFNSIID aIID, void **aResult) @@ -1435,9 +1193,6 @@ static const mozilla::Module::CIDEntry kXRECIDs[] = { static const mozilla::Module::ContractIDEntry kXREContracts[] = { { XULAPPINFO_SERVICE_CONTRACTID, &kAPPINFO_CID }, { XULRUNTIME_SERVICE_CONTRACTID, &kAPPINFO_CID }, -#ifdef MOZ_CRASHREPORTER - { NS_CRASHREPORTER_CONTRACTID, &kAPPINFO_CID }, -#endif { NS_PROFILESERVICE_CONTRACTID, &kProfileServiceCID }, { NS_NATIVEAPPSUPPORT_CONTRACTID, &kNativeAppSupportCID }, { nullptr } @@ -1590,28 +1345,29 @@ DumpHelp() #ifdef MOZ_X11 printf("X11 options\n" - " --display=DISPLAY X display to use\n" - " --sync Make X calls synchronous\n"); + " --display=DISPLAY X display to use.\n" + " --sync Make X calls synchronous.\n"); #endif #ifdef XP_UNIX - printf(" --g-fatal-warnings Make all warnings fatal\n" + printf(" --g-fatal-warnings Make all warnings fatal.\n" "\n%s options\n", gAppData->name); #endif - printf(" -h or --help Print this message.\n" - " -v or --version Print %s version.\n" - " -P <profile> Start with <profile>.\n" - " --profile <path> Start with profile at <path>.\n" - " --migration Start with migration wizard.\n" - " --ProfileManager Start with ProfileManager.\n" - " --no-remote Do not accept or send remote commands; implies\n" - " --new-instance.\n" - " --new-instance Open new instance, not a new window in running instance.\n" - " --UILocale <locale> Start with <locale> resources as UI Locale.\n" - " --safe-mode Disables extensions and themes for this session.\n", gAppData->name); + printf(" -h or --help Print this message.\n" + " -v or --version Print %s version.\n" + " -P <profile> Start with <profile>.\n" + " --profile <path> Start with profile at <path>.\n" + " --migration Start with migration wizard.\n" + " --ProfileManager Start with ProfileManager.\n" + " --no-remote Do not accept or send remote commands;\n" + " implies --new-instance.\n" + " --new-instance Open new instance, not a new window\n" + " in running instance.\n" + " --UILocale <locale> Start with <locale> resources as UI Locale.\n" + " --safe-mode Disables extensions and themes for this session.\n", (const char*) gAppData->name); #if defined(XP_WIN) - printf(" --console Start %s with a debugging console.\n", gAppData->name); + printf(" --console Start %s with a debugging console.\n", (const char*) gAppData->name); #endif // this works, but only after the components have registered. so if you drop in a new command line handler, --help @@ -2763,33 +2519,6 @@ static void RestoreStateForAppInitiatedRestart() } } -#ifdef MOZ_CRASHREPORTER -// When we first initialize the crash reporter we don't have a profile, -// so we set the minidump path to $TEMP. Once we have a profile, -// we set it to $PROFILE/minidumps, creating the directory -// if needed. -static void MakeOrSetMinidumpPath(nsIFile* profD) -{ - nsCOMPtr<nsIFile> dumpD; - profD->Clone(getter_AddRefs(dumpD)); - - if (dumpD) { - bool fileExists; - //XXX: do some more error checking here - dumpD->Append(NS_LITERAL_STRING("minidumps")); - dumpD->Exists(&fileExists); - if (!fileExists) { - nsresult rv = dumpD->Create(nsIFile::DIRECTORY_TYPE, 0700); - NS_ENSURE_SUCCESS_VOID(rv); - } - - nsAutoString pathStr; - if (NS_SUCCEEDED(dumpD->GetPath(pathStr))) - CrashReporter::SetMinidumpPath(pathStr); - } -} -#endif - const nsXREAppData* gAppData = nullptr; #ifdef MOZ_WIDGET_GTK @@ -3106,10 +2835,7 @@ XREMain::XRE_mainInit(bool* aExitFlag) // manual font file I/O on _all_ system fonts. To avoid this, load the // dwrite library and create a factory as early as possible so that the // FntCache service is ready by the time it's needed. - - if (IsVistaOrLater()) { - CreateThread(nullptr, 0, &InitDwriteBG, nullptr, 0, nullptr); - } + CreateThread(nullptr, 0, &InitDwriteBG, nullptr, 0, nullptr); } #endif @@ -3218,94 +2944,6 @@ XREMain::XRE_mainInit(bool* aExitFlag) if (NS_FAILED(rv)) return 1; -#ifdef MOZ_CRASHREPORTER - if (EnvHasValue("MOZ_CRASHREPORTER")) { - mAppData->flags |= NS_XRE_ENABLE_CRASH_REPORTER; - } - - nsCOMPtr<nsIFile> xreBinDirectory; - xreBinDirectory = mDirProvider.GetGREBinDir(); - - if ((mAppData->flags & NS_XRE_ENABLE_CRASH_REPORTER) && - NS_SUCCEEDED( - CrashReporter::SetExceptionHandler(xreBinDirectory))) { - nsCOMPtr<nsIFile> file; - rv = mDirProvider.GetUserAppDataDirectory(getter_AddRefs(file)); - if (NS_SUCCEEDED(rv)) { - CrashReporter::SetUserAppDataDirectory(file); - } - if (mAppData->crashReporterURL) - CrashReporter::SetServerURL(nsDependentCString(mAppData->crashReporterURL)); - - // We overwrite this once we finish starting up. - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("StartupCrash"), - NS_LITERAL_CSTRING("1")); - - // pass some basic info from the app data - if (mAppData->vendor) - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Vendor"), - nsDependentCString(mAppData->vendor)); - if (mAppData->name) - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ProductName"), - nsDependentCString(mAppData->name)); - if (mAppData->ID) - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ProductID"), - nsDependentCString(mAppData->ID)); - if (mAppData->version) - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Version"), - nsDependentCString(mAppData->version)); - if (mAppData->buildID) - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("BuildID"), - nsDependentCString(mAppData->buildID)); - - nsDependentCString releaseChannel(NS_STRINGIFY(MOZ_UPDATE_CHANNEL)); - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ReleaseChannel"), - releaseChannel); -#ifdef MOZ_LINKER - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("CrashAddressLikelyWrong"), - IsSignalHandlingBroken() ? NS_LITERAL_CSTRING("1") - : NS_LITERAL_CSTRING("0")); -#endif - -#ifdef XP_WIN - nsAutoString appInitDLLs; - if (widget::WinUtils::GetAppInitDLLs(appInitDLLs)) { - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AppInitDLLs"), - NS_ConvertUTF16toUTF8(appInitDLLs)); - } -#endif - - CrashReporter::SetRestartArgs(gArgc, gArgv); - - // annotate other data (user id etc) - nsCOMPtr<nsIFile> userAppDataDir; - if (NS_SUCCEEDED(mDirProvider.GetUserAppDataDirectory( - getter_AddRefs(userAppDataDir)))) { - CrashReporter::SetupExtraData(userAppDataDir, - nsDependentCString(mAppData->buildID)); - - // see if we have a crashreporter-override.ini in the application directory - nsCOMPtr<nsIFile> overrideini; - bool exists; - if (NS_SUCCEEDED(mDirProvider.GetAppDir()->Clone(getter_AddRefs(overrideini))) && - NS_SUCCEEDED(overrideini->AppendNative(NS_LITERAL_CSTRING("crashreporter-override.ini"))) && - NS_SUCCEEDED(overrideini->Exists(&exists)) && - exists) { -#ifdef XP_WIN - nsAutoString overridePathW; - overrideini->GetPath(overridePathW); - NS_ConvertUTF16toUTF8 overridePath(overridePathW); -#else - nsAutoCString overridePath; - overrideini->GetNativePath(overridePath); -#endif - - SaveWordToEnv("MOZ_CRASHREPORTER_STRINGS_OVERRIDE", overridePath); - } - } - } -#endif - #if defined(MOZ_SANDBOX) && defined(XP_WIN) if (mAppData->sandboxBrokerServices) { SandboxBroker::Initialize(mAppData->sandboxBrokerServices); @@ -3451,22 +3089,9 @@ XREMain::XRE_mainInit(bool* aExitFlag) } } -#ifdef MOZ_CRASHREPORTER - if (cpuUpdateRevision > 0) { - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("CPUMicrocodeVersion"), - nsPrintfCString("0x%x", - cpuUpdateRevision)); - } -#endif } #endif -#ifdef MOZ_CRASHREPORTER - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("SafeMode"), - gSafeMode ? NS_LITERAL_CSTRING("1") : - NS_LITERAL_CSTRING("0")); -#endif - // Handle --no-remote and --new-instance command line arguments. Setup // the environment to better accommodate other components and various // restart scenarios. @@ -3526,102 +3151,6 @@ XREMain::XRE_mainInit(bool* aExitFlag) return 0; } -#ifdef MOZ_CRASHREPORTER -#ifdef XP_WIN -/** - * Uses WMI to read some manufacturer information that may be useful for - * diagnosing hardware-specific crashes. This function is best-effort; failures - * shouldn't burden the caller. COM must be initialized before calling. - */ -static void AnnotateSystemManufacturer() -{ - RefPtr<IWbemLocator> locator; - - HRESULT hr = CoCreateInstance(CLSID_WbemLocator, nullptr, CLSCTX_INPROC_SERVER, - IID_IWbemLocator, getter_AddRefs(locator)); - - if (FAILED(hr)) { - return; - } - - RefPtr<IWbemServices> services; - - hr = locator->ConnectServer(_bstr_t(L"ROOT\\CIMV2"), nullptr, nullptr, nullptr, - 0, nullptr, nullptr, getter_AddRefs(services)); - - if (FAILED(hr)) { - return; - } - - hr = CoSetProxyBlanket(services, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, nullptr, - RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, - nullptr, EOAC_NONE); - - if (FAILED(hr)) { - return; - } - - RefPtr<IEnumWbemClassObject> enumerator; - - hr = services->ExecQuery(_bstr_t(L"WQL"), _bstr_t(L"SELECT * FROM Win32_BIOS"), - WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, - nullptr, getter_AddRefs(enumerator)); - - if (FAILED(hr) || !enumerator) { - return; - } - - RefPtr<IWbemClassObject> classObject; - ULONG results; - - hr = enumerator->Next(WBEM_INFINITE, 1, getter_AddRefs(classObject), &results); - - if (FAILED(hr) || results == 0) { - return; - } - - VARIANT value; - VariantInit(&value); - - hr = classObject->Get(L"Manufacturer", 0, &value, 0, 0); - - if (SUCCEEDED(hr) && V_VT(&value) == VT_BSTR) { - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("BIOS_Manufacturer"), - NS_ConvertUTF16toUTF8(V_BSTR(&value))); - } - - VariantClear(&value); -} - -static void PR_CALLBACK AnnotateSystemManufacturer_ThreadStart(void*) -{ - HRESULT hr = CoInitialize(nullptr); - - if (FAILED(hr)) { - return; - } - - AnnotateSystemManufacturer(); - - CoUninitialize(); -} -#endif // XP_WIN - -#if defined(XP_LINUX) && !defined(ANDROID) - -static void -AnnotateLSBRelease(void*) -{ - nsCString dist, desc, release, codename; - if (widget::lsb::GetLSBRelease(dist, desc, release, codename)) { - CrashReporter::AppendAppNotesToCrashReport(desc); - } -} - -#endif // defined(XP_LINUX) && !defined(ANDROID) - -#endif - namespace mozilla { ShutdownChecksMode gShutdownChecks = SCM_NOTHING; } // namespace mozilla @@ -4010,13 +3539,6 @@ XREMain::XRE_mainStartup(bool* aExitFlag) mozilla::Telemetry::SetProfileDir(mProfD); -#ifdef MOZ_CRASHREPORTER - if (mAppData->flags & NS_XRE_ENABLE_CRASH_REPORTER) - MakeOrSetMinidumpPath(mProfD); - - CrashReporter::SetProfileDirectory(mProfD); -#endif - nsAutoCString version; BuildVersion(version); @@ -4106,39 +3628,6 @@ XREMain::XRE_mainStartup(bool* aExitFlag) return 0; } -#if defined(MOZ_CRASHREPORTER) -#if defined(MOZ_CONTENT_SANDBOX) && !defined(MOZ_WIDGET_GONK) -void AddSandboxAnnotations() -{ - // Include the sandbox content level, regardless of platform - int level = Preferences::GetInt("security.sandbox.content.level"); - - nsAutoCString levelString; - levelString.AppendInt(level); - - CrashReporter::AnnotateCrashReport( - NS_LITERAL_CSTRING("ContentSandboxLevel"), levelString); - - // Include whether or not this instance is capable of content sandboxing - bool sandboxCapable = false; - -#if defined(XP_WIN) - // All supported Windows versions support some level of content sandboxing - sandboxCapable = true; -#elif defined(XP_MACOSX) - // All supported OS X versions are capable - sandboxCapable = true; -#elif defined(XP_LINUX) - sandboxCapable = SandboxInfo::Get().CanSandboxContent(); -#endif - - CrashReporter::AnnotateCrashReport( - NS_LITERAL_CSTRING("ContentSandboxCapable"), - sandboxCapable ? NS_LITERAL_CSTRING("1") : NS_LITERAL_CSTRING("0")); -} -#endif /* MOZ_CONTENT_SANDBOX && !MOZ_WIDGET_GONK */ -#endif /* MOZ_CRASHREPORTER */ - /* * XRE_mainRun - Command line startup, profile migration, and * the calling of appStartup->Run(). @@ -4172,40 +3661,6 @@ XREMain::XRE_mainRun() rv = mScopedXPCOM->SetWindowCreator(mNativeApp); NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE); -#ifdef MOZ_CRASHREPORTER - // tell the crash reporter to also send the release channel - nsCOMPtr<nsIPrefService> prefs = do_GetService("@mozilla.org/preferences-service;1", &rv); - if (NS_SUCCEEDED(rv)) { - nsCOMPtr<nsIPrefBranch> defaultPrefBranch; - rv = prefs->GetDefaultBranch(nullptr, getter_AddRefs(defaultPrefBranch)); - - if (NS_SUCCEEDED(rv)) { - nsXPIDLCString sval; - rv = defaultPrefBranch->GetCharPref("app.update.channel", getter_Copies(sval)); - if (NS_SUCCEEDED(rv)) { - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ReleaseChannel"), - sval); - } - } - } - // Needs to be set after xpcom initialization. - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("FramePoisonBase"), - nsPrintfCString("%.16llx", uint64_t(gMozillaPoisonBase))); - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("FramePoisonSize"), - nsPrintfCString("%lu", uint32_t(gMozillaPoisonSize))); - -#ifdef XP_WIN - PR_CreateThread(PR_USER_THREAD, AnnotateSystemManufacturer_ThreadStart, 0, - PR_PRIORITY_LOW, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, 0); -#endif - -#if defined(XP_LINUX) && !defined(ANDROID) - PR_CreateThread(PR_USER_THREAD, AnnotateLSBRelease, 0, PR_PRIORITY_LOW, - PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, 0); -#endif - -#endif - if (mStartOffline) { nsCOMPtr<nsIIOService2> io (do_GetService("@mozilla.org/network/io-service;1")); NS_ENSURE_TRUE(io, NS_ERROR_FAILURE); @@ -4311,17 +3766,6 @@ XREMain::XRE_mainRun() OverrideDefaultLocaleIfNeeded(); -#ifdef MOZ_CRASHREPORTER - nsCString userAgentLocale; - // Try a localized string first. This pref is always a localized string in - // Fennec, and might be elsewhere, too. - if (NS_SUCCEEDED(Preferences::GetLocalizedCString("general.useragent.locale", &userAgentLocale))) { - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("useragent_locale"), userAgentLocale); - } else if (NS_SUCCEEDED(Preferences::GetCString("general.useragent.locale", &userAgentLocale))) { - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("useragent_locale"), userAgentLocale); - } -#endif - appStartup->GetShuttingDown(&mShuttingDown); nsCOMPtr<nsICommandLineRunner> cmdLine; @@ -4414,11 +3858,6 @@ XREMain::XRE_mainRun() (void)appStartup->DoneStartingUp(); -#ifdef MOZ_CRASHREPORTER - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("StartupCrash"), - NS_LITERAL_CSTRING("0")); -#endif - appStartup->GetShuttingDown(&mShuttingDown); } @@ -4469,21 +3908,8 @@ XREMain::XRE_mainRun() sandboxInfo.Test(SandboxInfo::kEnabledForContent)); Telemetry::Accumulate(Telemetry::SANDBOX_MEDIA_ENABLED, sandboxInfo.Test(SandboxInfo::kEnabledForMedia)); -#if defined(MOZ_CRASHREPORTER) - nsAutoCString flagsString; - flagsString.AppendInt(sandboxInfo.AsInteger()); - - CrashReporter::AnnotateCrashReport( - NS_LITERAL_CSTRING("ContentSandboxCapabilities"), flagsString); -#endif /* MOZ_CRASHREPORTER */ #endif /* MOZ_SANDBOX && XP_LINUX && !MOZ_WIDGET_GONK */ -#if defined(MOZ_CRASHREPORTER) -#if defined(MOZ_CONTENT_SANDBOX) && !defined(MOZ_WIDGET_GONK) - AddSandboxAnnotations(); -#endif /* MOZ_CONTENT_SANDBOX && !MOZ_WIDGET_GONK */ -#endif /* MOZ_CRASHREPORTER */ - { rv = appStartup->Run(); if (NS_FAILED(rv)) { @@ -4676,10 +4102,6 @@ XREMain::XRE_main(int argc, char* argv[], const nsXREAppData* aAppData) rv = LaunchChild(mNativeApp, true); } -#ifdef MOZ_CRASHREPORTER - if (mAppData->flags & NS_XRE_ENABLE_CRASH_REPORTER) - CrashReporter::UnsetExceptionHandler(); -#endif return rv == NS_ERROR_LAUNCHED_CHILD_PROCESS ? 0 : 1; } @@ -4689,11 +4111,6 @@ XREMain::XRE_main(int argc, char* argv[], const nsXREAppData* aAppData) MOZ_gdk_display_close(mGdkDisplay); #endif -#ifdef MOZ_CRASHREPORTER - if (mAppData->flags & NS_XRE_ENABLE_CRASH_REPORTER) - CrashReporter::UnsetExceptionHandler(); -#endif - XRE_DeinitCommandLine(); return NS_FAILED(rv) ? 1 : 0; @@ -4835,7 +4252,7 @@ enum { kE10sDisabledForAddons = 7, kE10sForceDisabled = 8, // kE10sDisabledForXPAcceleration = 9, removed in bug 1296353 - kE10sDisabledForOperatingSystem = 10, + // kE10sDisabledForOperatingSystem = 10, removed due to xp-eol }; const char* kAccessibilityLastRunDatePref = "accessibility.lastLoadDate"; @@ -4866,12 +4283,6 @@ MultiprocessBlockPolicy() { bool addonsCanDisable = Preferences::GetBool("extensions.e10sBlocksEnabling", false); bool disabledByAddons = Preferences::GetBool("extensions.e10sBlockedByAddons", false); -#ifdef MOZ_CRASHREPORTER - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AddonsShouldHaveBlockedE10s"), - disabledByAddons ? NS_LITERAL_CSTRING("1") - : NS_LITERAL_CSTRING("0")); -#endif - if (addonsCanDisable && disabledByAddons) { gMultiprocessBlockPolicy = kE10sDisabledForAddons; return gMultiprocessBlockPolicy; @@ -4912,19 +4323,6 @@ MultiprocessBlockPolicy() { } #endif - /** - * Avoids enabling e10s for Windows XP users on the release channel. - */ -#if defined(XP_WIN) - if (!IsVistaOrLater()) { - nsAdoptingCString channelName = Preferences::GetDefaultCString("app.update.channel"); - if (channelName.EqualsLiteral("release") || channelName.EqualsLiteral("esr")) { - gMultiprocessBlockPolicy = kE10sDisabledForOperatingSystem; - return gMultiprocessBlockPolicy; - } - } -#endif // XP_WIN - /* * None of the blocking policies matched, so e10s is allowed to run. * Cache the information and return 0, indicating success. diff --git a/toolkit/xre/nsEmbedFunctions.cpp b/toolkit/xre/nsEmbedFunctions.cpp index 0e85532b9..4a612e495 100644 --- a/toolkit/xre/nsEmbedFunctions.cpp +++ b/toolkit/xre/nsEmbedFunctions.cpp @@ -24,6 +24,7 @@ #ifdef XP_WIN #include <process.h> +#include <shobjidl.h> #include "mozilla/ipc/WindowsMessageLoop.h" #endif @@ -119,10 +120,6 @@ using mozilla::startup::sChildProcessType; static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID); -#ifdef XP_WIN -static const wchar_t kShellLibraryName[] = L"shell32.dll"; -#endif - nsresult XRE_LockProfileDirectory(nsIFile* aDirectory, nsISupports* *aLockObject) @@ -242,73 +239,16 @@ XRE_SetProcessType(const char* aProcessTypeString) } } -#if defined(MOZ_CRASHREPORTER) -// FIXME/bug 539522: this out-of-place function is stuck here because -// IPDL wants access to this crashreporter interface, and -// crashreporter is built in such a way to make that awkward -bool -XRE_TakeMinidumpForChild(uint32_t aChildPid, nsIFile** aDump, - uint32_t* aSequence) -{ - return CrashReporter::TakeMinidumpForChild(aChildPid, aDump, aSequence); -} - -bool -XRE_SetRemoteExceptionHandler(const char* aPipe/*= 0*/) -{ -#if defined(XP_WIN) || defined(XP_MACOSX) - return CrashReporter::SetRemoteExceptionHandler(nsDependentCString(aPipe)); -#elif defined(OS_LINUX) - return CrashReporter::SetRemoteExceptionHandler(); -#else -# error "OOP crash reporter unsupported on this platform" -#endif -} -#endif // if defined(MOZ_CRASHREPORTER) - #if defined(XP_WIN) void SetTaskbarGroupId(const nsString& aId) { - typedef HRESULT (WINAPI * SetCurrentProcessExplicitAppUserModelIDPtr)(PCWSTR AppID); - - SetCurrentProcessExplicitAppUserModelIDPtr funcAppUserModelID = nullptr; - - HMODULE hDLL = ::LoadLibraryW(kShellLibraryName); - - funcAppUserModelID = (SetCurrentProcessExplicitAppUserModelIDPtr) - GetProcAddress(hDLL, "SetCurrentProcessExplicitAppUserModelID"); - - if (!funcAppUserModelID) { - ::FreeLibrary(hDLL); - return; - } - - if (FAILED(funcAppUserModelID(aId.get()))) { + if (FAILED(SetCurrentProcessExplicitAppUserModelID(aId.get()))) { NS_WARNING("SetCurrentProcessExplicitAppUserModelID failed for child process."); } - - if (hDLL) - ::FreeLibrary(hDLL); } #endif -#if defined(MOZ_CRASHREPORTER) -#if defined(MOZ_CONTENT_SANDBOX) && !defined(MOZ_WIDGET_GONK) -void -AddContentSandboxLevelAnnotation() -{ - if (XRE_GetProcessType() == GeckoProcessType_Content) { - int level = Preferences::GetInt("security.sandbox.content.level"); - nsAutoCString levelString; - levelString.AppendInt(level); - CrashReporter::AnnotateCrashReport( - NS_LITERAL_CSTRING("ContentSandboxLevel"), levelString); - } -} -#endif /* MOZ_CONTENT_SANDBOX && !MOZ_WIDGET_GONK */ -#endif /* MOZ_CRASHREPORTER */ - nsresult XRE_InitChildProcess(int aArgc, char* aArgv[], @@ -462,33 +402,6 @@ XRE_InitChildProcess(int aArgc, SetupErrorHandling(aArgv[0]); -#if defined(MOZ_CRASHREPORTER) - if (aArgc < 1) - return NS_ERROR_FAILURE; - const char* const crashReporterArg = aArgv[--aArgc]; - -# if defined(XP_WIN) || defined(XP_MACOSX) - // on windows and mac, |crashReporterArg| is the named pipe on which the - // server is listening for requests, or "-" if crash reporting is - // disabled. - if (0 != strcmp("-", crashReporterArg) && - !XRE_SetRemoteExceptionHandler(crashReporterArg)) { - // Bug 684322 will add better visibility into this condition - NS_WARNING("Could not setup crash reporting\n"); - } -# elif defined(OS_LINUX) - // on POSIX, |crashReporterArg| is "true" if crash reporting is - // enabled, false otherwise - if (0 != strcmp("false", crashReporterArg) && - !XRE_SetRemoteExceptionHandler(nullptr)) { - // Bug 684322 will add better visibility into this condition - NS_WARNING("Could not setup crash reporting\n"); - } -# else -# error "OOP crash reporting unsupported on this platform" -# endif -#endif // if defined(MOZ_CRASHREPORTER) - gArgv = aArgv; gArgc = aArgc; @@ -667,12 +580,6 @@ XRE_InitChildProcess(int aArgc, return NS_ERROR_FAILURE; } -#ifdef MOZ_CRASHREPORTER -#if defined(XP_WIN) || defined(XP_MACOSX) - CrashReporter::InitChildProcessTmpDir(); -#endif -#endif - #if defined(XP_WIN) // Set child processes up such that they will get killed after the // chrome process is killed in cases where the user shuts the system @@ -688,12 +595,6 @@ XRE_InitChildProcess(int aArgc, OverrideDefaultLocaleIfNeeded(); -#if defined(MOZ_CRASHREPORTER) -#if defined(MOZ_CONTENT_SANDBOX) && !defined(MOZ_WIDGET_GONK) - AddContentSandboxLevelAnnotation(); -#endif -#endif - // Run the UI event loop on the main thread. uiMessageLoop.MessageLoop::Run(); diff --git a/toolkit/xre/nsWindowsWMain.cpp b/toolkit/xre/nsWindowsWMain.cpp index 788d25a90..e282374cc 100644 --- a/toolkit/xre/nsWindowsWMain.cpp +++ b/toolkit/xre/nsWindowsWMain.cpp @@ -18,10 +18,6 @@ #include "nsSetDllDirectory.h" #endif -#if defined(__GNUC__) -#define XRE_DONT_SUPPORT_XPSP2 -#endif - #ifdef __MINGW32__ /* MingW currently does not implement a wide version of the diff --git a/toolkit/xre/nsX11ErrorHandler.cpp b/toolkit/xre/nsX11ErrorHandler.cpp index 0db24e58b..0fb0d29c5 100644 --- a/toolkit/xre/nsX11ErrorHandler.cpp +++ b/toolkit/xre/nsX11ErrorHandler.cpp @@ -117,18 +117,6 @@ X11Error(Display *display, XErrorEvent *event) { } } -#ifdef MOZ_CRASHREPORTER - switch (XRE_GetProcessType()) { - case GeckoProcessType_Default: - case GeckoProcessType_Plugin: - case GeckoProcessType_Content: - CrashReporter::AppendAppNotesToCrashReport(notes); - break; - default: - ; // crash report notes not supported. - } -#endif - #ifdef DEBUG // The resource id is unlikely to be useful in a crash report without // context of other ids, but add it to the debug console output. diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp index 2fbd324b7..09168319f 100644 --- a/toolkit/xre/nsXREDirProvider.cpp +++ b/toolkit/xre/nsXREDirProvider.cpp @@ -48,7 +48,6 @@ #ifdef XP_WIN #include <windows.h> #include <shlobj.h> -#include "mozilla/WindowsVersion.h" #endif #ifdef XP_MACOSX #include "nsILocalFileMac.h" @@ -762,15 +761,12 @@ nsXREDirProvider::LoadContentProcessTempDir() static bool IsContentSandboxDisabled() { + bool isSandboxDisabled = false; if (!BrowserTabsRemoteAutostart()) { return false; } -#if defined(XP_WIN) - const bool isSandboxDisabled = !mozilla::IsVistaOrLater() || - (Preferences::GetInt("security.sandbox.content.level") < 1); -#elif defined(XP_MACOSX) - const bool isSandboxDisabled = - Preferences::GetInt("security.sandbox.content.level") < 1; +#if defined(XP_WIN) || defined(XP_MACOSX) + isSandboxDisabled = Preferences::GetInt("security.sandbox.content.level") < 1; #endif return isSandboxDisabled; } diff --git a/toolkit/xre/test/win/TestDllInterceptor.cpp b/toolkit/xre/test/win/TestDllInterceptor.cpp index dff71817f..57d68ea77 100644 --- a/toolkit/xre/test/win/TestDllInterceptor.cpp +++ b/toolkit/xre/test/win/TestDllInterceptor.cpp @@ -2,11 +2,6 @@ * 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/. */ -#if _WIN32_WINNT < 0x0600 -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0600 -#endif - #include <shlobj.h> #include <stdio.h> |