Bug 238023 - Add a public build option for PDF.js
Summary: Add a public build option for PDF.js
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: PDF (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Carlos Garcia Campos
URL:
Keywords: InRadar
Depends on:
Blocks: 235969
  Show dependency treegraph
 
Reported: 2022-03-17 07:25 PDT by Carlos Garcia Campos
Modified: 2022-03-26 00:35 PDT (History)
18 users (show)

See Also:


Attachments
Patch (18.10 KB, patch)
2022-03-17 07:30 PDT, Carlos Garcia Campos
mcatanzaro: review+
ews-feeder: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Garcia Campos 2022-03-17 07:25:51 PDT
PDF.js increases the binary size of the library quite a bit, so embedders might want to disable it if they know they don't need PDF support at all.
Comment 1 Carlos Garcia Campos 2022-03-17 07:30:22 PDT
Created attachment 454971 [details]
Patch
Comment 2 Carlos Garcia Campos 2022-03-17 07:51:18 PDT
- wihtout PDF.js: libwebkit2gtk-4.1.so.0.2.0 -> 91M
- with PDF.js: libwebkit2gtk-4.1.so.0.2.0 -> 95M

This is a developer release build in both cases.
Comment 3 Michael Catanzaro 2022-03-17 08:19:32 PDT
Comment on attachment 454971 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=454971&action=review

> Source/WebCore/page/SecurityOrigin.cpp:127
>  #if PLATFORM(GTK) || PLATFORM(WPE)
>          || url.protocolIs("resource")
> +#if ENABLE(PDFJS)
>          || url.protocolIs("webkit-pdfjs-viewer")
> +#endif
>  #endif

I know we discussed this in bug #237513, but thinking about it more, webkit-pdfjs-viewer should never be treated as a unique origin on any port. Just move it outside the #if PLATFORM(GTK) || PLATFORM(WPE).
Comment 4 Tim Nguyen (:ntim) 2022-03-17 14:36:36 PDT
Comment on attachment 454971 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=454971&action=review

> ChangeLog:3
> +        [GTK][WPE] Add a public build option for PDF.js

This isn't really specific to GTK/WPE right?
Comment 5 Carlos Garcia Campos 2022-03-18 01:24:17 PDT
Comment on attachment 454971 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=454971&action=review

>> ChangeLog:3
>> +        [GTK][WPE] Add a public build option for PDF.js
> 
> This isn't really specific to GTK/WPE right?

Well, the public build option is specific to GTK and WPE, for other ports it's an internal flag

>> Source/WebCore/page/SecurityOrigin.cpp:127
>>  #endif
> 
> I know we discussed this in bug #237513, but thinking about it more, webkit-pdfjs-viewer should never be treated as a unique origin on any port. Just move it outside the #if PLATFORM(GTK) || PLATFORM(WPE).

I prefer not to change the behavior in this patch, this is just about adding a build option.
Comment 6 Carlos Garcia Campos 2022-03-18 01:35:37 PDT
Committed r291473 (248589@trunk): <https://commits.webkit.org/248589@trunk>
Comment 7 Radar WebKit Bug Importer 2022-03-18 01:36:19 PDT
<rdar://problem/90476812>