Snippets code from my daily experience

August 19, 2008

Error console in Komodo

Filed under: komodo,nsIConsoleService — dafi @ 3:25 pm

I’ve need to migrate to Komodo a bunch of Firefox extension code logging using nsIConsoleService.

The output goes to error console but Komodo doesn’t directly allow to open it, you can manually execute the code shown below as a macro.

window.openDialog(‘chrome://global/content/console.xul’, ‘_blank’);

Any time the code is executed a new error console window is open, if you don’t like this behaviour past the macro shown below

function toOpenWindowByType(inType, uri, features)
{
var windowManager = Components.classes[‘@mozilla.org/appshell/window-mediator;1’].getService();
var windowManagerInterface = windowManager.QueryInterface(Components.interfaces.nsIWindowMediator);
var topWindow = windowManagerInterface.getMostRecentWindow(inType);

if (topWindow)
topWindow.focus();
else if (features)
window.open(uri, “_blank”, features);
else
window.open(uri, “_blank”, “chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar”);
}

toOpenWindowByType(“global:console”, “chrome://global/content/console.xul”)

Create a free website or blog at WordPress.com.

%d bloggers like this: