diff options
author | Konstantin Tokarev <annulen@yandex.ru> | 2016-01-21 16:45:51 +0300 |
---|---|---|
committer | Konstantin Tokarev <annulen@yandex.ru> | 2016-01-21 15:02:46 +0000 |
commit | bbdf00cf0913dcdf900c541a2dbf418b7f23788f (patch) | |
tree | 670d4cf701f5f61f3e00bd85bea1b3409bea66cf /Source/WebKit/qt/WidgetApi/qwebframe.cpp | |
parent | 18f9f56c2f8b87dd15127e111ced70c4b8b7d3d4 (diff) | |
download | qtwebkit-bbdf00cf0913dcdf900c541a2dbf418b7f23788f.tar.gz |
Improved documentation of evaluateJavaScript().
Change-Id: I47d8f4c0e392ffb70655db9725b035d22a7cad91
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Diffstat (limited to 'Source/WebKit/qt/WidgetApi/qwebframe.cpp')
-rw-r--r-- | Source/WebKit/qt/WidgetApi/qwebframe.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/Source/WebKit/qt/WidgetApi/qwebframe.cpp b/Source/WebKit/qt/WidgetApi/qwebframe.cpp index e8faab881..38c649887 100644 --- a/Source/WebKit/qt/WidgetApi/qwebframe.cpp +++ b/Source/WebKit/qt/WidgetApi/qwebframe.cpp @@ -910,7 +910,22 @@ 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 + + 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) { |