Bug 1801232 - Remove category manager stream conversion in DispatchContent. r=Gijs,dlrobertson

Differential Revision: https://phabricator.services.mozilla.com/D169370
This commit is contained in:
Razvan Cojocaru 2023-02-14 19:06:38 +00:00
parent 333f533c79
commit aa607ca5d8
2 changed files with 3 additions and 46 deletions

View File

@ -15,22 +15,4 @@ nsIURILoader
%{ C++ %{ C++
#define NS_CONTENT_HANDLER_CONTRACTID "@mozilla.org/uriloader/content-handler;1" #define NS_CONTENT_HANDLER_CONTRACTID "@mozilla.org/uriloader/content-handler;1"
#define NS_CONTENT_HANDLER_CONTRACTID_PREFIX NS_CONTENT_HANDLER_CONTRACTID "?type=" #define NS_CONTENT_HANDLER_CONTRACTID_PREFIX NS_CONTENT_HANDLER_CONTRACTID "?type="
/**
* A category where content listeners can register. The name of the entry must
* be the content that this listener wants to handle, the value must be a
* contract ID for the listener. It will be created using createInstance (not
* getService).
*
* Listeners added this way are tried after the initial target of the load and
* after explicitly registered listeners (nsIURILoader::registerContentListener).
*
* These listeners must implement at least nsIURIContentListener (and
* nsISupports).
*
* @see nsICategoryManager
* @see nsIURIContentListener
*/
#define NS_CONTENT_LISTENER_CATEGORYMANAGER_ENTRY "external-uricontentlisteners"
%} %}

View File

@ -355,32 +355,7 @@ nsresult nsDocumentOpenInfo::DispatchContent(nsIRequest* request) {
} }
// //
// Third step: Try to find a content listener that has not yet had // Third step: Try to find an nsIContentHandler for our type.
// the chance to register, as it is contained in a not-yet-loaded
// module, but which has registered a contract ID.
//
nsCOMPtr<nsICategoryManager> catman =
do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
if (catman) {
nsCString contractidString;
rv = catman->GetCategoryEntry(NS_CONTENT_LISTENER_CATEGORYMANAGER_ENTRY,
mContentType, contractidString);
if (NS_SUCCEEDED(rv) && !contractidString.IsEmpty()) {
LOG((" Listener contractid for '%s' is '%s'", mContentType.get(),
contractidString.get()));
listener = do_CreateInstance(contractidString.get());
LOG((" Listener from category manager: 0x%p", listener.get()));
if (listener && TryContentListener(listener, aChannel)) {
LOG((" Listener from category manager likes this type"));
return NS_OK;
}
}
}
//
// Fourth step: try to find an nsIContentHandler for our type.
// //
nsAutoCString handlerContractID(NS_CONTENT_HANDLER_CONTRACTID_PREFIX); nsAutoCString handlerContractID(NS_CONTENT_HANDLER_CONTRACTID_PREFIX);
handlerContractID += mContentType; handlerContractID += mContentType;
@ -418,7 +393,7 @@ nsresult nsDocumentOpenInfo::DispatchContent(nsIRequest* request) {
} }
// //
// Fifth step: If no listener prefers this type, see if any stream // Fourth step: If no listener prefers this type, see if any stream
// converters exist to transform this content type into // converters exist to transform this content type into
// some other. // some other.
// //
@ -459,7 +434,7 @@ nsresult nsDocumentOpenInfo::DispatchContent(nsIRequest* request) {
} }
} }
// Sixth step: // Fifth step:
// //
// All attempts to dispatch this content have failed. Just pass it off to // All attempts to dispatch this content have failed. Just pass it off to
// the helper app service. // the helper app service.