summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaming4JC <g4jc@bulletmail.org>2018-09-17 19:36:46 -0400
committerGaming4JC <g4jc@bulletmail.org>2018-09-17 19:36:46 -0400
commit674e363d94834731e33b7c1e75cab5eedf9d4fc1 (patch)
tree4755001ca1ae20ded064c49f61b4cdb00ccc1a9f
parentca510ceb7f38aa00a2a203498f1005b8a2c6c6d6 (diff)
downloadiceweasel-uxp-674e363d94834731e33b7c1e75cab5eedf9d4fc1.tar.gz
Remove webservice feedreader support: backport m-c 147767
-rw-r--r--app/profile/iceweasel-uxp.js20
-rw-r--r--base/content/browser-feeds.js106
-rw-r--r--components/feeds/BrowserFeeds.manifest1
-rw-r--r--components/feeds/FeedConverter.js56
-rw-r--r--components/feeds/FeedWriter.js78
-rw-r--r--components/feeds/WebContentConverter.js717
-rw-r--r--components/feeds/moz.build1
-rw-r--r--components/feeds/nsIWebContentConverterRegistrar.idl117
-rw-r--r--components/preferences/applicationManager.js2
-rw-r--r--components/preferences/in-content/applications.js50
-rw-r--r--modules/Feeds.jsm15
11 files changed, 43 insertions, 1120 deletions
diff --git a/app/profile/iceweasel-uxp.js b/app/profile/iceweasel-uxp.js
index 90c81b4..b255b2b 100644
--- a/app/profile/iceweasel-uxp.js
+++ b/app/profile/iceweasel-uxp.js
@@ -670,26 +670,6 @@ pref("layout.spellcheckDefault", 1);
pref("browser.send_pings", false);
-/* initial web feed readers list */
-pref("browser.contentHandlers.types.0.title", "chrome://browser-region/locale/region.properties");
-pref("browser.contentHandlers.types.0.uri", "chrome://browser-region/locale/region.properties");
-pref("browser.contentHandlers.types.0.type", "application/vnd.mozilla.maybe.feed");
-pref("browser.contentHandlers.types.1.title", "chrome://browser-region/locale/region.properties");
-pref("browser.contentHandlers.types.1.uri", "chrome://browser-region/locale/region.properties");
-pref("browser.contentHandlers.types.1.type", "application/vnd.mozilla.maybe.feed");
-pref("browser.contentHandlers.types.2.title", "chrome://browser-region/locale/region.properties");
-pref("browser.contentHandlers.types.2.uri", "chrome://browser-region/locale/region.properties");
-pref("browser.contentHandlers.types.2.type", "application/vnd.mozilla.maybe.feed");
-pref("browser.contentHandlers.types.3.title", "chrome://browser-region/locale/region.properties");
-pref("browser.contentHandlers.types.3.uri", "chrome://browser-region/locale/region.properties");
-pref("browser.contentHandlers.types.3.type", "application/vnd.mozilla.maybe.feed");
-pref("browser.contentHandlers.types.4.title", "chrome://browser-region/locale/region.properties");
-pref("browser.contentHandlers.types.4.uri", "chrome://browser-region/locale/region.properties");
-pref("browser.contentHandlers.types.4.type", "application/vnd.mozilla.maybe.feed");
-pref("browser.contentHandlers.types.5.title", "chrome://browser-region/locale/region.properties");
-pref("browser.contentHandlers.types.5.uri", "chrome://browser-region/locale/region.properties");
-pref("browser.contentHandlers.types.5.type", "application/vnd.mozilla.maybe.feed");
-
pref("browser.feeds.handler", "ask");
pref("browser.videoFeeds.handler", "ask");
pref("browser.audioFeeds.handler", "ask");
diff --git a/base/content/browser-feeds.js b/base/content/browser-feeds.js
index 6f29d89..2d5da67 100644
--- a/base/content/browser-feeds.js
+++ b/base/content/browser-feeds.js
@@ -13,17 +13,14 @@ const TYPE_MAYBE_VIDEO_FEED = "application/vnd.mozilla.maybe.video.feed";
const PREF_SHOW_FIRST_RUN_UI = "browser.feeds.showFirstRunUI";
const PREF_SELECTED_APP = "browser.feeds.handlers.application";
-const PREF_SELECTED_WEB = "browser.feeds.handlers.webservice";
const PREF_SELECTED_ACTION = "browser.feeds.handler";
const PREF_SELECTED_READER = "browser.feeds.handler.default";
const PREF_VIDEO_SELECTED_APP = "browser.videoFeeds.handlers.application";
-const PREF_VIDEO_SELECTED_WEB = "browser.videoFeeds.handlers.webservice";
const PREF_VIDEO_SELECTED_ACTION = "browser.videoFeeds.handler";
const PREF_VIDEO_SELECTED_READER = "browser.videoFeeds.handler.default";
const PREF_AUDIO_SELECTED_APP = "browser.audioFeeds.handlers.application";
-const PREF_AUDIO_SELECTED_WEB = "browser.audioFeeds.handlers.webservice";
const PREF_AUDIO_SELECTED_ACTION = "browser.audioFeeds.handler";
const PREF_AUDIO_SELECTED_READER = "browser.audioFeeds.handler.default";
@@ -35,10 +32,7 @@ const SETTABLE_PREFS = new Set([
PREF_SELECTED_ACTION,
PREF_VIDEO_SELECTED_READER,
PREF_AUDIO_SELECTED_READER,
- PREF_SELECTED_READER,
- PREF_VIDEO_SELECTED_WEB,
- PREF_AUDIO_SELECTED_WEB,
- PREF_SELECTED_WEB
+ PREF_SELECTED_READER
]);
const EXECUTABLE_PREFS = new Set([
@@ -48,7 +42,7 @@ const EXECUTABLE_PREFS = new Set([
]);
const VALID_ACTIONS = new Set(["ask", "reader", "bookmarks"]);
-const VALID_READERS = new Set(["web", "client", "default", "bookmarks"]);
+const VALID_READERS = new Set(["client", "default", "bookmarks"]);
XPCOMUtils.defineLazyPreferenceGetter(this, "SHOULD_LOG",
"feeds.log", false);
@@ -84,19 +78,6 @@ function getPrefReaderForType(t) {
}
}
-function getPrefWebForType(t) {
- switch (t) {
- case Ci.nsIFeed.TYPE_VIDEO:
- return PREF_VIDEO_SELECTED_WEB;
-
- case Ci.nsIFeed.TYPE_AUDIO:
- return PREF_AUDIO_SELECTED_WEB;
-
- default:
- return PREF_SELECTED_WEB;
- }
-}
-
function getPrefAppForType(t) {
switch (t) {
case Ci.nsIFeed.TYPE_VIDEO:
@@ -420,13 +401,10 @@ var FeedHandler = {
const prefs = Services.prefs;
prefs.addObserver(PREF_SELECTED_ACTION, this, true);
prefs.addObserver(PREF_SELECTED_READER, this, true);
- prefs.addObserver(PREF_SELECTED_WEB, this, true);
prefs.addObserver(PREF_VIDEO_SELECTED_ACTION, this, true);
prefs.addObserver(PREF_VIDEO_SELECTED_READER, this, true);
- prefs.addObserver(PREF_VIDEO_SELECTED_WEB, this, true);
prefs.addObserver(PREF_AUDIO_SELECTED_ACTION, this, true);
prefs.addObserver(PREF_AUDIO_SELECTED_READER, this, true);
- prefs.addObserver(PREF_AUDIO_SELECTED_WEB, this, true);
},
uninit() {
@@ -457,11 +435,8 @@ var FeedHandler = {
// Rather than the others which happen on subscription
switch (prefName) {
case PREF_SELECTED_READER:
- case PREF_SELECTED_WEB:
case PREF_VIDEO_SELECTED_READER:
- case PREF_VIDEO_SELECTED_WEB:
case PREF_AUDIO_SELECTED_READER:
- case PREF_AUDIO_SELECTED_WEB:
case PREF_SELECTED_ACTION:
case PREF_VIDEO_SELECTED_ACTION:
case PREF_AUDIO_SELECTED_ACTION:
@@ -477,23 +452,11 @@ var FeedHandler = {
},
_initSubscriptionUIResponse(feedType) {
- const wccr = Cc["@mozilla.org/embeddor.implemented/web-content-handler-registrar;1"].
- getService(Ci.nsIWebContentConverterService);
- const handlersRaw = wccr.getContentHandlers(getMimeTypeForFeedType(feedType));
- const handlers = [];
- for (let handler of handlersRaw) {
- LOG(`Handler found: ${handler}`);
- handlers.push({
- name: handler.name,
- uri: handler.uri
- });
- }
let showFirstRunUI = true;
- // eslint-disable-next-line mozilla/use-default-preference-values
try {
showFirstRunUI = Services.prefs.getBoolPref(PREF_SHOW_FIRST_RUN_UI);
- } catch (ex) { }
- const response = { handlers, showFirstRunUI };
+ } catch (ex) { }
+ const response = { showFirstRunUI };
let selectedClientApp;
const feedTypePref = getPrefAppForType(feedType);
try {
@@ -541,25 +504,14 @@ var FeedHandler = {
},
_getReaderForType(feedType) {
- let prefs = Services.prefs;
let handler = "bookmarks";
- let url;
- // eslint-disable-next-line mozilla/use-default-preference-values
try {
- handler = prefs.getCharPref(getPrefReaderForType(feedType));
+ handler = prefs.getCharPref(getPrefReaderForType(feedType));
} catch (ex) { }
- if (handler === "web") {
- try {
- url = prefs.getComplexValue(getPrefWebForType(feedType), Ci.nsISupportsString).data;
- } catch (ex) {
- LOG("FeedWriter._setSelectedHandler: invalid or no handler in prefs");
- url = null;
- }
- }
const alwaysUse = this._getAlwaysUseState(feedType);
- const action = prefs.getCharPref(getPrefActionForType(feedType));
- return { handler, url, alwaysUse, action };
+ const action = Services.prefs.getCharPref(getPrefActionForType(feedType));
+ return { handler, alwaysUse, action };
},
_getAlwaysUseState(feedType) {
@@ -570,7 +522,6 @@ var FeedHandler = {
},
receiveMessage(msg) {
- let handler;
switch (msg.name) {
case "FeedWriter:GetSubscriptionUI":
const response = this._initSubscriptionUIResponse(msg.data.feedType);
@@ -598,40 +549,17 @@ var FeedHandler = {
this._setPref(actionPref, settings.action);
const readerPref = getPrefReaderForType(settings.feedType);
this._setPref(readerPref, settings.reader);
- handler = null;
-
- switch (settings.reader) {
- case "web":
- // This is a web set URI by content using window.registerContentHandler()
- // Lets make sure we know about it before setting it
- const webPref = getPrefWebForType(settings.feedType);
- let wccr = Cc["@mozilla.org/embeddor.implemented/web-content-handler-registrar;1"].
- getService(Ci.nsIWebContentConverterService);
- // If the user provided an invalid web URL this function won't give us a reference
- handler = wccr.getWebContentHandlerByURI(getMimeTypeForFeedType(settings.feedType), settings.uri);
- if (handler) {
- this._setPref(webPref, settings.uri, true);
- if (settings.useAsDefault) {
- wccr.setAutoHandler(getMimeTypeForFeedType(settings.feedType), handler);
- }
- msg.target.messageManager
- .sendAsyncMessage("FeedWriter:SetFeedPrefsAndSubscribeResponse",
- { redirect: handler.getHandlerURI(settings.feedLocation) });
- } else {
- LOG(`No handler found for web ${settings.feedType} ${settings.uri}`);
- }
- break;
- default:
- const feedService = Cc["@mozilla.org/browser/feeds/result-service;1"].
- getService(Ci.nsIFeedResultService);
-
- feedService.addToClientReader(settings.feedLocation,
- settings.feedTitle,
- settings.feedSubtitle,
- settings.feedType,
- settings.reader);
- }
+
+ const feedService = Cc["@mozilla.org/browser/feeds/result-service;1"].
+ getService(Ci.nsIFeedResultService);
+
+ feedService.addToClientReader(settings.feedLocation,
+ settings.feedTitle,
+ settings.feedSubtitle,
+ settings.feedType,
+ settings.reader);
break;
+
case "FeedConverter:ExecuteClientApp":
// Always check feedHandler is from a set array of executable prefs
if (EXECUTABLE_PREFS.has(msg.data.feedHandler)) {
diff --git a/components/feeds/BrowserFeeds.manifest b/components/feeds/BrowserFeeds.manifest
index ac5c299..22b1b61 100644
--- a/components/feeds/BrowserFeeds.manifest
+++ b/components/feeds/BrowserFeeds.manifest
@@ -22,4 +22,3 @@ component {49bb6593-3aff-4eb3-a068-2712c28bd58e} FeedWriter.js
contract @mozilla.org/browser/feeds/result-writer;1 {49bb6593-3aff-4eb3-a068-2712c28bd58e}
component {792a7e82-06a0-437c-af63-b2d12e808acc} WebContentConverter.js
contract @mozilla.org/embeddor.implemented/web-content-handler-registrar;1 {792a7e82-06a0-437c-af63-b2d12e808acc}
-category app-startup WebContentConverter service,@mozilla.org/embeddor.implemented/web-content-handler-registrar;1 application={3c2e2abc-06d4-11e1-ac3b-374f68613e61} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} application={aa3c5121-dab2-40e2-81ca-7ea25febc110} application={a23983c0-fd0e-11dc-95ff-0800200c9a66} application={d1bfe7d9-c01e-4237-998b-7b5f960a4314}
diff --git a/components/feeds/FeedConverter.js b/components/feeds/FeedConverter.js
index c2c5656..2c84842 100644
--- a/components/feeds/FeedConverter.js
+++ b/components/feeds/FeedConverter.js
@@ -25,17 +25,14 @@ const TYPE_MAYBE_AUDIO_FEED = "application/vnd.mozilla.maybe.audio.feed";
const TYPE_ANY = "*/*";
const PREF_SELECTED_APP = "browser.feeds.handlers.application";
-const PREF_SELECTED_WEB = "browser.feeds.handlers.webservice";
const PREF_SELECTED_ACTION = "browser.feeds.handler";
const PREF_SELECTED_READER = "browser.feeds.handler.default";
const PREF_VIDEO_SELECTED_APP = "browser.videoFeeds.handlers.application";
-const PREF_VIDEO_SELECTED_WEB = "browser.videoFeeds.handlers.webservice";
const PREF_VIDEO_SELECTED_ACTION = "browser.videoFeeds.handler";
const PREF_VIDEO_SELECTED_READER = "browser.videoFeeds.handler.default";
const PREF_AUDIO_SELECTED_APP = "browser.audioFeeds.handlers.application";
-const PREF_AUDIO_SELECTED_WEB = "browser.audioFeeds.handlers.webservice";
const PREF_AUDIO_SELECTED_ACTION = "browser.audioFeeds.handler";
const PREF_AUDIO_SELECTED_READER = "browser.audioFeeds.handler.default";
@@ -52,19 +49,6 @@ function getPrefAppForType(t) {
}
}
-function getPrefWebForType(t) {
- switch (t) {
- case Ci.nsIFeed.TYPE_VIDEO:
- return PREF_VIDEO_SELECTED_WEB;
-
- case Ci.nsIFeed.TYPE_AUDIO:
- return PREF_AUDIO_SELECTED_WEB;
-
- default:
- return PREF_SELECTED_WEB;
- }
-}
-
function getPrefActionForType(t) {
switch (t) {
case Ci.nsIFeed.TYPE_VIDEO:
@@ -183,8 +167,7 @@ FeedConverter.prototype = {
// generic feed content, the system will prevent them from setting an auto-
// handler for other stream types. In those cases, the user will always see
// the preview page and have to select a handler. We can guess and show
- // a client handler, but will not be able to show web handlers for those
- // types.
+ // a client handler.
//
// If this is just a feed, not some kind of specialized application, then
// auto-handlers can be set and we should obey them.
@@ -199,35 +182,12 @@ FeedConverter.prototype = {
if (handler != "ask") {
if (handler == "reader")
handler = safeGetCharPref(getPrefReaderForType(feed.type), "bookmarks");
- switch (handler) {
- case "web":
- let wccr =
- Cc["@mozilla.org/embeddor.implemented/web-content-handler-registrar;1"].
- getService(Ci.nsIWebContentConverterService);
- if ((feed.type == Ci.nsIFeed.TYPE_FEED &&
- wccr.getAutoHandler(TYPE_MAYBE_FEED)) ||
- (feed.type == Ci.nsIFeed.TYPE_VIDEO &&
- wccr.getAutoHandler(TYPE_MAYBE_VIDEO_FEED)) ||
- (feed.type == Ci.nsIFeed.TYPE_AUDIO &&
- wccr.getAutoHandler(TYPE_MAYBE_AUDIO_FEED))) {
- wccr.loadPreferredHandler(this._request);
- return;
- }
- break;
-
- default:
- LOG("unexpected handler: " + handler);
- // fall through -- let feed service handle error
- case "bookmarks":
- case "client":
- case "default":
- try {
- let title = feed.title ? feed.title.plainText() : "";
- let desc = feed.subtitle ? feed.subtitle.plainText() : "";
- feedService.addToClientReader(result.uri.spec, title, desc, feed.type, handler);
- return;
- } catch (ex) { /* fallback to preview mode */ }
- }
+ try {
+ let title = feed.title ? feed.title.plainText() : "";
+ let desc = feed.subtitle ? feed.subtitle.plainText() : "";
+ feedService.addToClientReader(result.uri.spec, title, desc, feed.type, handler);
+ return;
+ } catch (ex) { /* fallback to preview mode */ }
}
}
@@ -398,8 +358,6 @@ FeedResultService.prototype = {
feedHandler: "default" });
break;
default:
- // "web" should have been handled elsewhere
- LOG("unexpected handler: " + handler);
// fall through
case "bookmarks":
Services.cpmm.sendAsyncMessage("FeedConverter:addLiveBookmark",
diff --git a/components/feeds/FeedWriter.js b/components/feeds/FeedWriter.js
index 20f1399..21b0077 100644
--- a/components/feeds/FeedWriter.js
+++ b/components/feeds/FeedWriter.js
@@ -590,26 +590,9 @@ FeedWriter.prototype = {
}
},
- _getWebHandlerElementsForURL(aURL) {
- return this._handlersList.querySelectorAll('[webhandlerurl="' + aURL + '"]');
- },
-
- _setSelectedHandlerResponse(handler, url) {
- LOG(`Selecting handler response ${handler} ${url}`);
+ _setSelectedHandlerResponse(handler) {
+ LOG(`Selecting handler response ${handler}`);
switch (handler) {
- case "web": {
- if (this._handlersList) {
- let handlers =
- this._getWebHandlerElementsForURL(url);
- if (handlers.length == 0) {
- LOG(`Selected web handler isn't in the menulist ${url}`);
- return;
- }
-
- handlers[0].selected = true;
- }
- break;
- }
case "client":
case "default":
// do nothing, these are handled by the onchange event
@@ -678,26 +661,7 @@ FeedWriter.prototype = {
this._handlersList.appendChild(menuItem);
- // separator
- let chooseAppSep = liveBookmarksMenuItem.nextElementSibling.cloneNode(false);
- chooseAppSep.textContent = liveBookmarksMenuItem.nextElementSibling.textContent;
- this._handlersList.appendChild(chooseAppSep);
-
- for (let handler of setupMessage.handlers) {
- if (!handler.uri) {
- LOG("Handler with name " + handler.name + " has no URI!? Skipping...");
- continue;
- }
- menuItem = liveBookmarksMenuItem.cloneNode(false);
- menuItem.removeAttribute("selected");
- menuItem.className = "menuitem-iconic";
- menuItem.textContent = handler.name;
- menuItem.setAttribute("handlerType", "web");
- menuItem.setAttribute("webhandlerurl", handler.uri);
- this._handlersList.appendChild(menuItem);
- }
-
- this._setSelectedHandlerResponse(setupMessage.reader.handler, setupMessage.reader.url);
+ this._setSelectedHandlerResponse(setupMessage.reader.handler);
if (setupMessage.defaultMenuItem) {
LOG(`Setting default menu item ${setupMessage.defaultMenuItem}`);
@@ -814,7 +778,6 @@ FeedWriter.prototype = {
this._mm.addMessageListener("FeedWriter:PreferenceUpdated", this);
this._mm.addMessageListener("FeedWriter:SetApplicationLauncherMenuItem", this);
this._mm.addMessageListener("FeedWriter:GetSubscriptionUIResponse", this);
- this._mm.addMessageListener("FeedWriter:SetFeedPrefsAndSubscribeResponse", this);
const feedType = this._getFeedType();
this._mm.sendAsyncMessage("FeedWriter:GetSubscriptionUI",
@@ -844,13 +807,9 @@ FeedWriter.prototype = {
}
LOG(`Got pref ${JSON.stringify(feedTypePref)}`);
this._setCheckboxCheckedState(feedTypePref.alwaysUse);
- this._setSelectedHandlerResponse(feedTypePref.handler, feedTypePref.url);
+ this._setSelectedHandlerResponse(feedTypePref.handler);
this._setAlwaysUseLabel();
break;
- case "FeedWriter:SetFeedPrefsAndSubscribeResponse":
- LOG(`FeedWriter:SetFeedPrefsAndSubscribeResponse - Redirecting ${msg.data.redirect}`);
- this._window.location.href = msg.data.redirect;
- break;
case "FeedWriter:GetSubscriptionUIResponse":
// Set up the subscription UI
this._initSubscriptionUI(msg.data);
@@ -942,27 +901,22 @@ FeedWriter.prototype = {
feedSubtitle: this._document.getElementById(SUBTITLE_ID).textContent,
feedLocation: this._window.location.href
};
- if (selectedItem.hasAttribute("webhandlerurl")) {
- feedReader = "web";
- settings.uri = selectedItem.getAttribute("webhandlerurl");
- } else {
- switch (selectedItem.id) {
- case "selectedAppMenuItem":
- feedReader = "client";
- break;
- case "defaultHandlerMenuItem":
- feedReader = "default";
- break;
- case "liveBookmarksMenuItem":
- defaultHandler = "bookmarks";
- feedReader = "bookmarks";
- break;
- }
+ switch (selectedItem.id) {
+ case "selectedAppMenuItem":
+ feedReader = "client";
+ break;
+ case "defaultHandlerMenuItem":
+ feedReader = "default";
+ break;
+ case "liveBookmarksMenuItem":
+ defaultHandler = "bookmarks";
+ feedReader = "bookmarks";
+ break;
}
settings.reader = feedReader;
// If "Always use..." is checked, we should set PREF_*SELECTED_ACTION
- // to either "reader" (If a web reader or if an application is selected),
+ // to either "reader" (If an application is selected),
// or to "bookmarks" (if the live bookmarks option is selected).
// Otherwise, we should set it to "ask"
if (!useAsDefault) {
diff --git a/components/feeds/WebContentConverter.js b/components/feeds/WebContentConverter.js
index 2cb5cd1..6d5b7e0 100644
--- a/components/feeds/WebContentConverter.js
+++ b/components/feeds/WebContentConverter.js
@@ -15,20 +15,11 @@ function LOG(str) {
dump("*** " + str + "\n");
}
-const WCCR_CONTRACTID = "@mozilla.org/embeddor.implemented/web-content-handler-registrar;1";
const WCCR_CLASSID = Components.ID("{792a7e82-06a0-437c-af63-b2d12e808acc}");
const WCC_CLASSID = Components.ID("{db7ebf28-cc40-415f-8a51-1b111851df1e}");
const WCC_CLASSNAME = "Web Service Handler";
-const TYPE_MAYBE_FEED = "application/vnd.mozilla.maybe.feed";
-const TYPE_ANY = "*/*";
-
-const PREF_CONTENTHANDLERS_AUTO = "browser.contentHandlers.auto.";
-const PREF_CONTENTHANDLERS_BRANCH = "browser.contentHandlers.types.";
-const PREF_SELECTED_WEB = "browser.feeds.handlers.webservice";
-const PREF_SELECTED_ACTION = "browser.feeds.handler";
-const PREF_SELECTED_READER = "browser.feeds.handler.default";
const PREF_HANDLER_EXTERNAL_PREFIX = "network.protocol-handler.external";
const PREF_ALLOW_DIFFERENT_HOST = "gecko.handlerService.allowRegisterFromDifferentHost";
@@ -37,102 +28,6 @@ const STRING_BUNDLE_URI = "chrome://browser/locale/feeds/subscribe.properties";
const NS_ERROR_MODULE_DOM = 2152923136;
const NS_ERROR_DOM_SYNTAX_ERR = NS_ERROR_MODULE_DOM + 12;
-function WebContentConverter() {
-}
-WebContentConverter.prototype = {
- convert() { },
- asyncConvertData() { },
- onDataAvailable() { },
- onStopRequest() { },
-
- onStartRequest(request, context) {
- let wccr =
- Cc[WCCR_CONTRACTID].
- getService(Ci.nsIWebContentConverterService);
- wccr.loadPreferredHandler(request);
- },
-
- QueryInterface(iid) {
- if (iid.equals(Ci.nsIStreamConverter) ||
- iid.equals(Ci.nsIStreamListener) ||
- iid.equals(Ci.nsISupports))
- return this;
- throw Cr.NS_ERROR_NO_INTERFACE;
- }
-};
-
-let WebContentConverterFactory = {
- createInstance(outer, iid) {
- if (outer != null)
- throw Cr.NS_ERROR_NO_AGGREGATION;
- return new WebContentConverter().QueryInterface(iid);
- },
-
- QueryInterface(iid) {
- if (iid.equals(Ci.nsIFactory) ||
- iid.equals(Ci.nsISupports))
- return this;
- throw Cr.NS_ERROR_NO_INTERFACE;
- }
-};
-
-function ServiceInfo(contentType, uri, name) {
- this._contentType = contentType;
- this._uri = uri;
- this._name = name;
-}
-ServiceInfo.prototype = {
- /**
- * See nsIHandlerApp
- */
- get name() {
- return this._name;
- },
-
- /**
- * See nsIHandlerApp
- */
- equals(aHandlerApp) {
- if (!aHandlerApp)
- throw Cr.NS_ERROR_NULL_POINTER;
-
- if (aHandlerApp instanceof Ci.nsIWebContentHandlerInfo &&
- aHandlerApp.contentType == this.contentType &&
- aHandlerApp.uri == this.uri)
- return true;
-
- return false;
- },
-
- /**
- * See nsIWebContentHandlerInfo
- */
- get contentType() {
- return this._contentType;
- },
-
- /**
- * See nsIWebContentHandlerInfo
- */
- get uri() {
- return this._uri;
- },
-
- /**
- * See nsIWebContentHandlerInfo
- */
- getHandlerURI(uri) {
- return this._uri.replace(/%s/gi, encodeURIComponent(uri));
- },
-
- QueryInterface(iid) {
- if (iid.equals(Ci.nsIWebContentHandlerInfo) ||
- iid.equals(Ci.nsISupports))
- return this;
- throw Cr.NS_ERROR_NO_INTERFACE;
- }
-};
-
const Utils = {
makeURI(aURL, aOriginCharset, aBaseURI) {
return Services.io.newURI(aURL, aOriginCharset, aBaseURI);
@@ -211,25 +106,9 @@ const Utils = {
return new aWindowOrNull.DOMException(errorString, "SecurityError");
},
-
- /**
- * Mappings from known feed types to our internal content type.
- */
- _mappings: {
- "application/rss+xml": TYPE_MAYBE_FEED,
- "application/atom+xml": TYPE_MAYBE_FEED,
- },
-
- resolveContentType(aContentType) {
- if (aContentType in this._mappings)
- return this._mappings[aContentType];
- return aContentType;
- }
};
function WebContentConverterRegistrar() {
- this._contentTypes = {};
- this._autoHandleContentTypes = {};
}
WebContentConverterRegistrar.prototype = {
@@ -248,73 +127,7 @@ WebContentConverterRegistrar.prototype = {
},
/**
- * See nsIWebContentConverterService
- */
- getAutoHandler(contentType) {
- contentType = Utils.resolveContentType(contentType);
- if (contentType in this._autoHandleContentTypes)
- return this._autoHandleContentTypes[contentType];
- return null;
- },
-
- /**
- * See nsIWebContentConverterService
- */
- setAutoHandler(contentType, handler) {
- if (handler && !this._typeIsRegistered(contentType, handler.uri))
- throw Cr.NS_ERROR_NOT_AVAILABLE;
-
- contentType = Utils.resolveContentType(contentType);
- this._setAutoHandler(contentType, handler);
-
- let ps = Services.prefs;
- let autoBranch = ps.getBranch(PREF_CONTENTHANDLERS_AUTO);
- if (handler)
- autoBranch.setCharPref(contentType, handler.uri);
- else if (autoBranch.prefHasUserValue(contentType))
- autoBranch.clearUserPref(contentType);
-
- ps.savePrefFile(null);
- },
-
- /**
- * Update the internal data structure (not persistent)
- */
- _setAutoHandler(contentType, handler) {
- if (handler)
- this._autoHandleContentTypes[contentType] = handler;
- else if (contentType in this._autoHandleContentTypes)
- delete this._autoHandleContentTypes[contentType];
- },
-
- /**
- * See nsIWebContentConverterService
- */
- getWebContentHandlerByURI(contentType, uri) {
- return this.getContentHandlers(contentType)
- .find(e => e.uri == uri) || null;
- },
-
- /**
- * See nsIWebContentConverterService
- */
- loadPreferredHandler(request) {
- let channel = request.QueryInterface(Ci.nsIChannel);
- let contentType = Utils.resolveContentType(channel.contentType);
- let handler = this.getAutoHandler(contentType);
- if (handler) {
- request.cancel(Cr.NS_ERROR_FAILURE);
-
- let webNavigation =
- channel.notificationCallbacks.getInterface(Ci.nsIWebNavigation);
- webNavigation.loadURI(handler.getHandlerURI(channel.URI.spec),
- Ci.nsIWebNavigation.LOAD_FLAGS_NONE,
- null, null, null);
- }
- },
-
- /**
- * See nsIWebContentConverterService
+ * See nsIWebContentHandlerRegistrar
*/
removeProtocolHandler(aProtocol, aURITemplate) {
let eps = Cc["@mozilla.org/uriloader/external-protocol-service;1"].
@@ -336,29 +149,6 @@ WebContentConverterRegistrar.prototype = {
},
/**
- * See nsIWebContentConverterService
- */
- removeContentHandler(contentType, uri) {
- function notURI(serviceInfo) {
- return serviceInfo.uri != uri;
- }
-
- if (contentType in this._contentTypes) {
- this._contentTypes[contentType] =
- this._contentTypes[contentType].filter(notURI);
- }
- },
-
- /**
- * These are types for which there is a separate content converter aside
- * from our built in generic one. We should not automatically register
- * a factory for creating a converter for these types.
- */
- _blockedTypes: {
- "application/vnd.mozilla.maybe.feed": true,
- },
-
- /**
* Determines if a web handler is already registered.
*
* @param aProtocol
@@ -468,52 +258,6 @@ WebContentConverterRegistrar.prototype = {
},
/**
- * See nsIWebContentHandlerRegistrar
- * If a DOM window is provided, then the request came from content, so we
- * prompt the user to confirm the registration.
- */
- registerContentHandler(aContentType, aURIString, aTitle, aWindowOrBrowser) {
- LOG("registerContentHandler(" + aContentType + "," + aURIString + "," + aTitle + ")");
-
- // Make sure to do our URL checks up front, before our content type check,
- // just like the WebContentConverterRegistrarContent does.
- let haveWindow = aWindowOrBrowser &&
- (aWindowOrBrowser instanceof Ci.nsIDOMWindow);
- let uri;
- if (haveWindow) {
- uri = Utils.checkAndGetURI(aURIString, aWindowOrBrowser);
- } else if (aWindowOrBrowser) {
- // uri was vetted in the content process.
- uri = Utils.makeURI(aURIString, null);
- }
-
- // We only support feed types at present.
- let contentType = Utils.resolveContentType(aContentType);
- // XXX We should be throwing a Utils.getSecurityError() here in at least
- // some cases. See bug 1266492.
- if (contentType != TYPE_MAYBE_FEED) {
- return;
- }
-
- if (aWindowOrBrowser) {
- let notificationBox;
- if (haveWindow) {
- let browserWindow = this._getBrowserWindowForContentWindow(aWindowOrBrowser);
- let browserElement = this._getBrowserForContentWindow(browserWindow, aWindowOrBrowser);
- notificationBox = browserElement.getTabBrowser().getNotificationBox(browserElement);
- } else {
- notificationBox = aWindowOrBrowser.getTabBrowser()
- .getNotificationBox(aWindowOrBrowser);
- }
-
- this._appendFeedReaderNotification(uri, aTitle, notificationBox);
- }
- else {
- this._registerContentHandler(contentType, aURIString, aTitle);
- }
- },
-
- /**
* Returns the browser chrome window in which the content window is in
*/
_getBrowserWindowForContentWindow(aContentWindow) {
@@ -544,329 +288,6 @@ WebContentConverterRegistrar.prototype = {
},
/**
- * Appends a notifcation for the given feed reader details.
- *
- * The notification could be either a pseudo-dialog which lets
- * the user to add the feed reader:
- * [ [icon] Add %feed-reader-name% (%feed-reader-host%) as a Feed Reader? (Add) [x] ]
- *
- * or a simple message for the case where the feed reader is already registered:
- * [ [icon] %feed-reader-name% is already registered as a Feed Reader [x] ]
- *
- * A new notification isn't appended if the given notificationbox has a
- * notification for the same feed reader.
- *
- * @param aURI
- * The url of the feed reader as a nsIURI object
- * @param aName
- * The feed reader name as it was passed to registerContentHandler
- * @param aNotificationBox
- * The notification box to which a notification might be appended
- * @return true if a notification has been appended, false otherwise.
- */
- _appendFeedReaderNotification(aURI, aName, aNotificationBox) {
- let uriSpec = aURI.spec;
- let notificationValue = "feed reader notification: " + uriSpec;
- let notificationIcon = aURI.prePath + "/favicon.ico";
-
- // Don't append a new notification if the notificationbox
- // has a notification for the given feed reader already
- if (aNotificationBox.getNotificationWithValue(notificationValue))
- return false;
-
- let buttons;
- let message;
- if (this.getWebContentHandlerByURI(TYPE_MAYBE_FEED, uriSpec))
- message = this._getFormattedString("handlerRegistered", [aName]);
- else {
- message = this._getFormattedString("addHandler", [aName, aURI.host]);
- let self = this;
- let addButton = {
- _outer: self,
- label: self._getString("addHandlerAddButton"),
- accessKey: self._getString("addHandlerAddButtonAccesskey"),
- feedReaderInfo: { uri: uriSpec, name: aName },
-
- /* static */
- callback(aNotification, aButtonInfo) {
- let uri = aButtonInfo.feedReaderInfo.uri;
- let name = aButtonInfo.feedReaderInfo.name;
- let outer = aButtonInfo._outer;
-
- // The reader could have been added from another window mean while
- if (!outer.getWebContentHandlerByURI(TYPE_MAYBE_FEED, uri))
- outer._registerContentHandler(TYPE_MAYBE_FEED, uri, name);
-
- // avoid reference cycles
- aButtonInfo._outer = null;
-
- return false;
- }
- };
- buttons = [addButton];
- }
-
- aNotificationBox.appendNotification(message,
- notificationValue,
- notificationIcon,
- aNotificationBox.PRIORITY_INFO_LOW,
- buttons);
- return true;
- },
-
- /**
- * Save Web Content Handler metadata to persistent preferences.
- * @param contentType
- * The content Type being handled
- * @param uri
- * The uri of the web service
- * @param title
- * The human readable name of the web service
- *
- * This data is stored under:
- *
- * browser.contentHandlers.type0 = content/type
- * browser.contentHandlers.uri0 = http://www.foo.com/q=%s
- * browser.contentHandlers.title0 = Foo 2.0alphr
- */
- _saveContentHandlerToPrefs(contentType, uri, title) {
- let ps = Services.prefs;
- let i = 0;
- let typeBranch = null;
- while (true) {
- typeBranch =
- ps.getBranch(PREF_CONTENTHANDLERS_BRANCH + i + ".");
- try {
- typeBranch.getCharPref("type");
- ++i;
- }
- catch (e) {
- // No more handlers
- break;
- }
- }
- if (typeBranch) {
- typeBranch.setCharPref("type", contentType);
- let pls =
- Cc["@mozilla.org/pref-localizedstring;1"].
- createInstance(Ci.nsIPrefLocalizedString);
- pls.data = uri;
- typeBranch.setComplexValue("uri", Ci.nsIPrefLocalizedString, pls);
- pls.data = title;
- typeBranch.setComplexValue("title", Ci.nsIPrefLocalizedString, pls);
-
- ps.savePrefFile(null);
- }
- },
-
- /**
- * Determines if there is a type with a particular uri registered for the
- * specified content type already.
- * @param contentType
- * The content type that the uri handles
- * @param uri
- * The uri of the content type
- */
- _typeIsRegistered(contentType, uri) {
- if (!(contentType in this._contentTypes))
- return false;
-
- return this._contentTypes[contentType]
- .some(t => t.uri == uri);
- },
-
- /**
- * Gets a stream converter contract id for the specified content type.
- * @param contentType
- * The source content type for the conversion.
- * @returns A contract id to construct a converter to convert between the
- * contentType and *\/*.
- */
- _getConverterContractID(contentType) {
- const template = "@mozilla.org/streamconv;1?from=%s&to=*/*";
- return template.replace(/%s/, contentType);
- },
-
- /**
- * Register a web service handler for a content type.
- *
- * @param contentType
- * the content type being handled
- * @param uri
- * the URI of the web service
- * @param title
- * the human readable name of the web service
- */
- _registerContentHandler(contentType, uri, title) {
- this._updateContentTypeHandlerMap(contentType, uri, title);
- this._saveContentHandlerToPrefs(contentType, uri, title);
-
- if (contentType == TYPE_MAYBE_FEED) {
- // Make the new handler the last-selected reader in the preview page
- // and make sure the preview page is shown the next time a feed is visited
- let pb = Services.prefs.getBranch(null);
- pb.setCharPref(PREF_SELECTED_READER, "web");
-
- let supportsString =
- Cc["@mozilla.org/supports-string;1"].
- createInstance(Ci.nsISupportsString);
- supportsString.data = uri;
- pb.setComplexValue(PREF_SELECTED_WEB, Ci.nsISupportsString,
- supportsString);
- pb.setCharPref(PREF_SELECTED_ACTION, "ask");
- this._setAutoHandler(TYPE_MAYBE_FEED, null);
- }
- },
-
- /**
- * Update the content type -> handler map. This mapping is not persisted, use
- * registerContentHandler or _saveContentHandlerToPrefs for that purpose.
- * @param contentType
- * The content Type being handled
- * @param uri
- * The uri of the web service
- * @param title
- * The human readable name of the web service
- */
- _updateContentTypeHandlerMap(contentType, uri, title) {
- if (!(contentType in this._contentTypes))
- this._contentTypes[contentType] = [];
-
- // Avoid adding duplicates
- if (this._typeIsRegistered(contentType, uri))
- return;
-
- this._contentTypes[contentType].push(new ServiceInfo(contentType, uri, title));
-
- if (!(contentType in this._blockedTypes)) {
- let converterContractID = this._getConverterContractID(contentType);
- let cr = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
- cr.registerFactory(WCC_CLASSID, WCC_CLASSNAME, converterContractID,
- WebContentConverterFactory);
- }
- },
-
- /**
- * See nsIWebContentConverterService
- */
- getContentHandlers(contentType, countRef) {
- if (countRef) {
- countRef.value = 0;
- }
- if (!(contentType in this._contentTypes))
- return [];
-
- let handlers = this._contentTypes[contentType];
- if (countRef) {
- countRef.value = handlers.length;
- }
- return handlers;
- },
-
- /**
- * See nsIWebContentConverterService
- */
- resetHandlersForType(contentType) {
- // currently unused within the tree, so only useful for extensions; previous
- // impl. was buggy (and even infinite-looped!), so I argue that this is a
- // definite improvement
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
- },
-
- /**
- * Registers a handler from the settings on a preferences branch.
- *
- * Since we support up to six predefined readers, we need to handle gaps
- * better, since the first branch with user-added values will be .6
- *
- * How we deal with that is to check to see if there's no prefs in the
- * branch and stop cycling once that's true. This doesn't fix the case
- * where a user manually removes a reader, but that's not supported yet!
- *
- * @param branch
- * an nsIPrefBranch containing "type", "uri", and "title" preferences
- * corresponding to the content handler to be registered
- */
- _registerContentHandlerHavingBranch(branch) {
- let vals = branch.getChildList("");
- if (vals.length == 0)
- return;
-
- let type = branch.getCharPref("type");
- let uri = branch.getComplexValue("uri", Ci.nsIPrefLocalizedString).data;
- let title = branch.getComplexValue("title",
- Ci.nsIPrefLocalizedString).data;
- this._updateContentTypeHandlerMap(type, uri, title);
- },
-
- /**
- * Load the auto handler, content handler and protocol tables from
- * preferences.
- */
- _init() {
- let ps = Services.prefs;
-
- let children = ps.getBranch(PREF_CONTENTHANDLERS_BRANCH)
- .getChildList("");
-
- // first get the numbers of the providers by getting all ###.uri prefs
- let nums = children.map((child) => {
- let match = /^(\d+)\.uri$/.exec(child);
- return match ? match[1] : "";
- }).filter(child => !!child)
- .sort();
-
-
- // now register them
- for (let num of nums) {
- let branch = ps.getBranch(PREF_CONTENTHANDLERS_BRANCH + num + ".");
- try {
- this._registerContentHandlerHavingBranch(branch);
- } catch (ex) {
- // do nothing, the next branch might have values
- }
- }
-
- // We need to do this _after_ registering all of the available handlers,
- // so that getWebContentHandlerByURI can return successfully.
- let autoBranch;
- try {
- autoBranch = ps.getBranch(PREF_CONTENTHANDLERS_AUTO);
- } catch (e) {
- // No auto branch yet, that's fine
- // LOG("WCCR.init: There is no auto branch, benign");
- }
-
- if (autoBranch) {
- for (let type of autoBranch.getChildList("")) {
- let uri = autoBranch.getCharPref(type);
- if (uri) {
- let handler = this.getWebContentHandlerByURI(type, uri);
- if (handler) {
- this._setAutoHandler(type, handler);
- }
- }
- }
- }
- },
-
- /**
- * See nsIObserver
- */
- observe(subject, topic, data) {
- let os = Services.obs;
- switch (topic) {
- case "app-startup":
- os.addObserver(this, "browser-ui-startup-complete", false);
- break;
- case "browser-ui-startup-complete":
- os.removeObserver(this, "browser-ui-startup-complete");
- this._init();
- break;
- }
- },
-
- /**
* See nsIFactory
*/
createInstance(outer, iid) {
@@ -881,9 +302,7 @@ WebContentConverterRegistrar.prototype = {
* See nsISupports
*/
QueryInterface: XPCOMUtils.generateQI(
- [Ci.nsIWebContentConverterService,
- Ci.nsIWebContentHandlerRegistrar,
- Ci.nsIObserver,
+ [Ci.nsIWebContentHandlerRegistrar,
Ci.nsIFactory]),
_xpcom_categories: [{
@@ -893,140 +312,9 @@ WebContentConverterRegistrar.prototype = {
};
function WebContentConverterRegistrarContent() {
- this._contentTypes = {};
}
WebContentConverterRegistrarContent.prototype = {
-
- /**
- * Load the auto handler, content handler and protocol tables from
- * preferences.
- */
- _init() {
- let ps = Services.prefs;
-
- let children = ps.getBranch(PREF_CONTENTHANDLERS_BRANCH)
- .getChildList("");
-
- // first get the numbers of the providers by getting all ###.uri prefs
- let nums = children.map((child) => {
- let match = /^(\d+)\.uri$/.exec(child);
- return match ? match[1] : "";
- }).filter(child => !!child)
- .sort();
-
- // now register them
- for (num of nums) {
- let branch = ps.getBranch(PREF_CONTENTHANDLERS_BRANCH + num + ".");
- try {
- this._registerContentHandlerHavingBranch(branch);
- } catch (ex) {
- // do nothing, the next branch might have values
- }
- }
- },
-
- _typeIsRegistered(contentType, uri) {
- return this._contentTypes[contentType]
- .some(e => e.uri == uri);
- },
-
- /**
- * Since we support up to six predefined readers, we need to handle gaps
- * better, since the first branch with user-added values will be .6
- *
- * How we deal with that is to check to see if there's no prefs in the
- * branch and stop cycling once that's true. This doesn't fix the case
- * where a user manually removes a reader, but that's not supported yet!
- *
- * @param branch
- * The pref branch to register the content handler under
- *
- */
- _registerContentHandlerHavingBranch(branch) {
- let vals = branch.getChildList("");
- if (vals.length == 0)
- return;
-
- let type = branch.getCharPref("type");
- let uri = branch.getComplexValue("uri", Ci.nsIPrefLocalizedString).data;
- let title = branch.getComplexValue("title",
- Ci.nsIPrefLocalizedString).data;
- this._updateContentTypeHandlerMap(type, uri, title);
- },
-
- _updateContentTypeHandlerMap(contentType, uri, title) {
- if (!(contentType in this._contentTypes))
- this._contentTypes[contentType] = [];
-
- // Avoid adding duplicates
- if (this._typeIsRegistered(contentType, uri))
- return;
-
- this._contentTypes[contentType].push(new ServiceInfo(contentType, uri, title));
-
- if (!(contentType in this._blockedTypes)) {
- let converterContractID = this._getConverterContractID(contentType);
- let cr = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
- cr.registerFactory(WCC_CLASSID, WCC_CLASSNAME, converterContractID,
- WebContentConverterFactory);
- }
- },
-
- /**
- * See nsIWebContentConverterService
- */
- getContentHandlers(contentType, countRef) {
- this._init();
- if (countRef) {
- countRef.value = 0;
- }
-
- if (!(contentType in this._contentTypes))
- return [];
-
- let handlers = this._contentTypes[contentType];
- if (countRef) {
- countRef.value = handlers.length;
- }
- return handlers;
- },
-
- setAutoHandler(contentType, handler) {
- Services.cpmm.sendAsyncMessage("WCCR:setAutoHandler",
- { contentType, handler });
- },
-
- getWebContentHandlerByURI(contentType, uri) {
- return this.getContentHandlers(contentType)
- .find(e => e.uri == uri) || null;
- },
-
- /**
- * See nsIWebContentHandlerRegistrar
- */
- registerContentHandler(aContentType, aURIString, aTitle, aBrowserOrWindow) {
- // aBrowserOrWindow must be a window.
- let messageManager = aBrowserOrWindow.QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIWebNavigation)
- .QueryInterface(Ci.nsIDocShell)
- .QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsITabChild)
- .messageManager;
-
- let uri = Utils.checkAndGetURI(aURIString, aBrowserOrWindow);
- // XXX We should be throwing a Utils.getSecurityError() here in at least
- // some cases. See bug 1266492.
- if (Utils.resolveContentType(aContentType) != TYPE_MAYBE_FEED) {
- return;
- }
-
- messageManager.sendAsyncMessage("WCCR:registerContentHandler",
- { contentType: aContentType,
- uri: uri.spec,
- title: aTitle });
- },
-
registerProtocolHandler(aProtocol, aURIString, aTitle, aBrowserOrWindow) {
// aBrowserOrWindow must be a window.
let messageManager = aBrowserOrWindow.QueryInterface(Ci.nsIInterfaceRequestor)
@@ -1061,7 +349,6 @@ WebContentConverterRegistrarContent.prototype = {
*/
QueryInterface: XPCOMUtils.generateQI(
[Ci.nsIWebContentHandlerRegistrar,
- Ci.nsIWebContentConverterService,
Ci.nsIFactory])
};
diff --git a/components/feeds/moz.build b/components/feeds/moz.build
index b8755fc..b6d7e04 100644
--- a/components/feeds/moz.build
+++ b/components/feeds/moz.build
@@ -8,7 +8,6 @@ JAR_MANIFESTS += ['jar.mn']
XPIDL_SOURCES += [
'nsIFeedResultService.idl',
- 'nsIWebContentConverterRegistrar.idl',
]
XPIDL_MODULE = 'browser-feeds'
diff --git a/components/feeds/nsIWebContentConverterRegistrar.idl b/components/feeds/nsIWebContentConverterRegistrar.idl
deleted file mode 100644
index 08ce2f4..0000000
--- a/components/feeds/nsIWebContentConverterRegistrar.idl
+++ /dev/null
@@ -1,117 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsIMIMEInfo.idl"
-#include "nsIWebContentHandlerRegistrar.idl"
-
-interface nsIRequest;
-
-[scriptable, uuid(eb361098-5158-4b21-8f98-50b445f1f0b2)]
-interface nsIWebContentHandlerInfo : nsIHandlerApp
-{
- /**
- * The content type handled by the handler
- */
- readonly attribute AString contentType;
-
- /**
- * The uri of the handler, with an embedded %s where the URI of the loaded
- * document will be encoded.
- */
- readonly attribute AString uri;
-
- /**
- * Gets the service URL Spec, with the loading document URI encoded in it.
- * @param uri
- * The URI of the document being loaded
- * @returns The URI of the service with the loading document URI encoded in
- * it.
- */
- AString getHandlerURI(in AString uri);
-};
-
-[scriptable, uuid(de7cc06e-e778-45cb-b7db-7a114e1e75b1)]
-interface nsIWebContentConverterService : nsIWebContentHandlerRegistrar
-{
- /**
- * Specifies the handler to be used to automatically handle all links of a
- * certain content type from now on.
- * @param contentType
- * The content type to automatically load with the specified handler
- * @param handler
- * A web service handler. If this is null, no automatic action is
- * performed and the user must choose.
- * @throws NS_ERROR_NOT_AVAILABLE if the service refered to by |handler| is
- * not already registered.
- */
- void setAutoHandler(in AString contentType, in nsIWebContentHandlerInfo handler);
-
- /**
- * Gets the auto handler specified for a particular content type
- * @param contentType
- * The content type to look up an auto handler for.
- * @returns The web service handler that will automatically handle all
- * documents of the specified type. null if there is no automatic
- * handler. (Handlers may be registered, just none of them specified
- * as "automatic").
- */
- nsIWebContentHandlerInfo getAutoHandler(in AString contentType);
-
- /**
- * Gets a web handler for the specified service URI
- * @param contentType
- * The content type of the service being located
- * @param uri
- * The service URI of the handler to locate.
- * @returns A web service handler that uses the specified uri.
- */
- nsIWebContentHandlerInfo getWebContentHandlerByURI(in AString contentType,
- in AString uri);
-
- /**
- * Loads the preferred handler when content of a registered type is about
- * to be loaded.
- * @param request
- * The nsIRequest for the load of the content
- */
- void loadPreferredHandler(in nsIRequest request);
-
- /**
- * Removes a registered protocol handler
- * @param protocol
- * The protocol scheme to remove a service handler for
- * @param uri
- * The uri of the service handler to remove
- */
- void removeProtocolHandler(in AString protocol, in AString uri);
-
- /**
- * Removes a registered content handler
- * @param contentType
- * The content type to remove a service handler for
- * @param uri
- * The uri of the service handler to remove
- */
- void removeContentHandler(in AString contentType, in AString uri);
-
- /**
- * Gets the list of content handlers for a particular type.
- * @param contentType
- * The content type to get handlers for
- * @returns An array of nsIWebContentHandlerInfo objects
- */
- void getContentHandlers(in AString contentType,
- [optional] out unsigned long count,
- [retval,array,size_is(count)] out nsIWebContentHandlerInfo handlers);
-
- /**
- * Resets the list of available content handlers to the default set from
- * the distribution.
- * @param contentType
- * The content type to reset handlers for
- */
- void resetHandlersForType(in AString contentType);
-};
-
diff --git a/components/preferences/applicationManager.js b/components/preferences/applicationManager.js
index 2e0f47a..34b0b96 100644
--- a/components/preferences/applicationManager.js
+++ b/components/preferences/applicationManager.js
@@ -91,8 +91,6 @@ var gAppManagerDialog = {
address = app.executable.path;
else if (app instanceof Ci.nsIWebHandlerApp)
address = app.uriTemplate;
- else if (app instanceof Ci.nsIWebContentHandlerInfo)
- address = app.uri;
document.getElementById("appLocation").value = address;
var bundle = document.getElementById("appManagerBundle");
var appType = app instanceof Ci.nsILocalHandlerApp ? "descriptionLocalApp"
diff --git a/components/preferences/in-content/applications.js b/components/preferences/in-content/applications.js
index d751514..0b619a3 100644
--- a/components/preferences/in-content/applications.js
+++ b/components/preferences/in-content/applications.js
@@ -30,7 +30,7 @@ const PREF_HIDE_PLUGINS_WITHOUT_EXTENSIONS =
* set browser.feeds.handler.default to "bookmarks";
*
* browser.feeds.handler.default
- * - "bookmarks", "client" or "web" -- indicates the chosen feed reader used
+ * - "bookmarks", "client" -- indicates the chosen feed reader used
* to display feeds, either transiently (i.e., when the "use as default"
* checkbox is unchecked, corresponds to when browser.feeds.handler=="ask")
* or more permanently (i.e., the item displayed in the dropdown in Feeds
@@ -44,17 +44,14 @@ const PREF_HIDE_PLUGINS_WITHOUT_EXTENSIONS =
* been chosen
*/
const PREF_FEED_SELECTED_APP = "browser.feeds.handlers.application";
-const PREF_FEED_SELECTED_WEB = "browser.feeds.handlers.webservice";
const PREF_FEED_SELECTED_ACTION = "browser.feeds.handler";
const PREF_FEED_SELECTED_READER = "browser.feeds.handler.default";
const PREF_VIDEO_FEED_SELECTED_APP = "browser.videoFeeds.handlers.application";
-const PREF_VIDEO_FEED_SELECTED_WEB = "browser.videoFeeds.handlers.webservice";
const PREF_VIDEO_FEED_SELECTED_ACTION = "browser.videoFeeds.handler";
const PREF_VIDEO_FEED_SELECTED_READER = "browser.videoFeeds.handler.default";
const PREF_AUDIO_FEED_SELECTED_APP = "browser.audioFeeds.handlers.application";
-const PREF_AUDIO_FEED_SELECTED_WEB = "browser.audioFeeds.handlers.webservice";
const PREF_AUDIO_FEED_SELECTED_ACTION = "browser.audioFeeds.handler";
const PREF_AUDIO_FEED_SELECTED_READER = "browser.audioFeeds.handler.default";
@@ -460,10 +457,6 @@ FeedHandlerInfo.prototype = {
// Convenience Utils
- _converterSvc:
- Cc["@mozilla.org/embeddor.implemented/web-content-handler-registrar;1"].
- getService(Ci.nsIWebContentConverterService),
-
_shellSvc: AppConstants.HAVE_SHELL_SERVICE ? getShellService() : null,
// nsIHandlerInfo
@@ -481,12 +474,6 @@ FeedHandlerInfo.prototype = {
return null;
- case "web":
- var uri = this.element(this._prefSelectedWeb).value;
- if (!uri)
- return null;
- return this._converterSvc.getWebContentHandlerByURI(this.type, uri);
-
case "bookmarks":
default:
// When the pref is set to bookmarks, we handle feeds internally,
@@ -501,17 +488,6 @@ FeedHandlerInfo.prototype = {
this.element(this._prefSelectedApp).value = aNewValue.executable;
this.element(this._prefSelectedReader).value = "client";
}
- else if (aNewValue instanceof Ci.nsIWebContentHandlerInfo) {
- this.element(this._prefSelectedWeb).value = aNewValue.uri;
- this.element(this._prefSelectedReader).value = "web";
- // Make the web handler be the new "auto handler" for feeds.
- // Note: we don't have to unregister the auto handler when the user picks
- // a non-web handler (local app, Live Bookmarks, etc.) because the service
- // only uses the "auto handler" when the selected reader is a web handler.
- // We also don't have to unregister it when the user turns on "always ask"
- // (i.e. preview in browser), since that also overrides the auto handler.
- this._converterSvc.setAutoHandler(this.type, aNewValue);
- }
},
_possibleApplicationHandlers: null,
@@ -571,11 +547,6 @@ FeedHandlerInfo.prototype = {
this._possibleApplicationHandlers.appendElement(preferredApp, false);
}
- // Add the registered web handlers. There can be any number of these.
- var webHandlers = this._converterSvc.getContentHandlers(this.type);
- for (let webHandler of webHandlers)
- this._possibleApplicationHandlers.appendElement(webHandler, false);
-
return this._possibleApplicationHandlers;
},
@@ -733,10 +704,6 @@ FeedHandlerInfo.prototype = {
pref.reset();
}
}
- else {
- app.QueryInterface(Ci.nsIWebContentHandlerInfo);
- this._converterSvc.removeContentHandler(app.contentType, app.uri);
- }
}
this._possibleApplicationHandlers._removed = [];
},
@@ -753,7 +720,6 @@ FeedHandlerInfo.prototype = {
var feedHandlerInfo = {
__proto__: new FeedHandlerInfo(TYPE_MAYBE_FEED),
_prefSelectedApp: PREF_FEED_SELECTED_APP,
- _prefSelectedWeb: PREF_FEED_SELECTED_WEB,
_prefSelectedAction: PREF_FEED_SELECTED_ACTION,
_prefSelectedReader: PREF_FEED_SELECTED_READER,
_smallIcon: "chrome://browser/skin/feeds/feedIcon16.png",
@@ -763,7 +729,6 @@ var feedHandlerInfo = {
var videoFeedHandlerInfo = {
__proto__: new FeedHandlerInfo(TYPE_MAYBE_VIDEO_FEED),
_prefSelectedApp: PREF_VIDEO_FEED_SELECTED_APP,
- _prefSelectedWeb: PREF_VIDEO_FEED_SELECTED_WEB,
_prefSelectedAction: PREF_VIDEO_FEED_SELECTED_ACTION,
_prefSelectedReader: PREF_VIDEO_FEED_SELECTED_READER,
_smallIcon: "chrome://browser/skin/feeds/videoFeedIcon16.png",
@@ -773,7 +738,6 @@ var videoFeedHandlerInfo = {
var audioFeedHandlerInfo = {
__proto__: new FeedHandlerInfo(TYPE_MAYBE_AUDIO_FEED),
_prefSelectedApp: PREF_AUDIO_FEED_SELECTED_APP,
- _prefSelectedWeb: PREF_AUDIO_FEED_SELECTED_WEB,
_prefSelectedAction: PREF_AUDIO_FEED_SELECTED_ACTION,
_prefSelectedReader: PREF_AUDIO_FEED_SELECTED_READER,
_smallIcon: "chrome://browser/skin/feeds/audioFeedIcon16.png",
@@ -879,17 +843,14 @@ var gApplicationsPane = {
this._prefSvc.addObserver(PREF_SHOW_PLUGINS_IN_LIST, this, false);
this._prefSvc.addObserver(PREF_HIDE_PLUGINS_WITHOUT_EXTENSIONS, this, false);
this._prefSvc.addObserver(PREF_FEED_SELECTED_APP, this, false);
- this._prefSvc.addObserver(PREF_FEED_SELECTED_WEB, this, false);
this._prefSvc.addObserver(PREF_FEED_SELECTED_ACTION, this, false);
this._prefSvc.addObserver(PREF_FEED_SELECTED_READER, this, false);
this._prefSvc.addObserver(PREF_VIDEO_FEED_SELECTED_APP, this, false);
- this._prefSvc.addObserver(PREF_VIDEO_FEED_SELECTED_WEB, this, false);
this._prefSvc.addObserver(PREF_VIDEO_FEED_SELECTED_ACTION, this, false);
this._prefSvc.addObserver(PREF_VIDEO_FEED_SELECTED_READER, this, false);
this._prefSvc.addObserver(PREF_AUDIO_FEED_SELECTED_APP, this, false);
- this._prefSvc.addObserver(PREF_AUDIO_FEED_SELECTED_WEB, this, false);
this._prefSvc.addObserver(PREF_AUDIO_FEED_SELECTED_ACTION, this, false);
this._prefSvc.addObserver(PREF_AUDIO_FEED_SELECTED_READER, this, false);
@@ -944,17 +905,14 @@ var gApplicationsPane = {
this._prefSvc.removeObserver(PREF_SHOW_PLUGINS_IN_LIST, this);
this._prefSvc.removeObserver(PREF_HIDE_PLUGINS_WITHOUT_EXTENSIONS, this);
this._prefSvc.removeObserver(PREF_FEED_SELECTED_APP, this);
- this._prefSvc.removeObserver(PREF_FEED_SELECTED_WEB, this);
this._prefSvc.removeObserver(PREF_FEED_SELECTED_ACTION, this);
this._prefSvc.removeObserver(PREF_FEED_SELECTED_READER, this);
this._prefSvc.removeObserver(PREF_VIDEO_FEED_SELECTED_APP, this);
- this._prefSvc.removeObserver(PREF_VIDEO_FEED_SELECTED_WEB, this);
this._prefSvc.removeObserver(PREF_VIDEO_FEED_SELECTED_ACTION, this);
this._prefSvc.removeObserver(PREF_VIDEO_FEED_SELECTED_READER, this);
this._prefSvc.removeObserver(PREF_AUDIO_FEED_SELECTED_APP, this);
- this._prefSvc.removeObserver(PREF_AUDIO_FEED_SELECTED_WEB, this);
this._prefSvc.removeObserver(PREF_AUDIO_FEED_SELECTED_ACTION, this);
this._prefSvc.removeObserver(PREF_AUDIO_FEED_SELECTED_READER, this);
},
@@ -1289,9 +1247,6 @@ var gApplicationsPane = {
if (aHandlerApp instanceof Ci.nsIWebHandlerApp)
return aHandlerApp.uriTemplate;
- if (aHandlerApp instanceof Ci.nsIWebContentHandlerInfo)
- return aHandlerApp.uri;
-
return false;
},
@@ -1815,9 +1770,6 @@ var gApplicationsPane = {
if (aHandlerApp instanceof Ci.nsIWebHandlerApp)
return this._getIconURLForWebApp(aHandlerApp.uriTemplate);
- if (aHandlerApp instanceof Ci.nsIWebContentHandlerInfo)
- return this._getIconURLForWebApp(aHandlerApp.uri)
-
// We know nothing about other kinds of handler apps.
return "";
},
diff --git a/modules/Feeds.jsm b/modules/Feeds.jsm
index 179d2b8..180a71a 100644
--- a/modules/Feeds.jsm
+++ b/modules/Feeds.jsm
@@ -37,21 +37,6 @@ this.Feeds = {
break;
}
- case "WCCR:registerContentHandler": {
- let registrar = Cc["@mozilla.org/embeddor.implemented/web-content-handler-registrar;1"].
- getService(Ci.nsIWebContentHandlerRegistrar);
- registrar.registerContentHandler(data.contentType, data.uri, data.title,
- aMessage.target);
- break;
- }
-
- case "WCCR:setAutoHandler": {
- let registrar = Cc["@mozilla.org/embeddor.implemented/web-content-handler-registrar;1"].
- getService(Ci.nsIWebContentConverterService);
- registrar.setAutoHandler(data.contentType, data.handler);
- break;
- }
-
case "FeedConverter:addLiveBookmark": {
let topWindow = RecentWindow.getMostRecentBrowserWindow();
topWindow.PlacesCommandHook.addLiveBookmark(data.spec, data.title, data.subtitle)