From 5f8ea3af9c08adccbf4ca925da72de6e32eaf1fe Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Mon, 6 May 2024 13:21:26 -0400 Subject: [PATCH] PageDataChild: Return null channelInfo on non-HTTP channel Rather than throwing. Fixes requireSuccessfulStatus on file: (etc.) URIs. --- .../content/zotero/actors/PageDataChild.jsm | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/chrome/content/zotero/actors/PageDataChild.jsm b/chrome/content/zotero/actors/PageDataChild.jsm index e4eb4a0f88..c69de7982b 100644 --- a/chrome/content/zotero/actors/PageDataChild.jsm +++ b/chrome/content/zotero/actors/PageDataChild.jsm @@ -31,17 +31,18 @@ class PageDataChild extends JSWindowActorChild { case "channelInfo": { let docShell = this.contentWindow.docShell; - let channel = (docShell.currentDocumentChannel || docShell.failedChannel) - ?.QueryInterface(Ci.nsIHttpChannel); - if (channel) { - return { - responseStatus: channel.responseStatus, - responseStatusText: channel.responseStatusText - }; - } - else { - return null; + try { + let channel = (docShell.currentDocumentChannel || docShell.failedChannel) + ?.QueryInterface(Ci.nsIHttpChannel); + if (channel) { + return { + responseStatus: channel.responseStatus, + responseStatusText: channel.responseStatusText + }; + } } + catch (e) {} + return null; } } }