Skip to content

Instantly share code, notes, and snippets.

@caisui
Created June 17, 2012 07:41
Show Gist options
  • Save caisui/2943844 to your computer and use it in GitHub Desktop.
Save caisui/2943844 to your computer and use it in GitHub Desktop.
compatible service.js
if (!services.services.pref) {
[
["appStartup", "startup"],
["browserSearch", "search"],
["directory", "dirsvc"],
["observer", "obs"],
["pref", "prefs"],
["subscriptLoader", "scriptloader"],
["windowMediator", "wm"],
["windowWatcher", "ww"],
["xulAppInfo", "appinfo"],
].forEach(function ([name1, name2]) {
services.services.__defineGetter__(name1, function () {
delete this[name1];
Cu.reportError('services.get:' + name1 + ' is renamed ' + name2);
return this[name1] = {reference: services.get(name2)};
});
});
if (Ci.nsILivemarkService)
services.add(
"livemark",
"@mozilla.org/browser/livemark-service;2",
Ci.nsILivemarkService);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment