RESOLVED FIXED 54138
[Qt] QWebPage with WebGL content crashes when rendering if no QWebView parent
https://bugs.webkit.org/show_bug.cgi?id=54138
Summary [Qt] QWebPage with WebGL content crashes when rendering if no QWebView parent
Andrew Wason
Reported 2011-02-09 13:24:08 PST
Created attachment 81860 [details] Qt app that demonstrates the crash This bug depends on a working WebGL build from bug 53431 If a QWebPage content contains WebGL, when the page is rendered it crashes because WebCore::GraphicsContext3DInternal::getOwnerGLWidget assumes we have a QWebPageClient. Need to check and return 0 if no QWebPageClient was set. Simple demo app attached, and backtrace from running it.
Attachments
Qt app that demonstrates the crash (937 bytes, application/zip)
2011-02-09 13:24 PST, Andrew Wason
no flags
gdb backtrace when running client_crash test app (2.02 KB, text/plain)
2011-02-09 13:25 PST, Andrew Wason
no flags
Check webPageClient before referencing it (1.35 KB, patch)
2011-02-09 13:28 PST, Andrew Wason
benjamin: review-
Check webPageClient before referencing it (3.51 KB, patch)
2011-02-09 18:43 PST, Andrew Wason
no flags
Check webPageClient before referencing it (3.68 KB, patch)
2011-03-20 18:40 PDT, Andrew Wason
benjamin: review-
Check webPageClient before referencing it (3.99 KB, patch)
2011-03-22 08:20 PDT, Andrew Wason
no flags
Andrew Wason
Comment 1 2011-02-09 13:25:02 PST
Created attachment 81861 [details] gdb backtrace when running client_crash test app
Andrew Wason
Comment 2 2011-02-09 13:28:28 PST
Created attachment 81863 [details] Check webPageClient before referencing it
Benjamin Poulain
Comment 3 2011-02-09 13:49:14 PST
Comment on attachment 81863 [details] Check webPageClient before referencing it This should really have an autotest.
Andrew Wason
Comment 4 2011-02-09 18:43:54 PST
Created attachment 81911 [details] Check webPageClient before referencing it Add unit test
Antonio Gomes
Comment 5 2011-02-09 21:23:43 PST
Comment on attachment 81911 [details] Check webPageClient before referencing it View in context: https://bugs.webkit.org/attachment.cgi?id=81911&action=review > Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp:2482 > +#if defined(ENABLE_WEBGL) && ENABLE_WEBGL this looks odd... > Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp:2483 > +// https://bugs.webkit.org/show_bug.cgi?id=54138 usually git blame and the changelog are enough for reference bugs like this.
Andrew Wason
Comment 6 2011-02-10 08:07:39 PST
(In reply to comment #5) > (From update of attachment 81911 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=81911&action=review > > > Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp:2482 > > +#if defined(ENABLE_WEBGL) && ENABLE_WEBGL > > this looks odd... I know the conventional way is: #if ENABLE(WEBGL) but the ENABLE macro isn't available in tst_qwebpage.cpp - not sure what header I need to get it. Should I just remove the ifdefs altogether?
Benjamin Poulain
Comment 7 2011-02-10 08:10:35 PST
(In reply to comment #6) > I know the conventional way is: > #if ENABLE(WEBGL) > but the ENABLE macro isn't available in tst_qwebpage.cpp - not sure what header I need to get it. I doubt ENABLE_WEBGL is available for the tests, this is WebKit internal. Maybe you should check if WebGL is available at runtime, like I did for geolocation?
Andreas Kling
Comment 8 2011-02-10 08:12:43 PST
Why is there no QWebPageClient set?
Andrew Wason
Comment 9 2011-02-10 08:14:29 PST
(In reply to comment #7) > I doubt ENABLE_WEBGL is available for the tests, this is WebKit internal. Well, the test builds and runs (when passing --3d-canvas to build-webkit) so it must be available. > Maybe you should check if WebGL is available at runtime, like I did for geolocation? OK, I'll do that.
Benjamin Poulain
Comment 10 2011-02-10 08:18:36 PST
(In reply to comment #9) > (In reply to comment #7) > > I doubt ENABLE_WEBGL is available for the tests, this is WebKit internal. > > Well, the test builds and runs (when passing --3d-canvas to build-webkit) so it must be available. That particular function runs? Ok.
Andrew Wason
Comment 11 2011-02-10 08:30:38 PST
(In reply to comment #8) > Why is there no QWebPageClient set? It looks like the client is set when you set the view (in QWebPage::setView in Source/WebKit/qt/Api/qwebpage.cpp) and we don't have a view in this case.
Andrew Wason
Comment 12 2011-02-10 08:36:38 PST
(In reply to comment #10) > (In reply to comment #9) > > Well, the test builds and runs (when passing --3d-canvas to build-webkit) so it must be available. > > That particular function runs? Ok. Yes: ./tst_qwebpage webGLScreenshotWithoutView ********* Start testing of tst_QWebPage ********* Config: Using QTest library 4.7.1, Qt 4.7.1 PASS : tst_QWebPage::initTestCase() PASS : tst_QWebPage::webGLScreenshotWithoutView() PASS : tst_QWebPage::cleanupTestCase() Totals: 3 passed, 0 failed, 0 skipped ********* Finished testing of tst_QWebPage ********* LEAK: 7 WebCoreNode LEAK: 291 Structure
Jarkko Sakkinen
Comment 13 2011-03-20 13:03:58 PDT
Hi, what's the status of this? I have implemented couple of fixes to upstream that you have to take into account: - https://bugs.webkit.org/show_bug.cgi?id=56555 - https://bugs.webkit.org/show_bug.cgi?id=56339 I looked at your fix and these changes must be done: - In the test case enable QWebSettings::AcceleratedCompositing. We support (at least for the first releasable WebGL support) creation only when accelerated compositing is enabled. - Put the fix into getViewportGLWidget(). Either submit a revised fix *or* inform me if you don't want to do it. Thank you.
Jarkko Sakkinen
Comment 14 2011-03-20 13:05:18 PDT
Andrew Wason
Comment 15 2011-03-20 18:40:38 PDT
Created attachment 86288 [details] Check webPageClient before referencing it Fix patch to take into account upstream changes. Enable QWebSettings::AcceleratedCompositingEnabled in testcase.
Jarkko Sakkinen
Comment 16 2011-03-20 23:14:33 PDT
Looks good to me. Thanks.
Benjamin Poulain
Comment 17 2011-03-22 06:27:48 PDT
Comment on attachment 86288 [details] Check webPageClient before referencing it View in context: https://bugs.webkit.org/attachment.cgi?id=86288&action=review The change make sense to me, I would just like better testing. > Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp:2482 > +void tst_QWebPage::webGLScreenshotWithoutView() I would like this test, with and without AcceleratedCompositingEnabled. Just to have good coverage. > Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp:2484 > + QWebPage* page = new QWebPage; You should allocate the QWebPage on the stack to avoid dealing with the memory manually. > Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp:2492 > + ::waitForSignal(mainFrame, SIGNAL(loadFinished(bool)), 2000); Is loadFinished() called for setHtml? Otherwise the test would always spend 2 seconds waiting.
Andrew Wason
Comment 18 2011-03-22 08:20:14 PDT
Created attachment 86462 [details] Check webPageClient before referencing it Changed testcase to: * Test with and without AcceleratedCompositing enabled. * Allocate QWebPage on stack. * Do not wait for loadFinished signal, it is not called for setHtml().
WebKit Commit Bot
Comment 19 2011-03-22 08:49:18 PDT
Comment on attachment 86462 [details] Check webPageClient before referencing it Clearing flags on attachment: 86462 Committed r81669: <http://trac.webkit.org/changeset/81669>
WebKit Commit Bot
Comment 20 2011-03-22 08:49:24 PDT
All reviewed patches have been landed. Closing bug.
WebKit Review Bot
Comment 21 2011-03-22 11:39:38 PDT
http://trac.webkit.org/changeset/81669 might have broken GTK Linux 32-bit Debug The following tests are not passing: inspector/debugger/debug-inlined-scripts.html
Note You need to log in before you can comment on or make changes to this bug.