diff options
author | Doug Kearns <dougkearns@gmail.com> | 2014-02-08 00:05:35 +1100 |
---|---|---|
committer | Doug Kearns <dougkearns@gmail.com> | 2014-02-08 00:05:35 +1100 |
commit | 789b44209c6175c56cf57aeee44c7f9f0bf36b94 (patch) | |
tree | a6655b2845193b7511295fb8e12201f157fcca49 /common | |
parent | c8b430cd8f087d05344788ee217f18064a3691b8 (diff) | |
download | pentadactyl-789b44209c6175c56cf57aeee44c7f9f0bf36b94.tar.gz |
Remove some redundant version-specific code.
Diffstat (limited to 'common')
-rw-r--r-- | common/content/commandline.js | 10 | ||||
-rw-r--r-- | common/content/dactyl.js | 4 | ||||
-rw-r--r-- | common/content/tabs.js | 44 | ||||
-rw-r--r-- | common/modules/addons.jsm | 1 | ||||
-rw-r--r-- | common/modules/base.jsm | 41 | ||||
-rw-r--r-- | common/modules/buffer.jsm | 10 | ||||
-rw-r--r-- | common/modules/config.jsm | 13 | ||||
-rw-r--r-- | common/modules/dom.jsm | 50 |
8 files changed, 56 insertions, 117 deletions
diff --git a/common/content/commandline.js b/common/content/commandline.js index de8d9c3c..59197c39 100644 --- a/common/content/commandline.js +++ b/common/content/commandline.js @@ -263,16 +263,6 @@ var CommandWidgets = Class("CommandWidgets", { } [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) mow.resize(false); }, diff --git a/common/content/dactyl.js b/common/content/dactyl.js index 6ad9e553..26248dd9 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -1367,10 +1367,6 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { styles.system.add("taboptions", "chrome://*", 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) config.tabbrowser.tabContainer._positionPinnedTabs(); }, diff --git a/common/content/tabs.js b/common/content/tabs.js index a7f038e3..5c7e3e06 100644 --- a/common/content/tabs.js +++ b/common/content/tabs.js @@ -73,28 +73,26 @@ var Tabs = Module("tabs", { updateTabCount: function updateTabCount() { for (let [i, tab] in Iterator(this.visibleTabs)) { - if (dactyl.has("Gecko2")) { - let node = function node(class_) document.getAnonymousElementByAttribute(tab, "class", class_); - if (!node("dactyl-tab-number")) { - let img = node("tab-icon-image"); - if (img) { - let dom = DOM([ - ["xul:hbox", { highlight: "tab-number" }, - ["xul:label", { key: "icon", align: "center", highlight: "TabIconNumber", - class: "dactyl-tab-icon-number" }]], - ["xul:hbox", { highlight: "tab-number" }, - ["html:div", { key: "label", highlight: "TabNumber", - class: "dactyl-tab-number" }]]], - document).appendTo(img.parentNode); - - update(tab, { - get dactylOrdinal() Number(dom.nodes.icon.value), - set dactylOrdinal(i) { - dom.nodes.icon.value = dom.nodes.label.textContent = i; - this.setAttribute("dactylOrdinal", i); - } - }); - } + let node = function node(class_) document.getAnonymousElementByAttribute(tab, "class", class_); + if (!node("dactyl-tab-number")) { + let img = node("tab-icon-image"); + if (img) { + let dom = DOM([ + ["xul:hbox", { highlight: "tab-number" }, + ["xul:label", { key: "icon", align: "center", highlight: "TabIconNumber", + class: "dactyl-tab-icon-number" }]], + ["xul:hbox", { highlight: "tab-number" }, + ["html:div", { key: "label", highlight: "TabNumber", + class: "dactyl-tab-number" }]]], + document).appendTo(img.parentNode); + + update(tab, { + get dactylOrdinal() Number(dom.nodes.icon.value), + set dactylOrdinal(i) { + dom.nodes.icon.value = dom.nodes.label.textContent = i; + this.setAttribute("dactylOrdinal", i); + } + }); } } tab.dactylOrdinal = i + 1; @@ -1224,7 +1222,7 @@ var Tabs = Module("tabs", { tabs.tabStyle.enabled = false; } - if (value !== "multitab" || !dactyl.has("Gecko2")) + if (value !== "multitab") if (tabs.xulTabs) tabs.xulTabs.visible = value !== "never"; else diff --git a/common/modules/addons.jsm b/common/modules/addons.jsm index fb1e5961..c6a2c021 100644 --- a/common/modules/addons.jsm +++ b/common/modules/addons.jsm @@ -110,7 +110,6 @@ var actions = { name: "extr[ehash]", description: "Reload an extension", action: function (addon) { - util.assert(config.haveGecko("2b"), _("command.notUseful", config.host)); util.flushCache(); util.timeout(function () { addon.userDisabled = true; diff --git a/common/modules/base.jsm b/common/modules/base.jsm index 105639d4..75a0a920 100644 --- a/common/modules/base.jsm +++ b/common/modules/base.jsm @@ -734,33 +734,20 @@ function Class(...args) { if (callable(args[0])) 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\ - (function constructor(PARAMS) { \n\ - var self = Object.create(Constructor.prototype); \n\ - self.instance = self; \n\ - self.globalInstance = self; \n\ - \n\ - if ("_metaInit_" in self && self._metaInit_) \n\ - self._metaInit_.apply(self, arguments); \n\ - \n\ - var res = self.init.apply(self, arguments); \n\ - return res !== undefined ? res : self; \n\ - })', - "constructor", (name || superclass.className).replace(/\W/g, "_")) - .replace("PARAMS", /^function .*?\((.*?)\)/.exec(args[0] && args[0].init || Class.prototype.init)[1] + var Constructor = eval(String.replace('\n\ + (function constructor(PARAMS) { \n\ + var self = Object.create(Constructor.prototype); \n\ + self.instance = self; \n\ + self.globalInstance = self; \n\ + \n\ + if ("_metaInit_" in self && self._metaInit_) \n\ + self._metaInit_.apply(self, arguments); \n\ + \n\ + var res = self.init.apply(self, arguments); \n\ + return res !== undefined ? res : self; \n\ + })', + "constructor", (name || superclass.className).replace(/\W/g, "_")) + .replace("PARAMS", /^function .*?\((.*?)\)/.exec(args[0] && args[0].init || Class.prototype.init)[1] .replace(/\b(self|res|Constructor)\b/g, "$1_"))); Constructor.className = name || superclass.className || superclass.name; diff --git a/common/modules/buffer.jsm b/common/modules/buffer.jsm index 9ae00643..c47689ff 100644 --- a/common/modules/buffer.jsm +++ b/common/modules/buffer.jsm @@ -78,12 +78,8 @@ var Buffer = Module("Buffer", { * callback is not provided. */ getPref: function getPref(pref, callback) { - // God damn it. - if (config.haveGecko("19.0a1")) - services.contentPrefs.getPref(this.uri, pref, - sanitizer.getContext(this.win), callback); - else - services.contentPrefs.getPref(this.uri, pref, callback); + services.contentPrefs.getPref(this.uri, pref, + sanitizer.getContext(this.win), callback); }, /** @@ -525,8 +521,6 @@ var Buffer = Module("Buffer", { }; DOM(elem).mousedown(params).mouseup(params); - if (!config.haveGecko("2b")) - DOM(elem).click(params); let sel = util.selectionController(win); sel.getSelection(sel.SELECTION_FOCUS_REGION).collapseToStart(); diff --git a/common/modules/config.jsm b/common/modules/config.jsm index 881337b6..7c5b57b9 100644 --- a/common/modules/config.jsm +++ b/common/modules/config.jsm @@ -51,8 +51,6 @@ var ConfigBase = Class("ConfigBase", { this.loadConfig(); 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( @@ -160,17 +158,6 @@ var ConfigBase = Class("ConfigBase", { highlight.loadCSS(this.helpCSS.replace(/__MSG_(.*?)__/g, (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", ""); hl.onChange = function () { function hex(val) ("#" + util.regexp.iterate(/\d+/g, val) diff --git a/common/modules/dom.jsm b/common/modules/dom.jsm index 6831bd3e..42c3902b 100644 --- a/common/modules/dom.jsm +++ b/common/modules/dom.jsm @@ -1354,38 +1354,26 @@ var DOM = Class("DOM", { * @param {Node} target The DOM node to which to dispatch the event. * @param {Event} event The event to dispatch. */ - dispatch: Class.Memoize(function () - config.haveGecko("2b") - ? function dispatch(target, event, extra) { - try { - this.feedingEvent = extra; - - if (target instanceof Ci.nsIDOMElement) - // This causes a crash on Gecko<2.0, it seems. - return (target.ownerDocument || target.document || target).defaultView - .QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils) - .dispatchDOMEventViaPresShell(target, event, true); - else { - target.dispatchEvent(event); - return !event.defaultPrevented; - } - } - catch (e) { - util.reportError(e); - } - finally { - this.feedingEvent = null; - } + dispatch: function dispatch(target, event, extra) { + try { + this.feedingEvent = extra; + + if (target instanceof Ci.nsIDOMElement) + return (target.ownerDocument || target.document || target).defaultView + .QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils) + .dispatchDOMEventViaPresShell(target, event, true); + else { + target.dispatchEvent(event); + return !event.defaultPrevented; } - : function dispatch(target, event, extra) { - try { - this.feedingEvent = extra; - target.dispatchEvent(update(event, extra)); - } - finally { - this.feedingEvent = null; - } - }) + } + catch (e) { + util.reportError(e); + } + finally { + this.feedingEvent = null; + } + } }), createContents: Class.Memoize(() => services.has("dactyl") && services.dactyl.createContents |