RESOLVED INVALID 29481
[Qt] QWebFrame::evaluateJavaScript() always returns null
https://bugs.webkit.org/show_bug.cgi?id=29481
Summary [Qt] QWebFrame::evaluateJavaScript() always returns null
Tor Arne Vestbø
Reported 2009-09-18 08:44:50 PDT
This bug report originated from issue QTBUG-3019 http://bugreports.qt.nokia.com/browse/QTBUG-3019 --- Description --- EvaluateJavaScript is supposed to provide the return value of the script. It's always null. http://doc.trolltech.com/4.4/qwebframe.html#evaluateJavaScript int main(int argc, char *argv[]) { QApplication app(argc, argv); QWebView *view = new QWebView; view->setHtml("<html><body>Hello world</body></html>"); view->show(); QEventLoop l; QTimer::singleShot(2000, &l, SLOT(quit())); l.exec(); qDebug() << "evaluating javascript"; QVariant retval = view->page()->mainFrame()->evaluateJavaScript("alert('hi'); return true;"); qDebug() << retval; return app.exec(); }
Attachments
Jędrzej Nowacki
Comment 1 2009-10-29 06:21:12 PDT
In example JavaScript code: "alert('hi'); return true;" throw an exception. SyntaxError: Invalid return statement. Return key word can't be used outside functions body. Should be: "alert('hi'); a = true;" or just "alert('hi'); true;" The test case is wrong. Please close the bug.
Jędrzej Nowacki
Comment 2 2009-11-04 05:05:52 PST
(In reply to comment #1) > The test case is wrong. Please close the bug. Closing.
Note You need to log in before you can comment on or make changes to this bug.