0

I need to debug sdk extension, but browser console is very unconvinient because it is in separate window. So I found some solution to place output in webconsole, but it is little unpleasant.

const { getTabContentWindow, getActiveTab } = require('sdk/tabs/utils');
const { getMostRecentBrowserWindow } = require('sdk/window/utils');
var tab = getActiveTab(getMostRecentBrowserWindow())
console.error(tab) // browser console
let content = getTabContentWindow(tab)
content.wrappedJSObject.console.log("TAB ", tab); // web console

Here we see message in webconsole. But I think there should be more clear decision.

UPD. The problem for me is that browser console located in separate window and is too unconvinient for me. Think, one of two solutions would be appropriate:

  • redirect output to web console.
  • somehow "move" browser console inside firefox window.

Would appreciate any help.

user3003873
  • 543
  • 1
  • 4
  • 21
  • You have organized this in a way that is incompatible with the format on Stack Exchange. The Question should ask a question, or present a problem (See: [ask]). If you want to also provide an Answer that answers the Question or solves the problem presented in the Question, then that is perfectly fine. [Self answered questions are encouraged](http://stackoverflow.com/help/self-answer). – Makyen Sep 11 '16 at 15:15

1 Answers1

2

but browser console is very unconvinient because it is in separate window.

That sounds more like the problem lies with your desktop management or use patterns and not the addon sdk. Consider using a side-by-side window arrangement or moving the console to a different monitor. You can also have it immediately opened during startup by adding --jsconsole to the firefox arguments.

The web console is only really meant for page-specific content. To debug global things, such as addon scripts, you're supposed to use the browser console.

Also note that your approach would break under e10s.

the8472
  • 40,999
  • 5
  • 70
  • 122
  • I tried different ways to nest browser console inside firefox window. But didnt find howto. WIndow "tiling" is not an option for me. – user3003873 Sep 11 '16 at 15:27