зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 2 changesets (bug 1442694) for breaking session restores on update a=backout
Backed out changeset f100f8631f78 (bug 1442694) Backed out changeset 7a20c79a0e12 (bug 1442694)
This commit is contained in:
Родитель
dbddac86aa
Коммит
08b7f8eebb
|
@ -22,11 +22,6 @@
|
|||
display: none;
|
||||
}
|
||||
|
||||
.tab-icon-pending[preopened],
|
||||
.tab-icon-image[preopened] {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.tab-sharing-icon-overlay[sharing]:not([selected]),
|
||||
.tab-icon-overlay[soundplaying][pinned],
|
||||
.tab-icon-overlay[muted][pinned],
|
||||
|
|
|
@ -32,7 +32,6 @@ window._gBrowser = {
|
|||
window.addEventListener("occlusionstatechange", this);
|
||||
|
||||
this._setupInitialBrowserAndTab();
|
||||
this._preopenPinnedTabs();
|
||||
|
||||
if (Services.prefs.getBoolPref("browser.display.use_system_colors")) {
|
||||
this.tabpanels.style.backgroundColor = "-moz-default-background-color";
|
||||
|
@ -384,29 +383,6 @@ window._gBrowser = {
|
|||
browser.webProgress.addProgressListener(filter, Ci.nsIWebProgress.NOTIFY_ALL);
|
||||
},
|
||||
|
||||
_preopenPinnedTabs() {
|
||||
let numPinnedTabs = 0;
|
||||
let windows = browserWindows();
|
||||
windows.getNext();
|
||||
let isOnlyWindow = !windows.hasMoreElements();
|
||||
if (isOnlyWindow) {
|
||||
numPinnedTabs = Services.prefs.getIntPref("browser.tabs.firstWindowRestore.numPinnedTabs", 0);
|
||||
}
|
||||
|
||||
for (let i = 0; i < numPinnedTabs; i++) {
|
||||
let tab = this.addTrustedTab("about:blank", {
|
||||
skipAnimation: true,
|
||||
noInitialLabel: true,
|
||||
skipBackgroundNotify: true,
|
||||
createLazyBrowser: true,
|
||||
pinned: true,
|
||||
isForFirstWindowRestore: true,
|
||||
});
|
||||
|
||||
tab.setAttribute("preopened", "true");
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* BEGIN FORWARDED BROWSER PROPERTIES. IF YOU ADD A PROPERTY TO THE BROWSER ELEMENT
|
||||
* MAKE SURE TO ADD IT HERE AS WELL.
|
||||
|
@ -617,32 +593,14 @@ window._gBrowser = {
|
|||
this.tabContainer._updateCloseButtons();
|
||||
},
|
||||
|
||||
_sendPinnedTabContentMessage(aTab) {
|
||||
_notifyPinnedStatus(aTab) {
|
||||
this.getBrowserForTab(aTab).messageManager.sendAsyncMessage("Browser:AppTab", { isAppTab: aTab.pinned });
|
||||
},
|
||||
|
||||
_notifyPinnedStatus(aTab, aDeferContentMessage = false) {
|
||||
if (!aDeferContentMessage) {
|
||||
this._sendPinnedTabContentMessage(aTab);
|
||||
}
|
||||
|
||||
let event = document.createEvent("Events");
|
||||
event.initEvent(aTab.pinned ? "TabPinned" : "TabUnpinned", true, false);
|
||||
aTab.dispatchEvent(event);
|
||||
},
|
||||
|
||||
_maybeUpdateNumPinnedTabsPref() {
|
||||
if (BrowserWindowTracker.getTopWindow() == window) {
|
||||
Services.prefs.setIntPref("browser.tabs.firstWindowRestore.numPinnedTabs",
|
||||
this._numPinnedTabs);
|
||||
}
|
||||
},
|
||||
|
||||
activatePreopenedPinnedTab(aTab) {
|
||||
this._insertBrowser(aTab);
|
||||
this._sendPinnedTabContentMessage(aTab);
|
||||
},
|
||||
|
||||
pinTab(aTab) {
|
||||
if (aTab.pinned)
|
||||
return;
|
||||
|
@ -654,7 +612,6 @@ window._gBrowser = {
|
|||
aTab.setAttribute("pinned", "true");
|
||||
this._updateTabBarForPinnedTabs();
|
||||
this._notifyPinnedStatus(aTab);
|
||||
this._maybeUpdateNumPinnedTabsPref();
|
||||
},
|
||||
|
||||
unpinTab(aTab) {
|
||||
|
@ -666,7 +623,6 @@ window._gBrowser = {
|
|||
aTab.style.marginInlineStart = "";
|
||||
this._updateTabBarForPinnedTabs();
|
||||
this._notifyPinnedStatus(aTab);
|
||||
this._maybeUpdateNumPinnedTabsPref();
|
||||
},
|
||||
|
||||
previewTab(aTab, aCallback) {
|
||||
|
@ -2340,7 +2296,6 @@ window._gBrowser = {
|
|||
forceNotRemote,
|
||||
fromExternal,
|
||||
index,
|
||||
isForFirstWindowRestore,
|
||||
lazyTabTitle,
|
||||
name,
|
||||
nextTabParentId,
|
||||
|
@ -2524,9 +2479,6 @@ window._gBrowser = {
|
|||
|
||||
if (pinned) {
|
||||
this._updateTabBarForPinnedTabs();
|
||||
if (!isForFirstWindowRestore) {
|
||||
this._maybeUpdateNumPinnedTabsPref();
|
||||
}
|
||||
}
|
||||
this.tabContainer._setPositionalAttributes();
|
||||
|
||||
|
@ -2606,15 +2558,13 @@ window._gBrowser = {
|
|||
userContextId);
|
||||
b.registeredOpenURI = lazyBrowserURI;
|
||||
}
|
||||
if (!isForFirstWindowRestore) {
|
||||
SessionStore.setTabState(t, {
|
||||
entries: [{
|
||||
url: lazyBrowserURI ? lazyBrowserURI.spec : "about:blank",
|
||||
title: lazyTabTitle,
|
||||
triggeringPrincipal_base64: E10SUtils.serializePrincipal(triggeringPrincipal),
|
||||
}],
|
||||
});
|
||||
}
|
||||
SessionStore.setTabState(t, {
|
||||
entries: [{
|
||||
url: lazyBrowserURI ? lazyBrowserURI.spec : "about:blank",
|
||||
title: lazyTabTitle,
|
||||
triggeringPrincipal_base64: E10SUtils.serializePrincipal(triggeringPrincipal),
|
||||
}],
|
||||
});
|
||||
} else {
|
||||
this._insertBrowser(t, true);
|
||||
}
|
||||
|
@ -2652,9 +2602,7 @@ window._gBrowser = {
|
|||
|
||||
// If we didn't swap docShells with a preloaded browser
|
||||
// then let's just continue loading the page normally.
|
||||
if (!usingPreloadedContent &&
|
||||
!createLazyBrowser &&
|
||||
(!uriIsAboutBlank || !allowInheritPrincipal)) {
|
||||
if (!usingPreloadedContent && (!uriIsAboutBlank || !allowInheritPrincipal)) {
|
||||
// pretend the user typed this so it'll be available till
|
||||
// the document successfully loads
|
||||
if (aURI && !gInitialPages.includes(aURI)) {
|
||||
|
@ -2707,7 +2655,7 @@ window._gBrowser = {
|
|||
|
||||
// Additionally send pinned tab events
|
||||
if (pinned) {
|
||||
this._notifyPinnedStatus(t, isForFirstWindowRestore);
|
||||
this._notifyPinnedStatus(t);
|
||||
}
|
||||
|
||||
return t;
|
||||
|
@ -3205,10 +3153,8 @@ window._gBrowser = {
|
|||
this.tabs[i]._tPos = i;
|
||||
|
||||
if (!this._windowIsClosing) {
|
||||
if (wasPinned) {
|
||||
if (wasPinned)
|
||||
this.tabContainer._positionPinnedTabs();
|
||||
this._maybeUpdateNumPinnedTabsPref();
|
||||
}
|
||||
|
||||
// update tab close buttons state
|
||||
this.tabContainer._updateCloseButtons();
|
||||
|
@ -3893,6 +3839,7 @@ window._gBrowser = {
|
|||
skipAnimation: true,
|
||||
index: aIndex,
|
||||
createLazyBrowser,
|
||||
allowInheritPrincipal: createLazyBrowser,
|
||||
};
|
||||
|
||||
let numPinned = this._numPinnedTabs;
|
||||
|
@ -5069,7 +5016,6 @@ class TabProgressListener {
|
|||
this.mTab.removeAttribute("crashed");
|
||||
}
|
||||
|
||||
this.mTab.removeAttribute("preopened");
|
||||
if (this._shouldShowProgress(aRequest)) {
|
||||
if (!(aStateFlags & Ci.nsIWebProgressListener.STATE_RESTORING) &&
|
||||
aWebProgress && aWebProgress.isTopLevel) {
|
||||
|
|
|
@ -1937,10 +1937,10 @@
|
|||
anonid="tab-throbber"
|
||||
class="tab-throbber"
|
||||
layer="true"/>
|
||||
<xul:hbox xbl:inherits="fadein,pinned,busy,progress,selected=visuallyselected,pendingicon,preopened"
|
||||
<xul:hbox xbl:inherits="fadein,pinned,busy,progress,selected=visuallyselected,pendingicon"
|
||||
anonid="tab-icon-pending"
|
||||
class="tab-icon-pending"/>
|
||||
<xul:image xbl:inherits="src=image,triggeringprincipal=iconloadingprincipal,requestcontextid,fadein,pinned,selected=visuallyselected,busy,crashed,sharing,preopened"
|
||||
<xul:image xbl:inherits="src=image,triggeringprincipal=iconloadingprincipal,requestcontextid,fadein,pinned,selected=visuallyselected,busy,crashed,sharing"
|
||||
anonid="tab-icon-image"
|
||||
class="tab-icon-image"
|
||||
validate="never"
|
||||
|
|
|
@ -249,8 +249,8 @@ var SessionStore = {
|
|||
return SessionStoreInternal.getWindowState(aWindow);
|
||||
},
|
||||
|
||||
setWindowState: function ss_setWindowState(aWindow, aState, aOverwrite, aFirstWindow) {
|
||||
SessionStoreInternal.setWindowState(aWindow, aState, aOverwrite, aFirstWindow);
|
||||
setWindowState: function ss_setWindowState(aWindow, aState, aOverwrite) {
|
||||
SessionStoreInternal.setWindowState(aWindow, aState, aOverwrite);
|
||||
},
|
||||
|
||||
getTabState: function ss_getTabState(aTab) {
|
||||
|
@ -731,7 +731,6 @@ var SessionStoreInternal = {
|
|||
this._prefBranch.addObserver("sessionstore.max_windows_undo", this, true);
|
||||
|
||||
this._restore_on_demand = this._prefBranch.getBoolPref("sessionstore.restore_on_demand");
|
||||
this._restore_pinned_tabs_on_demand = this._prefBranch.getBoolPref("sessionstore.restore_pinned_tabs_on_demand");
|
||||
this._prefBranch.addObserver("sessionstore.restore_on_demand", this, true);
|
||||
|
||||
gResistFingerprintingEnabled = Services.prefs.getBoolPref("privacy.resistFingerprinting");
|
||||
|
@ -2500,15 +2499,12 @@ var SessionStoreInternal = {
|
|||
throw Components.Exception("Window is not tracked", Cr.NS_ERROR_INVALID_ARG);
|
||||
},
|
||||
|
||||
setWindowState: function ssi_setWindowState(aWindow, aState, aOverwrite, aFirstWindow) {
|
||||
setWindowState: function ssi_setWindowState(aWindow, aState, aOverwrite) {
|
||||
if (!aWindow.__SSi) {
|
||||
throw Components.Exception("Window is not tracked", Cr.NS_ERROR_INVALID_ARG);
|
||||
}
|
||||
|
||||
this.restoreWindows(aWindow, aState, {
|
||||
overwriteTabs: aOverwrite,
|
||||
firstWindow: aFirstWindow,
|
||||
});
|
||||
this.restoreWindows(aWindow, aState, {overwriteTabs: aOverwrite});
|
||||
|
||||
// Notify of changes to closed objects.
|
||||
this._notifyOfClosedObjectsChange();
|
||||
|
@ -3207,7 +3203,6 @@ var SessionStoreInternal = {
|
|||
if (!uriObj || (uriObj && !window.gBrowser.isLocalAboutURI(uriObj))) {
|
||||
tab.setAttribute("busy", "true");
|
||||
}
|
||||
tab.removeAttribute("preopened");
|
||||
|
||||
// Hack to ensure that the about:home, about:newtab, and about:welcome
|
||||
// favicon is loaded instantaneously, to avoid flickering and improve
|
||||
|
@ -3655,7 +3650,7 @@ var SessionStoreInternal = {
|
|||
|
||||
// We need to keep track of the initially open tabs so that they
|
||||
// can be moved to the end of the restored tabs.
|
||||
let initialTabs = [];
|
||||
let initialTabs;
|
||||
if (!overwriteTabs && firstWindow) {
|
||||
initialTabs = Array.slice(tabbrowser.tabs);
|
||||
}
|
||||
|
@ -3663,11 +3658,8 @@ var SessionStoreInternal = {
|
|||
// Get rid of tabs that aren't needed anymore.
|
||||
if (overwriteTabs) {
|
||||
for (let i = tabbrowser.browsers.length - 1; i >= 0; i--) {
|
||||
if (!tabbrowser.tabs[i].selected &&
|
||||
!tabbrowser.tabs[i].hasAttribute("preopened")) {
|
||||
if (!tabbrowser.tabs[i].selected) {
|
||||
tabbrowser.removeTab(tabbrowser.tabs[i]);
|
||||
} else if (tabbrowser.tabs[i].hasAttribute("preopened")) {
|
||||
initialTabs.push(tabbrowser.tabs[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3686,24 +3678,13 @@ var SessionStoreInternal = {
|
|||
if (select &&
|
||||
tabbrowser.selectedTab.userContextId == userContextId) {
|
||||
tab = tabbrowser.selectedTab;
|
||||
if (tab.pinned && !tabData.pinned) {
|
||||
if (!tabData.pinned) {
|
||||
tabbrowser.unpinTab(tab);
|
||||
} else if (!tab.pinned && tabData.pinned) {
|
||||
tabbrowser.removeTab(tabbrowser.tabs[t]);
|
||||
tabbrowser.pinTab(tab);
|
||||
tabbrowser.moveTabTo(tab, t);
|
||||
}
|
||||
|
||||
tabbrowser.moveTabToEnd();
|
||||
if (aWindow.gMultiProcessBrowser && !tab.linkedBrowser.isRemoteBrowser) {
|
||||
tabbrowser.updateBrowserRemoteness(tab.linkedBrowser, true);
|
||||
}
|
||||
} else if (tabData.pinned &&
|
||||
tabbrowser.tabs[t] &&
|
||||
tabbrowser.tabs[t].pinned &&
|
||||
!tabbrowser.tabs[t].linkedPanel) {
|
||||
tab = tabbrowser.tabs[t];
|
||||
tabbrowser.activatePreopenedPinnedTab(tab);
|
||||
}
|
||||
|
||||
// Add a new tab if needed.
|
||||
|
@ -3752,14 +3733,11 @@ var SessionStoreInternal = {
|
|||
}
|
||||
|
||||
// Move the originally open tabs to the end.
|
||||
let endPosition = tabbrowser.tabs.length - 1;
|
||||
for (let tab of initialTabs) {
|
||||
if (tab.hasAttribute("preopened") &&
|
||||
!tab.linkedPanel) {
|
||||
tabbrowser.removeTab(tab);
|
||||
} else if (!tab.hasAttribute("preopened")) {
|
||||
tabbrowser.unpinTab(tab);
|
||||
tabbrowser.moveTabTo(tab, endPosition);
|
||||
if (initialTabs) {
|
||||
let endPosition = tabbrowser.tabs.length - 1;
|
||||
for (let i = 0; i < initialTabs.length; i++) {
|
||||
tabbrowser.unpinTab(initialTabs[i]);
|
||||
tabbrowser.moveTabTo(initialTabs[i], endPosition);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4020,9 +3998,6 @@ var SessionStoreInternal = {
|
|||
for (let t = 0; t < aTabs.length; t++) {
|
||||
if (t != selectedIndex) {
|
||||
this.restoreTab(aTabs[t], aTabData[t]);
|
||||
if (this._restore_pinned_tabs_on_demand) {
|
||||
aTabs[t].removeAttribute("preopened");
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -113,7 +113,6 @@ skip-if = (verify && (os == 'win' || os == 'mac'))
|
|||
[browser_old_favicon.js]
|
||||
[browser_page_title.js]
|
||||
[browser_pending_tabs.js]
|
||||
[browser_preopened_apptabs.js]
|
||||
[browser_privatetabs.js]
|
||||
[browser_purge_shistory.js]
|
||||
skip-if = e10s # Bug 1271024
|
||||
|
|
|
@ -1,138 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
const PREF_RESTORE_ON_DEMAND = "browser.sessionstore.restore_on_demand";
|
||||
const PREF_NUM_PINNED_TABS = "browser.tabs.firstWindowRestore.numPinnedTabs";
|
||||
|
||||
function muffleMainWindowType() {
|
||||
let oldWinType = document.documentElement.getAttribute("windowtype");
|
||||
// Check if we've already done this to allow calling multiple times:
|
||||
if (oldWinType != "navigator:testrunner") {
|
||||
// Make the main test window not count as a browser window any longer
|
||||
document.documentElement.setAttribute("windowtype", "navigator:testrunner");
|
||||
|
||||
registerCleanupFunction(() => {
|
||||
document.documentElement.setAttribute("windowtype", oldWinType);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
Services.prefs.clearUserPref(PREF_NUM_PINNED_TABS);
|
||||
});
|
||||
|
||||
add_task(async function testPrefSynced() {
|
||||
Services.prefs.setIntPref(PREF_NUM_PINNED_TABS, 3);
|
||||
|
||||
let state = { windows: [{ tabs: [
|
||||
{ entries: [{ url: "http://example.org/#1", triggeringPrincipal_base64 }], pinned: true },
|
||||
{ entries: [{ url: "http://example.org/#2", triggeringPrincipal_base64 }], pinned: true },
|
||||
{ entries: [{ url: "http://example.org/#3", triggeringPrincipal_base64 }], pinned: true },
|
||||
], selected: 3 }] };
|
||||
|
||||
muffleMainWindowType();
|
||||
let win = await BrowserTestUtils.openNewBrowserWindow();
|
||||
Assert.equal([...win.gBrowser.tabs].filter(t => t.pinned).length, 3);
|
||||
Assert.equal([...win.gBrowser.tabs].filter(t => !!t.linkedPanel).length, 1);
|
||||
await setWindowState(win, state, false, true);
|
||||
Assert.equal([...win.gBrowser.tabs].filter(t => t.pinned).length, 3);
|
||||
Assert.equal([...win.gBrowser.tabs].filter(t => !!t.linkedPanel).length, 4);
|
||||
await BrowserTestUtils.closeWindow(win);
|
||||
});
|
||||
|
||||
add_task(async function testPrefSyncedSelected() {
|
||||
Services.prefs.setIntPref(PREF_NUM_PINNED_TABS, 3);
|
||||
|
||||
let state = { windows: [{ tabs: [
|
||||
{ entries: [{ url: "http://example.org/#1", triggeringPrincipal_base64 }], pinned: true },
|
||||
{ entries: [{ url: "http://example.org/#2", triggeringPrincipal_base64 }], pinned: true },
|
||||
{ entries: [{ url: "http://example.org/#3", triggeringPrincipal_base64 }], pinned: true },
|
||||
], selected: 1 }] };
|
||||
|
||||
muffleMainWindowType();
|
||||
let win = await BrowserTestUtils.openNewBrowserWindow();
|
||||
Assert.equal([...win.gBrowser.tabs].filter(t => t.pinned).length, 3);
|
||||
Assert.equal([...win.gBrowser.tabs].filter(t => !!t.linkedPanel).length, 1);
|
||||
await setWindowState(win, state, false, true);
|
||||
Assert.equal([...win.gBrowser.tabs].filter(t => t.pinned).length, 3);
|
||||
Assert.equal([...win.gBrowser.tabs].filter(t => !!t.linkedPanel).length, 4);
|
||||
await BrowserTestUtils.closeWindow(win);
|
||||
});
|
||||
|
||||
add_task(async function testPrefTooHigh() {
|
||||
Services.prefs.setIntPref(PREF_NUM_PINNED_TABS, 5);
|
||||
|
||||
let state = { windows: [{ tabs: [
|
||||
{ entries: [{ url: "http://example.org/#1", triggeringPrincipal_base64 }], pinned: true },
|
||||
{ entries: [{ url: "http://example.org/#2", triggeringPrincipal_base64 }], pinned: true },
|
||||
{ entries: [{ url: "http://example.org/#3", triggeringPrincipal_base64 }], pinned: true },
|
||||
], selected: 3 }] };
|
||||
|
||||
muffleMainWindowType();
|
||||
let win = await BrowserTestUtils.openNewBrowserWindow();
|
||||
Assert.equal([...win.gBrowser.tabs].filter(t => t.pinned).length, 5);
|
||||
Assert.equal([...win.gBrowser.tabs].filter(t => !!t.linkedPanel).length, 1);
|
||||
await setWindowState(win, state, false, true);
|
||||
Assert.equal([...win.gBrowser.tabs].filter(t => t.pinned).length, 3);
|
||||
Assert.equal([...win.gBrowser.tabs].filter(t => !!t.linkedPanel).length, 4);
|
||||
await BrowserTestUtils.closeWindow(win);
|
||||
});
|
||||
|
||||
add_task(async function testPrefTooLow() {
|
||||
Services.prefs.setIntPref(PREF_NUM_PINNED_TABS, 1);
|
||||
|
||||
let state = { windows: [{ tabs: [
|
||||
{ entries: [{ url: "http://example.org/#1", triggeringPrincipal_base64 }], pinned: true },
|
||||
{ entries: [{ url: "http://example.org/#2", triggeringPrincipal_base64 }], pinned: true },
|
||||
{ entries: [{ url: "http://example.org/#3", triggeringPrincipal_base64 }], pinned: true },
|
||||
], selected: 3 }] };
|
||||
|
||||
muffleMainWindowType();
|
||||
let win = await BrowserTestUtils.openNewBrowserWindow();
|
||||
Assert.equal([...win.gBrowser.tabs].filter(t => t.pinned).length, 1);
|
||||
Assert.equal([...win.gBrowser.tabs].filter(t => !!t.linkedPanel).length, 1);
|
||||
await setWindowState(win, state, false, true);
|
||||
Assert.equal([...win.gBrowser.tabs].filter(t => t.pinned).length, 3);
|
||||
Assert.equal([...win.gBrowser.tabs].filter(t => !!t.linkedPanel).length, 4);
|
||||
await BrowserTestUtils.closeWindow(win);
|
||||
});
|
||||
|
||||
add_task(async function testPrefTooHighSelected() {
|
||||
Services.prefs.setIntPref(PREF_NUM_PINNED_TABS, 5);
|
||||
|
||||
let state = { windows: [{ tabs: [
|
||||
{ entries: [{ url: "http://example.org/#1", triggeringPrincipal_base64 }], pinned: true },
|
||||
{ entries: [{ url: "http://example.org/#2", triggeringPrincipal_base64 }], pinned: true },
|
||||
{ entries: [{ url: "http://example.org/#3", triggeringPrincipal_base64 }], pinned: true },
|
||||
], selected: 1 }] };
|
||||
|
||||
muffleMainWindowType();
|
||||
let win = await BrowserTestUtils.openNewBrowserWindow();
|
||||
Assert.equal([...win.gBrowser.tabs].filter(t => t.pinned).length, 5);
|
||||
Assert.equal([...win.gBrowser.tabs].filter(t => !!t.linkedPanel).length, 1);
|
||||
await setWindowState(win, state, false, true);
|
||||
Assert.equal([...win.gBrowser.tabs].filter(t => t.pinned).length, 3);
|
||||
Assert.equal([...win.gBrowser.tabs].filter(t => !!t.linkedPanel).length, 4);
|
||||
await BrowserTestUtils.closeWindow(win);
|
||||
});
|
||||
|
||||
add_task(async function testPrefTooLowSelected() {
|
||||
Services.prefs.setIntPref(PREF_NUM_PINNED_TABS, 1);
|
||||
|
||||
let state = { windows: [{ tabs: [
|
||||
{ entries: [{ url: "http://example.org/#1", triggeringPrincipal_base64 }], pinned: true },
|
||||
{ entries: [{ url: "http://example.org/#2", triggeringPrincipal_base64 }], pinned: true },
|
||||
{ entries: [{ url: "http://example.org/#3", triggeringPrincipal_base64 }], pinned: true },
|
||||
], selected: 1 }] };
|
||||
|
||||
muffleMainWindowType();
|
||||
let win = await BrowserTestUtils.openNewBrowserWindow();
|
||||
Assert.equal([...win.gBrowser.tabs].filter(t => t.pinned).length, 1);
|
||||
Assert.equal([...win.gBrowser.tabs].filter(t => !!t.linkedPanel).length, 1);
|
||||
await setWindowState(win, state, false, true);
|
||||
Assert.equal([...win.gBrowser.tabs].filter(t => t.pinned).length, 3);
|
||||
Assert.equal([...win.gBrowser.tabs].filter(t => !!t.linkedPanel).length, 4);
|
||||
await BrowserTestUtils.closeWindow(win);
|
||||
});
|
|
@ -190,9 +190,8 @@ async function setBrowserState(state, win = window) {
|
|||
await promiseWindowRestored(win);
|
||||
}
|
||||
|
||||
async function setWindowState(win, state, overwrite = false, firstWindow = false) {
|
||||
ss.setWindowState(win, typeof state != "string" ? JSON.stringify(state) : state,
|
||||
overwrite, firstWindow);
|
||||
async function setWindowState(win, state, overwrite = false) {
|
||||
ss.setWindowState(win, typeof state != "string" ? JSON.stringify(state) : state, overwrite);
|
||||
await promiseWindowRestored(win);
|
||||
}
|
||||
|
||||
|
|
|
@ -96,11 +96,6 @@ function _untrackWindowOrder(window) {
|
|||
_trackedWindows.splice(idx, 1);
|
||||
}
|
||||
|
||||
function _trackPinnedTabs(window) {
|
||||
Services.prefs.setIntPref("browser.tabs.firstWindowRestore.numPinnedTabs",
|
||||
window.gBrowser._numPinnedTabs);
|
||||
}
|
||||
|
||||
// Methods that impact a window. Put into single object for organization.
|
||||
var WindowHelper = {
|
||||
addWindow(window) {
|
||||
|
@ -143,7 +138,6 @@ var WindowHelper = {
|
|||
|
||||
_untrackWindowOrder(window);
|
||||
_trackWindowOrder(window);
|
||||
_trackPinnedTabs(window);
|
||||
|
||||
_updateCurrentContentOuterWindowID(window.gBrowser.selectedBrowser);
|
||||
},
|
||||
|
|
Загрузка…
Ссылка в новой задаче