简体   繁体   中英

enabling Firefox 5.0 javascript dump()

I'm going through firefox extension writing bootcamp and somewhere along the way the video's author is speaking about switching browser.dom.window.dump.enabled in about:config to true. This option is no longer present in firefox 5.0. From what I read during my google searches, in ff 4.0 you had to create this preference yourself, and it seems like in firefox 5.0 it doesn't work anymore - I can't seem to dump information to firefox error console any more (regardless of whether console2 is enabled or not).

Relevant code:

Here's how I'm launching the browser:

/usr/bin/iceweasel -profile /some/path -no-remote -jsconsole

And here's the code that only shows the alert, without writing anything to the error console:

onCommand: function(event) {
  toJavaScriptConsole("toJavaScriptConsole: hello world");
  dump("Hello world!\n");
  alert("Hello world!\n");
}

Any idea what I can do to have working dump() called from the ff extension I'm working on in firefox 5.0?

You confused the error console with plain linux console - if you run firefox from terminal you should see the dumps right there.

in-depth explanation

This preference was never present by default - you always had to create it and set to true . Also, the output doesn't go to Error Console, it is rather visible in the terminal you start Firefox from. If you happen to test on Windows you should specify -console command line flag to open a terminal window for the output, on Linux simply starting Firefox from a terminal window will do.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM