Bug 1692391 - Replace NS_OBJC_BEGIN/END_TRY_ABORT_BLOCK_NIL with the functionally identical NS_OBJC_BEGIN/END_TRY_BLOCK_RETURN(nil). r=haik

This patch was generated automatically, using the following commands:

```
rg -l 'NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL' . | xargs sed -i '' -e 's/NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL/NS_OBJC_BEGIN_TRY_BLOCK_RETURN/g'
rg -l 'NS_OBJC_END_TRY_ABORT_BLOCK_NIL' . | xargs sed -i '' -e 's/NS_OBJC_END_TRY_ABORT_BLOCK_NIL/NS_OBJC_END_TRY_BLOCK_RETURN(nil)/g'
```

Differential Revision: https://phabricator.services.mozilla.com/D104959
This commit is contained in:
Markus Stange 2021-02-16 22:55:21 +00:00
Родитель c08d2df99d
Коммит 9bc888af4a
24 изменённых файлов: 153 добавлений и 161 удалений

Просмотреть файл

@ -65,7 +65,7 @@ AccessibleWrap::AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc)
AccessibleWrap::~AccessibleWrap() {}
mozAccessible* AccessibleWrap::GetNativeObject() {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
if (!mNativeInited && !mNativeObject) {
// We don't creat OSX accessibles for xul tooltips, defunct accessibles,
@ -83,7 +83,7 @@ mozAccessible* AccessibleWrap::GetNativeObject() {
return mNativeObject;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
void AccessibleWrap::GetNativeInterface(void** aOutInterface) {
@ -93,7 +93,7 @@ void AccessibleWrap::GetNativeInterface(void** aOutInterface) {
// overridden in subclasses to create the right kind of object. by default we
// create a generic 'mozAccessible' node.
Class AccessibleWrap::GetNativeType() {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
if (IsXULTabpanels()) {
return [mozPaneAccessible class];
@ -117,7 +117,7 @@ Class AccessibleWrap::GetNativeType() {
return GetTypeFromRole(Role());
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
// this method is very important. it is fired when an accessible object "dies".
@ -290,7 +290,7 @@ bool AccessibleWrap::ApplyPostFilter(const EWhichPostFilter& aSearchKey,
// AccessibleWrap protected
Class a11y::GetTypeFromRole(roles::Role aRole) {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
switch (aRole) {
case roles::COMBOBOX:
@ -398,5 +398,5 @@ Class a11y::GetTypeFromRole(roles::Role aRole) {
return nil;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}

Просмотреть файл

@ -82,7 +82,7 @@ mozilla::LogModule* GetMacAccessibilityLog() {
#pragma mark - mozAccessible/NSAccessibility
- (NSArray*)accessibilityAttributeNames {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
if ([self isExpired]) {
return nil;
@ -122,11 +122,11 @@ mozilla::LogModule* GetMacAccessibilityLog() {
return attributes;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (id)accessibilityAttributeValue:(NSString*)attribute {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
if ([self isExpired]) {
return nil;
}
@ -190,7 +190,7 @@ mozilla::LogModule* GetMacAccessibilityLog() {
return value;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (BOOL)accessibilityIsAttributeSettable:(NSString*)attribute {
@ -253,7 +253,7 @@ mozilla::LogModule* GetMacAccessibilityLog() {
}
- (NSArray*)accessibilityActionNames {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
if ([self isExpired]) {
return nil;
@ -271,7 +271,7 @@ mozilla::LogModule* GetMacAccessibilityLog() {
return actionNames;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (void)accessibilityPerformAction:(NSString*)action {
@ -295,15 +295,15 @@ mozilla::LogModule* GetMacAccessibilityLog() {
}
- (NSString*)accessibilityActionDescription:(NSString*)action {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
// by default we return whatever the MacOS API know about.
// if you have custom actions, override.
return NSAccessibilityActionDescription(action);
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (NSArray*)accessibilityParameterizedAttributeNames {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
if ([self isExpired]) {
return nil;
@ -327,12 +327,12 @@ mozilla::LogModule* GetMacAccessibilityLog() {
return attributeNames;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (id)accessibilityAttributeValue:(NSString*)attribute
forParameter:(id)parameter {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
if ([self isExpired]) {
return nil;
@ -369,19 +369,19 @@ mozilla::LogModule* GetMacAccessibilityLog() {
return value;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (id)accessibilityHitTest:(NSPoint)point {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
return [self moxHitTest:point];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (id)accessibilityFocusedUIElement {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
return [self moxFocusedUIElement];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (BOOL)isAccessibilityElement {

Просмотреть файл

@ -26,11 +26,11 @@ RootAccessibleWrap::RootAccessibleWrap(dom::Document* aDocument,
RootAccessibleWrap::~RootAccessibleWrap() {}
Class RootAccessibleWrap::GetNativeType() {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
return [mozRootAccessible class];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
void RootAccessibleWrap::GetNativeWidget(void** aOutView) {

Просмотреть файл

@ -47,7 +47,7 @@ using namespace mozilla::a11y;
@implementation mozAccessible
- (id)initWithAccessible:(AccessibleOrProxy)aAccOrProxy {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
MOZ_ASSERT(!aAccOrProxy.IsNull(), "Cannot init mozAccessible with null");
if ((self = [super init])) {
mGeckoAccessible = aAccOrProxy;
@ -56,7 +56,7 @@ using namespace mozilla::a11y;
return self;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (void)dealloc {
@ -100,12 +100,12 @@ using namespace mozilla::a11y;
}
- (id)childAt:(uint32_t)i {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
AccessibleOrProxy child = mGeckoAccessible.ChildAt(i);
return !child.IsNull() ? GetNativeFromGeckoAccessible(child) : nil;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
static const uint64_t kCachedStates =
@ -299,7 +299,7 @@ static const uint64_t kCacheInitialized = ((uint64_t)0x1) << 63;
}
- (id<mozAccessible>)moxParent {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
if ([self isExpired]) {
return nil;
}
@ -329,7 +329,7 @@ static const uint64_t kCacheInitialized = ((uint64_t)0x1) << 63;
return GetObjectOrRepresentedView(nativeParent);
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
// gets all our native children lazily, including those that are ignored.
@ -616,7 +616,7 @@ struct RoleDescrComparator {
}
- (NSString*)moxTitle {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
// In some special cases we provide the name in the label (AXDescription).
if ([self providesLabelNotTitle]) {
@ -632,11 +632,11 @@ struct RoleDescrComparator {
return nsCocoaUtils::ToNSString(title);
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (id)moxValue {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
nsAutoString value;
if (Accessible* acc = mGeckoAccessible.AsAccessible()) {
@ -647,11 +647,11 @@ struct RoleDescrComparator {
return nsCocoaUtils::ToNSString(value);
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (NSString*)moxHelp {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
// What needs to go here is actually the accDescription of an item.
// The MSAA acc_help method has nothing to do with this one.
@ -664,11 +664,11 @@ struct RoleDescrComparator {
return nsCocoaUtils::ToNSString(helpText);
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (NSWindow*)moxWindow {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
// Get a pointer to the native window (NSWindow) we reside in.
NSWindow* nativeWindow = nil;
@ -686,7 +686,7 @@ struct RoleDescrComparator {
MOZ_ASSERT(nativeWindow, "Couldn't get native window");
return nativeWindow;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (NSNumber*)moxEnabled {
@ -844,7 +844,7 @@ struct RoleDescrComparator {
#ifndef RELEASE_OR_BETA
- (NSString*)moxMozDebugDescription {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
NSMutableString* domInfo = [NSMutableString string];
if (NSString* tagName = utils::GetAccAttr(self, "tag")) {
@ -865,7 +865,7 @@ struct RoleDescrComparator {
NSStringFromClass([self class]), self,
[self moxRole], domInfo];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
#endif

Просмотреть файл

@ -106,11 +106,11 @@ enum CheckboxValue {
}
- (id)moxValue {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
return [NSNumber numberWithInt:[self isChecked]];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (void)stateChanged:(uint64_t)state isEnabled:(BOOL)enabled {

Просмотреть файл

@ -30,7 +30,7 @@ static id<mozAccessible, mozView> getNativeViewFromRootAccessible(
@implementation mozRootAccessible
- (id)initWithAccessible:(mozilla::a11y::AccessibleOrProxy)aAccOrProxy {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
MOZ_ASSERT(!aAccOrProxy.IsProxy(), "mozRootAccessible is never a proxy");
@ -38,7 +38,7 @@ static id<mozAccessible, mozView> getNativeViewFromRootAccessible(
return [super initWithAccessible:aAccOrProxy];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (NSNumber*)moxMain {
@ -51,13 +51,13 @@ static id<mozAccessible, mozView> getNativeViewFromRootAccessible(
// return the AXParent that our parallell NSView tells us about.
- (id)moxUnignoredParent {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
// If there is no represented view (eg. headless), this will return nil.
return [[self representedView]
accessibilityAttributeValue:NSAccessibilityParentAttribute];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (BOOL)hasRepresentedView {
@ -66,14 +66,14 @@ static id<mozAccessible, mozView> getNativeViewFromRootAccessible(
// this will return our parallell NSView. see mozDocAccessible.h
- (id)representedView {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
MOZ_ASSERT(mParallelView,
"root accessible does not have a native parallel view.");
return mParallelView;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (BOOL)isRoot {

Просмотреть файл

@ -233,7 +233,7 @@ void ProcessPendingGetURLAppleEvents() {
// Create the menu that shows up in the Dock.
- (NSMenu*)applicationDockMenu:(NSApplication*)sender {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
// Create the NSMenu that will contain the dock menu items.
NSMenu* menu = [[[NSMenu alloc] initWithTitle:@""] autorelease];
@ -276,7 +276,7 @@ void ProcessPendingGetURLAppleEvents() {
return menu;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (void)applicationWillFinishLaunching:(NSNotification*)notification {

Просмотреть файл

@ -177,12 +177,12 @@ OSXNotificationInfo::~OSXNotificationInfo() {
}
static id<FakeNSUserNotificationCenter> GetNotificationCenter() {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
Class c = NSClassFromString(@"NSUserNotificationCenter");
return [c performSelector:@selector(defaultUserNotificationCenter)];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
OSXNotificationCenter::OSXNotificationCenter() {

Просмотреть файл

@ -130,7 +130,7 @@ void ScreenHelperCocoa::RefreshScreens() {
}
NSScreen* ScreenHelperCocoa::CocoaScreenForScreen(nsIScreen* aScreen) {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
for (NSScreen* screen in [NSScreen screens]) {
NSDictionary* desc = [screen deviceDescription];
@ -149,7 +149,7 @@ NSScreen* ScreenHelperCocoa::CocoaScreenForScreen(nsIScreen* aScreen) {
}
return [NSScreen mainScreen];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
} // namespace widget

Просмотреть файл

@ -3411,7 +3411,7 @@ uint32_t IMEInputHandler::GetRangeCount(NSAttributedString* aAttrString) {
already_AddRefed<mozilla::TextRangeArray> IMEInputHandler::CreateTextRangeArray(
NSAttributedString* aAttrString, NSRange& aSelectedRange) {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
RefPtr<mozilla::TextRangeArray> textRangeArray = new mozilla::TextRangeArray();
@ -3953,7 +3953,7 @@ void IMEInputHandler::SetMarkedText(NSAttributedString* aAttrString, NSRange& aS
NSAttributedString* IMEInputHandler::GetAttributedSubstringFromRange(NSRange& aRange,
NSRange* aActualRange) {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
MOZ_LOG(gLog, LogLevel::Info,
("%p IMEInputHandler::GetAttributedSubstringFromRange, "
@ -4040,7 +4040,7 @@ NSAttributedString* IMEInputHandler::GetAttributedSubstringFromRange(NSRange& aR
}
return result;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
bool IMEInputHandler::HasMarkedText() {
@ -4277,7 +4277,7 @@ extern NSString* NSTextInputReplacementRangeAttributeName;
}
NSArray* IMEInputHandler::GetValidAttributesForMarkedText() {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::GetValidAttributesForMarkedText", this));
@ -4290,7 +4290,7 @@ NSArray* IMEInputHandler::GetValidAttributesForMarkedText() {
NSMarkedClauseSegmentAttributeName,
NSTextInputReplacementRangeAttributeName, nil];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
#pragma mark -

Просмотреть файл

@ -826,7 +826,7 @@ nsAppShell::AfterProcessNextEvent(nsIThreadInternal* aThread, bool aEventWasProc
//
// Constructs the AppShellDelegate object
- (id)initWithAppShell:(nsAppShell*)aAppShell {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
if ((self = [self init])) {
mAppShell = aAppShell;
@ -848,7 +848,7 @@ nsAppShell::AfterProcessNextEvent(nsIThreadInternal* aThread, bool aEventWasProc
return self;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (void)dealloc {

Просмотреть файл

@ -2175,7 +2175,7 @@ NSEvent* gLastDragMouseDownEvent = nil; // [strong]
// initWithFrame:geckoChild:
- (id)initWithFrame:(NSRect)inFrame geckoChild:(nsChildView*)inChild {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
if ((self = [super initWithFrame:inFrame])) {
mGeckoChild = inChild;
@ -2269,7 +2269,7 @@ NSEvent* gLastDragMouseDownEvent = nil; // [strong]
return self;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (NSTextInputContext*)inputContext {
@ -2361,12 +2361,12 @@ NSEvent* gLastDragMouseDownEvent = nil; // [strong]
}
- (NSString*)description {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
return [NSString stringWithFormat:@"ChildView %p, gecko child %p, frame %@", self, mGeckoChild,
NSStringFromRect([self frame])];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
// Make the origin of this view the topLeft corner (gecko origin) rather
@ -3373,7 +3373,7 @@ static gfx::IntPoint GetIntegerDeltaForEvent(NSEvent* aEvent) {
}
- (NSMenu*)menuForEvent:(NSEvent*)theEvent {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
if (!mGeckoChild) return nil;
@ -3410,7 +3410,7 @@ static gfx::IntPoint GetIntegerDeltaForEvent(NSEvent* aEvent) {
// responded to the eContextMenu event by putting up a fake context menu.
return nil;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (void)convertCocoaMouseWheelEvent:(NSEvent*)aMouseEvent
@ -3544,12 +3544,12 @@ static gfx::IntPoint GetIntegerDeltaForEvent(NSEvent* aEvent) {
}
- (NSArray*)validAttributesForMarkedText {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
NS_ENSURE_TRUE(mTextInputHandler, [NSArray array]);
return mTextInputHandler->GetValidAttributesForMarkedText();
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (void)insertText:(id)aString replacementRange:(NSRange)replacementRange {
@ -4531,7 +4531,7 @@ static gfx::IntPoint GetIntegerDeltaForEvent(NSEvent* aEvent) {
// and HTML to system services.
- (id)validRequestorForSendType:(NSString*)sendType returnType:(NSString*)returnType {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
// sendType contains the type of data that the service would like this
// application to send to it. sendType is nil if the service is not
@ -4582,7 +4582,7 @@ static gfx::IntPoint GetIntegerDeltaForEvent(NSEvent* aEvent) {
return result;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (BOOL)writeSelectionToPasteboard:(NSPasteboard*)pboard types:(NSArray*)types {
@ -4813,7 +4813,7 @@ nsresult nsChildView::GetSelectionAsPlaintext(nsAString& aResult) {
}
- (id)accessibilityAttributeValue:(NSString*)attribute {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
if (!mozilla::a11y::ShouldA11yBeEnabled()) return [super accessibilityAttributeValue:attribute];
@ -4829,7 +4829,7 @@ nsresult nsChildView::GetSelectionAsPlaintext(nsAString& aResult) {
return [accessible accessibilityAttributeValue:attribute];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
#endif /* ACCESSIBILITY */

Просмотреть файл

@ -437,7 +437,7 @@ nsClipboard::SupportsFindClipboard(bool* _retval) {
// and puts it into a dictionary which it returns.
// static
NSDictionary* nsClipboard::PasteboardDictFromTransferable(nsITransferable* aTransferable) {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
if (!aTransferable) {
return nil;
@ -637,7 +637,7 @@ NSDictionary* nsClipboard::PasteboardDictFromTransferable(nsITransferable* aTran
return pasteboardOutputDict;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
// aPasteboardType is being retained and needs to be released by the caller.

Просмотреть файл

@ -616,7 +616,7 @@ void nsCocoaUtils::NSRectToGeckoRect(const NSRect& aCocoaRect, nsIntRect& aOutGe
// static
NSEvent* nsCocoaUtils::MakeNewCocoaEventWithType(NSEventType aEventType, NSEvent* aEvent) {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
NSEvent* newEvent = [NSEvent keyEventWithType:aEventType
location:[aEvent locationInWindow]
@ -630,14 +630,14 @@ NSEvent* nsCocoaUtils::MakeNewCocoaEventWithType(NSEventType aEventType, NSEvent
keyCode:[aEvent keyCode]];
return newEvent;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
// static
NSEvent* nsCocoaUtils::MakeNewCococaEventFromWidgetEvent(const WidgetKeyboardEvent& aKeyEvent,
NSInteger aWindowNumber,
NSGraphicsContext* aContext) {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
NSEventType eventType;
if (aKeyEvent.mMessage == eKeyUp) {
@ -683,7 +683,7 @@ NSEvent* nsCocoaUtils::MakeNewCococaEventFromWidgetEvent(const WidgetKeyboardEve
isARepeat:NO
keyCode:0]; // Native key code not currently needed
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
// static
@ -1043,7 +1043,7 @@ uint32_t nsCocoaUtils::ConvertGeckoKeyCodeToMacCharCode(uint32_t aKeyCode) {
NSMutableAttributedString* nsCocoaUtils::GetNSMutableAttributedString(
const nsAString& aText, const nsTArray<mozilla::FontRange>& aFontRanges, const bool aIsVertical,
const CGFloat aBackingScaleFactor) {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL
NS_OBJC_BEGIN_TRY_BLOCK_RETURN
NSString* nsstr = nsCocoaUtils::ToNSString(aText);
NSMutableAttributedString* attrStr =
@ -1073,7 +1073,7 @@ NSMutableAttributedString* nsCocoaUtils::GetNSMutableAttributedString(
return attrStr;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL
NS_OBJC_END_TRY_BLOCK_RETURN(nil)
}
TimeStamp nsCocoaUtils::GetEventTimeStamp(NSTimeInterval aEventTime) {

Просмотреть файл

@ -2672,7 +2672,7 @@ already_AddRefed<nsIWidget> nsIWidget::CreateChildWindow() {
}
- (id)initWithGeckoWindow:(nsCocoaWindow*)geckoWind {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
[super init];
mGeckoWindow = geckoWind;
@ -2680,7 +2680,7 @@ already_AddRefed<nsIWidget> nsIWidget::CreateChildWindow() {
mHasEverBeenZoomed = false;
return self;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (NSSize)windowWillResize:(NSWindow*)sender toSize:(NSSize)proposedFrameSize {
@ -3435,7 +3435,7 @@ static const NSString* kStateWantsTitleDrawn = @"wantsTitleDrawn";
}
- (id)accessibilityAttributeValue:(NSString*)attribute {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
id retval = [super accessibilityAttributeValue:attribute];
@ -3480,7 +3480,7 @@ static const NSString* kStateWantsTitleDrawn = @"wantsTitleDrawn";
return retval;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (void)releaseJSObjects {
@ -3563,7 +3563,7 @@ static const NSString* kStateWantsTitleDrawn = @"wantsTitleDrawn";
styleMask:(NSUInteger)aStyle
backing:(NSBackingStoreType)aBufferingType
defer:(BOOL)aFlag {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
// We treat aChildViewRect as the rectangle that the window's main ChildView
// should be sized to. Get the right frameRect for the requested child view
@ -3602,7 +3602,7 @@ static const NSString* kStateWantsTitleDrawn = @"wantsTitleDrawn";
}
return self;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (void)dealloc {
@ -3875,7 +3875,7 @@ static const NSString* kStateWantsTitleDrawn = @"wantsTitleDrawn";
styleMask:(NSUInteger)styleMask
backing:(NSBackingStoreType)bufferingType
defer:(BOOL)deferCreation {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
mIsContextMenu = false;
return [super initWithContentRect:contentRect
@ -3883,7 +3883,7 @@ static const NSString* kStateWantsTitleDrawn = @"wantsTitleDrawn";
backing:bufferingType
defer:deferCreation];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
// Override the private API _backdropBleedAmount. This determines how much the

Просмотреть файл

@ -49,14 +49,14 @@ static const nsCursor sCustomCursor = eCursorCount;
@implementation nsCursorManager
+ (nsCursorManager*)sharedInstance {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
if (!gInstance) {
gInstance = [[nsCursorManager alloc] init];
}
return gInstance;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
+ (void)dispose {
@ -69,7 +69,7 @@ static const nsCursor sCustomCursor = eCursorCount;
}
+ (nsMacCursor*)createCursor:(enum nsCursor)aCursor {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
switch (aCursor) {
SEL cursorSelector;
@ -183,18 +183,18 @@ static const nsCursor sCustomCursor = eCursorCount;
return [nsMacCursor cursorWithCursor:[NSCursor arrowCursor] type:aCursor];
}
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (id)init {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
if ((self = [super init])) {
mCursors = [[NSMutableDictionary alloc] initWithCapacity:25];
}
return self;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (nsresult)setCursor:(enum nsCursor)aCursor {
@ -291,7 +291,7 @@ static const nsCursor sCustomCursor = eCursorCount;
}
- (nsMacCursor*)getCursor:(enum nsCursor)aCursor {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
nsMacCursor* result = [mCursors objectForKey:[NSNumber numberWithInt:aCursor]];
if (!result) {
@ -300,7 +300,7 @@ static const nsCursor sCustomCursor = eCursorCount;
}
return result;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (void)dealloc {

Просмотреть файл

@ -58,7 +58,7 @@ nsDragService::~nsDragService() {}
NSImage* nsDragService::ConstructDragImage(nsINode* aDOMNode, const Maybe<CSSIntRegion>& aRegion,
NSPoint* aDragPoint) {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
CGFloat scaleFactor = nsCocoaUtils::GetBackingScaleFactor(mNativeDragView);
@ -89,12 +89,12 @@ NSImage* nsDragService::ConstructDragImage(nsINode* aDOMNode, const Maybe<CSSInt
return image;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
NSImage* nsDragService::ConstructDragImage(nsINode* aDOMNode, const Maybe<CSSIntRegion>& aRegion,
CSSIntPoint aPoint, LayoutDeviceIntRect* aDragRect) {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
CGFloat scaleFactor = nsCocoaUtils::GetBackingScaleFactor(mNativeDragView);
@ -172,7 +172,7 @@ NSImage* nsDragService::ConstructDragImage(nsINode* aDOMNode, const Maybe<CSSInt
return [image autorelease];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
bool nsDragService::IsValidType(NSString* availableType, bool allowFileURL) {
@ -195,7 +195,7 @@ bool nsDragService::IsValidType(NSString* availableType, bool allowFileURL) {
NSString* nsDragService::GetStringForType(NSPasteboardItem* item, const NSString* type,
bool allowFileURL) {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
NSString* availableType = [item availableTypeFromArray:[NSArray arrayWithObjects:(id)type, nil]];
if (availableType && IsValidType(availableType, allowFileURL)) {
@ -204,11 +204,11 @@ NSString* nsDragService::GetStringForType(NSPasteboardItem* item, const NSString
return nil;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
NSString* nsDragService::GetTitleForURL(NSPasteboardItem* item) {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
NSString* name =
GetStringForType(item, [UTIHelper stringFromPboardType:kPublicUrlNamePboardType]);
@ -223,11 +223,11 @@ NSString* nsDragService::GetTitleForURL(NSPasteboardItem* item) {
return nil;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
NSString* nsDragService::GetFilePath(NSPasteboardItem* item) {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
NSString* urlString =
GetStringForType(item, [UTIHelper stringFromPboardType:(NSString*)kUTTypeFileURL], true);
@ -240,7 +240,7 @@ NSString* nsDragService::GetFilePath(NSPasteboardItem* item) {
return nil;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
nsresult nsDragService::InvokeDragSessionImpl(nsIArray* aTransferableArray,

Просмотреть файл

@ -93,7 +93,7 @@ nsFilePicker::~nsFilePicker() {}
void nsFilePicker::InitNative(nsIWidget* aParent, const nsAString& aTitle) { mTitle = aTitle; }
NSView* nsFilePicker::GetAccessoryView() {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
NSView* accessoryView = [[[NSView alloc] initWithFrame:NSMakeRect(0, 0, 0, 0)] autorelease];
@ -177,7 +177,7 @@ NSView* nsFilePicker::GetAccessoryView() {
[accessoryView addSubview:popupButton];
return accessoryView;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
// Display the file dialog
@ -497,7 +497,7 @@ int16_t nsFilePicker::PutLocalFile(nsIFile** outFile) {
}
NSArray* nsFilePicker::GetFilterList() {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
if (!mFilters.Length()) {
return nil;
@ -533,7 +533,7 @@ NSArray* nsFilePicker::GetFilterList() {
return
[[[NSArray alloc] initWithArray:[filterString componentsSeparatedByString:@";"]] autorelease];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
// Sets the dialog title to whatever it should be. If it fails, eh,
@ -555,7 +555,7 @@ void nsFilePicker::SetDialogTitle(const nsString& inTitle, id aPanel) {
// Converts path from an nsIFile into a NSString path
// If it fails, returns an empty string.
NSString* nsFilePicker::PanelDefaultDirectory() {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
NSString* directory = nil;
if (mDisplayDirectory) {
@ -567,7 +567,7 @@ NSString* nsFilePicker::PanelDefaultDirectory() {
}
return directory;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
NS_IMETHODIMP nsFilePicker::GetFile(nsIFile** aFile) {

Просмотреть файл

@ -124,34 +124,34 @@
@implementation nsMacCursor
+ (nsMacCursor*)cursorWithCursor:(NSCursor*)aCursor type:(nsCursor)aType {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
return [[[nsCocoaCursor alloc] initWithCursor:aCursor type:aType] autorelease];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
+ (nsMacCursor*)cursorWithImageNamed:(NSString*)aCursorImage
hotSpot:(NSPoint)aPoint
type:(nsCursor)aType {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
return [[[nsCocoaCursor alloc] initWithImageNamed:aCursorImage hotSpot:aPoint
type:aType] autorelease];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
+ (nsMacCursor*)cursorWithFrames:(NSArray*)aCursorFrames type:(nsCursor)aType {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
return [[[nsCocoaCursor alloc] initWithFrames:aCursorFrames type:aType] autorelease];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
+ (NSCursor*)cocoaCursorWithImageNamed:(NSString*)imageName hotSpot:(NSPoint)aPoint {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
nsCOMPtr<nsIFile> resDir;
nsAutoCString resPath;
@ -196,7 +196,7 @@ INIT_FAILURE:
[self release];
return nil;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (BOOL)isSet {
@ -290,7 +290,7 @@ INIT_FAILURE:
@implementation nsCocoaCursor
- (id)initWithFrames:(NSArray*)aCursorFrames type:(nsCursor)aType {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
self = [super init];
NSEnumerator* it = [aCursorFrames objectEnumerator];
@ -304,25 +304,25 @@ INIT_FAILURE:
mType = aType;
return self;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (id)initWithCursor:(NSCursor*)aCursor type:(nsCursor)aType {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
NSArray* frame = [NSArray arrayWithObjects:aCursor, nil];
return [self initWithFrames:frame type:aType];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (id)initWithImageNamed:(NSString*)aCursorImage hotSpot:(NSPoint)aPoint type:(nsCursor)aType {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
return [self initWithCursor:[nsMacCursor cocoaCursorWithImageNamed:aCursorImage hotSpot:aPoint]
type:aType];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (BOOL)isSet {
@ -348,11 +348,11 @@ INIT_FAILURE:
}
- (NSString*)description {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
return [mFrames description];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (void)dealloc {

Просмотреть файл

@ -54,14 +54,14 @@ static nsIContent* sQuitItemContent = nullptr;
@implementation ApplicationMenuDelegate
- (id)initWithApplicationMenu:(nsMenuBarX*)aApplicationMenu {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
if ((self = [super init])) {
mApplicationMenu = aApplicationMenu;
}
return self;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (void)menuWillOpen:(NSMenu*)menu {
@ -524,7 +524,7 @@ void nsMenuBarX::AquifyMenuBar() {
// for creating menu items destined for the Application menu
NSMenuItem* nsMenuBarX::CreateNativeAppMenuItem(nsMenuX* inMenu, const nsAString& nodeID,
SEL action, int tag, NativeMenuItemTarget* target) {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
RefPtr<mozilla::dom::Document> doc = inMenu->Content()->GetUncomposedDoc();
if (!doc) {
@ -599,7 +599,7 @@ NSMenuItem* nsMenuBarX::CreateNativeAppMenuItem(nsMenuX* inMenu, const nsAString
return newMenuItem;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
// build the Application menu shared by all menu bars

Просмотреть файл

@ -45,7 +45,7 @@ void nsMenuUtilsX::DispatchCommandTo(nsIContent* aTargetContent) {
}
NSString* nsMenuUtilsX::GetTruncatedCocoaLabel(const nsString& itemLabel) {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
// We want to truncate long strings to some reasonable pixel length but there is no
// good API for doing that which works for all OS versions and architectures. For now
@ -54,7 +54,7 @@ NSString* nsMenuUtilsX::GetTruncatedCocoaLabel(const nsString& itemLabel) {
return [NSString stringWithCharacters:reinterpret_cast<const unichar*>(itemLabel.get())
length:itemLabel.Length()];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
uint8_t nsMenuUtilsX::GeckoModifiersForNodeAttribute(const nsString& modifiersAttribute) {
@ -108,7 +108,7 @@ nsMenuBarX* nsMenuUtilsX::GetHiddenWindowMenuBar() {
// It would be nice if we could localize these edit menu names.
NSMenuItem* nsMenuUtilsX::GetStandardEditMenuItem() {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
// In principle we should be able to allocate this once and then always
// return the same object. But weird interactions happen between native
@ -176,7 +176,7 @@ NSMenuItem* nsMenuUtilsX::GetStandardEditMenuItem() {
return standardEditMenuItem;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
bool nsMenuUtilsX::NodeIsHiddenOrCollapsed(nsIContent* inContent) {

Просмотреть файл

@ -455,7 +455,7 @@ nsresult nsMenuX::GetEnabled(bool* aIsEnabled) {
}
GeckoNSMenu* nsMenuX::CreateMenuWithGeckoString(nsString& menuTitle) {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
NSString* title = [NSString stringWithCharacters:(UniChar*)menuTitle.get()
length:menuTitle.Length()];
@ -473,7 +473,7 @@ GeckoNSMenu* nsMenuX::CreateMenuWithGeckoString(nsString& menuTitle) {
return myMenu;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
void nsMenuX::LoadMenuItem(nsIContent* inMenuItemContent) {
@ -761,7 +761,7 @@ nsresult nsMenuX::SetupIcon() {
@implementation MenuDelegate
- (id)initWithGeckoMenu:(nsMenuX*)geckoMenu {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
if ((self = [super init])) {
NS_ASSERTION(geckoMenu,
@ -770,7 +770,7 @@ nsresult nsMenuX::SetupIcon() {
}
return self;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (void)menu:(NSMenu*)menu willHighlightItem:(NSMenuItem*)item {
@ -870,7 +870,7 @@ static NSMutableDictionary* gShadowKeyEquivDB = nil;
@implementation KeyEquivDBItem
- (id)initWithItem:(NSMenuItem*)aItem table:(NSMapTable*)aTable {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
if (!gShadowKeyEquivDB) {
gShadowKeyEquivDB = [[NSMutableDictionary alloc] init];
@ -886,7 +886,7 @@ static NSMutableDictionary* gShadowKeyEquivDB = nil;
}
return self;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (void)dealloc {

Просмотреть файл

@ -27,25 +27,25 @@
@implementation WindowDataMap
+ (WindowDataMap*)sharedWindowDataMap {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
static WindowDataMap* sWindowMap = nil;
if (!sWindowMap) sWindowMap = [[WindowDataMap alloc] init];
return sWindowMap;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (id)init {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
if ((self = [super init])) {
mWindowMap = [[NSMutableDictionary alloc] initWithCapacity:10];
}
return self;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (void)dealloc {
@ -70,11 +70,11 @@
}
- (id)dataForWindow:(NSWindow*)inWindow {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
return [mWindowMap objectForKey:[self keyForWindow:inWindow]];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (void)setData:(id)inData forWindow:(NSWindow*)inWindow {
@ -94,11 +94,11 @@
}
- (NSString*)keyForWindow:(NSWindow*)inWindow {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
return [NSString stringWithFormat:@"%p", inWindow];
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
@end
@ -111,7 +111,7 @@
@implementation TopLevelWindowData
- (id)initWithWindow:(NSWindow*)inWindow {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
if ((self = [super init])) {
[[NSNotificationCenter defaultCenter] addObserver:self
@ -141,7 +141,7 @@
}
return self;
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
}
- (void)dealloc {

Просмотреть файл

@ -33,14 +33,6 @@ void nsObjCExceptionLog(NSException* aException);
// suppress compiler warnings. This allows us to avoid having to refactor code
// to get scoping right when wrapping an entire method.
#define NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL @try {
#define NS_OBJC_END_TRY_ABORT_BLOCK_NIL \
} \
@catch (NSException * _exn) { \
nsObjCExceptionLog(_exn); \
} \
return nil;
#define NS_OBJC_BEGIN_TRY_BLOCK_RETURN @try {
#define NS_OBJC_END_TRY_BLOCK_RETURN(_rv) \
} \