| Index: lib/contentPolicy.js |
| =================================================================== |
| --- a/lib/contentPolicy.js |
| +++ b/lib/contentPolicy.js |
| @@ -360,17 +360,27 @@ let PolicyImplementation = |
| xpcom_categories: ["content-policy", "net-channel-event-sinks"], |
| /** |
| * Registers the content policy on startup. |
| */ |
| init: function() |
| { |
| let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); |
| - registrar.registerFactory(this.classID, this.classDescription, this.contractID, this); |
| + try |
| + { |
| + registrar.registerFactory(this.classID, this.classDescription, this.contractID, this); |
| + } |
| + catch (e if e.result == Cr.NS_ERROR_FACTORY_EXISTS) |
| + { |
| + // See bug 924340 - it might be too early to init now, the old version |
| + // we are replacing didn't finish removing itself yet. |
| + Utils.runAsync(this.init.bind(this)); |
| + return; |
| + } |
| let catMan = Utils.categoryManager; |
| for each (let category in this.xpcom_categories) |
| catMan.addCategoryEntry(category, this.contractID, this.contractID, false, true); |
| // http-on-opening-request is new in Gecko 18, http-on-modify-request can |
| // be used in earlier releases. |
| let httpTopic = "http-on-opening-request"; |