1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 07:27:58 +01:00

Remove some redundant version-specific code.

This commit is contained in:
Doug Kearns
2014-02-08 00:05:35 +11:00
parent c8b430cd8f
commit 789b44209c
8 changed files with 54 additions and 115 deletions

View File

@@ -263,16 +263,6 @@ var CommandWidgets = Class("CommandWidgets", {
} }
[this.commandbar.container, this.statusbar.container].forEach(check); [this.commandbar.container, this.statusbar.container].forEach(check);
// Work around a redrawing bug.
if (changed && config.haveGecko("16", "20")) {
util.delay(function () {
// Urgh.
statusline.statusBar.style.paddingRight = "1px";
DOM(statusline.statusBar).rect; // Force reflow.
statusline.statusBar.style.paddingRight = "";
}, 0);
}
if (this.initialized && loaded.mow && mow.visible) if (this.initialized && loaded.mow && mow.visible)
mow.resize(false); mow.resize(false);
}, },

View File

@@ -1367,10 +1367,6 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
styles.system.add("taboptions", "chrome://*", styles.system.add("taboptions", "chrome://*",
classes.length ? classes.join(",") + "{ display: none; }" : ""); classes.length ? classes.join(",") + "{ display: none; }" : "");
if (!dactyl.has("Gecko2")) {
tabs.tabBinding.enabled = Array.some(opts, k => k in this.opts);
tabs.updateTabCount();
}
if (config.tabbrowser.tabContainer._positionPinnedTabs) if (config.tabbrowser.tabContainer._positionPinnedTabs)
config.tabbrowser.tabContainer._positionPinnedTabs(); config.tabbrowser.tabContainer._positionPinnedTabs();
}, },

View File

@@ -73,7 +73,6 @@ var Tabs = Module("tabs", {
updateTabCount: function updateTabCount() { updateTabCount: function updateTabCount() {
for (let [i, tab] in Iterator(this.visibleTabs)) { for (let [i, tab] in Iterator(this.visibleTabs)) {
if (dactyl.has("Gecko2")) {
let node = function node(class_) document.getAnonymousElementByAttribute(tab, "class", class_); let node = function node(class_) document.getAnonymousElementByAttribute(tab, "class", class_);
if (!node("dactyl-tab-number")) { if (!node("dactyl-tab-number")) {
let img = node("tab-icon-image"); let img = node("tab-icon-image");
@@ -96,7 +95,6 @@ var Tabs = Module("tabs", {
}); });
} }
} }
}
tab.dactylOrdinal = i + 1; tab.dactylOrdinal = i + 1;
} }
statusline.updateTabCount(true); statusline.updateTabCount(true);
@@ -1224,7 +1222,7 @@ var Tabs = Module("tabs", {
tabs.tabStyle.enabled = false; tabs.tabStyle.enabled = false;
} }
if (value !== "multitab" || !dactyl.has("Gecko2")) if (value !== "multitab")
if (tabs.xulTabs) if (tabs.xulTabs)
tabs.xulTabs.visible = value !== "never"; tabs.xulTabs.visible = value !== "never";
else else

View File

