author | Benjamin Smedberg <benjamin@smedbergs.us> |
Thu, 10 Jun 2010 12:42:16 -0400 | |
changeset 43473 | 0327e126ea245112c0aa7283fee154e084866fb5 |
parent 43472 | be68a65eb4c751e42c6393e6c344e65d43576b09 |
child 43474 | 7b15545cf9aaf59f1c7148872f0fa1071b611010 |
child 46995 | 2250c9b0516e3a6de9ed7d54845f9ca091a2c140 |
push id | 13725 |
push user | bsmedberg@mozilla.com |
push date | Thu, 10 Jun 2010 16:42:33 +0000 |
treeherder | mozilla-central@0327e126ea24 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | bz |
bugs | 569644 |
milestone | 1.9.3a6pre |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/browser/components/preferences/applications.js +++ b/browser/components/preferences/applications.js @@ -450,39 +450,26 @@ HandlerInfoWrapper.prototype = { disablePluginType: function() { var disabledPluginTypes = this._getDisabledPluginTypes(); if (disabledPluginTypes.indexOf(this.type) == -1) disabledPluginTypes.push(this.type); this._prefSvc.setCharPref(PREF_DISABLED_PLUGIN_TYPES, disabledPluginTypes.join(",")); - - // Update the category manager so existing browser windows update. - this._categoryMgr.deleteCategoryEntry("Gecko-Content-Viewers", - this.type, - false); }, enablePluginType: function() { var disabledPluginTypes = this._getDisabledPluginTypes(); var type = this.type; disabledPluginTypes = disabledPluginTypes.filter(function(v) v != type); this._prefSvc.setCharPref(PREF_DISABLED_PLUGIN_TYPES, disabledPluginTypes.join(",")); - - // Update the category manager so existing browser windows update. - this._categoryMgr. - addCategoryEntry("Gecko-Content-Viewers", - this.type, - "@mozilla.org/content/plugin/document-loader-factory;1", - false, - true); }, //**************************************************************************// // Storage store: function() { this._handlerSvc.store(this.wrappedHandlerInfo);
--- a/content/base/public/nsIContentUtils.h +++ b/content/base/public/nsIContentUtils.h @@ -32,25 +32,40 @@ * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef nsIContentUtils_h__ #define nsIContentUtils_h__ +#include "nsIDocumentLoaderFactory.h" +#include "nsCOMPtr.h" + // C4EA618E-A3D9-4524-8EEA-E92F26FC44DB #define NS_ICONTENTUTILS_IID \ { 0xC4EA618E, 0xA3D9, 0x4524, \ { 0x8E, 0xEA, 0xE9, 0x2F, 0x26, 0xFC, 0x44, 0xDB } } class nsIContentUtils : public nsISupports { public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICONTENTUTILS_IID) NS_DECL_ISUPPORTS virtual PRBool IsSafeToRunScript(); + + enum ContentViewerType + { + TYPE_UNSUPPORTED, + TYPE_CONTENT, + TYPE_PLUGIN, + TYPE_UNKNOWN + }; + + virtual already_AddRefed<nsIDocumentLoaderFactory> + FindInternalContentViewer(const char* aType, + ContentViewerType* aLoaderType = NULL); }; NS_DEFINE_STATIC_IID_ACCESSOR(nsIContentUtils, NS_ICONTENTUTILS_IID) #endif /* nsIContentUtils_h__ */
--- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -175,16 +175,18 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_ #include "nsHtml5Module.h" #include "nsPresContext.h" #include "nsLayoutStatics.h" #include "nsLayoutUtils.h" #include "nsFrameManager.h" #include "BasicLayers.h" #include "nsFocusManager.h" #include "nsTextEditorState.h" +#include "nsIPluginHost.h" +#include "nsICategoryManager.h" #ifdef IBMBIDI #include "nsIBidiKeyboard.h" #endif #include "nsCycleCollectionParticipant.h" // for ReportToConsole #include "nsIStringBundle.h" @@ -198,16 +200,17 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_ #include "jsdate.h" #include "jsregexp.h" #include "jstypedarray.h" #include "xpcprivate.h" #include "nsScriptSecurityManager.h" #include "nsIChannelPolicy.h" #include "nsChannelPolicy.h" #include "nsIContentSecurityPolicy.h" +#include "nsContentDLF.h" using namespace mozilla::dom; const char kLoadAsData[] = "loadAsData"; static const char kJSStackContractID[] = "@mozilla.org/js/xpc/ContextStack;1"; static NS_DEFINE_CID(kParserServiceCID, NS_PARSERSERVICE_CID); static NS_DEFINE_CID(kCParserCID, NS_PARSER_CID); @@ -6035,8 +6038,59 @@ nsContentUtils::LayerManagerForDocument( NS_IMPL_ISUPPORTS1(nsIContentUtils, nsIContentUtils) PRBool nsIContentUtils::IsSafeToRunScript() { return nsContentUtils::IsSafeToRunScript(); } +already_AddRefed<nsIDocumentLoaderFactory> +nsIContentUtils::FindInternalContentViewer(const char* aType, + ContentViewerType* aLoaderType) +{ + if (aLoaderType) { + *aLoaderType = TYPE_UNSUPPORTED; + } + + // one helper factory, please + nsCOMPtr<nsICategoryManager> catMan(do_GetService(NS_CATEGORYMANAGER_CONTRACTID)); + if (!catMan) + return NULL; + + FullPagePluginEnabledType pluginEnabled = NOT_ENABLED; + + nsCOMPtr<nsIPluginHost> pluginHost = + do_GetService(MOZ_PLUGIN_HOST_CONTRACTID); + if (pluginHost) { + pluginHost->IsFullPagePluginEnabledForType(aType, &pluginEnabled); + } + + nsCOMPtr<nsIDocumentLoaderFactory> docFactory; + + if (OVERRIDE_BUILTIN == pluginEnabled) { + docFactory = do_GetService(PLUGIN_DLF_CONTRACTID); + if (docFactory && aLoaderType) { + *aLoaderType = TYPE_PLUGIN; + } + return docFactory.forget(); + } + + nsXPIDLCString contractID; + nsresult rv = catMan->GetCategoryEntry("Gecko-Content-Viewers", aType, getter_Copies(contractID)); + if (NS_SUCCEEDED(rv)) { + docFactory = do_GetService(contractID); + if (docFactory && aLoaderType) { + *aLoaderType = contractID.EqualsLiteral(CONTENT_DLF_CONTRACTID) ? TYPE_CONTENT : TYPE_UNKNOWN; + } + return docFactory.forget(); + } + + if (AVAILABLE == pluginEnabled) { + docFactory = do_GetService(PLUGIN_DLF_CONTRACTID); + if (docFactory && aLoaderType) { + *aLoaderType = TYPE_PLUGIN; + } + return docFactory.forget(); + } + + return NULL; +}
--- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -44,16 +44,17 @@ #ifdef MOZ_LOGGING // so we can get logging even in release builds (but only for some things) #define FORCE_PR_LOG 1 #endif #include "nsIBrowserDOMWindow.h" #include "nsIComponentManager.h" #include "nsIContent.h" +#include "nsIContentUtils.h" #include "mozilla/dom/Element.h" #include "nsIDocument.h" #include "nsIDOMDocument.h" #include "nsIDOM3Document.h" #include "nsIDOMNSDocument.h" #include "nsIDOMElement.h" #include "nsIDOMStorageObsolete.h" #include "nsIDOMStorage.h" @@ -6182,27 +6183,21 @@ nsDocShell::CreateAboutBlankContentViewe } // Now make sure we don't think we're in the middle of firing unload after // this point. This will make us fire unload when the about:blank document // unloads... but that's ok, more or less. Would be nice if it fired load // too, of course. mFiredUnloadEvent = PR_FALSE; - // one helper factory, please - nsCOMPtr<nsICategoryManager> catMan(do_GetService(NS_CATEGORYMANAGER_CONTRACTID)); - if (!catMan) - return NS_ERROR_FAILURE; - - nsXPIDLCString contractId; - rv = catMan->GetCategoryEntry("Gecko-Content-Viewers", "text/html", getter_Copies(contractId)); - if (NS_FAILED(rv)) - return rv; - - nsCOMPtr<nsIDocumentLoaderFactory> docFactory(do_GetService(contractId)); + nsCOMPtr<nsIContentUtils> cutils = do_GetService("@mozilla.org/content/contentutils;1"); + if (!cutils) + return NS_ERROR_FAILURE; + + nsCOMPtr<nsIDocumentLoaderFactory> docFactory = cutils->FindInternalContentViewer("text/html"); if (docFactory) { // generate (about:blank) document to load docFactory->CreateBlankDocument(mLoadGroup, aPrincipal, getter_AddRefs(blankDoc)); if (blankDoc) { // Hack: set the base URI manually, since this document never // got Reset() with a channel. blankDoc->SetBaseURI(aBaseURI); @@ -7172,29 +7167,23 @@ nsDocShell::CreateContentViewer(const ch nsresult nsDocShell::NewContentViewerObj(const char *aContentType, nsIRequest * request, nsILoadGroup * aLoadGroup, nsIStreamListener ** aContentHandler, nsIContentViewer ** aViewer) { nsCOMPtr<nsIChannel> aOpenedChannel = do_QueryInterface(request); - nsresult rv; - nsCOMPtr<nsICategoryManager> catMan(do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv)); - if (NS_FAILED(rv)) - return rv; - - nsXPIDLCString contractId; - rv = catMan->GetCategoryEntry("Gecko-Content-Viewers", aContentType, getter_Copies(contractId)); - - // Create an instance of the document-loader-factory - nsCOMPtr<nsIDocumentLoaderFactory> docLoaderFactory; - if (NS_SUCCEEDED(rv)) - docLoaderFactory = do_GetService(contractId.get()); - + nsCOMPtr<nsIContentUtils> cutils = do_GetService("@mozilla.org/content/contentutils;1"); + if (!cutils) { + return NS_ERROR_FAILURE; + } + + nsCOMPtr<nsIDocumentLoaderFactory> docLoaderFactory = + cutils->FindInternalContentViewer(aContentType); if (!docLoaderFactory) { return NS_ERROR_FAILURE; } // Now create an instance of the content viewer // nsLayoutDLF makes the determination if it should be a "view-source" instead of "view" NS_ENSURE_SUCCESS(docLoaderFactory->CreateInstance("view", aOpenedChannel,
--- a/docshell/base/nsWebNavigationInfo.cpp +++ b/docshell/base/nsWebNavigationInfo.cpp @@ -34,16 +34,17 @@ * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "nsWebNavigationInfo.h" #include "nsIWebNavigation.h" #include "nsString.h" #include "nsServiceManagerUtils.h" +#include "nsIContentUtils.h" #include "nsIDocumentLoaderFactory.h" #include "nsIPluginHost.h" NS_IMPL_ISUPPORTS1(nsWebNavigationInfo, nsIWebNavigationInfo) #define CONTENT_DLF_CONTRACT "@mozilla.org/content/document-loader-factory;1" #define PLUGIN_DLF_CONTRACT \ "@mozilla.org/content/plugin/document-loader-factory;1" @@ -101,53 +102,47 @@ nsWebNavigationInfo::IsTypeSupported(con return NS_OK; } nsresult nsWebNavigationInfo::IsTypeSupportedInternal(const nsCString& aType, PRUint32* aIsSupported) { - NS_PRECONDITION(mCategoryManager, "Must have category manager"); NS_PRECONDITION(aIsSupported, "Null out param?"); - nsXPIDLCString value; - nsresult rv = mCategoryManager->GetCategoryEntry("Gecko-Content-Viewers", - aType.get(), - getter_Copies(value)); - // If the category manager can't find what we're looking for - // it returns NS_ERROR_NOT_AVAILABLE, we don't want to propagate - // that to the caller since it's really not a failure + nsCOMPtr<nsIContentUtils> cutils = do_GetService("@mozilla.org/content/contentutils;1"); + if (!cutils) + return NS_ERROR_FAILURE; - if (NS_FAILED(rv) && rv != NS_ERROR_NOT_AVAILABLE) - return rv; + nsIContentUtils::ContentViewerType vtype = nsIContentUtils::TYPE_UNSUPPORTED; - // Now try to get an actual document loader factory for this contractid. If - // there is no contractid, don't try and just return false for *aIsSupported. - nsCOMPtr<nsIDocumentLoaderFactory> docLoaderFactory; - if (!value.IsEmpty()) { - docLoaderFactory = do_GetService(value.get()); - } + nsCOMPtr<nsIDocumentLoaderFactory> docLoaderFactory = + cutils->FindInternalContentViewer(aType.get(), &vtype); + + switch (vtype) { + case nsIContentUtils::TYPE_UNSUPPORTED: + *aIsSupported = nsIWebNavigationInfo::UNSUPPORTED; + break; - // If we got a factory, we should be able to handle this type - if (!docLoaderFactory) { - *aIsSupported = nsIWebNavigationInfo::UNSUPPORTED; - } - else if (value.EqualsLiteral(CONTENT_DLF_CONTRACT)) { + case nsIContentUtils::TYPE_PLUGIN: + *aIsSupported = nsIWebNavigationInfo::PLUGIN; + break; + + case nsIContentUtils::TYPE_UNKNOWN: + *aIsSupported = nsIWebNavigationInfo::OTHER; + break; + + case nsIContentUtils::TYPE_CONTENT: PRBool isImage = PR_FALSE; mImgLoader->SupportImageWithMimeType(aType.get(), &isImage); if (isImage) { *aIsSupported = nsIWebNavigationInfo::IMAGE; } else { *aIsSupported = nsIWebNavigationInfo::OTHER; } - } - else if (value.EqualsLiteral(PLUGIN_DLF_CONTRACT)) { - *aIsSupported = nsIWebNavigationInfo::PLUGIN; - } - else { - *aIsSupported = nsIWebNavigationInfo::OTHER; + break; } return NS_OK; }
--- a/layout/build/nsContentDLF.cpp +++ b/layout/build/nsContentDLF.cpp @@ -526,17 +526,17 @@ RegisterTypes(nsICategoryManager* aCatMg const char* contentType = *aTypes++; #ifdef NOISY_REGISTRY printf("Register %s => %s\n", contractid, aPath); #endif // add the MIME types layout can handle to the handlers category. // this allows users of layout's viewers (the docshell for example) // to query the types of viewers layout can create. rv = aCatMgr->AddCategoryEntry("Gecko-Content-Viewers", contentType, - "@mozilla.org/content/document-loader-factory;1", + CONTENT_DLF_CONTRACTID, aPersist, PR_TRUE, nsnull); if (NS_FAILED(rv)) break; } return rv; } static nsresult UnregisterTypes(nsICategoryManager* aCatMgr, const char* const* aTypes)
--- a/layout/build/nsContentDLF.h +++ b/layout/build/nsContentDLF.h @@ -47,16 +47,19 @@ class nsIComponentManager; class nsIContentViewer; class nsIDocumentViewer; class nsIFile; class nsIInputStream; class nsILoadGroup; class nsIStreamListener; struct nsModuleComponentInfo; +#define CONTENT_DLF_CONTRACTID "@mozilla.org/content/document-loader-factory;1" +#define PLUGIN_DLF_CONTRACTID "@mozilla.org/content/plugin/document-loader-factory;1" + class nsContentDLF : public nsIDocumentLoaderFactory { public: nsContentDLF(); virtual ~nsContentDLF(); NS_DECL_ISUPPORTS NS_DECL_NSIDOCUMENTLOADERFACTORY
--- a/layout/build/nsLayoutModule.cpp +++ b/layout/build/nsLayoutModule.cpp @@ -1392,17 +1392,17 @@ static const nsModuleComponentInfo gLayo { "XML Content Builder", NS_XMLCONTENTBUILDER_CID, NS_XMLCONTENTBUILDER_CONTRACTID, CreateXMLContentBuilder }, #endif { "Document Loader Factory", NS_CONTENT_DOCUMENT_LOADER_FACTORY_CID, - "@mozilla.org/content/document-loader-factory;1", + CONTENT_DLF_CONTRACTID, CreateContentDLF, nsContentDLF::RegisterDocumentFactories, nsContentDLF::UnregisterDocumentFactories }, { "Wyciwyg Handler", NS_WYCIWYGPROTOCOLHANDLER_CID, NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "wyciwyg", nsWyciwygProtocolHandlerConstructor }, @@ -1443,17 +1443,17 @@ static const nsModuleComponentInfo gLayo }, // view stuff { "View Manager", NS_VIEW_MANAGER_CID, "@mozilla.org/view-manager;1", nsViewManagerConstructor }, { "Plugin Document Loader Factory", NS_PLUGINDOCLOADERFACTORY_CID, - "@mozilla.org/content/plugin/document-loader-factory;1", + PLUGIN_DLF_CONTRACTID, CreateContentDLF }, { "Plugin Document", NS_PLUGINDOCUMENT_CID, nsnull, CreatePluginDocument }, #ifdef MOZ_MEDIA
--- a/modules/plugin/base/public/nsIPluginHost.idl +++ b/modules/plugin/base/public/nsIPluginHost.idl @@ -59,16 +59,33 @@ interface nsIPlugin; interface nsIURI; interface nsIDOMPlugin; interface nsIChannel; interface nsIPluginStreamListener; [ptr] native PRLibraryPtr(PRLibrary); [ref] native nsIStreamListenerRef(nsIStreamListener *); [ptr] native nsPluginNativeWindowPtr(nsPluginNativeWindow); +native FullPagePluginEnabledType(FullPagePluginEnabledType); + +%{C++ +enum FullPagePluginEnabledType +{ + // No plugin was found for this MIME type. + NOT_ENABLED, + + // A plugin is available and should take precedence over builtin + // content viewers. + OVERRIDE_BUILTIN, + + // A plugin is available, but a builtin content viewers should be used if + // present. + AVAILABLE +}; +%} [scriptable, uuid(D419142E-0571-416B-B797-2A8E6624491D)] interface nsIPluginHost : nsISupports { [noscript] void init(); [noscript] void destroy(); @@ -101,16 +118,18 @@ interface nsIPluginHost : nsISupports [noscript] void setUpPluginInstance(in string aMimeType, in nsIURI aURL, in nsIPluginInstanceOwner aOwner); // The return code is NS_OK if the plugin is enabled, // NS_ERROR_PLUGIN_DISABLED if the plugin is explicitly disabled, and // NS_ERROR_FAILURE if there is no plugin for this type. [noscript] void isPluginEnabledForType(in string aMimeType); + [noscript] FullPagePluginEnabledType isFullPagePluginEnabledForType(in string aMimeType); + // The return code is NS_OK if the plugin is enabled and NS_ERROR_FAILURE if // the plugin is explicitly disabled or there is no plugin. [noscript] void isPluginEnabledForExtension(in string aExtension, in constCharStarRef aMimeType); [noscript] readonly attribute unsigned long pluginCount; [noscript] void getPlugins(in unsigned long aPluginCount, out /*array*/ nsIDOMPlugin aPluginArray);
--- a/modules/plugin/base/src/nsPluginHost.cpp +++ b/modules/plugin/base/src/nsPluginHost.cpp @@ -2605,16 +2605,52 @@ nsPluginHost::IsPluginEnabledForType(con return NS_ERROR_PLUGIN_BLOCKLISTED; else return NS_ERROR_PLUGIN_DISABLED; } return NS_OK; } +NS_IMETHODIMP +nsPluginHost::IsFullPagePluginEnabledForType(const char* aMimeType, + FullPagePluginEnabledType* aResult) +{ + *aResult = NOT_ENABLED; + + nsCOMPtr<nsIPrefBranch> psvc(do_GetService(NS_PREFSERVICE_CONTRACTID)); + if (!psvc) + return NS_OK; + + // A preference controls whether or not the full page plugin is disabled for + // a particular type. The string must be in the form: + // type1,type2,type3,type4 + // Note: need an actual interface to control this and subsequent disabling + // (and other plugin host settings) so applications can reliably disable + // plugins - without relying on implementation details such as prefs/category + // manager entries. + nsXPIDLCString overrideTypes; + psvc->GetCharPref("plugin.disable_full_page_plugin_for_types", getter_Copies(overrideTypes)); + overrideTypes.Insert(',', 0); + overrideTypes.Append(','); + + nsCAutoString commaSeparated(','); + commaSeparated.Append(aMimeType); + commaSeparated.Append(','); + if (overrideTypes.Find(commaSeparated) != kNotFound) + return NS_OK; + + nsPluginTag* plugin = FindPluginForType(aMimeType, PR_TRUE); + if (!plugin || !plugin->IsEnabled()) + return NS_OK; + + *aResult = mOverrideInternalTypes ? OVERRIDE_BUILTIN : AVAILABLE; + return NS_OK; +} + // check comma delimitered extensions static int CompareExtensions(const char *aExtensionList, const char *aExtension) { if (!aExtensionList || !aExtension) return -1; const char *pExt = aExtensionList; const char *pComma = strchr(pExt, ','); @@ -3349,19 +3385,16 @@ nsresult nsPluginHost::ScanPluginsDirect } } // do it if we still want it if (bAddIt) { pluginTag->SetHost(this); pluginTag->mNext = mPlugins; mPlugins = pluginTag; - - if (pluginTag->IsEnabled()) - pluginTag->RegisterWithCategoryManager(mOverrideInternalTypes); } } if (warnOutdated) mPrefService->SetBoolPref("plugins.update.notifyUser", PR_TRUE); return NS_OK; }
--- a/modules/plugin/base/src/nsPluginTags.cpp +++ b/modules/plugin/base/src/nsPluginTags.cpp @@ -407,114 +407,26 @@ nsPluginTag::SetBlocklisted(PRBool aBloc Mark(NS_PLUGIN_FLAG_BLOCKLISTED); else UnMark(NS_PLUGIN_FLAG_BLOCKLISTED); mPluginHost->UpdatePluginInfo(nsnull); return NS_OK; } -void -nsPluginTag::RegisterWithCategoryManager(PRBool aOverrideInternalTypes, - nsPluginTag::nsRegisterType aType) -{ - if (!mMimeTypeArray) - return; - - PLUGIN_LOG(PLUGIN_LOG_NORMAL, - ("nsPluginTag::RegisterWithCategoryManager plugin=%s, removing = %s\n", - mFileName.get(), aType == ePluginUnregister ? "yes" : "no")); - - nsCOMPtr<nsICategoryManager> catMan = do_GetService(NS_CATEGORYMANAGER_CONTRACTID); - if (!catMan) - return; - - const char *contractId = "@mozilla.org/content/plugin/document-loader-factory;1"; - - nsCOMPtr<nsIPrefBranch> psvc(do_GetService(NS_PREFSERVICE_CONTRACTID)); - if (!psvc) - return; // NS_ERROR_OUT_OF_MEMORY - - // A preference controls whether or not the full page plugin is disabled for - // a particular type. The string must be in the form: - // type1,type2,type3,type4 - // Note: need an actual interface to control this and subsequent disabling - // (and other plugin host settings) so applications can reliably disable - // plugins - without relying on implementation details such as prefs/category - // manager entries. - nsXPIDLCString overrideTypes; - psvc->GetCharPref("plugin.disable_full_page_plugin_for_types", getter_Copies(overrideTypes)); - nsCAutoString overrideTypesFormatted; - overrideTypesFormatted.Assign(','); - overrideTypesFormatted += overrideTypes; - overrideTypesFormatted.Append(','); - - nsACString::const_iterator start, end; - for (int i = 0; i < mVariants; i++) { - if (aType == ePluginUnregister) { - nsXPIDLCString value; - if (NS_SUCCEEDED(catMan->GetCategoryEntry("Gecko-Content-Viewers", - mMimeTypeArray[i], - getter_Copies(value)))) { - // Only delete the entry if a plugin registered for it - if (strcmp(value, contractId) == 0) { - catMan->DeleteCategoryEntry("Gecko-Content-Viewers", - mMimeTypeArray[i], - PR_TRUE); - } - } - } else { - overrideTypesFormatted.BeginReading(start); - overrideTypesFormatted.EndReading(end); - - nsDependentCString mimeType(mMimeTypeArray[i]); - nsCAutoString commaSeparated; - commaSeparated.Assign(','); - commaSeparated += mimeType; - commaSeparated.Append(','); - if (!FindInReadable(commaSeparated, start, end)) { - catMan->AddCategoryEntry("Gecko-Content-Viewers", - mMimeTypeArray[i], - contractId, - PR_FALSE, /* persist: broken by bug 193031 */ - aOverrideInternalTypes, /* replace if we're told to */ - nsnull); - } - } - - PLUGIN_LOG(PLUGIN_LOG_NOISY, - ("nsPluginTag::RegisterWithCategoryManager mime=%s, plugin=%s\n", - mMimeTypeArray[i], mFileName.get())); - } -} - void nsPluginTag::Mark(PRUint32 mask) { PRBool wasEnabled = IsEnabled(); mFlags |= mask; - // Update entries in the category manager if necessary. - if (mPluginHost && wasEnabled != IsEnabled()) { - if (wasEnabled) - RegisterWithCategoryManager(PR_FALSE, nsPluginTag::ePluginUnregister); - else - RegisterWithCategoryManager(PR_FALSE, nsPluginTag::ePluginRegister); - } } void nsPluginTag::UnMark(PRUint32 mask) { PRBool wasEnabled = IsEnabled(); mFlags &= ~mask; - // Update entries in the category manager if necessary. - if (mPluginHost && wasEnabled != IsEnabled()) { - if (wasEnabled) - RegisterWithCategoryManager(PR_FALSE, nsPluginTag::ePluginUnregister); - else - RegisterWithCategoryManager(PR_FALSE, nsPluginTag::ePluginRegister); - } } PRBool nsPluginTag::HasFlag(PRUint32 flag) { return (mFlags & flag) != 0; } PRUint32 nsPluginTag::Flags() @@ -558,22 +470,16 @@ void nsPluginTag::TryUnloadPlugin() nsPluginHost::PostPluginUnloadEvent(mLibrary); } // we should zero it anyway, it is going to be unloaded by // CleanUnsedLibraries before we need to call the library // again so the calling code should not be fooled and reload // the library fresh mLibrary = nsnull; - - // Remove mime types added to the category manager - // only if we were made 'active' by setting the host - if (mPluginHost) { - RegisterWithCategoryManager(PR_FALSE, nsPluginTag::ePluginUnregister); - } } /* nsPluginInstanceTag */ nsPluginInstanceTag::nsPluginInstanceTag(nsPluginTag* aPluginTag, nsIPluginInstance* aInstance, const char * url) {
--- a/modules/plugin/base/src/nsPluginTags.h +++ b/modules/plugin/base/src/nsPluginTags.h @@ -61,21 +61,16 @@ struct nsPluginInfo; #define NS_PLUGIN_FLAG_UNWANTED 0x0008 // this is an unwanted plugin #define NS_PLUGIN_FLAG_BLOCKLISTED 0x0010 // this is a blocklisted plugin // A linked-list of plugin information that is used for instantiating plugins // and reflecting plugin information into JavaScript. class nsPluginTag : public nsIPluginTag { public: - enum nsRegisterType { - ePluginRegister, - ePluginUnregister - }; - NS_DECL_ISUPPORTS NS_DECL_NSIPLUGINTAG nsPluginTag(nsPluginTag* aPluginTag); nsPluginTag(nsPluginInfo* aPluginInfo); nsPluginTag(const char* aName, const char* aDescription, const char* aFileName, @@ -93,18 +88,16 @@ public: void SetHost(nsPluginHost * aHost); void TryUnloadPlugin(); void Mark(PRUint32 mask); void UnMark(PRUint32 mask); PRBool HasFlag(PRUint32 flag); PRUint32 Flags(); PRBool Equals(nsPluginTag* aPluginTag); PRBool IsEnabled(); - void RegisterWithCategoryManager(PRBool aOverrideInternalTypes, - nsRegisterType aType = ePluginRegister); nsRefPtr<nsPluginTag> mNext; nsPluginHost *mPluginHost; nsCString mName; // UTF-8 nsCString mDescription; // UTF-8 PRInt32 mVariants; char **mMimeTypeArray; nsTArray<nsCString> mMimeDescriptionArray; // UTF-8