Bug 1354117 - remove wrap handling for the bookmarks toolbar button and tests verifying it, r=johannh

MozReview-Commit-ID: CeSGIQrDPpw

--HG--
extra : rebase_source : 11a15f98fe7b4fc8fa26152ad5e5e43551cc8a3b
This commit is contained in:
Gijs Kruitbosch 2017-07-31 21:52:06 +01:00
Родитель e01119f316
Коммит cf5f0b7624
7 изменённых файлов: 1 добавлений и 114 удалений

Просмотреть файл

@ -17,9 +17,6 @@ var CustomizationHandler = {
case "customizationstarting": case "customizationstarting":
this._customizationStarting(); this._customizationStarting();
break; break;
case "customizationchange":
this._customizationChange();
break;
case "customizationending": case "customizationending":
this._customizationEnding(aEvent.detail); this._customizationEnding(aEvent.detail);
break; break;
@ -54,10 +51,6 @@ var CustomizationHandler = {
} }
}, },
_customizationChange() {
PlacesToolbarHelper.customizeChange();
},
_customizationEnding(aDetails) { _customizationEnding(aDetails) {
// Update global UI elements that may have been added or removed // Update global UI elements that may have been added or removed
if (aDetails.changed) { if (aDetails.changed) {

Просмотреть файл

@ -1195,8 +1195,6 @@ var PlacesToolbarHelper = {
if (forceToolbarOverflowCheck) { if (forceToolbarOverflowCheck) {
viewElt._placesView.updateOverflowStatus(); viewElt._placesView.updateOverflowStatus();
} }
this._shouldWrap = false;
this._setupPlaceholder();
}, },
uninit: function PTH_uninit() { uninit: function PTH_uninit() {
@ -1211,28 +1209,6 @@ var PlacesToolbarHelper = {
} finally { } finally {
this._isCustomizing = true; this._isCustomizing = true;
} }
this._shouldWrap = this._getShouldWrap();
},
customizeChange: function PTH_customizeChange() {
this._setupPlaceholder();
},
_setupPlaceholder: function PTH_setupPlaceholder() {
let placeholder = this._placeholder;
if (!placeholder) {
return;
}
let shouldWrapNow = this._getShouldWrap();
if (this._shouldWrap != shouldWrapNow) {
if (shouldWrapNow) {
placeholder.setAttribute("wrap", "true");
} else {
placeholder.removeAttribute("wrap");
}
this._shouldWrap = shouldWrapNow;
}
}, },
customizeDone: function PTH_customizeDone() { customizeDone: function PTH_customizeDone() {
@ -1240,13 +1216,6 @@ var PlacesToolbarHelper = {
this.init(true); this.init(true);
}, },
_getShouldWrap: function PTH_getShouldWrap() {
let placement = CustomizableUI.getPlacementOfWidget("personal-bookmarks");
let area = placement && placement.area;
let areaType = area && CustomizableUI.getAreaType(area);
return !area || CustomizableUI.TYPE_MENU_PANEL == areaType;
},
onPlaceholderCommand() { onPlaceholderCommand() {
let widgetGroup = CustomizableUI.getWidget("personal-bookmarks"); let widgetGroup = CustomizableUI.getWidget("personal-bookmarks");
let widget = widgetGroup.forWindow(window); let widget = widgetGroup.forWindow(window);

Просмотреть файл

@ -1711,7 +1711,6 @@ var gBrowserInit = {
window.addEventListener("dragover", MousePosTracker); window.addEventListener("dragover", MousePosTracker);
gNavToolbox.addEventListener("customizationstarting", CustomizationHandler); gNavToolbox.addEventListener("customizationstarting", CustomizationHandler);
gNavToolbox.addEventListener("customizationchange", CustomizationHandler);
gNavToolbox.addEventListener("customizationending", CustomizationHandler); gNavToolbox.addEventListener("customizationending", CustomizationHandler);
// End startup crash tracking after a delay to catch crashes while restoring // End startup crash tracking after a delay to catch crashes while restoring

Просмотреть файл

@ -257,12 +257,6 @@ const PanelUI = {
return; return;
} }
let personalBookmarksPlacement = CustomizableUI.getPlacementOfWidget("personal-bookmarks");
if (personalBookmarksPlacement &&
personalBookmarksPlacement.area == CustomizableUI.AREA_PANEL) {
PlacesToolbarHelper.customizeChange();
}
let anchor; let anchor;
let domEvent = null; let domEvent = null;
if (!aEvent || if (!aEvent ||

Просмотреть файл

@ -101,8 +101,6 @@ skip-if = os == "linux" # Intermittent failures
[browser_963639_customizing_attribute_non_customizable_toolbar.js] [browser_963639_customizing_attribute_non_customizable_toolbar.js]
[browser_967000_button_charEncoding.js] [browser_967000_button_charEncoding.js]
[browser_967000_button_feeds.js] [browser_967000_button_feeds.js]
[browser_968447_bookmarks_toolbar_items_in_panel.js]
skip-if = os == "linux" # Intemittent failures - bug 979207
[browser_968565_insert_before_hidden_items.js] [browser_968565_insert_before_hidden_items.js]
[browser_969427_recreate_destroyed_widget_after_reset.js] [browser_969427_recreate_destroyed_widget_after_reset.js]
[browser_969661_character_encoding_navbar_disabled.js] [browser_969661_character_encoding_navbar_disabled.js]

Просмотреть файл

@ -1,66 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
// Bug 968447 - The Bookmarks Toolbar Items doesn't appear as a
// normal menu panel button in new windows.
add_task(async function() {
await SpecialPowers.pushPrefEnv({set: [["browser.photon.structure.enabled", false]]});
const buttonId = "bookmarks-toolbar-placeholder";
await startCustomizing();
CustomizableUI.addWidgetToArea("personal-bookmarks", CustomizableUI.AREA_PANEL);
await endCustomizing();
await PanelUI.show();
let bookmarksToolbarPlaceholder = document.getElementById(buttonId);
ok(bookmarksToolbarPlaceholder.classList.contains("toolbarbutton-1"),
"Button should have toolbarbutton-1 class");
is(bookmarksToolbarPlaceholder.getAttribute("wrap"), "true",
"Button should have the 'wrap' attribute");
info("Waiting for panel to close");
let panelHiddenPromise = promisePanelHidden(window);
PanelUI.hide();
await panelHiddenPromise;
info("Waiting for window to open");
let newWin = await openAndLoadWindow({}, true);
info("Waiting for panel in new window to open");
let hideTrace = function() {
info(new Error().stack);
info("Panel was hidden.");
};
newWin.PanelUI.panel.addEventListener("popuphidden", hideTrace);
await newWin.PanelUI.show();
let newWinBookmarksToolbarPlaceholder = newWin.document.getElementById(buttonId);
ok(newWinBookmarksToolbarPlaceholder.classList.contains("toolbarbutton-1"),
"Button in new window should have toolbarbutton-1 class");
is(newWinBookmarksToolbarPlaceholder.getAttribute("wrap"), "true",
"Button in new window should have 'wrap' attribute");
newWin.PanelUI.panel.removeEventListener("popuphidden", hideTrace);
// XXXgijs on Linux, we're sometimes seeing the panel being hidden early
// in the newly created window, probably because something else steals focus.
if (newWin.PanelUI.panel.state != "closed") {
info("Panel is still open in new window, waiting for it to close");
panelHiddenPromise = promisePanelHidden(newWin);
newWin.PanelUI.hide();
await panelHiddenPromise;
} else {
info("panel was already closed");
}
info("Waiting for new window to close");
await promiseWindowClosed(newWin);
});
add_task(async function asyncCleanUp() {
await endCustomizing();
CustomizableUI.reset();
});

Просмотреть файл

@ -305,7 +305,7 @@ function promisePanelHidden(win) {
} }
function promiseOverflowHidden(win) { function promiseOverflowHidden(win) {
let panelEl = document.getElementById("widget-overflow"); let panelEl = win.PanelUI.overflowPanel;
return promisePanelElementHidden(win, panelEl); return promisePanelElementHidden(win, panelEl);
} }