Fix error trying to delete a profile in Profile Manager

Regression from 23da0d70b0 -- commonDialog.xhtml now pulls in
include.js, but that window can be opened via Services.prompt.confirm()
in the Profile Manager when deleting profiles, which caused it to try to
initialize Zotero without an active profile, which was bad.

https://forums.zotero.org/discussion/112751/zotero-7-beta-68-error-when-attempting-to-delete-zotero-profile
This commit is contained in:
Dan Stillman 2024-04-02 01:07:40 -04:00
parent 29c0460930
commit 38287cec07

View file

@ -326,10 +326,14 @@ function modify_omni {
'<\?xml-stylesheet href=\"chrome:\/\/global\/skin\/commonDialog.css\" type=\"text\/css\"\?>
<\?xml-stylesheet href=\"chrome:\/\/zotero-platform\/content\/zotero.css\" type=\"text\/css\"\?>' \
chrome/toolkit/content/global/commonDialog.xhtml
# commonDialog.xhtml can be opened via Services.prompt in the Profile Manager, so check for a profile first
replace_line '<script>' \
'<script>
Services.scriptloader.loadSubScript(\"chrome:\/\/zotero\/content\/include.js\", this);
Services.scriptloader.loadSubScript(\"chrome:\/\/zotero\/content\/customElements.js\", this);' \
try {
Services.dirsvc.get(\"ProfD\", Ci.nsIFile);
Services.scriptloader.loadSubScript(\"chrome:\/\/zotero\/content\/include.js\", this);
Services.scriptloader.loadSubScript(\"chrome:\/\/zotero\/content\/customElements.js\", this);
} catch (e) {}' \
chrome/toolkit/content/global/commonDialog.xhtml
# Use native checkbox instead of Firefox-themed version in prompt dialogs