tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

head.js (698B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 const ConsoleAPIStorage = Cc["@mozilla.org/consoleAPI-storage;1"].getService(
      5  Ci.nsIConsoleAPIStorage
      6 );
      7 
      8 // This is intended to just be a drop-in replacement for an old observer
      9 // notification.
     10 function addConsoleStorageListener(listener) {
     11  listener.__handler = (message, id) => {
     12    listener.observe(message, id);
     13  };
     14  ConsoleAPIStorage.addLogEventListener(
     15    listener.__handler,
     16    Cc["@mozilla.org/systemprincipal;1"].createInstance(Ci.nsIPrincipal)
     17  );
     18 }
     19 
     20 function removeConsoleStorageListener(listener) {
     21  ConsoleAPIStorage.removeLogEventListener(listener.__handler);
     22 }