From 3979f697e6508cbd8e11f2a286b4e0d3b2c66634 Mon Sep 17 00:00:00 2001 From: "enndeakin@sympatico.ca" Date: Tue, 29 Apr 2008 12:07:14 -0700 Subject: [PATCH] Bug 402798, bookmarks missing from menu, r=mano,a=beltzner --- browser/base/content/test/Makefile.in | 5 +++ .../base/content/test/browser_customize.js | 38 +++++++++++++++++++ toolkit/content/customizeToolbar.js | 6 +++ 3 files changed, 49 insertions(+) create mode 100644 browser/base/content/test/browser_customize.js diff --git a/browser/base/content/test/Makefile.in b/browser/base/content/test/Makefile.in index ada7d820781b..1624d1182014 100644 --- a/browser/base/content/test/Makefile.in +++ b/browser/base/content/test/Makefile.in @@ -60,6 +60,11 @@ _BROWSER_FILES = browser_bug321000.js \ browser_getshortcutoruri.js \ $(NULL) +ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT))) +_BROWSER_FILES += browser_customize.js \ + $(NULL) +endif + # disable tests on linux for now.. ifneq ($(OS_ARCH),Linux) _BROWSER_FILES += \ diff --git a/browser/base/content/test/browser_customize.js b/browser/base/content/test/browser_customize.js new file mode 100644 index 000000000000..13e3f510ff3e --- /dev/null +++ b/browser/base/content/test/browser_customize.js @@ -0,0 +1,38 @@ +function test() +{ + waitForExplicitFinish(); + var panel = document.getElementById("customizeToolbarSheetPopup"); + panel.addEventListener("popupshown", testCustomizePopupShown, false); + document.getElementById("cmd_CustomizeToolbars").doCommand(); +} + +function testCustomizePopupShown() +{ + var panel = document.getElementById("customizeToolbarSheetPopup"); + panel.removeEventListener("popupshown", testCustomizePopupShown, false); + panel.addEventListener("popuphidden", testCustomizePopupHidden, false); + + var frame = document.getElementById("customizeToolbarSheetIFrame").contentDocument; + frame.addEventListener("load", testCustomizeFrameLoaded, true); +} + +function testCustomizeFrameLoaded() +{ + var frame = document.getElementById("customizeToolbarSheetIFrame"); + frame.removeEventListener("load", testCustomizeFrameLoaded, true); + + var menu = document.getElementById("bookmarksMenuPopup"); + ok("getResult" in menu, "menu has binding"); + + var framedoc = document.getElementById("customizeToolbarSheetIFrame").contentDocument; + var b = framedoc.getElementById("donebutton"); + + framedoc.getElementById("donebutton").doCommand(); +} + +function testCustomizePopupHidden() +{ + var panel = document.getElementById("customizeToolbarSheetPopup"); + panel.removeEventListener("popuphidden", testCustomizePopupHidden, false); + finish(); +} diff --git a/toolkit/content/customizeToolbar.js b/toolkit/content/customizeToolbar.js index 4ae833c9b193..407b22cc0110 100644 --- a/toolkit/content/customizeToolbar.js +++ b/toolkit/content/customizeToolbar.js @@ -193,6 +193,12 @@ function wrapToolbarItems() if (isCustomizableToolbar(toolbar)) { for (var k = 0; k < toolbar.childNodes.length; ++k) { var item = toolbar.childNodes[k]; + +#ifdef XP_MACOSX + if (item.firstChild && item.firstChild.localName == "menubar") + continue; +#endif + if (isToolbarItem(item)) { var nextSibling = item.nextSibling;