Bug 250936 - check that mozilla can handle the MIME type before opening

a window.  r=bzbarsky, sr=darin
This commit is contained in:
tor%cs.brown.edu 2005-02-19 01:36:59 +00:00
Родитель 3e7b26be5a
Коммит 7a444fe3ca
1 изменённых файлов: 13 добавлений и 2 удалений

Просмотреть файл

@ -56,8 +56,10 @@ const nsISupportsString = Components.interfaces.nsISupportsString;
const nsIWebNavigation = Components.interfaces.nsIWebNavigation;
const nsIWindowMediator = Components.interfaces.nsIWindowMediator;
const nsIWindowWatcher = Components.interfaces.nsIWindowWatcher;
const nsICategoryManager = Components.interfaces.nsICategoryManager;
const NS_BINDING_ABORTED = 0x80020006;
const NS_ERROR_WONT_HANDLE_CONTENT = 0x805d0001;
function needHomepageOverride(prefb) {
var savedmstone;
@ -245,6 +247,15 @@ var nsBrowserContentHandler = {
/* nsIContentHandler */
handleContent : function bch_handleContent(contentType, context, request) {
try {
var catMan = Components.classes["@mozilla.org/categorymanager;1"]
.getService(nsICategoryManager);
var entry = catMan.getCategoryEntry("Gecko-Content-Viewers",
contentType);
} catch (e) {
throw NS_ERROR_WONT_HANDLE_CONTENT;
}
var parentWin;
try {
parentWin = context.getInterface(nsIDOMWindow);
@ -451,7 +462,7 @@ var Module = {
registerType("application/http-index-format");
var catMan = Components.classes["@mozilla.org/categorymanager;1"]
.getService(Components.interfaces.nsICategoryManager);
.getService(nsICategoryManager);
catMan.addCategoryEntry("command-line-handler",
"m-browser",
@ -467,7 +478,7 @@ var Module = {
compReg.unregisterFactoryLocation(dch_CID, location);
var catMan = Components.classes["@mozilla.org/categorymanager;1"]
.getService(Components.interfaces.nsICategoryManager);
.getService(nsICategoryManager);
catMan.deleteCategoryEntry("command-line-handler",
"m-browser", true);