firefox-devel.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Tue, 31 May 2011 17:05:38 +0300
changeset 875 ce06c05f5f4b
parent 874 80c35b648deb
child 876 91658c72d15f
permissions -rwxr-xr-x
Components.utils.reportError.

-*- mode: outline; coding: utf-8; fill-column: 90 -*-

* Setting up environment.

In 'about:config' set this variable:

  javascript.options.showInConsole = true
                Logs errors in chrome files to the Error Console.
  javascript.options.strict = true
                Enables strict JavaScript warnings in the Error Console.
  extensions.logging.enabled = true
                This will send more detailed information about installation and update
                problems to the Error Console.

  https://developer.mozilla.org/en/Setting_up_extension_development_environment
                setting up profile, options and about developer plugin

* Useful developer plugin.

** Firebug.

Firebug integrates with Firefox to put a wealth of development tools at your fingertips
while you browse. You can edit, debug, and monitor CSS, HTML, and JavaScript live in any
web page.

  http://getfirebug.com
                home page
  https://addons.mozilla.org/firefox/addon/1843
                download page

** Live HTTP Headers.

 * First by adding a 'Headers' tab in 'View Page Info' of a web page.
 * Second by adding a tool in the 'Tools->Web Development' menu to be able to display http
   headers in real time (while pages are being downloaded from the Internet.
 * Third by letting you edit request headers and replay an URL (beta). Look for the Replay
   button in the live window!

This project may be of some help for the following:

 * Help debugging web application.
 * See which kind of web server the remote site is using.
 * See the cookies sent by remote site.

Alternatively you can use fiddler2 (only Windows as it written in .NET)

  http://livehttpheaders.mozdev.org/
                home page
  https://addons.mozilla.org/en-US/firefox/addon/3829/
                download page
  http://www.fiddler2.com/fiddler2/
                Web Debugging Proxy

** Tamper Data.

 * Use tamperdata to view and modify HTTP/HTTPS headers and post parameters.
 * Trace and time http response/requests.
 * Security test web applications by modifying POST parameters.

Based on code and incompotable with "Live HTTP Headers" extensions.

  http://tamperdata.mozdev.org/index.html
                home page
  https://addons.mozilla.org/en-US/firefox/addon/966/
                download page
  http://jimbojw.com/wiki/index.php?title=Tamper_Data

* How build Firefox.

  https://developer.mozilla.org/en/Build_Documentation
                Build Instructions
  https://developer.mozilla.org/en/Mozilla_Source_Code_%28Mercurial%29
                Getting Mozilla Source Code Using Mercurial

* Extension security.

  https://developer.mozilla.org/en/Security_best_practices_in_extensions

* Debugin Firefox.

  https://developer.mozilla.org/en/how_to_get_a_stacktrace_with_windbg

* Debugin JavaScript in Firefox.

// Logs errors in chrome files to the Error Console. Enable Components.utils.reportError().
user_pref("javascript.options.showInConsole", true);
// Disables the XUL cache so that changes to windows and dialogs do not require a restart.
user_pref("nglayout.debug.disable_xul_cache", true);
// Enables the use of the dump() statement to print to the standard console.
user_pref("browser.dom.window.dump.enabled", true);
// Enables strict JavaScript warnings in the Error Console.
user_pref("javascript.options.strict", true);
// This enables to run JavaScript code snippets in the chrome context of the Scratchpad from the Tools menu.
user_pref("devtools.chrome.enabled", true);
// This will send more detailed information about installation and update problems to the Error Console.
user_pref("extensions.logging.enabled", true);
user_pref("dom.report_all_js_exceptions", true);

** Debugging JavaScript in Firefox with Web Console.

'console.log()', 'console.info()', 'console.warn()', 'console.error()'.

  https://developer.mozilla.org/en/Using_the_Web_Console

** Debugging JavaScript in Firefox with Firebug.

With Firebug you can use 'console.log(obj)' for logging. Also output can be grouped with
console.group("name") to start a new indentation block, and then console.groupEnd().

Same but with different coloring do 'console.debug', 'console.info', 'console.warn', and
'console.error' functions.

'console.log' can format strings in the great tradition of printf.

'console.trace()' - to print trace.

  http://getfirebug.com/logging

** dump().

Set in 'about:config' 'browser.dom.window.dump.enabled' to 'true'.

All messages go to native console. On Windows this require '-console' option for 'firefox.exe'.

  https://developer.mozilla.org/en/DOM/window.dump

* Components.utils.reportError.

Write error msg to Error console (not in Web Console).

  Components.utils.reportError("msg");
  // Show the error console.
  toJavaScriptConsole();

  https://developer.mozilla.org/en/Components.utils.reportError