Bug 260019 - [WPE][GTK] There should be an easily accessible way to disable pdf.js at runtime
Summary: [WPE][GTK] There should be an easily accessible way to disable pdf.js at runtime
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: PDF (show other bugs)
Version: Other
Hardware: All Linux
: P2 Enhancement
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-08-10 03:33 PDT by Martin Demlon
Modified: 2023-10-13 10:56 PDT (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Demlon 2023-08-10 03:33:08 PDT
I prefer my local PDF viewer over pdf.js and would like my browser (in case it matters: luakit) to directly hand through PDFs to it.  I have groped around in the Webkit source a bit, but all I could find was the build-time ENABLED(PDF) switches – which is not helpful in my case, as I would like to keep using my distribution's packages), and grepping for enable-something in the built libwebkitgtk did not yield anything either.

So... can we have a pdf.js-switch?  Or could the the pdf.js machinery at
least honour the enable-plugins setting?
Comment 1 Radar WebKit Bug Importer 2023-08-17 03:34:13 PDT
<rdar://problem/114018319>
Comment 2 Alberto Garcia 2023-10-13 03:10:26 PDT
Also reported downstream in Debian recently for WebKitGTK: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1053713
Comment 3 Michael Catanzaro 2023-10-13 05:42:13 PDT
There is a PdfJSViewerEnabled setting for this, but it's not exposed for WPE/GTK APIs. This would be a good first pull request for anyone interested in contributing. Add the setting to WebKitSettings.h.in and WebKitSettings.cpp, then add a sanity-check test to TestWebKitSettings.cpp just to ensure that toggling the setting works. Most of the work will be copy/pasting from an existing setting and then renaming things.
Comment 4 Michael Catanzaro 2023-10-13 10:56:51 PDT
OK, this can sort of be done already using webkit_settings_get_all_features(), iterate through the list until you find PdfJSViewerEnabled, and then webkit_settings_set_feature_enabled(). That's not very convenient, though.