Switch to legacy PDF.js build
The normal PDF.js build only officially supports the latest Chromium, so things might break every once in a while with QtWebEngine (e.g. #8199, #7335). Let's instead bundle and recommend the legacy build. Closes #8332 Closes #7721 (reworded) Also see #7135
This commit is contained in:
parent
e7b346ecf2
commit
9e70ffeaad
|
|
@ -39,7 +39,7 @@ jobs:
|
||||||
- name: Set up problem matchers
|
- name: Set up problem matchers
|
||||||
run: "python scripts/dev/ci/problemmatchers.py py3 ${{ runner.temp }}"
|
run: "python scripts/dev/ci/problemmatchers.py py3 ${{ runner.temp }}"
|
||||||
- name: Upgrade 3rd party assets
|
- name: Upgrade 3rd party assets
|
||||||
run: "tox exec -e ${{ matrix.testenv }} -- python scripts/dev/update_3rdparty.py --gh-token ${{ secrets.GITHUB_TOKEN }}"
|
run: "tox exec -e ${{ matrix.testenv }} -- python scripts/dev/update_3rdparty.py --gh-token ${{ secrets.GITHUB_TOKEN }} --modern-pdfjs"
|
||||||
if: "endsWith(matrix.image, '-qt6')"
|
if: "endsWith(matrix.image, '-qt6')"
|
||||||
- name: Run tox
|
- name: Run tox
|
||||||
run: dbus-run-session tox -e ${{ matrix.testenv }}
|
run: dbus-run-session tox -e ${{ matrix.testenv }}
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,11 @@ Changed
|
||||||
setting (but not per-domain overrides). This fixes subtle JS issues on
|
setting (but not per-domain overrides). This fixes subtle JS issues on
|
||||||
websites that rely on the custom header being sent for those requests, and
|
websites that rely on the custom header being sent for those requests, and
|
||||||
e.g. block the requests server-side otherwise. (#8370)
|
e.g. block the requests server-side otherwise. (#8370)
|
||||||
|
- Our packaging scripts now prefer the "legacy"/"for older browsers" PDF.js
|
||||||
|
build as their normal release only supports the latest Chromium version and
|
||||||
|
might break in qutebrowser on updates. **Note to packagers:** If there's a
|
||||||
|
PDF.js package in your distribution as an (optional) qutebrowser dependency,
|
||||||
|
consider also switching to this variant (same code, built differently).
|
||||||
|
|
||||||
Fixed
|
Fixed
|
||||||
~~~~~
|
~~~~~
|
||||||
|
|
|
||||||
|
|
@ -110,9 +110,11 @@ li {
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
You can manually download the pdf.js archive
|
You can manually
|
||||||
<a href="https://mozilla.github.io/pdf.js/getting_started/#download">here</a>
|
<a href="https://mozilla.github.io/pdf.js/getting_started/#download">download pdf.js</a>
|
||||||
and extract it to <code>{{ pdfjs_dir }}</code>
|
and extract it to <code>{{ pdfjs_dir }}</code>. Note the "older
|
||||||
|
browsers" ("legacy") build is recommended, the "modern browsers"
|
||||||
|
build only supports the latest Chromium release and might break.
|
||||||
<br>
|
<br>
|
||||||
<span class="warning">Warning:</span> Using this method you are
|
<span class="warning">Warning:</span> Using this method you are
|
||||||
responsible for yourself to keep the installation updated! If a
|
responsible for yourself to keep the installation updated! If a
|
||||||
|
|
|
||||||
|
|
@ -279,7 +279,7 @@ def build_mac(
|
||||||
shutil.rmtree(d, ignore_errors=True)
|
shutil.rmtree(d, ignore_errors=True)
|
||||||
|
|
||||||
utils.print_title("Updating 3rdparty content")
|
utils.print_title("Updating 3rdparty content")
|
||||||
update_3rdparty.run(ace=False, pdfjs=True, legacy_pdfjs=False, fancy_dmg=False,
|
update_3rdparty.run(ace=False, pdfjs=True, modern_pdfjs=False, fancy_dmg=False,
|
||||||
gh_token=gh_token)
|
gh_token=gh_token)
|
||||||
|
|
||||||
utils.print_title("Building .app via pyinstaller")
|
utils.print_title("Building .app via pyinstaller")
|
||||||
|
|
@ -391,7 +391,7 @@ def build_windows(
|
||||||
) -> list[Artifact]:
|
) -> list[Artifact]:
|
||||||
"""Build windows executables/setups."""
|
"""Build windows executables/setups."""
|
||||||
utils.print_title("Updating 3rdparty content")
|
utils.print_title("Updating 3rdparty content")
|
||||||
update_3rdparty.run(nsis=True, ace=False, pdfjs=True, legacy_pdfjs=False,
|
update_3rdparty.run(nsis=True, ace=False, pdfjs=True, modern_pdfjs=False,
|
||||||
fancy_dmg=False, gh_token=gh_token)
|
fancy_dmg=False, gh_token=gh_token)
|
||||||
|
|
||||||
utils.print_title("Building Windows binaries")
|
utils.print_title("Building Windows binaries")
|
||||||
|
|
|
||||||
|
|
@ -89,14 +89,15 @@ def get_latest_pdfjs_url(gh_token, legacy):
|
||||||
return (version_name, download_url)
|
return (version_name, download_url)
|
||||||
|
|
||||||
|
|
||||||
def update_pdfjs(target_version=None, legacy=False, gh_token=None):
|
def update_pdfjs(target_version=None, legacy=True, gh_token=None):
|
||||||
"""Download and extract the latest pdf.js version.
|
"""Download and extract the latest pdf.js version.
|
||||||
|
|
||||||
If target_version is not None, download the given version instead.
|
If target_version is not None, download the given version instead.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
target_version: None or version string ('x.y.z')
|
target_version: None or version string ('x.y.z')
|
||||||
legacy: Whether to download the legacy build for 83-based.
|
legacy: Whether to download the "legacy" build (the normal build only
|
||||||
|
supports the latest Chromium release).
|
||||||
gh_token: GitHub token to use for the API. Optional except on CI.
|
gh_token: GitHub token to use for the API. Optional except on CI.
|
||||||
"""
|
"""
|
||||||
if target_version is None:
|
if target_version is None:
|
||||||
|
|
@ -115,7 +116,8 @@ def update_pdfjs(target_version=None, legacy=False, gh_token=None):
|
||||||
os.chdir(os.path.join(os.path.dirname(os.path.abspath(__file__)),
|
os.chdir(os.path.join(os.path.dirname(os.path.abspath(__file__)),
|
||||||
'..', '..'))
|
'..', '..'))
|
||||||
target_path = os.path.join('qutebrowser', '3rdparty', 'pdfjs')
|
target_path = os.path.join('qutebrowser', '3rdparty', 'pdfjs')
|
||||||
print(f"=> Downloading pdf.js {version}{' (legacy)' if legacy else ''}")
|
version_suffix = '' if legacy else ' (modern browsers version)'
|
||||||
|
print(f"=> Downloading pdf.js {version}{version_suffix}")
|
||||||
try:
|
try:
|
||||||
(archive_path, _headers) = urllib.request.urlretrieve(url)
|
(archive_path, _headers) = urllib.request.urlretrieve(url)
|
||||||
except urllib.error.HTTPError as error:
|
except urllib.error.HTTPError as error:
|
||||||
|
|
@ -171,13 +173,13 @@ def test_dicts():
|
||||||
print('ERROR: {}'.format(response.status))
|
print('ERROR: {}'.format(response.status))
|
||||||
|
|
||||||
|
|
||||||
def run(*, nsis=False, ace=False, pdfjs=True, legacy_pdfjs=False, fancy_dmg=False,
|
def run(*, nsis=False, ace=False, pdfjs=True, modern_pdfjs=False, fancy_dmg=False,
|
||||||
pdfjs_version=None, dicts=False, gh_token=None):
|
pdfjs_version=None, dicts=False, gh_token=None):
|
||||||
"""Update components based on the given arguments."""
|
"""Update components based on the given arguments."""
|
||||||
if nsis:
|
if nsis:
|
||||||
download_nsis_plugins()
|
download_nsis_plugins()
|
||||||
if pdfjs:
|
if pdfjs:
|
||||||
update_pdfjs(pdfjs_version, legacy=legacy_pdfjs, gh_token=gh_token)
|
update_pdfjs(pdfjs_version, legacy=not modern_pdfjs, gh_token=gh_token)
|
||||||
if ace:
|
if ace:
|
||||||
update_ace()
|
update_ace()
|
||||||
if fancy_dmg:
|
if fancy_dmg:
|
||||||
|
|
@ -195,8 +197,8 @@ def main():
|
||||||
help='Specify pdfjs version. If not given, '
|
help='Specify pdfjs version. If not given, '
|
||||||
'the latest version is used.',
|
'the latest version is used.',
|
||||||
required=False, metavar='VERSION')
|
required=False, metavar='VERSION')
|
||||||
parser.add_argument("--legacy-pdfjs",
|
parser.add_argument("--modern-pdfjs",
|
||||||
help="Use legacy PDF.js build (for 83-based)",
|
help="Use PDF.js modern build (only supports latest Chromium)",
|
||||||
action='store_true')
|
action='store_true')
|
||||||
parser.add_argument('--fancy-dmg', help="Update fancy-dmg Makefile",
|
parser.add_argument('--fancy-dmg', help="Update fancy-dmg Makefile",
|
||||||
action='store_true')
|
action='store_true')
|
||||||
|
|
@ -209,7 +211,7 @@ def main():
|
||||||
'--gh-token', help="GitHub token to use.", nargs='?')
|
'--gh-token', help="GitHub token to use.", nargs='?')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
run(nsis=False, ace=True, pdfjs=True, fancy_dmg=args.fancy_dmg,
|
run(nsis=False, ace=True, pdfjs=True, fancy_dmg=args.fancy_dmg,
|
||||||
pdfjs_version=args.pdfjs, legacy_pdfjs=args.legacy_pdfjs,
|
pdfjs_version=args.pdfjs, modern_pdfjs=args.modern_pdfjs,
|
||||||
dicts=args.dicts, gh_token=args.gh_token)
|
dicts=args.dicts, gh_token=args.gh_token)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue