Re: Improving XML error pages (YSOD)

Jonas Sicking <[email protected]> Mon, 24 Mar 2008 17:33:32 -0700
Newsgroups gmane.comp.mozilla.devel.xml
Message-ID <[email protected]>
[email protected] wrote:
> Hi all,
> 
>   I thought I might have a look at bug 418305 (Make Yellow-Screen-Of-
> Death More Informative). My first effort was going to be to make the
> error page look a bit more like the new network error pages.
> 
>   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.
> 
>   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.
> 
>   Then I thought I might be able to use an nsIContentSniffer to detect
> the "<parsererror>", but the content sniffer sees the original XML
> page, not the error page.
> 
>   Any ideas on better ways to do this? I could just enhance
> nsXMLContentSink to produce a more complex page, but it might be
> better to leave that interface only for backwards-compatibility.

FWIW I hate how we do these error pages. The <parsererror> stuff should 
never be exposed to the web. We should be using null where possible and 
empty documents where not.

So I don't think we should be aiming at backwards compat here. Instead 
we should do a proper implementation that returns an empty document for 
window.document and use whatever mechanism we're using for network 
errors instead.

/ Jonas