Fix segfault when hyphenating text in main process (#3388)

This commit is contained in:
Abe Jellinek 2023-09-14 02:48:50 -04:00 committed by GitHub
parent 78fe68164f
commit 8d825f641a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 0 deletions

View file

@ -213,15 +213,21 @@ cd "$app_dir"
# Copy 'browser' files from Firefox
#
# omni.ja is left uncompressed within the Firefox application files by fetch_xulrunner
#
# TEMP: Also extract .hyf hyphenation files from the outer (still compressed) omni.ja
# This works around https://bugzilla.mozilla.org/show_bug.cgi?id=1772900
set +e
if [ $BUILD_MAC == 1 ]; then
cp -Rp "$MAC_RUNTIME_PATH"/Contents/Resources/browser/omni "$app_dir"
unzip -qj "$MAC_RUNTIME_PATH"/Contents/Resources/omni.ja "hyphenation/*" -d "$app_dir"/hyphenation/
elif [ $BUILD_WIN == 1 ]; then
# Non-arch-specific files, so just use 64-bit version
cp -Rp "${WIN_RUNTIME_PATH_PREFIX}win-x64"/browser/omni "$app_dir"
unzip -qj "${WIN_RUNTIME_PATH_PREFIX}win-x64"/omni.ja "hyphenation/*" -d "$app_dir"/hyphenation/
elif [ $BUILD_LINUX == 1 ]; then
# Non-arch-specific files, so just use 64-bit version
cp -Rp "${LINUX_RUNTIME_PATH_PREFIX}x86_64"/browser/omni "$app_dir"
unzip -qj "${LINUX_RUNTIME_PATH_PREFIX}x86_64"/omni.ja "hyphenation/*" -d "$app_dir"/hyphenation/
fi
set -e
cd $omni_dir

View file

@ -0,0 +1,10 @@
<?xml version="1.0"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<browser remote="false" />
<script>
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
document.querySelector('browser').loadURI('chrome://zotero-unit/content/hyphenationTestContent.html', {
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal()
});
</script>
</window>

View file

@ -0,0 +1,7 @@
<!DOCTYPE html>
<html lang="de-DE">
<div style="hyphens: auto">
Am 15. Juli 2017 wäre Walter Benjamin (1892-1940) 125 Jahre alt
geworden. Ottmar Fuchs erschließt einige Grundzüge seines Denkens.
</div>

View file

@ -0,0 +1,8 @@
describe("Hyphenation", function () {
it("should not cause a segfault", async function () {
// Files in test/tests/data/ (resources://) can't be parsed as XUL/XHTML, so the data for this test is in
// test/content/ (chrome://), which can
window.openDialog('chrome://zotero-unit/content/hyphenationTest.xhtml', 'test', 'chrome');
await Zotero.Promise.delay(200);
});
});