[Qtwebengine] How to tell when DOM resources finishes downloading?

Kevin Truong knt261 at gmail.com
Tue Dec 15 22:06:45 CET 2015


Thanks Kai -- I'll take a look at the submission process later this week.

Yeah I agree with you it isn't the perfect solution. After the render
downloads the ajax or iframe, I make it wait 100ms and hope it loads into
the DOM. This gets most pages correct, but isn't perfect and many still
serialize too early. Do you have a better idea/suggestion? I know you
suggested this before:

> If you know the HTML/AJAX of the specific page, you might be able to hook
up
a JS handler that is called when the AJAX request is done, and then signal
this to the
C++ world , e.g. via QWebChannel.

If I understand it correctly, this means I have to know beforehand which
node gets inserted into the HTML via the ajax/iframe right? E.g. <div
id="ajax">, and in the javascript, I repeatedly test if div[id=ajax] exists
in the HTML? I prefer not to use this approach, since my test suite have
over 1K URLs and I prefer not to write 1K rules by hand for each URL. I'm
looking for a general way to tell (or approximately tell) when the
ajax/iframe/specific plug in loads into the DOM, and the signal I patched
is currently the only thing I could think of.

On Tue, Dec 15, 2015 at 3:01 AM, Koehne Kai <Kai.Koehne at theqtcompany.com>
wrote:

>
>
> > -----Original Message-----
> > From: Kevin Truong [mailto:knt261 at gmail.com]
> > Subject: Re: [Qtwebengine] How to tell when DOM resources finishes
> > downloading?
> >
> > Hi Kai and community,
> >
> > I patched QWebEngineUrlRequestInterceptor so that it emits a signal when
> > the DOM resource is finished downloading (or if it failed, or if it
> aborted). I'd
> > like to help contribute to the Qt Web Engine project, so I was wondering
> if I
> > can submit my patch for a code review to the repository. Maybe other
> > people might find this feature useful.
>
> Honestly speaking I'm not sure how this signal is the right solution in
> your use case.
> After all this will only reflect the state of the network request, while I
> understood
> you want to get notified if the DOM is updated with AJAX requests, right?
> Since rendering
> is done concurrently (in a separate process) there's no guarantee that the
> page is
> rendered when you react to this signal.
>
> Regards
>
>
> Kai
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qtwebengine/attachments/20151215/c23bee37/attachment.html>


More information about the QtWebEngine mailing list