From bae6f10a73d850181193c248f1ad0e26f5c1b995 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Thu, 21 Aug 2014 12:27:19 +0100 Subject: [PATCH] Backed out changeset 6aee7a646f7e (bug 1014332) --- .../customizableui/CustomizableUI.jsm | 2 +- ...er_876944_customize_mode_create_destroy.js | 4 +- ...owser_880382_drag_wide_widgets_in_panel.js | 63 +++++++------------ .../browser_890140_orphaned_placeholders.js | 43 +++++++------ 4 files changed, 47 insertions(+), 65 deletions(-) diff --git a/browser/components/customizableui/CustomizableUI.jsm b/browser/components/customizableui/CustomizableUI.jsm index 7bd4eef437d1..268a6e49089c 100644 --- a/browser/components/customizableui/CustomizableUI.jsm +++ b/browser/components/customizableui/CustomizableUI.jsm @@ -166,7 +166,6 @@ let CustomizableUIInternal = { "preferences-button", "add-ons-button", "developer-button", - "social-share-button", ]; if (gPalette.has("switch-to-metro-button")) { @@ -208,6 +207,7 @@ let CustomizableUIInternal = { "downloads-button", "home-button", "loop-call-button", + "social-share-button", ], defaultCollapsed: false, }, true); diff --git a/browser/components/customizableui/test/browser_876944_customize_mode_create_destroy.js b/browser/components/customizableui/test/browser_876944_customize_mode_create_destroy.js index cdc401c064e5..6458db7360a2 100644 --- a/browser/components/customizableui/test/browser_876944_customize_mode_create_destroy.js +++ b/browser/components/customizableui/test/browser_876944_customize_mode_create_destroy.js @@ -27,7 +27,7 @@ add_task(function testWrapUnwrap() { // Creating and destroying a widget should correctly deal with panel placeholders add_task(function testPanelPlaceholders() { let panel = document.getElementById(CustomizableUI.AREA_PANEL); - is(panel.querySelectorAll(".panel-customization-placeholder").length, isInWin8() ? 3 : 1, "The number of placeholders should be correct."); + is(panel.querySelectorAll(".panel-customization-placeholder").length, isInWin8() ? 1 : 2, "The number of placeholders should be correct."); CustomizableUI.createWidget({id: kTestWidget2, label: 'Pretty label', tooltiptext: 'Pretty tooltip', defaultArea: CustomizableUI.AREA_PANEL}); let elem = document.getElementById(kTestWidget2); let wrapper = document.getElementById("wrapper-" + kTestWidget2); @@ -35,7 +35,7 @@ add_task(function testPanelPlaceholders() { ok(wrapper, "There should be a wrapper"); is(wrapper.firstChild.id, kTestWidget2, "Wrapper should have test widget"); is(wrapper.parentNode, panel, "Wrapper should be in panel"); - is(panel.querySelectorAll(".panel-customization-placeholder").length, isInWin8() ? 2 : 3, "The number of placeholders should be correct."); + is(panel.querySelectorAll(".panel-customization-placeholder").length, isInWin8() ? 3 : 1, "The number of placeholders should be correct."); CustomizableUI.destroyWidget(kTestWidget2); wrapper = document.getElementById("wrapper-" + kTestWidget2); ok(!wrapper, "There should be a wrapper"); diff --git a/browser/components/customizableui/test/browser_880382_drag_wide_widgets_in_panel.js b/browser/components/customizableui/test/browser_880382_drag_wide_widgets_in_panel.js index 8b1d0ac029e1..b001e48dc5ae 100644 --- a/browser/components/customizableui/test/browser_880382_drag_wide_widgets_in_panel.js +++ b/browser/components/customizableui/test/browser_880382_drag_wide_widgets_in_panel.js @@ -22,8 +22,7 @@ add_task(function() { "find-button", "preferences-button", "add-ons-button", - "developer-button", - "social-share-button"]; + "developer-button"]; addSwitchToMetroButtonInWindows8(placementsAfterMove); simulateItemDrag(zoomControls, printButton); assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove); @@ -49,8 +48,7 @@ add_task(function() { "find-button", "preferences-button", "add-ons-button", - "developer-button", - "social-share-button"]; + "developer-button"]; addSwitchToMetroButtonInWindows8(placementsAfterMove); simulateItemDrag(zoomControls, savePageButton); assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove); @@ -74,8 +72,7 @@ add_task(function() { "find-button", "preferences-button", "add-ons-button", - "developer-button", - "social-share-button"]; + "developer-button"]; addSwitchToMetroButtonInWindows8(placementsAfterMove); simulateItemDrag(zoomControls, newWindowButton); assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove); @@ -98,8 +95,7 @@ add_task(function() { "find-button", "preferences-button", "add-ons-button", - "developer-button", - "social-share-button"]; + "developer-button"]; addSwitchToMetroButtonInWindows8(placementsAfterMove); simulateItemDrag(zoomControls, historyPanelMenu); assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove); @@ -126,8 +122,7 @@ add_task(function() { "find-button", "preferences-button", "add-ons-button", - "developer-button", - "social-share-button"]; + "developer-button"]; addSwitchToMetroButtonInWindows8(placementsAfterMove); simulateItemDrag(zoomControls, preferencesButton); assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove); @@ -154,8 +149,7 @@ add_task(function() { "find-button", "preferences-button", "add-ons-button", - "developer-button", - "social-share-button"]; + "developer-button"]; addSwitchToMetroButtonInWindows8(placementsAfterInsert); simulateItemDrag(openFileButton, zoomControls); assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterInsert); @@ -194,8 +188,7 @@ add_task(function() { "find-button", "preferences-button", "add-ons-button", - "developer-button", - "social-share-button"]; + "developer-button"]; addSwitchToMetroButtonInWindows8(placementsAfterInsert); simulateItemDrag(openFileButton, editControls); assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterInsert); @@ -231,8 +224,7 @@ add_task(function() { "find-button", "preferences-button", "add-ons-button", - "developer-button", - "social-share-button"]; + "developer-button"]; addSwitchToMetroButtonInWindows8(placementsAfterMove); simulateItemDrag(editControls, zoomControls); assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove); @@ -256,8 +248,7 @@ add_task(function() { "find-button", "preferences-button", "add-ons-button", - "developer-button", - "social-share-button"]; + "developer-button"]; addSwitchToMetroButtonInWindows8(placementsAfterMove); simulateItemDrag(editControls, newWindowButton); assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove); @@ -284,8 +275,7 @@ add_task(function() { "find-button", "preferences-button", "add-ons-button", - "developer-button", - "social-share-button"]; + "developer-button"]; addSwitchToMetroButtonInWindows8(placementsAfterMove); simulateItemDrag(editControls, privateBrowsingButton); assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove); @@ -312,8 +302,7 @@ add_task(function() { "find-button", "preferences-button", "add-ons-button", - "developer-button", - "social-share-button"]; + "developer-button"]; addSwitchToMetroButtonInWindows8(placementsAfterMove); simulateItemDrag(editControls, savePageButton); assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove); @@ -339,8 +328,7 @@ add_task(function() { "preferences-button", "add-ons-button", "edit-controls", - "developer-button", - "social-share-button"]; + "developer-button"]; addSwitchToMetroButtonInWindows8(placementsAfterMove); simulateItemDrag(editControls, panel); assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove); @@ -365,8 +353,7 @@ add_task(function() { "find-button", "preferences-button", "add-ons-button", - "developer-button", - "social-share-button"]; + "developer-button"]; addSwitchToMetroButtonInWindows8(placementsAfterMove); let paletteChildElementCount = palette.childElementCount; simulateItemDrag(editControls, palette); @@ -390,8 +377,7 @@ add_task(function() { yield startCustomizing(); let editControls = document.getElementById("edit-controls"); let panel = document.getElementById(CustomizableUI.AREA_PANEL); - let numPlaceholders = isInWin8() ? 3 : 1; - is(numPlaceholders, panel.getElementsByClassName("panel-customization-placeholder").length, "correct number of placeholders"); + let numPlaceholders = isInWin8() ? 1 : 2; for (let i = 0; i < numPlaceholders; i++) { // NB: We can't just iterate over all of the placeholders // because each drag-drop action recreates them. @@ -407,8 +393,7 @@ add_task(function() { "preferences-button", "add-ons-button", "edit-controls", - "developer-button", - "social-share-button"]; + "developer-button"]; addSwitchToMetroButtonInWindows8(placementsAfterMove); simulateItemDrag(editControls, placeholder); assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove); @@ -438,8 +423,6 @@ add_task(function() { yield startCustomizing(); let editControls = document.getElementById("edit-controls"); let panel = document.getElementById(CustomizableUI.AREA_PANEL); - let numPlaceholders = isInWin8() ? 3 : 1; - is(panel.getElementsByClassName("panel-customization-placeholder").length, numPlaceholders, "correct number of placeholders"); let target = panel.getElementsByClassName("panel-customization-placeholder")[0]; let placementsAfterMove = ["zoom-controls", "new-window-button", @@ -452,22 +435,18 @@ add_task(function() { "preferences-button", "add-ons-button", "edit-controls", - "developer-button", - "social-share-button"]; + "developer-button"]; addSwitchToMetroButtonInWindows8(placementsAfterMove); - if (isInWin8()) { - placementsAfterMove.splice(10, 1); - placementsAfterMove.push("edit-controls"); - } simulateItemDrag(editControls, target); assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove); let itemToDrag = "sync-button"; let button = document.getElementById(itemToDrag); + placementsAfterMove.splice(11, 0, itemToDrag); if (isInWin8()) { - placementsAfterMove.push(itemToDrag); - } else { - placementsAfterMove.splice(10, 1, itemToDrag); - placementsAfterMove.push("edit-controls"); + placementsAfterMove[10] = placementsAfterMove[11]; + placementsAfterMove[11] = placementsAfterMove[12]; + placementsAfterMove[12] = placementsAfterMove[13]; + placementsAfterMove[13] = "edit-controls"; } simulateItemDrag(button, editControls); assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove); diff --git a/browser/components/customizableui/test/browser_890140_orphaned_placeholders.js b/browser/components/customizableui/test/browser_890140_orphaned_placeholders.js index f96f70b590e4..bddcb50dc19c 100644 --- a/browser/components/customizableui/test/browser_890140_orphaned_placeholders.js +++ b/browser/components/customizableui/test/browser_890140_orphaned_placeholders.js @@ -11,13 +11,15 @@ add_task(function() { yield startCustomizing(); let btn = document.getElementById("open-file-button"); let panel = document.getElementById(CustomizableUI.AREA_PANEL); + let placements = getAreaWidgetIds(CustomizableUI.AREA_PANEL); - CustomizableUI.removeWidgetFromArea("social-share-button"); if (isInWin8()) { CustomizableUI.removeWidgetFromArea("switch-to-metro-button"); + placements = getAreaWidgetIds(CustomizableUI.AREA_PANEL); + ok(!CustomizableUI.inDefaultState, "Should no longer be in default state."); + } else { + ok(CustomizableUI.inDefaultState, "Should be in default state."); } - let placements = getAreaWidgetIds(CustomizableUI.AREA_PANEL); - ok(!CustomizableUI.inDefaultState, "Should no longer be in default state."); assertAreaPlacements(CustomizableUI.AREA_PANEL, placements); is(getVisiblePlaceholderCount(panel), 2, "Should only have 2 visible placeholders before exiting"); @@ -26,7 +28,6 @@ add_task(function() { yield startCustomizing(); is(getVisiblePlaceholderCount(panel), 2, "Should only have 2 visible placeholders after re-entering"); - CustomizableUI.addWidgetToArea("social-share-button", CustomizableUI.AREA_PANEL); if (isInWin8()) { CustomizableUI.addWidgetToArea("switch-to-metro-button", CustomizableUI.AREA_PANEL); } @@ -38,7 +39,6 @@ add_task(function() { yield startCustomizing(); let btn = document.getElementById("open-file-button"); let panel = document.getElementById(CustomizableUI.AREA_PANEL); - CustomizableUI.removeWidgetFromArea("social-share-button"); let placements = getAreaWidgetIds(CustomizableUI.AREA_PANEL); let placementsAfterAppend = placements; @@ -49,7 +49,7 @@ add_task(function() { } assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterAppend); - ok(!CustomizableUI.inDefaultState, "Should not be in default state"); + is(CustomizableUI.inDefaultState, isInWin8(), "Should only be in default state if on Win8"); is(getVisiblePlaceholderCount(panel), 1, "Should only have 1 visible placeholder before exiting"); yield endCustomizing(); @@ -63,24 +63,26 @@ add_task(function() { btn = document.getElementById("open-file-button"); simulateItemDrag(btn, palette); } - CustomizableUI.addWidgetToArea("social-share-button", CustomizableUI.AREA_PANEL); ok(CustomizableUI.inDefaultState, "Should be in default state again."); }); // Two orphaned items should have one placeholder next to them (case 2). add_task(function() { yield startCustomizing(); - let buttonsToMove = ["add-ons-button", "developer-button", "social-share-button"]; - if (isInWin8()) { - buttonsToMove.push("switch-to-metro-button"); - } + let btn = document.getElementById("add-ons-button"); + let btn2 = document.getElementById("developer-button"); + let btn3 = document.getElementById("switch-to-metro-button"); let panel = document.getElementById(CustomizableUI.AREA_PANEL); let palette = document.getElementById("customization-palette"); let placements = getAreaWidgetIds(CustomizableUI.AREA_PANEL); - let placementsAfterAppend = placements.filter(p => buttonsToMove.indexOf(p) < 0); - for (let i in buttonsToMove) { - CustomizableUI.removeWidgetFromArea(buttonsToMove[i]); + let placementsAfterAppend = placements.filter(p => p != btn.id && p != btn2.id); + simulateItemDrag(btn, palette); + simulateItemDrag(btn2, palette); + + if (isInWin8()) { + placementsAfterAppend = placementsAfterAppend.filter(p => p != btn3.id); + simulateItemDrag(btn3, palette); } assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterAppend); @@ -91,8 +93,11 @@ add_task(function() { yield startCustomizing(); is(getVisiblePlaceholderCount(panel), 1, "Should only have 1 visible placeholder after re-entering"); - for (let i in buttonsToMove) { - CustomizableUI.addWidgetToArea(buttonsToMove[i], CustomizableUI.AREA_PANEL); + simulateItemDrag(btn, panel); + simulateItemDrag(btn2, panel); + + if (isInWin8()) { + simulateItemDrag(btn3, panel); } assertAreaPlacements(CustomizableUI.AREA_PANEL, placements); @@ -107,7 +112,6 @@ add_task(function() { let metroBtn = document.getElementById("switch-to-metro-button"); let panel = document.getElementById(CustomizableUI.AREA_PANEL); let palette = document.getElementById("customization-palette"); - CustomizableUI.removeWidgetFromArea("social-share-button"); let placements = getAreaWidgetIds(CustomizableUI.AREA_PANEL); placements.pop(); @@ -129,7 +133,6 @@ add_task(function() { is(getVisiblePlaceholderCount(panel), 3, "Should have 3 visible placeholders after re-entering"); simulateItemDrag(developerButton, panel); - CustomizableUI.addWidgetToArea("social-share-button", CustomizableUI.AREA_PANEL); if (isInWin8()) { simulateItemDrag(metroBtn, panel); } @@ -138,10 +141,10 @@ add_task(function() { ok(CustomizableUI.inDefaultState, "Should be in default state again."); }); -// The default placements should have one placeholder at the bottom (or 3 in metro-enabled win8). +// The default placements should have two placeholders at the bottom (or 1 in win8). add_task(function() { yield startCustomizing(); - let numPlaceholders = isInWin8() ? 3 : 1; + let numPlaceholders = isInWin8() ? 1 : 2; let panel = document.getElementById(CustomizableUI.AREA_PANEL); ok(CustomizableUI.inDefaultState, "Should be in default state."); is(getVisiblePlaceholderCount(panel), numPlaceholders, "Should have " + numPlaceholders + " visible placeholders before exiting");