Bug 402798, bookmarks missing from menu, r=mano,a=beltzner
authorenndeakin@sympatico.ca
Tue, 29 Apr 2008 12:07:14 -0700
changeset 14778 3361edf4680e2d76301c0ad1434ac61421fa8e7c
parent 14777 eb163948dd033520bee00687d11b62c793f24afb
child 14779 736e79b4a020846daddf0ffc65ee2fe7d58c4e96
push id15
push userbsmedberg@mozilla.com
push dateWed, 30 Apr 2008 16:36:32 +0000
treeherdermozilla-central@5fd5f0514bfc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmano, beltzner
bugs402798
milestone1.9pre
Bug 402798, bookmarks missing from menu, r=mano,a=beltzner
browser/base/content/test/Makefile.in
browser/base/content/test/browser_customize.js
toolkit/content/customizeToolbar.js
--- a/browser/base/content/test/Makefile.in
+++ b/browser/base/content/test/Makefile.in
@@ -55,16 +55,21 @@ include $(topsrcdir)/config/rules.mk
                  browser_bug409481.js \
                  browser_autodiscovery.js \
                  browser_bug420160.js \
                  autodiscovery.html \
                  moz.png \
                  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 += \
                  browser_bug427559.js \
     $(NULL)
 endif
 
 libs:: $(_TEST_FILES)
new file mode 100644
--- /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();
+}
--- a/toolkit/content/customizeToolbar.js
+++ b/toolkit/content/customizeToolbar.js
@@ -188,16 +188,22 @@ function persistCurrentSets()
  */
 function wrapToolbarItems()
 {
   for (var i = 0; i < gToolbox.childNodes.length; ++i) {
     var toolbar = getToolbarAt(i);
     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;
           
           var wrapper = wrapToolbarItem(item);
           
           if (nextSibling)
             toolbar.insertBefore(wrapper, nextSibling);
           else