mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 573740 - Register resource://services-sync before xpcshell tests get run [r=Mardak]
Don't try to create the alias too early, add-on chrome registration might not have happened yet, so do it during testing.
This commit is contained in:
parent
fc4daed597
commit
9b34f348c7
@ -40,7 +40,9 @@ const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
function WeaveService() {}
|
||||
function WeaveService() {
|
||||
this.wrappedJSObject = this;
|
||||
}
|
||||
WeaveService.prototype = {
|
||||
classDescription: "Weave Service",
|
||||
contractID: "@mozilla.org/weave/service;1",
|
||||
@ -56,6 +58,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 +71,25 @@ 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);
|
||||
}
|
||||
};
|
||||
|
||||
@ -134,20 +156,3 @@ function NSGetModule(compMgr, fileSpec) {
|
||||
AboutWeaveLog1
|
||||
]);
|
||||
}
|
||||
|
||||
(function addResourceAlias() {
|
||||
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);
|
||||
})();
|
||||
|
@ -58,3 +58,7 @@ registrar.registerFactory(Components.ID("{fbfae60b-64a4-44ef-a911-08ceb70b9f31}"
|
||||
XULAppInfoFactory);
|
||||
|
||||
}
|
||||
|
||||
// Provide resource://services-sync if it isn't already available
|
||||
let weaveService = Cc["@mozilla.org/weave/service;1"].getService();
|
||||
weaveService.wrappedJSObject.addResourceAlias();
|
||||
|
Loading…
Reference in New Issue
Block a user