Catch Objective-C exceptions in NPAPI_ShowCocoaContextMenu. b=561477 r=josh
authorBenoit Girard <b56girard@gmail.com>
Wed, 09 Jun 2010 00:11:54 -0400
changeset 43371 82169be6b34d087fef62f209887573e17b667935
parent 43370 df8b93c91fe57af3eaacc861d949da541231d0c7
child 43372 86cdcd6616de9dd4ea522a52b7bcb418bbc4803e
push idunknown
push userunknown
push dateunknown
reviewersjosh
bugs561477
milestone1.9.3a5pre
Catch Objective-C exceptions in NPAPI_ShowCocoaContextMenu. b=561477 r=josh
layout/generic/nsPluginUtilsOSX.mm
--- a/layout/generic/nsPluginUtilsOSX.mm
+++ b/layout/generic/nsPluginUtilsOSX.mm
@@ -94,16 +94,18 @@ PRBool NS_NPAPI_CocoaWindowIsMain(void* 
 
   return (PRBool)[window isMainWindow];
 
   NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(PR_TRUE);
 }
 
 NPError NS_NPAPI_ShowCocoaContextMenu(void* menu, nsIWidget* widget, NPCocoaEvent* event)
 {
+  NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
+
   if (!menu || !widget || !event)
     return NPERR_GENERIC_ERROR;
 
   NSMenu* cocoaMenu = (NSMenu*)menu;
   NSView* cocoaView = (NSView*)widget->GetNativeData(NS_NATIVE_WIDGET);
 
   NSEventType cocoaEventType = NSRightMouseDown;
   unsigned int cocoaModifierFlags = 0;
@@ -144,16 +146,18 @@ NPError NS_NPAPI_ShowCocoaContextMenu(vo
                                             context:nil
                                         eventNumber:0
                                          clickCount:1
                                            pressure:0.0];
 
   [NSMenu popUpContextMenu:cocoaMenu withEvent:cocoaEvent forView:cocoaView];
 
   return NPERR_NO_ERROR;
+
+  NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(NPERR_GENERIC_ERROR);
 }
 
 NPBool NS_NPAPI_ConvertPointCocoa(void* inView,
                                   double sourceX, double sourceY, NPCoordinateSpace sourceSpace,
                                   double *destX, double *destY, NPCoordinateSpace destSpace)
 {
   NS_ASSERTION(inView, "Must have a native view to convert coordinates.");