From 278f2de7bdb632ff490ec7e75d026b78a711e518 Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Mon, 7 Aug 2023 15:59:00 -0400 Subject: [PATCH] Fix iframe load stopping if attachment resource channel aborts (#67) --- components/zotero-protocol-handler.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/components/zotero-protocol-handler.js b/components/zotero-protocol-handler.js index 8ad9fc1e0d..4753bd59f3 100644 --- a/components/zotero-protocol-handler.js +++ b/components/zotero-protocol-handler.js @@ -1411,7 +1411,12 @@ AsyncChannel.prototype = { }, onDataAvailable: function (request, inputStream, offset, count) { //Zotero.debug("onDataAvailable"); - streamListener.onDataAvailable(channel, inputStream, offset, count); + try { + streamListener.onDataAvailable(channel, inputStream, offset, count); + } + catch (e) { + channel.cancel(e.result); + } }, onStopRequest: function (request, status) { //Zotero.debug("Stopping request"); @@ -1515,7 +1520,10 @@ AsyncChannel.prototype = { } throw e; } finally { - if (channel.loadGroup) channel.loadGroup.removeRequest(channel, null, 0); + try { + if (channel.loadGroup) channel.loadGroup.removeRequest(channel, null, 0); + } + catch (e) {} } }),