Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/contentPolicy.js

Issue 12796001: Worked around bug 924340, updating extension will fail in current Firefox nightlies (Closed)
Patch Set: Created Oct. 8, 2013, 7:43 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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";
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld