From 29ebaa5ec62e751f7197b2931a4a0f8061ae20f4 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Fri, 21 May 2021 17:53:21 +0100 Subject: [PATCH] Assume fetch-based API for feed processsing This converts the feed processor to expect a `fetch`-based API instead of an XPCOM stream. --- resource/feeds/FeedProcessor.js | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/resource/feeds/FeedProcessor.js b/resource/feeds/FeedProcessor.js index b7f059f483..be065e9722 100644 --- a/resource/feeds/FeedProcessor.js +++ b/resource/feeds/FeedProcessor.js @@ -1159,28 +1159,10 @@ FeedProcessor.prototype = { this._reader.parseAsync(requestObserver); }, - // nsIStreamListener + // Fetch API - // The XMLReader will throw sensible exceptions if these get called - // out of order. - onStartRequest: function (request, context) { - // this will throw if the request is not a channel, but so will nsParser. - var channel = request.QueryInterface(Ci.nsIChannel); - channel.contentType = "application/vnd.mozilla.maybe.feed"; - this._reader.onStartRequest(request, context); - }, - - onStopRequest: function (request, context, statusCode) { - try { - this._reader.onStopRequest(request, context, statusCode); - } - finally { - this._reader = null; - } - }, - - onDataAvailable: function (request, context, inputStream, offset, count) { - this._reader.onDataAvailable(request, context, inputStream, offset, count); + onResponseAvailable(response) { + return this._reader.onResponseAvailable(response); }, // nsISAXErrorHandler