зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
64264d8ec0
Коммит
75bfb7059a
|
@ -56,6 +56,7 @@ WeaveService.prototype = {
|
||||||
let os = Cc["@mozilla.org/observer-service;1"].
|
let os = Cc["@mozilla.org/observer-service;1"].
|
||||||
getService(Ci.nsIObserverService);
|
getService(Ci.nsIObserverService);
|
||||||
os.addObserver(this, "final-ui-startup", true);
|
os.addObserver(this, "final-ui-startup", true);
|
||||||
|
this.addResourceAlias();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "final-ui-startup":
|
case "final-ui-startup":
|
||||||
|
@ -68,6 +69,26 @@ WeaveService.prototype = {
|
||||||
}, 10000, Ci.nsITimer.TYPE_ONE_SHOT);
|
}, 10000, Ci.nsITimer.TYPE_ONE_SHOT);
|
||||||
break;
|
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);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче