[webkit-dev] Error handling support in DRT.

tonikitoo (Antonio Gomes) tonikitoo at gmail.com
Mon Nov 9 18:35:16 PST 2009

Thanks for replying, Darin. Comments below ...

> WebKit itself does not have error pages. This is a feature of specific browsers: Recent versions of Safari do this, although earlier versions used sheets and alerts instead.

I agree that supporting "error pages" is a browser-specific feature.
The point is that WebCore::FrameLoader gives FrameLoaderClient the
right hook to load error pages and even has special treatment for when
it happens: If you look close at snippet FrameLoader code in
http://pastebin.com/f176c3bf5, it is obvious that
"m_delegateIsHandlingProvisionalLoadError" , for example, is
preventing that method body to get executed if an "error page" is
being handled:

>  m_delegateIsHandlingProvisionalLoadError = true;
>  m_client->dispatchDidFailProvisionalLoad(error);
>  m_delegateIsHandlingProvisionalLoadError = false;

In the sequence:

// Finish resetting the load state, but only if another load hasn't
// been started by the delegate callback.
if (pdl == m_provisionalDocumentLoadeer)
else if (m_provisionalDocumentLoader) { <---- THIS IS THE PROBLEM
    KURL unreachableURL = m_provisionalDocumentLoader->unreachableURL();
    if (!unreachableURL.isEmpty() && unreachableURL == pdl->request().url())
        shouldReset = false;

Just checking for "m_provisionalDocumentLoader" (the 'else' block) is
not enough to ensure if a load error has been loaded or not. in my
opnion, it should be "activeDocumentLoader()". As is, shouldReset
keeps as "true" and back/forward status gets broken.

I have patched it and even made a layout test and qt unittests [1],
but w/o DRT to support error pages my test is invalid.

[1] https://bug-30573-attachments.webkit.org/attachment.cgi?id=42829

> I think it’s reasonable to have a way in DumpRenderTree to indicate somehow in its output if a page load fails and what error code is involved. But I would not recommend using "error pages" as the way to do this. And we’d have to be careful to make this something easy to use cross-platform. Specific error codes are also likely to be platform-specific.

The error page I made for QT is simple "data:html/test,<body/>", just
in order to let something to get rendered. So I am not caring much
about the type of error here for now ...

> There may be some way to accomplish this in some cases using "onerror" and frames.

As far as I could see "onError" are to catch runtime JS execution
exception, which from the problem description above it can not be
enough (?).

--Antonio Gomes

More information about the webkit-dev mailing list