Skip to content

Commit e854a91

Browse files
committed
Merge branch 'nightly'
Conflicts: chrome/content/tabutils-st.js chrome/content/tabutils.js
2 parents 4d025f1 + 62c0cf6 commit e854a91

File tree

5 files changed

+66
-27
lines changed

5 files changed

+66
-27
lines changed

chrome/content/tabutils-pt.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ tabutils._phantomTabs = function() {
5757
}
5858

5959
if (!aRestoring) {
60-
tabutils._ss.setTabValue(aTab, "pinned", true);
61-
tabutils._ss.setTabValue(aTab, "bookmarkId", aTab.bookmarkId);
60+
tabutils._ss.setTabValue(aTab, "pinned", "true");
61+
tabutils._ss.setTabValue(aTab, "bookmarkId", String(aTab.bookmarkId || "")); // Bug 961646
6262
}
6363
aTab.dispatchEvent(new CustomEvent("TabPinning", {bubbles: true}));
6464

chrome/content/tabutils.js

Lines changed: 55 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -582,10 +582,38 @@ tabutils._tabOpeningOptions = function() {
582582
let win = aWebProgress.DOMWindow;
583583
win._closeTimer = win.setTimeout(function() {
584584
this.mTabBrowser.isBlankTab(this.mTab) && this.mTabBrowser.removeTab(this.mTab);
585-
}.bind(this), 250);
585+
}.bind(this), 750);
586586
}
587587
});
588588

589+
let tmp = {};
590+
Cu.import("resource://gre/modules/DownloadLastDir.jsm", tmp);
591+
592+
if (tmp.DownloadLastDir && // Bug 722995 [Fx19]
593+
tmp.DownloadLastDir.prototype.getFileAsync && // Bug 854299 [Fx23]
594+
tmp.DownloadLastDir.prototype.getFileAsync.name != "TU_getFileAsync")
595+
tmp.DownloadLastDir.prototype.getFileAsync = (function() {
596+
let getFileAsync = tmp.DownloadLastDir.prototype.getFileAsync;
597+
return function TU_getFileAsync(aURI, aCallback) {
598+
let win = this.window;
599+
if (win._closeTimer) {
600+
win.clearTimeout(win._closeTimer);
601+
win._closeTimer = null;
602+
603+
aCallback = (function() {
604+
let lastDirCallback = aCallback;
605+
return function TU_LastDirCallback(lastDir) {
606+
lastDirCallback(lastDir);
607+
if (!win.closed) {
608+
win.setTimeout(win.close, 250);
609+
}
610+
};
611+
})();
612+
}
613+
getFileAsync.apply(this, arguments);
614+
};
615+
})();
616+
589617
//在当前标签页的右侧打开新标签页
590618
//连续打开后台标签时保持原有顺序
591619
TU_hookCode("gBrowser.addTab",
@@ -602,7 +630,7 @@ tabutils._tabOpeningOptions = function() {
602630

603631
if (TU_getPref("extensions.tabutils.openTabNext.keepOrder", true)) {
604632
let tab = lastRelatedTab.nextSibling;
605-
let panelId = this.mCurrentTab.linkedPanel;
633+
let panelId = this.mCurrentTab.linkedPanel + "#";
606634
for (; tab && tab.pinned; tab = tab.nextSibling);
607635
for (; tab && tab.getAttribute("opener") == panelId && tab != t && (!willStack || shouldStack(tab)); tab = tab.nextSibling)
608636
lastRelatedTab = tab;
@@ -624,7 +652,7 @@ tabutils._tabOpeningOptions = function() {
624652
default: return false; //None
625653
}
626654
})()) {
627-
aTab.setAttribute("opener", this.mCurrentTab.linkedPanel);
655+
aTab.setAttribute("opener", this.mCurrentTab.linkedPanel + "#");
628656
}
629657
});
630658