@@ -110,7 +110,6 @@ var actions = {
name: "extr[ehash]", name: "extr[ehash]",
description: "Reload an extension", description: "Reload an extension",
action: function (addon) { action: function (addon) {
util.assert(config.haveGecko("2b"), _("command.notUseful", config.host));
util.flushCache(); util.flushCache();
util.timeout(function () { util.timeout(function () {
addon.userDisabled = true; addon.userDisabled = true;

View File

@@ -734,19 +734,6 @@ function Class(...args) {
if (callable(args[0])) if (callable(args[0]))
superclass = args.shift(); superclass = args.shift();
if (loaded.config && (config.haveGecko("5.*", "6.0") || config.haveGecko("6.*"))) // Bug 657418.
var Constructor = function Constructor() {
var self = Object.create(Constructor.prototype);
self.instance = self;
self.globalInstance = self;
if ("_metaInit_" in self && self._metaInit_)
self._metaInit_.apply(self, arguments);
var res = self.init.apply(self, arguments);
return res !== undefined ? res : self;
};
else
var Constructor = eval(String.replace('\n\ var Constructor = eval(String.replace('\n\
(function constructor(PARAMS) { \n\ (function constructor(PARAMS) { \n\
var self = Object.create(Constructor.prototype); \n\ var self = Object.create(Constructor.prototype); \n\

View File

@@ -78,12 +78,8 @@ var Buffer = Module("Buffer", {
* callback is not provided. * callback is not provided.
*/ */
getPref: function getPref(pref, callback) { getPref: function getPref(pref, callback) {
// God damn it.
if (config.haveGecko("19.0a1"))
services.contentPrefs.getPref(this.uri, pref, services.contentPrefs.getPref(this.uri, pref,
sanitizer.getContext(this.win), callback); sanitizer.getContext(this.win), callback);
else
services.contentPrefs.getPref(this.uri, pref, callback);
}, },
/** /**
@@ -525,8 +521,6 @@ var Buffer = Module("Buffer", {
}; };
DOM(elem).mousedown(params).mouseup(params); DOM(elem).mousedown(params).mouseup(params);
if (!config.haveGecko("2b"))
DOM(elem).click(params);
let sel = util.selectionController(win); let sel = util.selectionController(win);
sel.getSelection(sel.SELECTION_FOCUS_REGION).collapseToStart(); sel.getSelection(sel.SELECTION_FOCUS_REGION).collapseToStart();

View File

@@ -51,8 +51,6 @@ var ConfigBase = Class("ConfigBase", {
this.loadConfig(); this.loadConfig();
this.features.push = deprecated("Set.add", function push(feature) Set.add(this, feature)); this.features.push = deprecated("Set.add", function push(feature) Set.add(this, feature));
if (this.haveGecko("2b"))
Set.add(this.features, "Gecko2");
JSMLoader.registerFactory(JSMLoader.Factory(AboutHandler)); JSMLoader.registerFactory(JSMLoader.Factory(AboutHandler));
JSMLoader.registerFactory(JSMLoader.Factory( JSMLoader.registerFactory(JSMLoader.Factory(
@@ -160,17 +158,6 @@ var ConfigBase = Class("ConfigBase", {
highlight.loadCSS(this.helpCSS.replace(/__MSG_(.*?)__/g, highlight.loadCSS(this.helpCSS.replace(/__MSG_(.*?)__/g,
(m0, m1) => _(m1))); (m0, m1) => _(m1)));
if (!this.haveGecko("2b"))
highlight.loadCSS(literal(/*
!TabNumber font-weight: bold; margin: 0px; padding-right: .8ex;
!TabIconNumber {
font-weight: bold;
color: white;
text-align: center;
text-shadow: black -1px 0 1px, black 0 1px 1px, black 1px 0 1px, black 0 -1px 1px;
}
*/));
let hl = highlight.set("Find", ""); let hl = highlight.set("Find", "");
hl.onChange = function () { hl.onChange = function () {
function hex(val) ("#" + util.regexp.iterate(/\d+/g, val) function hex(val) ("#" + util.regexp.iterate(/\d+/g, val)

View File

@@ -1354,14 +1354,11 @@ var DOM = Class("DOM", {
* @param {Node} target The DOM node to which to dispatch the event. * @param {Node} target The DOM node to which to dispatch the event.
* @param {Event} event The event to dispatch. * @param {Event} event The event to dispatch.
*/ */
dispatch: Class.Memoize(function () dispatch: function dispatch(target, event, extra) {
config.haveGecko("2b")
? function dispatch(target, event, extra) {
try { try {
this.feedingEvent = extra; this.feedingEvent = extra;
if (target instanceof Ci.nsIDOMElement) if (target instanceof Ci.nsIDOMElement)
// This causes a crash on Gecko<2.0, it seems.
return (target.ownerDocument || target.document || target).defaultView return (target.ownerDocument || target.document || target).defaultView
.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils) .QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils)
.dispatchDOMEventViaPresShell(target, event, true); .dispatchDOMEventViaPresShell(target, event, true);
@@ -1377,15 +1374,6 @@ var DOM = Class("DOM", {
this.feedingEvent = null; this.feedingEvent = null;
} }
} }
: function dispatch(target, event, extra) {
try {
this.feedingEvent = extra;
target.dispatchEvent(update(event, extra));
}
finally {
this.feedingEvent = null;
}
})
}), }),
createContents: Class.Memoize(() => services.has("dactyl") && services.dactyl.createContents createContents: Class.Memoize(() => services.has("dactyl") && services.dactyl.createContents