Talkilla is currently based mainly around the Social API in Firefox. As a result, the usual debugging tools for web applications can't be used. However, there are alternatives and replacements.
The Social API consists of front-end parts (e.g. conversation window) and a number of background workers.
Found under Tools -> Web Developer -> Browser Console
, the Browser Console is the main logger to view. It can show various errors, logging and network activity.
Currently, you have to log in different ways depending on if you are in a worker or not. It is hoped that this will be resolved in the future (bug 620935).
To log to the browser console from a front-end window, use console.log. This also allows an object which can then be examined in detail in the Browser Console:
console.log("Message", object);
The console.log function can take many objects to log.
To log to the browser console from a worker:
-
Ensure you are running the server in development mode, or with a modified config with
DEBUG
set to true. -
Ensure the sidebar is open
-
Call a special function:
tkWorker.ports.broadcastDebug("Message", object);
This function can only take one object to log.
If none of the other methods work, worst-case you can use dump to log output to the native console.
In order to effectively debug panels, they need to be made to not disappear when the mouse pointer is clicked in your debugging tool of choice. Until something like this makes it into Firefox, this code base includes an add-on which makes the drop-down panel not automatically hide itself. Instead, the developer clicks in the toolbar button that spawned the panel to make the panel close. To install it:
-
Go to
Tools -> Add-ons
while using the browser profile you use for development -
Click the
Extensions
side tab -
Click the gear button next to the search box near the top of the tab
-
Select
Install Add-on From File
-
Navigate into the
bin
directory in your Talkilla source tree, and selectPinPanel.xpi
.
At the time of this writing, it's not really possible to debug live code in dynamically created widgets (eg chat box, panel) using the built-in debugger. Sufficiently new versions (e.g. 1.13.0a6) of Firebug, however, work pretty well.
The remote debugger can be used for debugging in the sidebar or the frameworker. See the general debugger information for details on how it works.
There are a couple of known issues:
- It cannot currently be used for debugging the sub-workers e.g. the SPAs (bug 757133)
- There is also a known issue ([bug 958752] (https://bugzilla.mozilla.org/show_bug.cgi?id=958752)) where closing and re-opening a panel causes already-set breakpoints not to fire.
- This bug has the side effect that it's not possible to set breakpoints using the UI in the code that runs while the panel is being setup (eg constructors). This can be worked around by temporarily adding a "debugger;" command where you need to break.
To use the remote debugger:
-
In about:config, set both
devtools.debugger.remote-enabled
anddevtools.chrome.enabled
to true -
Go to
Tools -> Web Developer -> Browser Debugger
(orBrowser Toolbox
, in newer builds). -
When it opens, accept the incoming connection
If other tools aren't working well enough to inspect the DOM, it's also possible to use the [DOM Inspector] (https://addons.mozilla.org/firefox/addon/dom-inspector-6622/).
To use the add-on:
-
Install it from the add-on page and restart Firefox if necessary.
-
Open DOM Inspector (Command/Ctrl+shift+I keyboard shortcut)
-
File->Inspect Content Document->Talkilla Sidebar (or the title of the window you want to inspect)
-
Click the first toolbar button.
-
Focus the main browser window again, and click on the element you want to inspect; it will be shown/selected in the tree on the left side of the DOM Inspector window.
-
At the top of the right panel, there's a drop down to select between "DOM Node", "Box Model", "CSS Rules", "Computed Style", "JavaScript Object". All these views are very useful (for different purposes), try them :-).