Bug 571902 - Land sync and crypto components on trunk [r=mconnor]

If resource://services-sync isn't defined yet, alias it to resource://gre/modules/services-sync.
This commit is contained in:
Philipp von Weitershausen 2010-06-18 14:11:14 -07:00
Родитель 64264d8ec0
Коммит 75bfb7059a
1 изменённых файлов: 21 добавлений и 0 удалений

Просмотреть файл

@ -56,6 +56,7 @@ WeaveService.prototype = {
let os = Cc["@mozilla.org/observer-service;1"].
getService(Ci.nsIObserverService);
os.addObserver(this, "final-ui-startup", true);
this.addResourceAlias();
break;
case "final-ui-startup":
@ -68,6 +69,26 @@ WeaveService.prototype = {
}, 10000, Ci.nsITimer.TYPE_ONE_SHOT);
break;
}
},
addResourceAlias: function() {
let ioService = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService);
let resProt = ioService.getProtocolHandler("resource")
.QueryInterface(Ci.nsIResProtocolHandler);
// Only create alias if resource://services-sync doesn't already exist.
if (resProt.hasSubstitution("services-sync"))
return;
let uri = ioService.newURI("resource://gre/modules/services-sync",
null, null);
let file = uri.QueryInterface(Ci.nsIFileURL)
.file.QueryInterface(Ci.nsILocalFile);
let aliasURI = ioService.newFileURI(file);
resProt.setSubstitution("services-sync", aliasURI);
}
};