From b109279a17f2bbd3f4266740f992db99c3e6fbac Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 13 May 2016 15:45:51 -0400 Subject: [PATCH] Avoid errors for some invalid requests viewing attachments --- components/zotero-protocol-handler.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/components/zotero-protocol-handler.js b/components/zotero-protocol-handler.js index 17e3426966..fe9e8f7d87 100644 --- a/components/zotero-protocol-handler.js +++ b/components/zotero-protocol-handler.js @@ -1094,14 +1094,14 @@ ZoteroProtocolHandler.prototype = { } } - // pass request through to ZoteroProtocolHandler::newChannel - if (uriString.indexOf("chrome") != 0) { - uriString = uri.spec; - uriString = "chrome" + uriString.substring(uriString.indexOf(":")); - uri = chromeService.newURI(uriString, null, null); - } - - newChannel = chromeService.newChannel(uri); + // Return cancelled channel for unknown paths + // + // These can be in the form zotero://example.com/... -- maybe for "//example.com" URLs? + var chromeURI = chromeService.newURI(DUMMY_CHROME_URL, null, null); + var extChannel = chromeService.newChannel(chromeURI); + var chromeRequest = extChannel.QueryInterface(Components.interfaces.nsIRequest); + chromeRequest.cancel(0x804b0002); // BINDING_ABORTED + return extChannel; } catch (e) { Components.utils.reportError(e);