From 8f4cb5002a50bab30584c32ba65a9776a6fd90fa Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Wed, 23 Aug 2023 04:56:21 -0400 Subject: [PATCH] Fix progress queue segfault (#3359) --- chrome/content/zotero/components/progressQueueTable.jsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/chrome/content/zotero/components/progressQueueTable.jsx b/chrome/content/zotero/components/progressQueueTable.jsx index c010c7639e..dfa6c66ef2 100644 --- a/chrome/content/zotero/components/progressQueueTable.jsx +++ b/chrome/content/zotero/components/progressQueueTable.jsx @@ -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);