Re: Improving XML error pages (YSOD)

Boris Zbarsky <[email protected]> Sun, 23 Mar 2008 14:08:59 -0500
Newsgroups gmane.comp.mozilla.devel.xml
Message-ID <[email protected]>
[email protected] wrote:
>   Currently the YSOD page is produced in nsXMLContentSink which
> creates a page with a "<parsererror>" root element. This is relied on
> by other code and extensions so I guess it should stay the same.

Perhaps...  I see no reason not to change this in a future release, for what 
it's worth.

>   I tried adding a processing instruction into the parsererror
> document, transforming it into a error page with XSLT, but I got an
> error saying that the stylesheet couldn't be loaded.

XSLT can only be loaded same-origin.

>   Then I thought I might be able to use an nsIContentSniffer to detect
> the "<parsererror>"

nsIContentSniffer works on the original byte stream before anything gets 
anywhere near the XML parser.

>   Any ideas on better ways to do this? I could just enhance
> nsXMLContentSink to produce a more complex page

You can do that, or you can use XBL (a la XML prettyprinting, but bound via a 
stylesheet in this case) to make the page look different without changing the 
actual DOM.

-Boris