My XUL application has an external javascript file which defines some functions. These functions were previously working, but now I can't call any of these functions from within the .xul file. Can anyone see what I've done wrong?
Here's the chrome.manifest file
content mac chrome/content/
skin mac classic/1.0 chrome/skin/
Here's the very top of my main.xul file
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://mac/skin/main.css" type="text/css"?>
<window id="mac-window"
title="MAC"
persist="screenX screenY width height sizemode"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="text/javascript" src="chrome://mac/content/main.js"/>
Note that the css file referenced at the top of the file works fine. Also, I've tried changing the "text/javascript" to "application/x-javascript" with no effect.
Here's the entire contents of the javascript file:
function exit() {
window.close();
}
function toggle_toolbar(menuitem, toolbar) {
switch (menuitem.getAttribute("checked"))
{
case "true":
menuitem.setAttribute("checked", "false");
toolbar.hidden = true;
break;
case "false";
menuitem.setAttribute("checked", "true");
toolbar.hidden = false;
break;
}
}
These functions get called like this:
<commandset id="cmdset-file">
<command id="cmd-toolbar" oncommand="toggle_toolbar(document.getElementById('view-popup-toolbar'), document.getElementById('the-toolbar'));"/>
<command id="cmd-exit" oncommand="exit();"/>
</commandset>
And two menuitems have the command attribute set to the id of these two commands.
Javascript put inline in the XUL file work properly, but it seems as if the javascript file cannot be referenced. This worked perfectly fine earlier today. Before this stopped working, I was experimenting with some javascript to hide/un-hide some tabboxes, but I'm not sure if that's related or not.
Does anyone see why my javascript file has stopped working?
Thanks in advance!
EDIT: For clarification, I'm using XULRunner. Also, attempting to call one of the javascript functions from within script tags in the .xul document doesn't work, either.