init()

in src/js/background/assignManager.js [406:436]


  init() {
    browser.contextMenus.onClicked.addListener((info, tab) => {
      info.bookmarkId ?
        this._onClickedBookmark(info) :
        this._onClickedHandler(info, tab);
    });

    // Before anything happens we decide if the request should be proxified
    this.maybeAddProxyListeners();

    // Before a request is handled by the browser we decide if we should
    // route through a different container
    this.canceledRequests = {};
    browser.webRequest.onBeforeRequest.addListener((options) => {
      return this.onBeforeRequest(options);
    },{urls: ["<all_urls>"], types: ["main_frame"]}, ["blocking"]);

    // Clean up canceled requests
    browser.webRequest.onCompleted.addListener((options) => {
      if (this.canceledRequests[options.tabId]) {
        delete this.canceledRequests[options.tabId];
      }
    },{urls: ["<all_urls>"], types: ["main_frame"]});
    browser.webRequest.onErrorOccurred.addListener((options) => {
      if (this.canceledRequests[options.tabId]) {
        delete this.canceledRequests[options.tabId];
      }
    },{urls: ["<all_urls>"], types: ["main_frame"]});

    this.resetBookmarksMenuItem();
  },