Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Firefox 4 compatibility tweaks, thanks to slyf!

  • Loading branch information...
commit 71239c3fa6763ef41942f2aaba46bb31474582ef 1 parent 714c30d
@chromakode authored
Showing with 23 additions and 10 deletions.
  1. +2 −2 install.rdf
  2. +21 −8 modules/migration.jsm
View
4 install.rdf
@@ -5,10 +5,10 @@
<RDF:Description RDF:about="rdf:#$tddXp3"
em:id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
em:minVersion="3.0"
- em:maxVersion="3.5.*" />
+ em:maxVersion="4.*" />
<RDF:Description RDF:about="urn:mozilla:install-manifest"
em:id="socialite@chromakode"
- em:version="1.3.3.8pre1"
+ em:version="1.4"
em:type="2"
em:iconURL="chrome://socialite/skin/socialite.png"
em:optionsURL="chrome://socialite/content/socialitePreferences.xul">
View
29 modules/migration.jsm
@@ -7,16 +7,18 @@ let versionCompare = Components.classes["@mozilla.org/xpcom/version-comparator;1
.getService(Components.interfaces.nsIVersionComparator)
.compare;
-let extensionManager = Components.classes["@mozilla.org/extensions/manager;1"]
- .getService(Components.interfaces.nsIExtensionManager);
+let extensionManager, AddonManager;
+try {
+ extensionManager = Components.classes["@mozilla.org/extensions/manager;1"]
+ .getService(Components.interfaces.nsIExtensionManager);
+} catch(e) {
+ Components.utils.import("resource://gre/modules/AddonManager.jsm");
+}
let EXTENSION_ID = "socialite@chromakode";
-var SocialiteMigration = {
- perform: function() {
- let currentVersion = extensionManager.getItemForID(EXTENSION_ID).version;
-
- let lastVersion;
+function migrate(currentVersion){
+ let lastVersion;
if (Socialite.preferences.prefHasUserValue("lastVersion")) {
lastVersion = Socialite.preferences.getCharPref("lastVersion");
} else {
@@ -49,5 +51,16 @@ var SocialiteMigration = {
// Update the record of the last version seen
Socialite.preferences.setCharPref("lastVersion", currentVersion);
}
+}
+
+var SocialiteMigration = {
+ perform: function() {
+ if (AddonManager) {
+ AddonManager.getAddonByID(EXTENSION_ID, function(addon) {
+ migrate(addon.version)
+ });
+ } else {
+ migrate(extensionManager.getItemForID(EXTENSION_ID).version);
+ }
}
-};
+};
Please sign in to comment.
Something went wrong with that request. Please try again.