extensions/wtf-injector-firefox/lib/main.js
function setupContextMenu() {
  var enableContextMenuItem = contextMenu.Item({
    label: 'Enable For This URL',
    data: 'toggle',
    contentScript:
        "self.on('context', function(node) {" +
        "  var hasWtf = !!document.querySelector('.wtf_a');" +
        "  return !hasWtf ? 'Enable For This URL' : 'Disable For This URL';" +
        "});"
  });
  var resetSettingsContextMenuItem = contextMenu.Item({
    label: 'Reset Settings For This URL',
    data: 'reset'
  });
  var showUiContextMenuItem = contextMenu.Item({
    label: 'Show UI',
    data: 'show_ui'
  });
  var rootContextMenuItem = contextMenu.Menu({
    label: 'Tracing Framework',
    items: [
      enableContextMenuItem,
      resetSettingsContextMenuItem,
      contextMenu.Separator(),
      showUiContextMenuItem
    ],
    contentScript:
        "self.on('click', function(node, data) {" +
        "  self.postMessage(data);" +
        "});",
    onMessage: function(action) {
      switch (action) {
        case 'toggle':
          toggleInjectionForActiveTab();
          break;
        case 'reset':
          resetOptionsForActiveTab();
          break;
        case 'show_ui':
          showUi();
          break;
      }
    }
  });
}
function setupContextMenu() {
  var enableContextMenuItem = contextMenu.Item({
    label: 'Enable For This URL',
    data: 'toggle',
    contentScript:
        "self.on('context', function(node) {" +
        "  var hasWtf = !!document.querySelector('.wtf_a');" +
        "  return !hasWtf ? 'Enable For This URL' : 'Disable For This URL';" +
        "});"
  });
  var resetSettingsContextMenuItem = contextMenu.Item({
    label: 'Reset Settings For This URL',
    data: 'reset'
  });
  var showUiContextMenuItem = contextMenu.Item({
    label: 'Show UI',
    data: 'show_ui'
  });
  var rootContextMenuItem = contextMenu.Menu({
    label: 'Tracing Framework',
    items: [
      enableContextMenuItem,
      resetSettingsContextMenuItem,
      contextMenu.Separator(),
      showUiContextMenuItem
    ],
    contentScript:
        "self.on('click', function(node, data) {" +
        "  self.postMessage(data);" +
        "});",
    onMessage: function(action) {
      switch (action) {
        case 'toggle':
          toggleInjectionForActiveTab();
          break;
        case 'reset':
          resetOptionsForActiveTab();
          break;
        case 'show_ui':
          showUi();
          break;
      }
    }
  });
}
function setupContextMenu ( ) { var enableContextMenuItem = contextMenu . Item ( { label : 'Enable For This URL' , data : 'toggle' , contentScript : "self.on('context', function(node) {" + "  var hasWtf = !!document.querySelector('.wtf_a');" + "  return !hasWtf ? 'Enable For This URL' : 'Disable For This URL';" + "});" } ) ; var resetSettingsContextMenuItem = contextMenu . Item ( { label : 'Reset Settings For This URL' , data : 'reset' } ) ; var showUiContextMenuItem = contextMenu . Item ( { label : 'Show UI' , data : 'show_ui' } ) ; var rootContextMenuItem = contextMenu . Menu ( { label : 'Tracing Framework' , items : [ enableContextMenuItem , resetSettingsContextMenuItem , contextMenu . Separator ( ) , showUiContextMenuItem ] , contentScript : "self.on('click', function(node, data) {" + "  self.postMessage(data);" + "});" , onMessage : function ( action ) { switch ( action ) { case 'toggle' : toggleInjectionForActiveTab ( ) ; break ; case 'reset' : resetOptionsForActiveTab ( ) ; break ; case 'show_ui' : showUi ( ) ; break ; } } } ) ; }
Sets up the page context menu.
Sets up the page context menu .