@@ -766,7 +794,7 @@ tabutils._tabClosingOptions = function() {
766794

767795
//关闭标签页时选择亲属标签
768796
TU_hookCode("gBrowser.onTabSelect", "}", function() {
769-
var panelId = aTab.linkedPanel;
797+
var panelId = aTab.linkedPanel + "#";
770798
Array.forEach(this.visibleTabs, function(aTab) {
771799
if (aTab.getAttribute("opener").startsWith(panelId))
772800
aTab.setAttribute("opener", panelId + (+aTab.getAttribute("opener").slice(panelId.length) + 1));
@@ -776,7 +804,7 @@ tabutils._tabClosingOptions = function() {
776804
TU_hookCode("gBrowser.onTabClose", "}", function() {
777805
if (aTab.hasAttribute("opener")) {
778806
let opener = aTab.getAttribute("opener");
779-
let panelId = aTab.linkedPanel;
807+
let panelId = aTab.linkedPanel + "#";
780808
Array.forEach(this.visibleTabs, function(aTab) {
781809
if (aTab.getAttribute("opener").startsWith(panelId))
782810
aTab.setAttribute("opener", opener);
@@ -794,8 +822,8 @@ tabutils._tabClosingOptions = function() {
794822
bTab = this.mCurrentTab;
795823

796824
return aTab.hasAttribute("opener") && aTab.getAttribute("opener") == bTab.getAttribute("opener")
797-
|| aTab.getAttribute("opener").startsWith(bTab.linkedPanel)
798-
|| bTab.getAttribute("opener").startsWith(aTab.linkedPanel);
825+
|| aTab.getAttribute("opener").startsWith(bTab.linkedPanel + "#")
826+
|| bTab.getAttribute("opener").startsWith(aTab.linkedPanel + "#");
799827
};
800828

801829
//关闭标签页时选择上次浏览的标签
@@ -2360,17 +2388,11 @@ tabutils._miscFeatures = function() {
23602388
switch (sheet.href) {
23612389
case "chrome://browser/skin/browser.css":
23622390
for (let cssRule of Array.slice(sheet.cssRules)) {
2363-
if (/> .tabbrowser-tab/.test(cssRule.selectorText)) {
2364-
tabutils.insertRule(cssRule.cssText.replace(RegExp.lastMatch, ".tabbrowser-tab"));
2365-
continue;
2366-
}
2367-
2368-
if (/> .tabbrowser-arrowscrollbox > .arrowscrollbox-scrollbox/.test(cssRule.selectorText)) {
2369-
tabutils.insertRule(cssRule.cssText.replace(RegExp.lastMatch, "#PinnedTabsBarItems"));
2370-
continue;
2371-
}
2372-
23732391
switch (cssRule.selectorText) {
2392+
case "#tabbrowser-tabs[positionpinnedtabs] > .tabbrowser-tab[pinned]:before": // Bug 877368 [Fx29]
2393+
case "#tabbrowser-tabs[positionpinnedtabs] > .tabbrowser-tab[pinned]::before":
2394+
tabutils.insertRule(cssRule.cssText.replace("#tabbrowser-tabs[positionpinnedtabs] >", ""));
2395+
break;
23742396
case ".tabbrowser-arrowscrollbox > .arrowscrollbox-scrollbox":
23752397
tabutils.insertRule(cssRule.cssText.replace(cssRule.selectorText, ".tabbrowser-tabs[orient='horizontal']:not([overflow]):not([multirow]) $&"))
23762398
.style.MozMarginStart = "-" + cssRule.style.MozPaddingStart;
@@ -2382,6 +2404,16 @@ tabutils._miscFeatures = function() {
23822404
case ".tab-throbber[pinned], .tab-icon-image[pinned], .tabs-newtab-button > .toolbarbutton-icon":
23832405
tabutils.insertRule(cssRule.cssText.replace(cssRule.selectorText, '.tabbrowser-tabs[orient="horizontal"] > .tabbrowser-tab[faviconized] :-moz-any(.tab-throbber, .tab-icon-image)'));
23842406
break;
2407+
default:
2408+
if (/> .tabbrowser-tab/.test(cssRule.selectorText)) {
2409+
tabutils.insertRule(cssRule.cssText.replace(RegExp.lastMatch, ".tabbrowser-tab"));
2410+
continue;
2411+
}
2412+
2413+
if (/> .tabbrowser-arrowscrollbox > .arrowscrollbox-scrollbox/.test(cssRule.selectorText)) {
2414+
tabutils.insertRule(cssRule.cssText.replace(RegExp.lastMatch, "#PinnedTabsBarItems"));
2415+
continue;
2416+
}
23852417
}
23862418
}
23872419
break;
@@ -2714,6 +2746,11 @@ tabutils._hideTabBar = function() {
27142746
toolbarNodes.push(tabsToolbar);
27152747
});
27162748

2749+
if ("getTogglableToolbars" in window) // Bug 940669 [Fx29]
2750+
TU_hookCode("getTogglableToolbars", /(?=.*return.*)/, function() {
2751+
toolbarNodes = [...new Set(toolbarNodes)];
2752+
});
2753+
27172754
TU_hookCode("setToolbarVisibility", /.*setAttribute.*/, 'if (toolbar.id == "TabsToolbar") gBrowser.mTabContainer.visible = isVisible; else $&');
27182755
TU_hookCode("gBrowser.mTabContainer.updateVisibility", "{", 'if (!TU_getPref("browser.tabs.autoHide")) return;');
27192756
};
@@ -2785,7 +2822,7 @@ tabutils._undoCloseTabButton = function() {
27852822
document.getElementById("History:UndoCloseTab").removeAttribute("disabled");
27862823
gBrowser._lastClosedTabsCount = null;
27872824
};
2788-
//tabutils.updateUndoCloseTabCommand();
2825+
document.getElementById("History:UndoCloseTab").setAttribute("disabled", true);
27892826
TU_hookCode("gBrowser.onTabClose", "}", "tabutils.updateUndoCloseTabCommand();");
27902827
TU_hookCode("gBrowser.onTabRestoring", "}", "tabutils.updateUndoCloseTabCommand();");
27912828
TU_hookCode("gSessionHistoryObserver.observe", "}", "tabutils.updateUndoCloseTabCommand();");

chrome/content/tabutils.xul

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -419,13 +419,14 @@
419419

420420
<vbox id="browser-panel">
421421
<hbox id="fullscr-toggler" collapsed="true" insertbefore="browser"/>
422-
<hbox id="browser">
423-
<vbox id="fullscr-toggler-left" collapsed="true" insertbefore="appcontent"/>
424-
<vbox id="fullscr-toggler-right" collapsed="true" insertafter="appcontent"/>
425-
</hbox>
426422
<hbox id="fullscr-toggler-bottom" collapsed="true" insertafter="browser"/>
427423
</vbox>
428424

425+
<hbox id="browser">
426+
<vbox id="fullscr-toggler-left" collapsed="true" insertbefore="appcontent"/>
427+
<vbox id="fullscr-toggler-right" collapsed="true" insertafter="appcontent"/>
428+
</hbox>
429+
429430
<statusbar id="status-bar">
430431
<statusbarpanel id="statusbar-openintab"
431432
class="statusbarpanel-iconic-text"

chrome/content/unknownContentType.xul

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
if (win && win._closeTimer) {
77
win.clearTimeout(win._closeTimer);
88
window.addEventListener("unload", function() {
9-
win && win.setTimeout(function() {this.close();}, 250);
9+
if (win._closeTimer && !win.closed)
10+
win._closeTimer = win.setTimeout(win.close, 250);
1011
}, false);
1112
}
1213
]]>

chrome/skin/tabutils.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ menuseparator:last-child {
6767
}
6868

6969
.tabbrowser-tab[locked] .tab-throbber:not([busy]) {
70-
-moz-margin-end: -8px;
70+
-moz-margin-end: -8px !important;
7171
}
7272

7373
.tabbrowser-tab[locked] .tab-throbber:not([busy]) + .tab-icon-image {
74-
-moz-margin-start: -8px;
74+
-moz-margin-start: -8px !important;
7575
position: relative;
7676
z-index: -1;
7777
}

0 commit comments

Comments
 (0)