RESOLVED FIXED29381
[Qt] [Regression] QWebView::setHtml() executes script body twice
https://bugs.webkit.org/show_bug.cgi?id=29381
Summary [Qt] [Regression] QWebView::setHtml() executes script body twice
Tor Arne Vestbø
Reported 2009-09-18 07:04:41 PDT
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(); }
Attachments
[Qt] Use the default timeout interval for JS as the HTML tokenizer delay for setHtml() (7.84 KB, patch)
2009-10-30 06:27 PDT, Tor Arne Vestbø
no flags
Tor Arne Vestbø
Comment 1 2009-09-25 04:25:34 PDT
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(); }
Tor Arne Vestbø
Comment 2 2009-10-30 06:27:35 PDT
Created attachment 42209 [details] [Qt] Use the default timeout interval for JS as the HTML tokenizer delay for setHtml()
Kenneth Rohde Christiansen
Comment 3 2009-11-10 05:15:46 PST
Would be nice to have API for setting the default timeout. Especially for slower embedded devices.
Tor Arne Vestbø
Comment 4 2009-11-10 06:36:31 PST
(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.
Eric Seidel (no email)
Comment 5 2009-12-28 23:00:14 PST
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...
Tor Arne Vestbø
Comment 6 2010-01-04 00:29:58 PST
Pong. It depends on bug 30879, which I need to write a LayoutTest for first.
Tor Arne Vestbø
Comment 7 2010-02-09 02:20:40 PST
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.
Simon Hausmann
Comment 8 2010-03-28 23:46:42 PDT
Should we backport this patch and the one in the depending bug into the branch?
Simon Hausmann
Comment 9 2010-07-26 01:54:29 PDT
Simon Hausmann
Comment 10 2010-07-26 06:54:14 PDT
Revision r64036 cherry-picked into qtwebkit-2.0 with commit a72015752c7cd51dad5602166422c5cce9332d95
Simon Hausmann
Comment 11 2010-07-30 04:11:00 PDT
Revision r64036 cherry-picked into qtwebkit-2.1 with commit 0698601d6735cfc493ecd0177b6cfadfc48e6188
Note You need to log in before you can comment on or make changes to this bug.