If my test file has extension 'htm' (not 'xhtml') or I load test, for exmaple, http://www.mozilla.org/access/dhtml/alert then <div x2:role="wairole:alert"/> elements have @x2:role attribute of empty namespace. nsAccessNode::GetRoleAttribute() doesn't handle this case. I'm not sure wheter GetRoleAttribute should handle this or these elements should @x2:role attribute of x2 namespace. But this leads alert events is not fired for such nodes.
Namespaces are not supported in text/html, because the XML parser is not used. When you use .htm on your local file system it's causing it to be loaded as text/html. This is unfortunately the design. Note that these days we support the role attribute in the xhtml1 namespace. Rather than put in extra code to prevent it, we're now allow an unnamespaced use of the role attribute in html 4 as well. So, in either html or xhtml 1.x, you can use <div role="wairole:alert"> (no namespace on role).
Ok, http://www.mozilla.org/access/dhtml/alert contains xhtml, where proper mime type should be specified?
Mime type is determined by server settings, unless it's on the local file system, in which case it's the file extension. You can look at the .htaccess file for www.mozilla.org/access/dhtml to see how we serve it with Apache (it still needs to be served as text/html to IE, which doesn't support XHTML or namespaces).