Avoid errors for some invalid requests viewing attachments

This commit is contained in:
Dan Stillman 2016-05-13 15:45:51 -04:00
parent eb400587e8
commit b109279a17

View file

@ -1094,14 +1094,14 @@ ZoteroProtocolHandler.prototype = {
} }
} }
// pass request through to ZoteroProtocolHandler::newChannel // Return cancelled channel for unknown paths
if (uriString.indexOf("chrome") != 0) { //
uriString = uri.spec; // These can be in the form zotero://example.com/... -- maybe for "//example.com" URLs?
uriString = "chrome" + uriString.substring(uriString.indexOf(":")); var chromeURI = chromeService.newURI(DUMMY_CHROME_URL, null, null);
uri = chromeService.newURI(uriString, null, null); var extChannel = chromeService.newChannel(chromeURI);
} var chromeRequest = extChannel.QueryInterface(Components.interfaces.nsIRequest);
chromeRequest.cancel(0x804b0002); // BINDING_ABORTED
newChannel = chromeService.newChannel(uri); return extChannel;
} }
catch (e) { catch (e) {
Components.utils.reportError(e); Components.utils.reportError(e);