Skip to content

Stop bundling errorWrapper CSS rules in the MOZCENTRAL build #14810

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

Snuffleupagus
Copy link
Collaborator

Note that both the errorWrapper HTML and JavaScript code is being ignored in the MOZCENTRAL build, i.e. the built-in Firefox PDF Viewer, however the CSS rules are still being included.
That seems totally unnecessary, and while we currently don't have full build-target support in the CSS pre-processor we can actually improve things quite easily anyway. By (ab)using the existing CSS pre-processor, which will remove any non-Firefox CSS rules for the MOZCENTRAL build, it's possible to easily stop bundling any CSS rules by using comments that include a -webkit-string.

Please note: To easily test that this doesn't break the errorWrapper in GENERIC builds, try running e.g. PDFViewerApplication._otherError("test"); in the web-console.

Note that both the `errorWrapper` HTML and JavaScript code is being ignored in the MOZCENTRAL build, i.e. the *built-in* Firefox PDF Viewer, however the CSS rules are still being included.
That seems totally unnecessary, and while we currently don't have full build-target support in the CSS pre-processor we can actually improve things quite easily anyway. By (ab)using the existing CSS pre-processor, which will remove any non-Firefox CSS rules for the MOZCENTRAL build, it's possible to easily stop bundling any CSS rules by using comments that include a `-webkit`-string.

*Please note:* To easily test that this doesn't break the `errorWrapper` in GENERIC builds, try running e.g. `PDFViewerApplication._otherError("test");` in the web-console.
@Snuffleupagus
Copy link
Collaborator Author

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_preview from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/42e2731a3dfa6ec/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/42e2731a3dfa6ec/output.txt

Total script time: 2.60 mins

Published

@timvandermeij timvandermeij merged commit 452a98b into mozilla:master Apr 20, 2022
@timvandermeij
Copy link
Contributor

timvandermeij commented Apr 20, 2022

Ha, that's a creative way to do it indeed ;-)

Let's do this; thanks!

@Snuffleupagus Snuffleupagus deleted the mozcentral-rm-errorWrapper-CSS branch April 20, 2022 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants