User:Rflint/Scratchpad
From MozillaWiki
Contents
nsContentRegistry
- Gets protocol and MIME type registrations out of the preference system/mimeTypes.rdf and provides a unified means of accessing/modifying them.
- Provides better control over plugins
- State - whether a plugin is enabled/disabled.
- Handling - which MIME types/protocols a plugin's allowed to load.
- Extends the existing extension blocklist to allow disabling plugins remotely by name, version or type/protocol handled.
- Provides datastore for nsIWebContentConverterService.
What's Handled
- MIME type registrations
- Protocol registrations
- Reserved MIME types/protocols
- Plugin state/permissions
Datastore Schema
Single sqlite database with three tables.
MIME Table
TBD
Protocol Table
TBD
Plugin Table
TBD
Incomplete Strawman IDL
#include "nsISupports.idl" interface nsIURI; interface nsIContentHandlerSet; interface nsIProtocolHandlerSet; [scriptable, uuid(4ab2fc3b-3086-4611-95cd-f3854b9d0786)] interface nsIContentRegistry : nsISupports { /** * Registers a content handler for the given MIME type. * @param aTitle Human readable title for this handler. * @param aMimeType The MIME type to register this handler for. * @param aHandler The URI to the specified handler. * @param aDefault Whether to set this handler as the default for the specified * type * @throws NS_ERROR_FAILURE if aMimeType is a reserved type or if the handler * already exists for the given type. */ void addContentHandler(in AString aTitle, in AString aMimeType, in nsIURI aHandler, in boolean aDefault); /** * Removes the given content handler for a particular MIME type. * @param aMimeType * @param aHandler * @throws NS_ERROR_FAILURE if the given handler does not exist. */ void removeContentHandler(in AString aMimeType, in nsIURI aHandler); /** * Sets the given handler as the default for the specified MIME type. * @param aMimeType * @param aHandler * @throws NS_ERROR_FAILURE */ void setDefaultContentHandler(in AString aMimeType, in nsIURI aHandler); /** * Registers a protocol handler for the given protocol. * @param aTitle * @param aProtocol * @param aHandler * @param aDefault * @throws NS_ERROR_FAILURE */ void addProtocolHandler(in AString aTitle, in AString aProtocol, in nsIURI aHandler, in boolean aDefault); /** * Removes the given handler for the specified protocol. * @param aProtocol * @param aHandler * @throws NS_ERROR_FAILURE */ void removeProtocolHandler(in AString aProtocol, in nsIURI aHandler); /** * Sets the given hander as the default for the specified protocol. * @param aProtocol * @param aHandler * @throws NS_ERROR_FAILURE */ void setDefaultProtocolHandler(in AString aProtocol, in nsIURI aHandler); /** * Disables the named plugin. * @param aName The plugin's name. * @param aType A specifc type to disable or null to disable this plugin for * all types. */ void disablePlugin(in AString aName, in AString aType); /** * Enables the named plugin or sets it as the default for the given type. * @param aName The plugin's name. * @param aType A specific type to enable or null to enable all types. * @param aDefault Optional - set this plugin as the default for the specified * type. */ void enablePlugin(in AString aName, in AString aType, [in boolean aDefault]); /** * Returns whether or not the specified plugin is permitted handle the given * type and if it is the default for that type. * @param aName * @param aType */ boolean pluginCanLoad(in AString aName, in AString aType); }; [scriptable, uuid(cc672cdd-4dfe-46cf-bf9c-275b66a2f3c7)] interface nsIContentHandlerSet : nsISupports { }; [scriptable, uuid(e174ee5a-213f-43cf-8606-ad07d9609f78)] interface nsIProtocolHandlerSet : nsISupports { };