[Pkg-mozext-commits] [tabmixplus] 65/123: Remove leftover blank tab if last session contained only pinned tab(s).
David Prévot
taffit at moszumanska.debian.org
Wed Sep 17 21:16:27 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository tabmixplus.
commit 18134046f938681e03ef09711a11111aaf8bfe4d
Author: onemen <tabmix.onemen at gmail.com>
Date: Mon Sep 1 22:03:42 2014 +0300
Remove leftover blank tab if last session contained only pinned tab(s).
---
chrome/content/links/setup.js | 24 ++++++++++++++----------
chrome/content/session/session.js | 19 ++++++++++++++++++-
2 files changed, 32 insertions(+), 11 deletions(-)
diff --git a/chrome/content/links/setup.js b/chrome/content/links/setup.js
index b3a2cf8..543f988 100644
--- a/chrome/content/links/setup.js
+++ b/chrome/content/links/setup.js
@@ -103,17 +103,19 @@ Tabmix.beforeBrowserInitOnLoad = function() {
bowserStartup = bowserStartup._replace(swapOldCode, swapNewCode);
var firstWindow = this.firstWindowInSession || SM.firstNonPrivateWindow;
- var disAllow = SM.isPrivateWindow || TMP_SessionStore.isSessionStoreEnabled() ||
- this.extensions.sessionManager ||
- !this.isVersion(250) && this.isWindowAfterSessionRestore;
+ var disabled = TMP_SessionStore.isSessionStoreEnabled() ||
+ this.extensions.sessionManager
var sessionManager = this.prefs.getBoolPref("sessions.manager");
- var resumeSession = sessionManager &&
- this.prefs.getIntPref("sessions.onStart") < 2;
- var recoverSession = this.prefs.getBoolPref("sessions.crashRecovery") &&
- this.prefs.prefHasUserValue("sessions.crashed");
-
- SM.doRestore = !disAllow && firstWindow && (recoverSession || resumeSession);
- if (SM.doRestore) {
+ var willRestore = firstWindow && !disabled && (sessionManager &&
+ this.prefs.getIntPref("sessions.onStart") <= 1 ||
+ this.prefs.getBoolPref("sessions.crashRecovery") &&
+ this.prefs.prefHasUserValue("sessions.crashed"));
+ var notRestore = firstWindow && !disabled && sessionManager &&
+ this.prefs.getIntPref("sessions.onStart") > 1;
+ var afterSessionRestore = !this.isVersion(250) && this.isWindowAfterSessionRestore;
+ SM.doRestore = willRestore && !(SM.isPrivateWindow || afterSessionRestore);
+ var willOverrideHomepage = willRestore && !SM.isPrivateWindow;
+ if (willOverrideHomepage) {
// Prevent the default homepage from loading if we're going to restore a session
if (this.isVersion(240)) {
this.changeCode(gBrowserInit, "gBrowserInit._getUriToLoad")._replace(
@@ -126,7 +128,9 @@ Tabmix.beforeBrowserInitOnLoad = function() {
'uriToLoad = gHomeButton.getHomePage() == window.arguments[0] ? null : window.arguments[0];'
);
}
+ }
+ if (SM.doRestore) {
// move this code from gBrowserInit.onLoad to gBrowserInit._delayedStartup after bug 756313
loadOnStartup =
' if (uriToLoad && uriToLoad != "about:blank") {' +
diff --git a/chrome/content/session/session.js b/chrome/content/session/session.js
index 1528b29..4381de1 100644
--- a/chrome/content/session/session.js
+++ b/chrome/content/session/session.js
@@ -385,9 +385,26 @@ var TabmixSessionManager = {
return;
}
+/**
+//XXX TODO - fix the case that last session contained more then one window
+ with pinned tabs. in this case SessionStore will open more windows
+*/
if (Tabmix.isWindowAfterSessionRestore) {
let self = this;
- setTimeout(function(){self.onSessionRestored()}, 0);
+ setTimeout(function(){
+ // remove leftover blank tab if last session contained only pinned tab(s)
+ // we don't selected last session selected tab
+ let last = gBrowser.tabs.length - 1;
+ if (gBrowser._numPinnedTabs == last) {
+ let tab = gBrowser.tabs[last];
+ if (gBrowser.isBlankNotBusyTab(tab, true)) {
+ gBrowser.removeTab(tab);
+ setTimeout(function(){
+ gBrowser.selectedBrowser.focus();
+ }, 0);
+ }
+ }
+ self.onSessionRestored()}, 0);
}
else {
// remove extra tab that was opened by SessionStore if last session
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/tabmixplus.git
More information about the Pkg-mozext-commits
mailing list