[webkit-qt] infinite loop while rendering this url

Tarandeep Singh tarandeep at gmail.com
Tue Apr 26 10:01:42 PDT 2011


On Tue, Apr 26, 2011 at 8:01 AM, Alexis Menard
<alexis.menard at openbossa.org>wrote:

>
> On Apr 25, 2011, at 7:22 PM, Tarandeep Singh wrote:
>
> I think webkit is entering into infinite loop while rendering this url-
> http://nzonlinemall.com/home.html
>
> I am using qt+webkit (qt-4.6.2) on Ubuntu 9.10
> My set up is simple-
>
> - create a webpage object
> - load this url
> - once load is finished, get the html and print it
> - delete the webpage
>
> it looks like loop happens when I try to delete the webpage. Webpage
> settings that I am using-
>
>   page = new WebPage( );
>   page->setViewportSize( QSize( 64000, 40000));
>
>
> I haven't looked more but without WebPage code I'm not sure what we can do.
> Also setting such sizes to the viewport is not very nice looking code :D.
>
>

I am sorry, I forgot to mention, webpage class is just a wrapper on
qwebpage, here is the code-

///////////////////////////   webpage.h  ///////////////////////////
#ifndef WEBPAGE_H
#define WEBPAGE_H

#include <QWebPage>
#include <QWebFrame>
#include <QWebSettings>
#include <QNetworkRequest>

class WebPage : public QWebPage
{
  Q_OBJECT

  public:
    WebPage( );
    void setUserAgent( const QString&);
    QString userAgentForUrl( const QUrl&) const;
    void javaScriptAlert( QWebFrame*, const QString&);
    bool javaScriptConfirm( QWebFrame*, const QString&);
    void javaScriptConsoleMessage( const QString&, int, const QString&);
    bool javaScriptPrompt( QWebFrame*, const QString&, const
QString&,QString*);

  public slots:
    bool shouldInterruptJavaScript( );

  private:
    QString userAgent;
};

#endif
/////////////////////////////////////////////////////////////////////////////////////////////


//////////////////////// webpage.cpp
/////////////////////////////////////////////
#include "webpage.h"

WebPage::WebPage( )
{
}

void WebPage::setUserAgent( const QString& ua)
{
  this->userAgent = ua;
}

bool WebPage::shouldInterruptJavaScript( )
{
  return true;
}

QString WebPage::userAgentForUrl( const QUrl& url) const
{
  if( userAgent.isEmpty( ))
    return QWebPage::userAgentForUrl( url);

  return userAgent;
}

/**
 * This function is called whenever a javascript program running inside
frame
 * calls the alert() function with the message. Override the default
 * impelementationa and don't do anything.
 */
void WebPage::javaScriptAlert( QWebFrame*, const QString&)
{
  // do nothing
}

/**
 * This function is called whenever a javascript program running inside
frame
 * calls the confirm() function with the message. Override the default
 * implementation and return true.
 */
bool WebPage::javaScriptConfirm( QWebFrame*, const QString&)
{
  return true;
}

/**
 * This function is called whenever a javascript program running inside
frame
 * tries to prompt the user for input. Override the default implementation
 * and return true.
 */
bool WebPage::javaScriptPrompt( QWebFrame*, const QString&, const QString&,
                                QString*)
{
  return true;
}

/**
 * This function is called whenever a javascript program tries to print a
 * message to the web browser's console. Override the default implementation
 * and do nothing.
 */
void WebPage::javaScriptConsoleMessage( const QString&, int, const QString&)
{
  // do nothing
}

/////////////////////////////////////////////////////////////////////////////////////////////

And high values for viewport are set for some specific reason - to handle
some of ajax loading of images.

>   page->setNetworkAccessManager( nwManager);
>
>   QWebHistory* history = page->history( );
>   history->setMaximumItemCount( 0);
>
>   QWebSettings* settings = page->settings( );
>   settings->setAttribute( QWebSettings::JavaEnabled, false);
>   settings->setAttribute( QWebSettings::JavascriptEnabled, true);
>   settings->setAttribute( QWebSettings::JavascriptCanOpenWindows, false);
>   settings->setAttribute( QWebSettings::JavascriptCanAccessClipboard,
> false);
>   settings->setAttribute( QWebSettings::PrivateBrowsingEnabled, true);
>   settings->setAttribute( QWebSettings::AutoLoadImages, false);
>   settings->setAttribute( QWebSettings::PluginsEnabled, false);
>   settings->setAttribute( QWebSettings::DeveloperExtrasEnabled, false);
>   settings->setAttribute( QWebSettings::DnsPrefetchEnabled, true);
>   settings->setAttribute( QWebSettings::DeveloperExtrasEnabled, false);
>   settings->setMaximumPagesInCache( 0);
>   settings->setObjectCacheCapacities( 0, 0, 0);
>   settings->setOfflineStorageDefaultQuota( 0);
>   settings->setOfflineWebApplicationCacheQuota( 0);
>   settings->setIconDatabasePath( "");
>
> Can someone please check and confirm.
>
> Thanks,
> Tarandeep
> _______________________________________________
> webkit-qt mailing list
> webkit-qt at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-qt
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-qt/attachments/20110426/699856f3/attachment.html>


More information about the webkit-qt mailing list