[Qtwebengine] QWebEnginePage -- when is loadFinished() called?

Koehne Kai Kai.Koehne at theqtcompany.com
Thu Nov 5 09:47:41 CET 2015



> -----Original Message-----
> From: QtWebEngine [mailto:qtwebengine-bounces at qt-project.org] On Behalf
> Of Kevin Truong
> Sent: Thursday, November 05, 2015 3:51 AM
> To: qtwebengine at qt-project.org
> Subject: [Qtwebengine] QWebEnginePage -- when is loadFinished() called?
> 
> I'm creating a headless render engine, which serializes whenever loadFinished()
> is signaled. Because of this, I'd like to understand the details of loadFinished().
> 
> There are many definitions of being "finished" when rendering a page, including:
> 1. DOM has been downloaded
> 2. DOM has been downloaded, resources specified in the original DOM (as
> opposed to other scripts or iframes) have been rendered into the page (as used
> in phantomjs http://phantomjs.org/api/webpage/handler/on-load-
> finished.html)
> 3. The global javascript variable "window" fires the "load" event (see
> https://developer.mozilla.org/en-US/Add-ons/Code_snippets/On_page_load)
> 
> For QWebEnginePage, is it correct to assume loadFinished() is signaled the same
> as #2? If not, can anyone share their insights as to what conditions must be filled
> for loadFinished() to signal?

The loadFinished() signal is emitted in response to WebContentsObserver::DidFinishLoad. From it's in-source documentation:

// This method is invoked when the navigation is done, i.e. the spinner of
// the tab will stop spinning, and the onload event was dispatched.

 https://code.google.com/p/chromium/codesearch#chromium/src/content/public/browser/web_contents_observer.h&q=file:web_contents_observer.h%20function:DidFinishLoad&sq=package:chromium&l=197

So yeah, this should be 2. and 3.

Regards

Kai


More information about the QtWebEngine mailing list