Skip to content

Commit

Permalink
Simplify code for debug logs from content process
Browse files Browse the repository at this point in the history
  • Loading branch information
Infocatcher committed Nov 9, 2018
1 parent 5254184 commit cac6b0a
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions protocol.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,7 @@ const P_CID = Components.ID("{e974cf10-11cb-4293-af88-e61c7dfe717c}"),
P_NAME = "Private Tab protocol handler";

Components.utils.import("resource://gre/modules/Services.jsm");
__defineGetter__.call(this, "_log", function() {
delete this._log;
Services.scriptloader.loadSubScript("chrome://privatetab/content/log.js");
return _log;
});
__defineSetter__.call(this, "_log", function(logger) {
delete this._log;
this._log = logger;
});
var _log;

var privateProtocol = {
get platformVersion() {
Expand All @@ -32,13 +24,15 @@ var privateProtocol = {
init: function(logger) {
if(logger)
_log = logger;
else
Services.scriptloader.loadSubScript("chrome://privatetab/content/log.js");
this.compReg.registerFactory(P_CID, P_NAME, P_CONTRACTID, this);
_log("[protocol] Initialized");
_log("[protocol] Initialized" + (logger ? "" : " + loaded log.js"));
},
destroy: function() {
this.compReg.unregisterFactory(P_CID, this);
_log("[protocol] Destroyed");
_log = function() {};
_log = null;
},

// nsIFactory
Expand Down

0 comments on commit cac6b0a

Please sign in to comment.