| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 18 matching lines...) Expand all Loading... |
| 29 require("synchronizer"); | 29 require("synchronizer"); |
| 30 require("notification"); | 30 require("notification"); |
| 31 require("sync"); | 31 require("sync"); |
| 32 require("messageResponder"); | 32 require("messageResponder"); |
| 33 require("ui"); | 33 require("ui"); |
| 34 | 34 |
| 35 function bootstrapChildProcesses() | 35 function bootstrapChildProcesses() |
| 36 { | 36 { |
| 37 let info = require("info"); | 37 let info = require("info"); |
| 38 | 38 |
| 39 // Huge hack: we cannot opt out of individual compatibility shims (see | |
| 40 // https://bugzilla.mozilla.org/show_bug.cgi?id=1167802). So the about | |
| 41 // protocol shim will override our handler in the content process. Prevent | |
| 42 // this by making sure it isn't messaged. | |
| 43 try | |
| 44 { | |
| 45 let {AboutProtocolParent} = Cu.import("resource://gre/modules/RemoteAddonsPa
rent.jsm", {}); | |
| 46 if (AboutProtocolParent && typeof AboutProtocolParent.registerFactory == "fu
nction") | |
| 47 { | |
| 48 let origRegisterFactory = AboutProtocolParent.registerFactory; | |
| 49 AboutProtocolParent.registerFactory = function(addon, ...args) | |
| 50 { | |
| 51 if (addon != info.addonID) | |
| 52 origRegisterFactory.call(this, addon, ...args); | |
| 53 } | |
| 54 onShutdown.add(() => AboutProtocolParent.registerFactory = origRegisterFac
tory); | |
| 55 } | |
| 56 } | |
| 57 catch(e) {} | |
| 58 | |
| 59 let processScript = info.addonRoot + "lib/child/bootstrap.js?" + Math.random()
; | 39 let processScript = info.addonRoot + "lib/child/bootstrap.js?" + Math.random()
; |
| 60 let messageManager = Cc["@mozilla.org/parentprocessmessagemanager;1"] | 40 let messageManager = Cc["@mozilla.org/parentprocessmessagemanager;1"] |
| 61 .getService(Ci.nsIProcessScriptLoader) | 41 .getService(Ci.nsIProcessScriptLoader) |
| 62 .QueryInterface(Ci.nsIMessageBroadcaster); | 42 .QueryInterface(Ci.nsIMessageBroadcaster); |
| 63 messageManager.loadProcessScript(processScript, true); | 43 messageManager.loadProcessScript(processScript, true); |
| 64 messageManager.broadcastAsyncMessage("AdblockPlus:Info", info); | 44 messageManager.broadcastAsyncMessage("AdblockPlus:Info", info); |
| 65 | 45 |
| 66 onShutdown.add(() => { | 46 onShutdown.add(() => { |
| 67 messageManager.broadcastAsyncMessage("AdblockPlus:Shutdown", processScript); | 47 messageManager.broadcastAsyncMessage("AdblockPlus:Shutdown", processScript); |
| 68 messageManager.removeDelayedProcessScript(processScript); | 48 messageManager.removeDelayedProcessScript(processScript); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 92 | 72 |
| 93 let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); | 73 let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); |
| 94 registrar.registerFactory(classID, "Adblock Plus public API URL", contractID,
factory); | 74 registrar.registerFactory(classID, "Adblock Plus public API URL", contractID,
factory); |
| 95 | 75 |
| 96 onShutdown.add(function() | 76 onShutdown.add(function() |
| 97 { | 77 { |
| 98 registrar.unregisterFactory(classID, factory); | 78 registrar.unregisterFactory(classID, factory); |
| 99 Cu.unload(uri.spec); | 79 Cu.unload(uri.spec); |
| 100 }); | 80 }); |
| 101 } | 81 } |
| OLD | NEW |