aboutsummaryrefslogtreecommitdiffstats
path: root/pluginManager.js
diff options
context:
space:
mode:
authorteramako2009-02-01 05:32:30 +0000
committerteramako2009-02-01 05:32:30 +0000
commitd78228e5cc04dfeed4cff23324e4c076dd4f78b8 (patch)
tree9f22de46740cae3b68dac30ef32916cc20097f34 /pluginManager.js
parent0c3734b39b1b7024a941173f6a82e04013687144 (diff)
downloadvimperator-plugins-d78228e5cc04dfeed4cff23324e4c076dd4f78b8.tar.bz2
change compVersion to use [https://developer.mozilla.org/En/NsIVersionComparator nsIVersionComparator]
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@29380 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'pluginManager.js')
-rw-r--r--pluginManager.js18
1 files changed, 3 insertions, 15 deletions
diff --git a/pluginManager.js b/pluginManager.js
index 20d5ed6..a44d158 100644
--- a/pluginManager.js
+++ b/pluginManager.js
@@ -320,21 +320,9 @@ Plugin.prototype = { // {{{
return '<span style="font-weight: bold; color: blue;">update complete.</span>';
},
- compVersion: function(a, b){
- a = (a || '').split('.');
- b = (b || '').split('.');
- if (!a.length && b.length) return -1;
- if (a.length && !b.length) return 1;
- for (let [i, bv] in Iterator(b)) {
- var av = i < a.length ? a[i] : 0;
- if (av == bv) continue;
- if (!isNaN(av) && !isNaN(bv)) {
- av = parseInt(av);
- bv = parseInt(bv);
- }
- return av < bv ? -1 : 1;
- }
- return 0;
+ compVersion: function(a, b){
+ const comparator = Cc["@mozilla.org/xpcom/version-comparator;1"].getService(Ci.nsIVersionComparator);
+ return comparator.compare(a, b);
}
}; // }}}
// }}}