Closed Bug 542379 Opened 14 years ago Closed 14 years ago

Add Mac OS X support for PrefSubmitReports in nsExceptionHandler.cpp

Categories

(Toolkit :: Crash Reporting, defect)

All
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: Dolske, Assigned: jaas)

References

Details

Attachments

(1 file, 1 obsolete file)

Over in bug 540532 I'm adding a checkbox in the prefs UI to expose if crash reports should be submitted or not. This is a little tricky to implement, because it's reusing the natively stored pref used by the existing crash reporter... A registry key on Windows, an INI file on Linux.

I don't know how to expose how the OS X crash reporter stores this pref. I see the code in crashreporter_osx.mm, but I'm mostly clueless about how to interface with ObjC from the browser side of things.

Josh, could you help out here? I suspect all that's needed is a tiny XPCOM component implemented in ObjC. If there's such an existing thing I could crib from, that would probably be enough to get me going.
We already have an ObjC++ file to use Cocoa APIs in nsExceptionHandler:
http://mxr.mozilla.org/mozilla-central/source/toolkit/crashreporter/mac_utils.mm

You can just stick some ObjC code in there inside a normal C function, and call it from nsExceptionHandler.
This bug's summary is written in such a way that is seems to be requesting a generic xpcom component for accessing NSUserDefaults, but the description suggests a more specific goal. I'm going to morph this bug for the more specific goal and take it, if the reporter disagrees we can file another generic xpcom component bug (though if we don't need one any more, we shouldn't).
Assignee: nobody → joshmoz
Hardware: x86 → All
Summary: Need an XPCOM way to access app's NSUserDefaults on OS X → Add Mac OS X support for PrefSubmitReports in nsExceptionHandler.cpp
Attached patch fix v1.0 (obsolete) — Splinter Review
Attachment #451618 - Flags: review?(ted.mielczarek)
I don't think this does the right thing. The point of this code is to read the same data as the crash reporter client, which for OS X is here:
http://mxr.mozilla.org/mozilla-central/source/toolkit/crashreporter/client/crashreporter_osx.mm#178

I think that sets it under org.mozilla.crashreporter, for one, and also the key name is different.
Attachment #451618 - Attachment is obsolete: true
Attachment #451618 - Flags: review?(ted.mielczarek)
Attached patch fix v2.0Splinter Review
Better fix, uses the more powerful CoreFoundation API which avoids Obj-C code and allows for easier access to prefs outside the current application domain. Also includes synchronization fixes.
Attachment #451694 - Flags: review?(ted.mielczarek)
Attachment #451694 - Flags: review?(ted.mielczarek) → review+
pushed to mozilla-central

http://hg.mozilla.org/mozilla-central/rev/0a95d72de4d4
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
bustage fix for non-IPC builds

http://hg.mozilla.org/mozilla-central/rev/658b1f7e53c0
You need to log in before you can comment on or make changes to this bug.