diff --git a/protocol-process.js b/protocol-process.js index ab82791..16f4142 100644 --- a/protocol-process.js +++ b/protocol-process.js @@ -1,13 +1,12 @@ -Components.utils.import("resource://gre/modules/Services.jsm"); -if(Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT) { - Components.utils.import("chrome://privatetab/content/protocol.jsm"); +(function() { + var {Services} = Components.utils.import("resource://gre/modules/Services.jsm", {}); + if(Services.appinfo.processType != Services.appinfo.PROCESS_TYPE_CONTENT) + return; + var {privateProtocol} = Components.utils.import("chrome://privatetab/content/protocol.jsm", {}); privateProtocol.init(function() {}); - let global = this; addMessageListener("PrivateTab:ProtocolDestroy", function destroy(msg) { removeMessageListener("PrivateTab:ProtocolDestroy", destroy); privateProtocol.destroy(); - delete global.Services; - delete global.privateProtocol; Components.utils.unload("chrome://privatetab/content/protocol.jsm"); }); -} \ No newline at end of file +})(); \ No newline at end of file