Remove codes for outdated versions of Firefox
This commit is contained in:
parent
802d6ea7d3
commit
c91ffcac54
@ -17,17 +17,6 @@ var TreeStyleTabWindowHelper = {
|
||||
) {
|
||||
target = 'gBrowserInit._delayedStartup';
|
||||
}
|
||||
else if ( // legacy code for Firefox 18 and olders
|
||||
'onLoad' in gBrowserInit &&
|
||||
(source = gBrowserInit.onLoad.toSource()) &&
|
||||
source.indexOf('swapBrowsersAndCloseOther') > -1
|
||||
) {
|
||||
target = 'gBrowserInit.onLoad';
|
||||
}
|
||||
}
|
||||
else if ('BrowserStartup' in window) { // legacy code for Firefox 15 and olders
|
||||
source = window.BrowserStartup.toSource();
|
||||
target = 'BrowserStartup';
|
||||
}
|
||||
if (!target)
|
||||
dump('Tree Style Tab: failed to initialize startup function!');
|
||||
@ -290,18 +279,12 @@ var TreeStyleTabWindowHelper = {
|
||||
));
|
||||
}
|
||||
|
||||
if ('TabsOnTop' in window && TabsOnTop.syncUI) { // Firefox 12 or later
|
||||
if ('TabsOnTop' in window && TabsOnTop.syncUI) {
|
||||
eval('TabsOnTop.syncUI = '+TabsOnTop.syncUI.toSource().replace(
|
||||
/(\}\)?)$/,
|
||||
'gBrowser.treeStyleTab.onTabsOnTopSyncCommand(enabled); $&'
|
||||
));
|
||||
}
|
||||
if ('TabsOnTop' in window && TabsOnTop.syncCommand) { // Firefox 4-11
|
||||
eval('TabsOnTop.syncCommand = '+TabsOnTop.syncCommand.toSource().replace(
|
||||
/(\}\)?)$/,
|
||||
'gBrowser.treeStyleTab.onTabsOnTopSyncCommand(enabled); $&'
|
||||
));
|
||||
}
|
||||
|
||||
if ('toggleSidebar' in window) {
|
||||
eval('window.toggleSidebar = '+
|
||||
@ -357,7 +340,7 @@ var TreeStyleTabWindowHelper = {
|
||||
tabbar.addEventListener('click', this.service, true);
|
||||
|
||||
var newTabButton = document.getElementById('new-tab-button');
|
||||
const nsIDOMNode = Ci.nsIDOM3Node || Ci.nsIDOMNode; // on Firefox 7, nsIDOM3Node was merged to nsIDOMNode.
|
||||
const nsIDOMNode = Ci.nsIDOMNode;
|
||||
if (newTabButton &&
|
||||
!(tabbar.compareDocumentPosition(newTabButton) & nsIDOMNode.DOCUMENT_POSITION_CONTAINED_BY))
|
||||
newTabButton.parentNode.addEventListener('click', this.service, true);
|
||||
@ -375,7 +358,7 @@ var TreeStyleTabWindowHelper = {
|
||||
tabbar.removeEventListener('click', this.service, true);
|
||||
|
||||
var newTabButton = document.getElementById('new-tab-button');
|
||||
const nsIDOMNode = Ci.nsIDOM3Node || Ci.nsIDOMNode; // on Firefox 7, nsIDOM3Node was merged to nsIDOMNode.
|
||||
const nsIDOMNode = Ci.nsIDOMNode;
|
||||
if (newTabButton &&
|
||||
!(tabbar.compareDocumentPosition(newTabButton) & Ci.nsIDOMNode.DOCUMENT_POSITION_CONTAINED_BY))
|
||||
newTabButton.parentNode.removeEventListener('click', this.service, true);
|
||||
@ -390,18 +373,8 @@ var TreeStyleTabWindowHelper = {
|
||||
var b = aTabBrowser;
|
||||
|
||||
let (source = b.moveTabForward.toSource()) {
|
||||
if (source.indexOf('nextTab.hidden') < 0) { // Firefox 19 or olders
|
||||
source = source.replace(
|
||||
'{', '{ var nextTab;'
|
||||
).replace(
|
||||
'tabPos < this.browsers.length - 1',
|
||||
'nextTab = this.treeStyleTab.getNextSiblingTab(this.mCurrentTab)'
|
||||
).replace(
|
||||
'tabPos + 1', 'nextTab._tPos'
|
||||
);
|
||||
}
|
||||
else {
|
||||
source = source.replace(
|
||||
eval('b.moveTabForward = '+
|
||||
source.replace(
|
||||
'if (nextTab)',
|
||||
'(function() {\n' +
|
||||
' if (this.treeStyleTab.hasChildTabs(this.mCurrentTab)) {\n' +
|
||||
@ -411,10 +384,7 @@ var TreeStyleTabWindowHelper = {
|
||||
' }\n' +
|
||||
'}).call(this);' +
|
||||
'$&'
|
||||
);
|
||||
}
|
||||
eval('b.moveTabForward = '+
|
||||
source.replace(
|
||||
).replace(
|
||||
/(this.moveTabTo\([^;]+\);)/,
|
||||
'(function() {\n' +
|
||||
' let descendant = this.treeStyleTab.getDescendantTabs(nextTab);\n' +
|
||||
@ -442,16 +412,6 @@ var TreeStyleTabWindowHelper = {
|
||||
}
|
||||
|
||||
let (source = b.moveTabBackward.toSource()) {
|
||||
if (source.indexOf('prevTab.hidden') < 0) { // Firefox 19 or olders
|
||||
source = source.replace(
|
||||
'{', '{ var prevTab;'
|
||||
).replace(
|
||||
'tabPos > 0',
|
||||
'prevTab = this.treeStyleTab.getPreviousSiblingTab(this.mCurrentTab)'
|
||||
).replace(
|
||||
'tabPos - 1', 'prevTab._tPos'
|
||||
);
|
||||
}
|
||||
eval('b.moveTabBackward = '+
|
||||
source.replace(
|
||||
'this.moveTabToEnd();',
|
||||
|
@ -321,8 +321,6 @@ var TreeStyleTabBase = {
|
||||
{
|
||||
let target = targets.getNext()
|
||||
.QueryInterface(Ci.nsIDOMWindow);
|
||||
if ('nsIDOMWindowInternal' in Ci) // for Firefox 7 or olders
|
||||
target = target.QueryInterface(Ci.nsIDOMWindowInternal);
|
||||
windows.push(target);
|
||||
}
|
||||
|
||||
|
@ -740,7 +740,6 @@ TreeStyleTabBrowser.prototype = {
|
||||
Services.obs.addObserver(this, this.kTOPIC_INDENT_MODIFIED, false);
|
||||
Services.obs.addObserver(this, this.kTOPIC_COLLAPSE_EXPAND_ALL, false);
|
||||
Services.obs.addObserver(this, this.kTOPIC_CHANGE_TREEVIEW_AVAILABILITY, false);
|
||||
Services.obs.addObserver(this, 'private-browsing-change-granted', false); // only for Firefox 19 and olders
|
||||
Services.obs.addObserver(this, 'lightweight-theme-styling-update', false);
|
||||
prefs.addPrefListener(this);
|
||||
|
||||
@ -765,8 +764,8 @@ TreeStyleTabBrowser.prototype = {
|
||||
|
||||
var self = this;
|
||||
(this.deferredTasks['init'] = this.Deferred.next(function() {
|
||||
// On Firefox 12 and later, this command is always enabled
|
||||
// and the TabsOnTop can be enabled by <tabbrowser>.updateVisibility().
|
||||
// This command is always enabled and the TabsOnTop can be enabled
|
||||
// by <tabbrowser>.updateVisibility().
|
||||
// So we have to reset TabsOnTop state on the startup.
|
||||
var toggleTabsOnTop = d.getElementById('cmd_ToggleTabsOnTop');
|
||||
var TabsOnTop = 'TabsOnTop' in w ? w.TabsOnTop : null ;
|
||||
@ -1839,8 +1838,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
(aReason & this.kTABBAR_UPDATE_BY_FULLSCREEN ? 'fullscreen ' : '' ) +
|
||||
(aReason & this.kTABBAR_UPDATE_BY_AUTOHIDE ? 'autohide ' : '' ) +
|
||||
(aReason & this.kTABBAR_UPDATE_BY_INITIALIZE ? 'initialize ' : '' ) +
|
||||
(aReason & this.kTABBAR_UPDATE_BY_TOGGLE_SIDEBAR ? 'toggle-sidebar ' : '' ) +
|
||||
(aReason & this.kTABBAR_UPDATE_BY_PRIVATE_BROWSING ? 'private-browsing ' : '' );
|
||||
(aReason & this.kTABBAR_UPDATE_BY_TOGGLE_SIDEBAR ? 'toggle-sidebar ' : '' );
|
||||
dump('TSTBrowser_updateFloatingTabbarInternal: ' + humanReadableReason + '\n');
|
||||
}
|
||||
|
||||
@ -2157,7 +2155,6 @@ TreeStyleTabBrowser.prototype = {
|
||||
Services.obs.removeObserver(this, this.kTOPIC_INDENT_MODIFIED);
|
||||
Services.obs.removeObserver(this, this.kTOPIC_COLLAPSE_EXPAND_ALL);
|
||||
Services.obs.removeObserver(this, this.kTOPIC_CHANGE_TREEVIEW_AVAILABILITY);
|
||||
Services.obs.removeObserver(this, 'private-browsing-change-granted'); // only for Firefox 19 and olders
|
||||
Services.obs.removeObserver(this, 'lightweight-theme-styling-update');
|
||||
prefs.removePrefListener(this);
|
||||
|
||||
@ -2404,11 +2401,6 @@ TreeStyleTabBrowser.prototype = {
|
||||
}
|
||||
return;
|
||||
|
||||
case 'private-browsing-change-granted': // only for Firefox 19 and olders
|
||||
this.collapseExpandAllSubtree(false, true);
|
||||
this.updateFloatingTabbar(this.kTABBAR_UPDATE_BY_PRIVATE_BROWSING);
|
||||
return;
|
||||
|
||||
case 'lightweight-theme-styling-update':
|
||||
return this.updateFloatingTabbar(this.kTABBAR_UPDATE_BY_APPEARANCE_CHANGE);
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
* The Original Code is the Tree Style Tab.
|
||||
*
|
||||
* The Initial Developer of the Original Code is YUKI "Piro" Hiroshi.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010-2013
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010-2014
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): YUKI "Piro" Hiroshi <piro.outsider.reflex@gmail.com>
|
||||
@ -179,12 +179,11 @@ const TreeStyleTabConstants = Object.freeze({
|
||||
kTABBAR_UPDATE_BY_TABBAR_RESIZE : (1 << 5),
|
||||
kTABBAR_UPDATE_BY_WINDOW_RESIZE : (1 << 6),
|
||||
kTABBAR_UPDATE_BY_FULLSCREEN : (1 << 7),
|
||||
kTABBAR_UPDATE_BY_PRIVATE_BROWSING : (1 << 8),
|
||||
kTABBAR_UPDATE_BY_AUTOHIDE : (1 << 9),
|
||||
kTABBAR_UPDATE_BY_INITIALIZE : (1 << 10),
|
||||
kTABBAR_UPDATE_BY_TOGGLE_SIDEBAR : (1 << 11),
|
||||
kTABBAR_UPDATE_NOW : (1 << 5) | (1 << 6) | (1 << 9) | (1 << 10),
|
||||
kTABBAR_UPDATE_SYNC_TO_TABBAR : (1 << 0) | (1 << 1) | (1 << 2) | (1 << 5) | (1 << 8) | (1 << 9),
|
||||
kTABBAR_UPDATE_SYNC_TO_TABBAR : (1 << 0) | (1 << 1) | (1 << 2) | (1 << 5) | (1 << 9),
|
||||
kTABBAR_UPDATE_SYNC_TO_PLACEHOLDER : (1 << 3) | (1 << 4) | (1 << 6) | (1 << 7) | (1 << 10) | (1 << 11),
|
||||
|
||||
kCLOSE_PARENT_BEHAVIOR_PROMOTE_FIRST_CHILD : 3,
|
||||
|
@ -14,7 +14,7 @@
|
||||
* The Original Code is the Tree Style Tab.
|
||||
*
|
||||
* The Initial Developer of the Original Code is YUKI "Piro" Hiroshi.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010-2013
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010-2014
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): YUKI "Piro" Hiroshi <piro.outsider.reflex@gmail.com>
|
||||
@ -649,7 +649,6 @@ catch(e) {
|
||||
if (aTab.hasAttribute(sv.kDROP_POSITION))
|
||||
aTab.removeAttribute(sv.kDROP_POSITION)
|
||||
|
||||
// clear drop position preview on Firefox 17 and later
|
||||
if (aOnFinish) {
|
||||
aTab.style.transform = '';
|
||||
if ('__treestyletab__opacityBeforeDragged' in aTab) {
|
||||
@ -1000,7 +999,7 @@ try{
|
||||
this.clearDropPosition();
|
||||
indicatorTab.setAttribute(sv.kDROP_POSITION, dropPosition);
|
||||
if (b.ownerDocument.defaultView['piro.sakura.ne.jp'].tabsDragUtils
|
||||
.canAnimateDraggedTabs(aEvent)) { // Firefox 17 and later
|
||||
.canAnimateDraggedTabs(aEvent)) {
|
||||
let newOpacity = dropPosition == 'self' ? 0.35 : 0.75 ; // to prevent the dragged tab hides the drop target itself
|
||||
this.window['piro.sakura.ne.jp'].tabsDragUtils.getDraggedTabs(aEvent).forEach(function(aTab) {
|
||||
if (!('__treestyletab__opacityBeforeDragged' in aTab))
|
||||
@ -1191,9 +1190,7 @@ catch(e) {
|
||||
let sourceURI = sourceDoc ? sourceDoc.documentURI : 'file:///' ;
|
||||
let principal = sourceDoc ?
|
||||
sourceDoc.nodePrincipal :
|
||||
SecMan.getSimpleCodebasePrincipal ? // this method isn't there on Firefox 16 and olders!
|
||||
SecMan.getSimpleCodebasePrincipal(Services.io.newURI(sourceURI, null, null)) :
|
||||
null ;
|
||||
SecMan.getSimpleCodebasePrincipal(Services.io.newURI(sourceURI, null, null)) ;
|
||||
try {
|
||||
if (principal)
|
||||
SecMan.checkLoadURIStrWithPrincipal(principal, normalizedURI.spec, Ci.nsIScriptSecurityManager.STANDARD);
|
||||
|
Loading…
x
Reference in New Issue
Block a user