Bug 1151345 - Add debug logging to help decipher this bug. r=spohl

This commit is contained in:
Steven Michaud 2015-04-23 09:55:20 -05:00
parent ff114dc400
commit 3d8adbe6d5

View File

@ -186,6 +186,13 @@ 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()
@ -552,13 +559,28 @@ 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 (!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 (!domdoc) {
#if !defined(RELEASE_BUILD) || defined(DEBUG)
NSLog(@"nsMenuBarX::CreateNativeAppMenuItem(2): nodeID %s, domdoc is null!",
nodeID_UTF8.get());
#endif
return nil;
}
// Get information from the gecko menu item
nsAutoString label;
@ -572,6 +594,10 @@ 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;
}
@ -617,7 +643,16 @@ NSMenuItem* nsMenuBarX::CreateNativeAppMenuItem(nsMenuX* inMenu, const nsAString
MenuItemInfo * info = [[MenuItemInfo alloc] initWithMenuGroupOwner:this];
[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;