зеркало из https://github.com/mozilla/pjs.git
bug 382541 - Mozilla Crash Reporter supresses writing of Mac OS X crash log - short term workaround. r=mento
This commit is contained in:
Родитель
a096c5ab3e
Коммит
6373626b42
|
@ -61,6 +61,8 @@ ifeq ($(OS_ARCH),WINNT)
|
|||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),Darwin)
|
||||
CMMSRCS = mac_utils.mm
|
||||
|
||||
DIRS += \
|
||||
airbag/src/common \
|
||||
airbag/src/common/mac \
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Breakpad integration
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ted Mielczarek <ted.mielczarek@gmail.com>
|
||||
* Portions created by the Initial Developer are Copyright (C) 2007
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef toolkit_breakpad_mac_utils_h__
|
||||
#define toolkit_breakpad_mac_utils_h__
|
||||
|
||||
/*
|
||||
* Look up a setting in our user defaults indicating
|
||||
* that the user wants to see the OS crash reporting dialog.
|
||||
*/
|
||||
bool PassToOSCrashReporter();
|
||||
|
||||
#endif /* toolkit_breakpad_mac_utils_h__ */
|
|
@ -0,0 +1,50 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Breakpad integration
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ted Mielczarek <ted.mielczarek@gmail.com>
|
||||
* Portions created by the Initial Developer are Copyright (C) 2007
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include <Foundation/Foundation.h>
|
||||
|
||||
#include "mac_utils.h"
|
||||
|
||||
bool PassToOSCrashReporter()
|
||||
{
|
||||
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
|
||||
NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults];
|
||||
BOOL osCrashReporter = [userDefaults boolForKey:@"OSCrashReporter"];
|
||||
[pool release];
|
||||
|
||||
return osCrashReporter == YES;
|
||||
}
|
|
@ -49,6 +49,7 @@
|
|||
#include <string>
|
||||
#include <Carbon/Carbon.h>
|
||||
#include <fcntl.h>
|
||||
#include "mac_utils.h"
|
||||
#elif defined(XP_LINUX)
|
||||
#include "client/linux/handler/exception_handler.h"
|
||||
#include <fcntl.h>
|
||||
|
@ -104,6 +105,9 @@ static XP_CHAR* crashReporterPath;
|
|||
// if this is false, we don't launch the crash reporter
|
||||
static bool doReport = true;
|
||||
|
||||
// if this is true, we pass the exception on to the OS crash reporter
|
||||
static bool showOSCrashReporter = false;
|
||||
|
||||
// this holds additional data sent via the API
|
||||
static nsDataHashtable<nsCStringHashKey,nsCString>* crashReporterAPIData_Hash;
|
||||
static nsCString* crashReporterAPIData = nsnull;
|
||||
|
@ -131,7 +135,7 @@ bool MinidumpCallback(const XP_CHAR* dump_path,
|
|||
#endif
|
||||
bool succeeded)
|
||||
{
|
||||
printf("Wrote minidump ID %s\n", minidump_id);
|
||||
bool returnValue = showOSCrashReporter ? false : succeeded;
|
||||
|
||||
XP_CHAR minidumpPath[XP_PATH_MAX];
|
||||
int size = XP_PATH_MAX;
|
||||
|
@ -170,7 +174,7 @@ bool MinidumpCallback(const XP_CHAR* dump_path,
|
|||
}
|
||||
|
||||
if (!doReport) {
|
||||
return succeeded;
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
STARTUPINFO si;
|
||||
|
@ -204,7 +208,7 @@ bool MinidumpCallback(const XP_CHAR* dump_path,
|
|||
}
|
||||
|
||||
if (!doReport) {
|
||||
return succeeded;
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
pid_t pid = fork();
|
||||
|
@ -218,7 +222,7 @@ bool MinidumpCallback(const XP_CHAR* dump_path,
|
|||
}
|
||||
#endif
|
||||
|
||||
return succeeded;
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
nsresult SetExceptionHandler(nsILocalFile* aXREDirectory,
|
||||
|
@ -311,6 +315,13 @@ nsresult SetExceptionHandler(nsILocalFile* aXREDirectory,
|
|||
AnnotateCrashReport(NS_LITERAL_CSTRING("ServerURL"),
|
||||
nsDependentCString(aServerURL));
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
// On OS X, many testers like to see the OS crash reporting dialog
|
||||
// since it offers immediate stack traces. We allow them to set
|
||||
// a default to pass exceptions to the OS handler.
|
||||
showOSCrashReporter = PassToOSCrashReporter();
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче