зеркало из https://github.com/mozilla/pjs.git
Fixing 132430 -- RealJukeBox breaks plugin finder service, r=peterl, sr=attinasi
This commit is contained in:
Родитель
922e9b6d8f
Коммит
c32275df79
|
@ -53,3 +53,4 @@ nsPluginLogging.h
|
|||
nsPluginError.h
|
||||
npapi.h
|
||||
npupp.h
|
||||
nsDefaultPlugin.h
|
||||
|
|
|
@ -55,6 +55,7 @@ EXPORTS = \
|
|||
nsPIPluginHost.h \
|
||||
nsPluginLogging.h \
|
||||
nsPluginError.h \
|
||||
nsDefaultPlugin.h \
|
||||
$(NULL)
|
||||
|
||||
# 4.x headers moved from mozilla/include
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
|
||||
|
||||
DEPTH = ..\..\..\..
|
||||
|
||||
MODULE = plugin
|
||||
|
||||
EXPORTS = \
|
||||
nsIEventHandler.h \
|
||||
nsIFileUtilities.h \
|
||||
nsIMalloc.h \
|
||||
nsIPlugin.h \
|
||||
nsIPluginInstance.h \
|
||||
nsIPluginInstancePeer.h \
|
||||
nsIPluginInstancePeer2.h \
|
||||
nsIPluginManager2.h \
|
||||
nsIPluginTagInfo.h \
|
||||
nsIPluginTagInfo2.h \
|
||||
nsIWindowlessPlugInstPeer.h \
|
||||
nsIPluginStreamListener.h \
|
||||
nsIPluginStreamInfo.h \
|
||||
nsplugin.h \
|
||||
nsplugindefs.h \
|
||||
nsICookieStorage.h \
|
||||
nsPIPluginHost.h \
|
||||
nsPluginLogging.h \
|
||||
nsPluginError.h
|
||||
|
||||
# 4.x headers moved from mozilla/include
|
||||
EXPORTS = $(EXPORTS) \
|
||||
npapi.h \
|
||||
npupp.h \
|
||||
$(NULL)
|
||||
|
||||
# DEPRECATED -- remove before we ship 5.0
|
||||
EXPORTS = $(EXPORTS) \
|
||||
nsIPluginStream.h \
|
||||
nsIPluginStreamPeer.h \
|
||||
nsIPluginStreamPeer2.h \
|
||||
nsISeekablePluginStreamPeer.h \
|
||||
nsILiveConnectPlugin.h \
|
||||
nsILiveConnectPlugInstPeer.h \
|
||||
nsIJRILiveConnectPlugin.h \
|
||||
nsIJRILiveConnectPlugInstPeer.h \
|
||||
nsIPluginInputStream.h \
|
||||
nsIPluginInputStream2.h
|
||||
|
||||
XPIDLSRCS = \
|
||||
.\nsIScriptablePlugin.idl \
|
||||
.\nsIHTTPHeaderListener.idl \
|
||||
.\nsIPluginManager.idl \
|
||||
.\nsIPluginViewer.idl \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)/config/rules.mak>
|
||||
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
|
||||
/*
|
||||
* npupp.h $Revision: 3.9 $
|
||||
* npupp.h $Revision: 3.10 $
|
||||
* function call mecahnics needed by platform specific glue code.
|
||||
*/
|
||||
|
||||
|
@ -1259,6 +1259,8 @@ NPError OSCALL NP_Initialize(NPNetscapeFuncs* pFuncs);
|
|||
|
||||
NPError OSCALL NP_Shutdown();
|
||||
|
||||
char* NP_GetMIMEDescription();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* 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 NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _DEFAULT_H_
|
||||
#define _DEFAULT_H_
|
||||
|
||||
// This mimetype is reserved for use with the Netscape
|
||||
// Default Plugin only. Using it in any other plugin will break
|
||||
// the basic functionality of the Mozilla based browsers
|
||||
#define NS_PLUGIN_DEFAULT_MIME_DESCRIPTION "*"
|
||||
|
||||
#endif // _DEFAULT_H_
|
|
@ -149,6 +149,7 @@
|
|||
#include "nsUnicharUtils.h"
|
||||
|
||||
#include "imgILoader.h"
|
||||
#include "nsDefaultPlugin.h"
|
||||
|
||||
#ifdef XP_UNIX
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
|
@ -2577,12 +2578,15 @@ nsPluginHostImpl::nsPluginHostImpl()
|
|||
mIsDestroyed = PR_FALSE;
|
||||
mUnusedLibraries = nsnull;
|
||||
mOverrideInternalTypes = PR_FALSE;
|
||||
mAllowAlienStarHandler = PR_FALSE;
|
||||
|
||||
// check to see if pref is set at startup to let plugins take over in
|
||||
// full page mode for certain image mime types that we handle internally
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID));
|
||||
if (prefs)
|
||||
if (prefs) {
|
||||
prefs->GetBoolPref("plugin.override_internal_types", &mOverrideInternalTypes);
|
||||
prefs->GetBoolPref("plugin.allow_alien_star_handler", &mAllowAlienStarHandler);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIObserverService> obsService = do_GetService("@mozilla.org/observer-service;1");
|
||||
if (obsService)
|
||||
|
@ -4675,6 +4679,45 @@ static int PR_CALLBACK ComparePluginFileInDirectory (const void *v1, const void
|
|||
return result;
|
||||
}
|
||||
|
||||
typedef NS_4XPLUGIN_CALLBACK(char *, NP_GETMIMEDESCRIPTION)(void);
|
||||
|
||||
static nsresult FixUpPluginInfo(nsPluginInfo &aInfo, nsPluginFile &aPluginFile)
|
||||
{
|
||||
#ifndef XP_WIN
|
||||
retrun NS_OK;
|
||||
#endif
|
||||
|
||||
for (PRUint32 i = 0; i < aInfo.fVariantCount; i++) {
|
||||
if (PL_strcmp(aInfo.fMimeTypeArray[i], "*"))
|
||||
continue;
|
||||
|
||||
// we got "*" type
|
||||
// check if this is an alien plugin (not our default plugin)
|
||||
// by trying to find a special entry point
|
||||
PRLibrary *library = nsnull;
|
||||
if (NS_FAILED(aPluginFile.LoadPlugin(library)) || !library)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
NP_GETMIMEDESCRIPTION pf = (NP_GETMIMEDESCRIPTION)PR_FindSymbol(library, "NP_GetMIMEDescription");
|
||||
if (pf) {
|
||||
// if we found it, this is the default plugin, return
|
||||
char * mimedescription = pf();
|
||||
if (!PL_strncmp(mimedescription, NS_PLUGIN_DEFAULT_MIME_DESCRIPTION, 1))
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// if we are here that means we have an alien plugin
|
||||
// which wants to take over "*" type
|
||||
|
||||
// change its "*" mime type to "[*]"
|
||||
PL_strfree(aInfo.fMimeTypeArray[i]);
|
||||
aInfo.fMimeTypeArray[i] = PL_strdup("[*]");
|
||||
|
||||
// continue the loop?
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
nsresult nsPluginHostImpl::ScanPluginsDirectory(nsIFile * pluginsDir,
|
||||
nsIComponentManager * compManager,
|
||||
|
@ -4805,7 +4848,13 @@ nsresult nsPluginHostImpl::ScanPluginsDirectory(nsIFile * pluginsDir,
|
|||
pluginFile.FreePluginInfo(info);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Check for any potential '*' mime type handlers which are not our
|
||||
// own default plugin and disable them as they will break the plugin
|
||||
// finder service, see Bugzilla bug 132430
|
||||
if (!mAllowAlienStarHandler)
|
||||
FixUpPluginInfo(info, pluginFile);
|
||||
|
||||
pluginTag = new nsPluginTag(&info);
|
||||
pluginFile.FreePluginInfo(info);
|
||||
|
||||
|
|
|
@ -471,7 +471,8 @@ private:
|
|||
PRBool mPluginsLoaded;
|
||||
PRBool mDontShowBadPluginMessage;
|
||||
PRBool mIsDestroyed;
|
||||
PRBool mOverrideInternalTypes; // set by pref plugin.override_internal_types
|
||||
PRBool mOverrideInternalTypes; // set by pref plugin.override_internal_types
|
||||
PRBool mAllowAlienStarHandler; // set by pref plugin.allow_alien_star_handler
|
||||
|
||||
nsActivePluginList mActivePluginList;
|
||||
nsUnusedLibrary *mUnusedLibraries;
|
||||
|
|
Загрузка…
Ссылка в новой задаче