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

Kevin Truong knt261 at gmail.com
Sat Dec 12 03:42:52 CET 2015

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.

What is the process for me to submit my patch?


On Wed, Nov 25, 2015 at 12:14 AM, Koehne Kai <Kai.Koehne at theqtcompany.com>

> > -----Original Message-----
> > From: Kevin Truong [mailto:knt261 at gmail.com]
> > Sent: Tuesday, November 24, 2015 7:15 PM
> > To: Koehne Kai <Kai.Koehne at theqtcompany.com>
> > Cc: qtwebengine at qt-project.org
> > Subject: Re: [Qtwebengine] How to tell when DOM resources finishes
> > downloading?
> >
> > Sure Kai -- here's my use case: I have a page that loads ajax data into
> the
> > document. The ajax gets loaded into the DOM much later than when the
> > DomContentLoaded and the Load event is triggered (the red and blue
> vertical
> > lines in the picture under "Network Panel Overview"
> > https://developer.chrome.com/devtools/docs/network). If I understood
> > correctly, it means the ajax is loaded much later than when
> loadFinished() is
> > signaled as well. The amount of time we have to wait before the ajax is
> loaded
> > into the document is variable -- it can take 50ms, or it can take up to
> 10 seconds.
> > I would like to know exactly when the ajax is loaded into the DOM (or if
> that's
> > not possible, exactly when the render finish downloading the ajax) before
> > serializing/downloading the HTML of the page and doing tests on the
> HTML. This
> > is because the HTML changes after the ajax is loaded into the DOM, and
> the
> > tests need to be run on the updated HTML, not the initial HTML.
> I see. 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.
> > I'd like this to be generalized as well (not just ajax, but any other
> DOM resource),
> > because I have test pages where the exact same thing happens, but with
> iframes
> > instead of ajax, or with certain very specific plug-ins (like the
> facebook posts
> > that load below an article page). These resources load independently of
> > DomContentLoaded and the Load event. However, I can identify them either
> via
> > the URL or the content type -- I just need to figure out how I can tell
> the render
> > to serialize only right after these resources are loaded.
> I'm afraid that's not possible right now in the general case. In Qt 5.6
> we'll add
> QWebEngineUrlRequestInterceptor:
> http://doc-snapshots.qt.io/qt5-5.6/qwebengineurlrequestinterceptor.html
> But that is called _before_ the request hits the networking stack.
> But even if you would have a way to get notified when the network request
> is
> done, it doesn't mean that the page is re-rendered/the DOM being updated.
> Regards
> Kai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qtwebengine/attachments/20151211/37e548cf/attachment.html>

More information about the QtWebEngine mailing list