Maximum duration for a script



  • What is the maximum duration a script can run before Qt decides that it has hung up and shows the message - "The script on this page appears to have a problem. Do you want to stop the script?"



  • How do I overcome this problem? Any help will be greatly appreciated!!!



  • Hi,

    I am also new at this forum and not an expert on QT, and i will also appreciate some people to help and answer the questions. But it is not the case !!

    For your question i have seen following :

    ./qt/src/3rdparty/webkit/Source/WebKit/qt/Api/qwebpage.cpp

    /*!
    \fn bool QWebPage::shouldInterruptJavaScript()
    \since 4.6
    This function is called when a JavaScript program is running for a long period of time.

    If the user wanted to stop the JavaScript the implementation should return true; otherwise false.
    
    The default implementation executes the query using QMessageBox::information with QMessageBox::Yes and QMessageBox::No buttons.
    
    \warning Because of binary compatibility constraints, this function is not virtual. If you want to
    provide your own implementation in a QWebPage subclass, reimplement the shouldInterruptJavaScript()
    slot in your subclass instead. QtWebKit will dynamically detect the slot and call it.
    

    /
    bool QWebPage::shouldInterruptJavaScript()
    {
    #ifdef QT_NO_MESSAGEBOX
    return false;
    #else
    QWidget
    parent = (d->client) ? d->client->ownerWidget() : 0;
    return QMessageBox::Yes == QMessageBox::information(parent, tr("JavaScript Problem - %1").arg(mainFrame()->url().host()), tr("The script on this page appears to have a problem. Do you want to stop the script?"), QMessageBox::Yes, QMessageBox::No);
    #endif
    }

    So i guess you can deactivate this dialog box by using :
    QT_NO_MESSAGEBOX

    Regards


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.