Fix progress queue segfault (#3359)

This commit is contained in:
Abe Jellinek 2023-08-23 04:56:21 -04:00 committed by GitHub
parent 8125b62108
commit 8f4cb5002a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -68,6 +68,14 @@ const ProgressQueueTable = ({ onActivate = noop, progressQueue }) => {
for (let column of columns) {
if (column.dataKey === 'success') {
let span = document.createElement('span');
if (!span.ownerGlobal) {
// If this script was imported from a non-window context, we'll have a global object that looks like
// a Window and document.createElement() will succeed, but the returned Element object won't have
// an ownerGlobal. Trying to append a child or set its innerHTML will segfault Zotero. For now,
// let's just abort if we get an invalid Element.
// TODO: Remove once we're using ES modules
return div;
}
span.className = `cell icon ${column.className}`;
span.appendChild(getImageByStatus(row.status));
div.appendChild(span);