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

Konstantin Tokarev annulen at yandex.ru
Sun Apr 30 05:46:51 PDT 2017



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


More information about the webkit-qt mailing list