mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1151345 - Firefox app menu sometimes contains only "Quit" on OS X. r=spohl
This commit is contained in:
parent
39074be05e
commit
cf0c647ccd
@ -28,6 +28,7 @@
|
||||
#include "nsCocoaFeatures.h"
|
||||
#include "nsCocoaUtils.h"
|
||||
#include "nsChildView.h"
|
||||
#include "nsMenuBarX.h"
|
||||
#include "nsToolkit.h"
|
||||
#include "TextInputHandler.h"
|
||||
#include "mozilla/HangMonitor.h"
|
||||
@ -647,6 +648,7 @@ nsAppShell::Run(void)
|
||||
mStarted = true;
|
||||
|
||||
AddScreenWakeLockListener();
|
||||
nsMenuBarX::ResetNativeApplicationMenu();
|
||||
|
||||
NS_OBJC_TRY_ABORT([NSApp run]);
|
||||
|
||||
|
@ -126,6 +126,7 @@ public:
|
||||
void ForceUpdateNativeMenuAt(const nsAString& indexString);
|
||||
void ForceNativeMenuReload(); // used for testing
|
||||
static char GetLocalizedAccelKey(const char *shortcutID);
|
||||
static void ResetNativeApplicationMenu();
|
||||
|
||||
protected:
|
||||
void ConstructNativeMenus();
|
||||
|
@ -186,13 +186,6 @@ void nsMenuBarX::ConstructFallbackNativeMenus()
|
||||
[quitMenuItem setTarget:nsMenuBarX::sNativeEventTarget];
|
||||
[quitMenuItem setTag:eCommand_ID_Quit];
|
||||
[sApplicationMenu addItem:quitMenuItem];
|
||||
|
||||
// Add debug logging to help decipher bug 1151345.
|
||||
#if !defined(RELEASE_BUILD) || defined(DEBUG)
|
||||
NSLog(@"nsMenuBarX::ConstructFallbackNativeMenus(): labelUTF16 %s, keyUTF16 %s",
|
||||
NS_ConvertUTF16toUTF8(labelUTF16).get(),
|
||||
NS_ConvertUTF16toUTF8(keyUTF16).get());
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t nsMenuBarX::GetMenuCount()
|
||||
@ -504,6 +497,14 @@ char nsMenuBarX::GetLocalizedAccelKey(const char *shortcutID)
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* static */
|
||||
void nsMenuBarX::ResetNativeApplicationMenu()
|
||||
{
|
||||
[sApplicationMenu removeAllItems];
|
||||
[sApplicationMenu release];
|
||||
sApplicationMenu = nil;
|
||||
}
|
||||
|
||||
// Hide the item in the menu by setting the 'hidden' attribute. Returns it in |outHiddenNode| so
|
||||
// the caller can hang onto it if they so choose. It is acceptable to pass nsull
|
||||
// for |outHiddenNode| if the caller doesn't care about the hidden node.
|
||||
@ -559,26 +560,13 @@ NSMenuItem* nsMenuBarX::CreateNativeAppMenuItem(nsMenuX* inMenu, const nsAString
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||
|
||||
// Add debug logging to help decipher bug 1151345.
|
||||
#if !defined(RELEASE_BUILD) || defined(DEBUG)
|
||||
NS_ConvertUTF16toUTF8 nodeID_UTF8(nodeID);
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = inMenu->Content()->GetUncomposedDoc();
|
||||
if (!doc) {
|
||||
#if !defined(RELEASE_BUILD) || defined(DEBUG)
|
||||
NSLog(@"nsMenuBarX::CreateNativeAppMenuItem(1): nodeID %s, doc is null!",
|
||||
nodeID_UTF8.get());
|
||||
#endif
|
||||
return nil;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domdoc(do_QueryInterface(doc));
|
||||
if (!domdoc) {
|
||||
#if !defined(RELEASE_BUILD) || defined(DEBUG)
|
||||
NSLog(@"nsMenuBarX::CreateNativeAppMenuItem(2): nodeID %s, domdoc is null!",
|
||||
nodeID_UTF8.get());
|
||||
#endif
|
||||
return nil;
|
||||
}
|
||||
|
||||
@ -594,10 +582,6 @@ NSMenuItem* nsMenuBarX::CreateNativeAppMenuItem(nsMenuX* inMenu, const nsAString
|
||||
menuItem->GetAttribute(NS_LITERAL_STRING("key"), key);
|
||||
}
|
||||
else {
|
||||
#if !defined(RELEASE_BUILD) || defined(DEBUG)
|
||||
NSLog(@"nsMenuBarX::CreateNativeAppMenuItem(3): nodeID %s, menuItem is null!",
|
||||
nodeID_UTF8.get());
|
||||
#endif
|
||||
return nil;
|
||||
}
|
||||
|
||||
@ -644,15 +628,6 @@ NSMenuItem* nsMenuBarX::CreateNativeAppMenuItem(nsMenuX* inMenu, const nsAString
|
||||
[newMenuItem setRepresentedObject:info];
|
||||
[info release];
|
||||
|
||||
#if !defined(RELEASE_BUILD) || defined(DEBUG)
|
||||
if (!newMenuItem) {
|
||||
NSLog(@"nsMenuBarX::CreateNativeAppMenuItem(4): nodeID %s, label %s, modifiers %s, key %s, newMenuItem is null!",
|
||||
nodeID_UTF8.get(),
|
||||
NS_ConvertUTF16toUTF8(label).get(),
|
||||
NS_ConvertUTF16toUTF8(modifiers).get(),
|
||||
NS_ConvertUTF16toUTF8(key).get());
|
||||
}
|
||||
#endif
|
||||
return newMenuItem;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||
|
Loading…
Reference in New Issue
Block a user