Error handling support in DRT.

View: New views
4 Messages — Rating Filter:   Alert me  

Error handling support in DRT.

by tonikitoo (Antonio Gomes) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi guys, I have a question about DRT and its current support to
handling error pages.

For a layout test I am working for a bug fix (see bug 30573), it would
be great if the DumpRenderTree supports a way to handle "error pages".

For example, in the end of the hypotactic test execution below (JS
snippet), the error page html source would be dumped instead:

(...)
   if (window.layoutTestController) {
        layoutTestController.dumpAsText();
        layoutTestController.overridePreference("WebKitUsesPageCachePreferenceKey",
1);
        layoutTestController.setHandleErrorPage();   <--- this does
not exist current.
    }

    function onPageLoad(evt)
    {
            layoutTestController.queueLoad("./non-existent.html");
    }

    window.onload = onPageLoad;
(...)

In my case specifically, I'd like to have this kind of support in DRT,
since I am testing BackForward list content/state after a couple of
back's and forward's involving a non-successful load (qtwebkit does
give support to handle error pages).

Any plans to do so ?


--
--Antonio Gomes
_______________________________________________
webkit-dev mailing list
webkit-dev@...
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

Re: Error handling support in DRT.

by Darin Adler :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Nov 6, 2009, at 10:49 AM, tonikitoo (Antonio Gomes) wrote:

> Hi guys, I have a question about DRT and its current support to handling error pages.
>
> For a layout test I am working for a bug fix (see bug 30573), it would be great if the DumpRenderTree supports a way to handle "error pages".
>
> For example, in the end of the hypotactic test execution below (JS snippet), the error page html source would be dumped instead:

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 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.

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

We’ve welcomed patches many times in the past that add things to DumpRenderTree that help us test previously untested aspects of the engine.

    -- Darin

_______________________________________________
webkit-dev mailing list
webkit-dev@...
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

Re: Error handling support in DRT.

by tonikitoo (Antonio Gomes) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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)
    clearProvisionalLoad();
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
_______________________________________________
webkit-dev mailing list
webkit-dev@...
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

Re: Error handling support in DRT.

by tonikitoo (Antonio Gomes) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It was agreed on IRC that having DRTs able to handle error pages in
not a bad thing, but good since it brings DRT closer to a real
browsers behavior. Hence, I moved on here and implemented it for QT's
DRT (see https://bugs.webkit.org/show_bug.cgi?id=31509#c0).

Currently the single test depending on it is
fast/history/back-forward-reset-after-error-handling.html (see
https://bugs.webkit.org/show_bug.cgi?id=30573), which is in gtk, win
and mac 'Skipped' for now.

Also, I've filed follow up bugs for each of these DRT to track down
the implementation of such feature for their DRTs:

* MAC -> https://bugs.webkit.org/show_bug.cgi?id=31555
* GTK -> https://bugs.webkit.org/show_bug.cgi?id=31556
* WIN -> https://bugs.webkit.org/show_bug.cgi?id=31557

Regards


--
--Antonio Gomes
_______________________________________________
webkit-dev mailing list
webkit-dev@...
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev