Skip to content

Commit

Permalink
Clarify logic: don't create global variables at all
Browse files Browse the repository at this point in the history
  • Loading branch information
Infocatcher committed Jul 6, 2016
1 parent 1cb4e8d commit 55d0ff9
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions protocol-process.js
Original file line number Diff line number Diff line change
@@ -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");
});
}
})();

0 comments on commit 55d0ff9

Please sign in to comment.