diff options
Diffstat (limited to 'Source/WebKit/qt/WidgetApi/qwebframe.cpp')
-rw-r--r-- | Source/WebKit/qt/WidgetApi/qwebframe.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Source/WebKit/qt/WidgetApi/qwebframe.cpp b/Source/WebKit/qt/WidgetApi/qwebframe.cpp index e8faab881..dd08725eb 100644 --- a/Source/WebKit/qt/WidgetApi/qwebframe.cpp +++ b/Source/WebKit/qt/WidgetApi/qwebframe.cpp @@ -910,7 +910,21 @@ void QWebFrame::print(QPrinter *printer) const Evaluates the JavaScript defined by \a scriptSource using this frame as context and returns the result of the last executed statement. - \sa addToJavaScriptWindowObject(), javaScriptWindowObjectCleared() + \note This method may be very inefficient if \a scriptSource returns a DOM element + as a result. For example, evaluation of the next innocuously looking code may take + a lot of CPU and memory to execute: + + \code + var img = document.createElement('img'); + document.getElementById(\"foo\").appendChild(img); + \endcode + + This code returns appended DOM element, which is converted to QVariantMap + containing all its properties. To avoid this issue you can add "true" after + the last statement. + + \sa addToJavaScriptWindowObject(), javaScriptWindowObjectCleared(), + QWebElement::evaluateJavaScript() */ QVariant QWebFrame::evaluateJavaScript(const QString& scriptSource) { |