0

//I'm trying to reproduce the example of context menus with the following code (taken from MDN).

browser.contextMenus.create({
  id: "log-selection",
  title: "Log '%s' to the console",
  contexts: ["selection"]
});

browser.contextMenus.onClicked.addListener(function(info, tab) {
  if (info.menuItemId == "log-selection") {
    console.log(info.selectionText);
  }
});

The problem is I can not see the logs in any kind of console: not in the Web console nor the navigator console (opened through the debugging button I about:debugging). So, where should I see the logs?

Makyen
  • 31,849
  • 12
  • 86
  • 121
gal007
  • 6,911
  • 8
  • 47
  • 70

2 Answers2

0

Assuming this is background code, you need to inspect the background page itself.

In Firefox, this is accessible through the corresponding Debug button on about:debugging.

Reading through Anatomy of a WebExtension is also recommended.

Xan
  • 74,770
  • 16
  • 179
  • 206
  • Hello Xan, I already read it, I swear you. But it is not being logged. You can check it by installing this project and then opening the debug window as you sayd: https://github.com/mdn/webextensions-examples/tree/master/context-menu-demo – gal007 Jun 22 '17 at 13:51
  • Now I updated Firefox to version 55.0b3 and it is the same, I can not see the logs in any console – gal007 Jun 22 '17 at 13:53
  • Found. It may be a bug. It is in the browser's console but not when you access from about:debuging – gal007 Jun 22 '17 at 13:57
0

It is in the Browser console that you can access from MAY+CTRL+ALT+I, not from the one that is opened from about:debugging

gal007
  • 6,911
  • 8
  • 47
  • 70