From 34bc3d456b0b8bbb17c4d38a0591f8c704fa145f Mon Sep 17 00:00:00 2001 From: Smokey Ardisson Date: Wed, 24 Mar 2010 13:33:04 -0400 Subject: [PATCH] Add support for an old type of Apple event so that preview from Dreamweaver (<= CS4) works again. b=549680 r=josh --- toolkit/xre/MacApplicationDelegate.mm | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/toolkit/xre/MacApplicationDelegate.mm b/toolkit/xre/MacApplicationDelegate.mm index a2fa9198292..5b31fd66b06 100644 --- a/toolkit/xre/MacApplicationDelegate.mm +++ b/toolkit/xre/MacApplicationDelegate.mm @@ -112,10 +112,17 @@ SetupMacApplicationDelegate() NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN; if ((self = [super init])) { - [[NSAppleEventManager sharedAppleEventManager] setEventHandler:self - andSelector:@selector(handleAppleEvent:withReplyEvent:) - forEventClass:kInternetEventClass - andEventID:kAEGetURL]; + NSAppleEventManager *aeMgr = [NSAppleEventManager sharedAppleEventManager]; + + [aeMgr setEventHandler:self + andSelector:@selector(handleAppleEvent:withReplyEvent:) + forEventClass:kInternetEventClass + andEventID:kAEGetURL]; + + [aeMgr setEventHandler:self + andSelector:@selector(handleAppleEvent:withReplyEvent:) + forEventClass:'WWW!' + andEventID:'OURL']; } return self; @@ -126,7 +133,9 @@ SetupMacApplicationDelegate() { NS_OBJC_BEGIN_TRY_ABORT_BLOCK; - [[NSAppleEventManager sharedAppleEventManager] removeEventHandlerForEventClass:kInternetEventClass andEventID:kAEGetURL]; + NSAppleEventManager *aeMgr = [NSAppleEventManager sharedAppleEventManager]; + [aeMgr removeEventHandlerForEventClass:kInternetEventClass andEventID:kAEGetURL]; + [aeMgr removeEventHandlerForEventClass:'WWW!' andEventID:'OURL']; [super dealloc]; NS_OBJC_END_TRY_ABORT_BLOCK; @@ -364,7 +373,8 @@ static NSWindow* GetCocoaWindowForXULWindow(nsISupports *aXULWindow) if (!event) return; - if ([event eventClass] == kInternetEventClass && [event eventID] == kAEGetURL) { + if (([event eventClass] == kInternetEventClass && [event eventID] == kAEGetURL) || + ([event eventClass] == 'WWW!' && [event eventID] == 'OURL')) { NSString* urlString = [[event paramDescriptorForKeyword:keyDirectObject] stringValue]; // don't open chrome URLs