diff options
author | shess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-24 22:07:05 +0000 |
---|---|---|
committer | shess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-24 22:07:05 +0000 |
commit | 39e3b9538deaedaaa8104f1cc67bcddaacad8269 (patch) | |
tree | 1954c4dbd73ffdce24040d2dea10bbc3a6e59691 /printing | |
parent | 3aca95d4039b0f7d4ffb3a811a94622afa7f4114 (diff) | |
download | chromium_src-39e3b9538deaedaaa8104f1cc67bcddaacad8269.zip chromium_src-39e3b9538deaedaaa8104f1cc67bcddaacad8269.tar.gz chromium_src-39e3b9538deaedaaa8104f1cc67bcddaacad8269.tar.bz2 |
[Mac] Allow NSExceptions in certain cases.
Thirdy-party print drivers seem to be a source of NSExceptions which
Chromium will never be able to fix. ScopedNSExceptionEnabler causes
the code which makes throwing an NSException fatal to allow throws.
The flag will be reset in -reportException: in most cases.
For now, allow exceptions to be thrown for -selectPDE: (bug 80686) and
PrintingContextMac::AskUserForSettings() (bug 82589).
BUG=80686, 82589
TEST=Monitor crash server.
Review URL: http://codereview.chromium.org/7038010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86503 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing')
-rw-r--r-- | printing/printing_context_mac.mm | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/printing/printing_context_mac.mm b/printing/printing_context_mac.mm index a8e4fa0..599fa78 100644 --- a/printing/printing_context_mac.mm +++ b/printing/printing_context_mac.mm @@ -9,6 +9,8 @@ #include "base/logging.h" #include "base/mac/scoped_cftyperef.h" +#include "base/mac/scoped_nsautorelease_pool.h" +#include "base/mac/scoped_nsexception_enabler.h" #include "base/sys_string_conversions.h" #include "base/values.h" #include "printing/print_settings_initializer_mac.h" @@ -36,6 +38,15 @@ void PrintingContextMac::AskUserForSettings(gfx::NativeView parent_view, int max_pages, bool has_selection, PrintSettingsCallback* callback) { + // Third-party print drivers seem to be an area prone to raising exceptions. + // This will allow exceptions to be raised, but does not handle them. The + // NSPrintPanel appears to have appropriate NSException handlers. + base::mac::ScopedNSExceptionEnabler enabler; + + // Exceptions can also happen when the NSPrintPanel is being + // deallocated, so it must be autoreleased within this scope. + base::mac::ScopedNSAutoreleasePool pool; + DCHECK([NSThread isMainThread]); // We deliberately don't feed max_pages into the dialog, because setting |