зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1258344 - fix customizemode re-entering issues when switching tabs, r=jaws
MozReview-Commit-ID: 3KONzSxf8g9 --HG-- extra : rebase_source : 31cee7d85b80d2c136722558c9589132574b6455
This commit is contained in:
Родитель
f310165068
Коммит
748a42f056
|
@ -65,6 +65,7 @@ function closeGlobalTab() {
|
|||
win.BrowserOpenTab();
|
||||
}
|
||||
win.gBrowser.removeTab(gTab);
|
||||
gTab = null;
|
||||
}
|
||||
|
||||
function unregisterGlobalTab() {
|
||||
|
@ -210,7 +211,10 @@ CustomizeMode.prototype = {
|
|||
return;
|
||||
}
|
||||
if (!gTab.selected) {
|
||||
// This will force another .enter() to be called via the
|
||||
// onlocationchange handler of the tabbrowser, so we return early.
|
||||
gTab.ownerGlobal.gBrowser.selectedTab = gTab;
|
||||
return;
|
||||
}
|
||||
gTab.ownerGlobal.focus();
|
||||
if (gTab.ownerDocument != this.document) {
|
||||
|
|
|
@ -147,3 +147,4 @@ skip-if = os == "mac"
|
|||
[browser_bootstrapped_custom_toolbar.js]
|
||||
[browser_customizemode_contextmenu_menubuttonstate.js]
|
||||
[browser_panel_toggle.js]
|
||||
[browser_switch_to_customize_mode.js]
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
"use strict";
|
||||
|
||||
add_task(function*() {
|
||||
yield startCustomizing();
|
||||
is(gBrowser.tabs.length, 2, "Should have 2 tabs");
|
||||
|
||||
let paletteKidCount = document.getElementById("customization-palette").childElementCount;
|
||||
let nonCustomizingTab = gBrowser.tabContainer.querySelector("tab:not([customizemode=true])");
|
||||
let finishedCustomizing = BrowserTestUtils.waitForEvent(gNavToolbox, "aftercustomization");
|
||||
yield BrowserTestUtils.switchTab(gBrowser, nonCustomizingTab);
|
||||
yield finishedCustomizing;
|
||||
|
||||
let startedCount = 0;
|
||||
let handler = e => startedCount++;
|
||||
gNavToolbox.addEventListener("customizationstarting", handler);
|
||||
yield startCustomizing();
|
||||
CustomizableUI.removeWidgetFromArea("home-button");
|
||||
yield gCustomizeMode.reset().catch(e => {
|
||||
ok(false, "Threw an exception trying to reset after making modifications in customize mode: " + e);
|
||||
});
|
||||
|
||||
let newKidCount = document.getElementById("customization-palette").childElementCount;
|
||||
is(newKidCount, paletteKidCount, "Should have just as many items in the palette as before.");
|
||||
yield endCustomizing();
|
||||
is(startedCount, 1, "Should have only started once");
|
||||
gNavToolbox.removeEventListener("customizationstarting", handler);
|
||||
let customizableToolbars = document.querySelectorAll("toolbar[customizable=true]:not([autohide=true])");
|
||||
for (let toolbar of customizableToolbars) {
|
||||
ok(!toolbar.hasAttribute("customizing"), "Toolbar " + toolbar.id + " is no longer customizing");
|
||||
}
|
||||
let menuitem = document.getElementById("PanelUI-customize");
|
||||
isnot(menuitem.getAttribute("label"), menuitem.getAttribute("exitLabel"), "Should have exited successfully");
|
||||
});
|
||||
|
|
@ -191,27 +191,7 @@ function endCustomizing(aWindow=window) {
|
|||
aWindow.gNavToolbox.addEventListener("aftercustomization", onCustomizationEnds);
|
||||
aWindow.gCustomizeMode.exit();
|
||||
|
||||
return deferredEndCustomizing.promise.then(function() {
|
||||
let deferredLoadNewTab = Promise.defer();
|
||||
|
||||
//XXXgijs so some tests depend on this tab being about:blank. Make it so.
|
||||
let newTabBrowser = aWindow.gBrowser.selectedBrowser;
|
||||
newTabBrowser.stop();
|
||||
|
||||
// If we stop early enough, this might actually be about:blank.
|
||||
if (newTabBrowser.currentURI.spec == "about:blank") {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Otherwise, make it be about:blank, and wait for that to be done.
|
||||
function onNewTabLoaded(e) {
|
||||
newTabBrowser.removeEventListener("load", onNewTabLoaded, true);
|
||||
deferredLoadNewTab.resolve();
|
||||
}
|
||||
newTabBrowser.addEventListener("load", onNewTabLoaded, true);
|
||||
newTabBrowser.loadURI("about:blank");
|
||||
return deferredLoadNewTab.promise;
|
||||
});
|
||||
return deferredEndCustomizing.promise;
|
||||
}
|
||||
|
||||
function startCustomizing(aWindow=window) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче