This bug report originated from issue QTBUG-3713 <http://bugreports.qt.nokia.com/browse/QTBUG-3713> --- Description --- QWebView::setHtml() executes script body twice, the following example will show the alert message box two times. This is a regression from Qt 4.4.3. class widget : public QWebView { public: widget(QWidget* parent = 0) : QWebView(parent) { setHtml("<html><body><script>\n" "var x = new Date();\n" "alert(x);\n" "</script></body></html>\n"); } }; int main(int argc, char **argv) { QApplication a(argc, argv); widget w; w.show(); return a.exec(); }
Confirmed in trunk. Also, when the alert() is active the body element will contain the following innerHTML: <script> var x = new Date(); alert('foo'); document.write('Date: ' + x + '<br>'); </script>Date: Fri Sep 25 2009 13:23:25 GMT+0200 (CEST)<br><script> var x = new Date(); alert('foo'); document.write('Date: ' + x + '<br>'); </script>Date: Fri Sep 25 2009 13:23:26 GMT+0200 (CEST)<br>hallo hallo using the following snippet: #include <QtGui> #include <QWebView.h> int main(int argc, char **argv) { QApplication a(argc, argv); QWebView w; w.setHtml("<html><body><script>\n" "var x = new Date();\n" "alert('foo');\n" "document.write('Date: ' + x + '<br>');\n" "</script>hallo</body></html>\n"); w.show(); return a.exec(); }
Created attachment 42209 [details] [Qt] Use the default timeout interval for JS as the HTML tokenizer delay for setHtml()
Would be nice to have API for setting the default timeout. Especially for slower embedded devices.
(In reply to comment #3) > Would be nice to have API for setting the default timeout. Especially for > slower embedded devices. True, this also relates to the QtScript stuff. Btw, this patch needs 30879 to land first.
Ping? Should this still be marked r+ and in the pending-commit list? There has been no action on this bug in over a month and a half...
Pong. It depends on bug 30879, which I need to write a LayoutTest for first.
Comment on attachment 42209 [details] [Qt] Use the default timeout interval for JS as the HTML tokenizer delay for setHtml() Clearing r+ since this patch depends on another bug to be landed first.
Should we backport this patch and the one in the depending bug into the branch?
Committed r64036: <http://trac.webkit.org/changeset/64036>
Revision r64036 cherry-picked into qtwebkit-2.0 with commit a72015752c7cd51dad5602166422c5cce9332d95
Revision r64036 cherry-picked into qtwebkit-2.1 with commit 0698601d6735cfc493ecd0177b6cfadfc48e6188