In order for loadTinderboxStatus()
to have any effect we need to define a matching updateTinderboxStatus()
function.
function updateTinderboxStatus() { var icon = document.getElementById('tinderbox-status'); if (gXMLHttpRequest.responseText.match("EE0000")) icon.setAttribute("status", "busted"); else if (gXMLHttpRequest.responseText.match("FFAA00")) icon.setAttribute("status", "testfailed"); else if (gXMLHttpRequest.responseText.match("11DD11")) icon.setAttribute("status", "success"); else icon.setAttribute("status", ""); }
updateTinderboxStatus()
retrieves a reference to the statusbarpanel
element then searches through the retrieved HTML document (stored in the responseText
property of the XMLHttpRequest
instance) for one of several color references. The color red (represented by the RGB code EE0000) means a tinderbox client failed to build Mozilla. The color orange ("FFAAOO") means a client successfully built Mozilla, but the build failed tests. The color green ("11DD11") means the client successfully built and tested Mozilla. When it finds a color, it sets the panel's status
attribute to the corresponding status, which causes the previously defined CSS rules to switch to the icon appropriate for that status. Because our conditional looks for worse states (bustage, test failures) first, it will display those states before displaying the success state.