[webkit-qt] Crash with pdf.js (Technology preview 5)

Konstantin Tokarev annulen at yandex.ru
Sun Apr 30 06:29:39 PDT 2017



30.04.2017, 16:07, "Thomas Rusche" <thomas.rusche at gmail.com>:
> Hello Konstantin,
>
> thanks for your answer. Although I am working on Windows 8.1 64 bit, my MinGW is only 32 bit (the one included in the Qt installer). 

Ah, sorry I misunderstood your initial message.

>So I am wondering why it crashes because it seems not to be related to 64 bit MinGW.

Indeed, JIT with MinGW 32-bit was known to work fine. I'll try to reproduce your crash.

>
> The other module you are talking about (QtPdf) I already heard about and it is really interesting, but isn't it using Pdfium? Then I would need to use MSVC compiler on Windows. And I am not sure if I could then use the same code on Linux and Mac.

I see that pdfium is packages in MSYS:

https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-pdfium-git

So I guess it should be possible to make QtPdf building as well, using patch from this link.
That said, QtPdf currently disables build with MinGW, maybe authors are unaware of that patch.

http://code.qt.io/cgit/qt-labs/qtpdf.git/tree/qpdf.pro

>
> The TP5 is already build and I only needed to copy the files into Qt's install path. If I manage to build qtwebkit-stable, does it produce the same kind of files which I only need to copy then?

Then you may want to wait for binary builds of the next release, it should happen next week.

>
> Thanks!
> Greetings
> Thomas
>
> 2017-04-30 14:46 GMT+02:00 Konstantin Tokarev <annulen at yandex.ru>:
>
>> 30.04.2017, 10:56, "Thomas Rusche" <thomas.rusche at gmail.com>:
>>> Hello!
>>>
>>> Recently I downloaded the preview version 5 and tried to view pdf files with Mozilla's pdf.js. I am using Qt5.8 on Windows 8.1 64bit with MinGW.
>>>
>>> The application crashes immediately, saying there was an error in this Webkit lib. I cannot find more details because the MinGW debug build is not supported right now.
>>
>> TP5 did not support 64-bit MinGW, please use qtwebkit-stable branch.
>>
>> There are 2 issues here:
>>
>> * JIT is currently broken with 64-bit MinGW (see issue [1]). Yeah it's a shame, but current solution is to disable JIT automatically in this configuration [2]. Someone has to fix it, otherwise if fast JavaScript is your requirement you should consider 32-bit MinGW or 64-bit MSVC.
>>
>> * Debug build with MinGW is possible in qtwebkit-stable branch now, by skipping debug info for internal code [3]. Similar hack was employed in legacy QtWebKit too.
>>
>> Note that there is a possible alternative to using pdf,js that avoid using JavaScript for rendering PDF, by integrating new QtPdf module. See [4]. Note that some code was already written, if you are interested to help with implementation please join our IRC channel and ping austriancoder. Though I have no info if QtPdf supports MinGW at the moment or there are any issues.
>>
>> [1] https://github.com/annulen/webkit/issues/442
>> [2] https://github.com/annulen/webkit/blob/qtwebkit-stable/Source/cmake/OptionsQt.cmake#L206
>> [3] https://github.com/annulen/webkit/blob/qtwebkit-stable/Source/PlatformQt.cmake#L10
>> [4] https://github.com/annulen/webkit/issues/232
>>
>>>
>>> But perhaps you can retry it.
>>> Just download pdf.js from here: https://github.com/mozilla/pdf.js/releases
>>> and integrate it into a Qt-resource-file under the prefix "/pdfjs".
>>>
>>> Here is the source code:
>>>
>>> pdfjs.h:
>>>
>>> #ifndef PDFJS_H
>>>
>>> #define PDFJS_H
>>>
>>> #include <QWidget>
>>>
>>> #include <QtWebKitWidgets/QWebView>
>>>
>>> class PdfJs : public QWidget
>>>
>>> {
>>>
>>> Q_OBJECT
>>>
>>> QWebView *webview_ = nullptr;
>>>
>>> public:
>>>
>>> PdfJs(QWidget *parent = 0);
>>>
>>> ~PdfJs();
>>>
>>> };
>>>
>>> #endif // PDFJS_H
>>>
>>> pdfjs.cpp:
>>>
>>> #include "pdfjs.h"
>>>
>>> #include <QVBoxLayout>
>>>
>>> #include <QWebInspector>
>>>
>>> #include <QWebSettings>
>>>
>>> PdfJs::PdfJs(QWidget *parent)
>>>
>>> : QWidget(parent)
>>>
>>> {
>>>
>>> this->setLayout( new QVBoxLayout );
>>>
>>> this->layout()->setContentsMargins(0,0,0,0);
>>>
>>> webview_ = new QWebView(this);
>>>
>>> webview_->setUrl( QUrl("qrc:/pdfjs/web/viewer.html") );
>>>
>>> // Try to find crash hints with the WebInspector (did not work, app crashes too early)
>>>
>>> webview_->page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
>>>
>>> QWebInspector *inspector = new QWebInspector();
>>>
>>> inspector->setPage(webview_->page());
>>>
>>> inspector->setVisible(true);
>>>
>>> this->layout()->addWidget( webview_ );
>>>
>>> }
>>>
>>> PdfJs::~PdfJs()
>>>
>>> {
>>>
>>> }
>>>
>>> Greetings
>>>
>>> Thomas
>>>
>>> ,
>>>
>>> _______________________________________________
>>> webkit-qt mailing list
>>> webkit-qt at lists.webkit.org
>>> https://lists.webkit.org/mailman/listinfo/webkit-qt
>>
>> --
>> Regards,
>> Konstantin


-- 
Regards,
Konstantin


More information about the webkit-qt mailing list