OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2013 Eyeo GmbH | 3 * Copyright (C) 2006-2013 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 classID: Components.ID("cfeaabe6-1dd1-11b2-a0c6-cb5c268894c9"), | 358 classID: Components.ID("cfeaabe6-1dd1-11b2-a0c6-cb5c268894c9"), |
359 contractID: "@adblockplus.org/abp/policy;1", | 359 contractID: "@adblockplus.org/abp/policy;1", |
360 xpcom_categories: ["content-policy", "net-channel-event-sinks"], | 360 xpcom_categories: ["content-policy", "net-channel-event-sinks"], |
361 | 361 |
362 /** | 362 /** |
363 * Registers the content policy on startup. | 363 * Registers the content policy on startup. |
364 */ | 364 */ |
365 init: function() | 365 init: function() |
366 { | 366 { |
367 let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); | 367 let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); |
368 registrar.registerFactory(this.classID, this.classDescription, this.contract
ID, this); | 368 try |
| 369 { |
| 370 registrar.registerFactory(this.classID, this.classDescription, this.contra
ctID, this); |
| 371 } |
| 372 catch (e if e.result == Cr.NS_ERROR_FACTORY_EXISTS) |
| 373 { |
| 374 // See bug 924340 - it might be too early to init now, the old version |
| 375 // we are replacing didn't finish removing itself yet. |
| 376 Utils.runAsync(this.init.bind(this)); |
| 377 return; |
| 378 } |
369 | 379 |
370 let catMan = Utils.categoryManager; | 380 let catMan = Utils.categoryManager; |
371 for each (let category in this.xpcom_categories) | 381 for each (let category in this.xpcom_categories) |
372 catMan.addCategoryEntry(category, this.contractID, this.contractID, false,
true); | 382 catMan.addCategoryEntry(category, this.contractID, this.contractID, false,
true); |
373 | 383 |
374 // http-on-opening-request is new in Gecko 18, http-on-modify-request can | 384 // http-on-opening-request is new in Gecko 18, http-on-modify-request can |
375 // be used in earlier releases. | 385 // be used in earlier releases. |
376 let httpTopic = "http-on-opening-request"; | 386 let httpTopic = "http-on-opening-request"; |
377 if (Services.vc.compare(Utils.platformVersion, "18.0") < 0) | 387 if (Services.vc.compare(Utils.platformVersion, "18.0") < 0) |
378 httpTopic = "http-on-modify-request"; | 388 httpTopic = "http-on-modify-request"; |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 if (!wnd || wnd.closed) | 755 if (!wnd || wnd.closed) |
746 return; | 756 return; |
747 | 757 |
748 if (entry.type == Policy.type.OBJECT) | 758 if (entry.type == Policy.type.OBJECT) |
749 { | 759 { |
750 node.removeEventListener("mouseover", objectMouseEventHander, true); | 760 node.removeEventListener("mouseover", objectMouseEventHander, true); |
751 node.removeEventListener("mouseout", objectMouseEventHander, true); | 761 node.removeEventListener("mouseout", objectMouseEventHander, true); |
752 } | 762 } |
753 Policy.processNode(wnd, node, entry.type, Utils.makeURI(entry.location), true)
; | 763 Policy.processNode(wnd, node, entry.type, Utils.makeURI(entry.location), true)
; |
754 } | 764 } |
OLD | NEW |