            this.setAttribute('focused','true');
          ]]>
        </handler>
-@@ -574,24 +581,35 @@
+@@ -574,24 +581,40 @@
                // For now, only do this when the outermost menupopup opens.
                this.menuBoxObject.activeChild = this.mSelectedInternal;
            }

diff --git a/toolkit/toolkit.mozbuild b/toolkit/toolkit.mozbuild
--- a/toolkit/toolkit.mozbuild
+++ b/toolkit/toolkit.mozbuild
@@ -166,17 +166,16 @@ if not CONFIG['MOZ_ENABLE_QTNETWORK'] an
     DIRS += ['/toolkit/system/dbus']
 
 DIRS += ['/addon-sdk']
 
 if CONFIG['ENABLE_MARIONETTE'] or CONFIG['MOZ_WIDGET_TOOLKIT'] not in ('gonk', 'android'):
     DIRS += ['/testing/marionette']

 
 NS_IMETHODIMP
 PuppetScreenManager::ScreenForRect(int32_t inLeft,
diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -6394,17 +6394,17 @@ HandleEvent(CGEventTapProxy aProxy, CGEv
   CFRunLoopStop(CFRunLoopGetCurrent());
 }
 
 - (void)shutdownAndReleaseCalledOnAnyThread
 {
   [self performSelector:@selector(shutdownAndReleaseCalledOnEventThread) onThread:mThread withObject:nil waitUntilDone:NO];
 }
 
-static const CGEventField kCGWindowNumberField = 51;
+static const CGEventField kCGWindowNumberField = (const CGEventField) 51;
 
 // Called on scroll thread
 - (void)handleEvent:(CGEventRef)cgEvent type:(CGEventType)type
 {
   if (type != kCGEventScrollWheel) {
     return;
   }
 
diff --git a/widget/cocoa/nsMenuItemX.mm b/widget/cocoa/nsMenuItemX.mm
--- a/widget/cocoa/nsMenuItemX.mm
+++ b/widget/cocoa/nsMenuItemX.mm
