mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-15 06:15:43 +00:00
Fix for 44692, allowing default plugin guess about mime type by extension, a=mscott
This commit is contained in:
parent
69980043ac
commit
2f358f1418
@ -90,6 +90,9 @@
|
||||
#include "nsPluginDocLoaderFactory.h"
|
||||
#include "nsIDocumentLoaderFactory.h"
|
||||
|
||||
#include "nsIMIMEService.h"
|
||||
#include "nsCExternalHandlerService.h"
|
||||
|
||||
#ifdef XP_UNIX
|
||||
#include <gdk/gdkx.h> // for GDK_DISPLAY()
|
||||
#endif
|
||||
@ -2443,6 +2446,30 @@ nsresult nsPluginHostImpl::SetUpDefaultPluginInstance(const char *aMimeType, nsI
|
||||
if(peer == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
// if we don't have a mimetype, check by file extension
|
||||
nsXPIDLCString mt;
|
||||
if(mimetype == nsnull)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
nsCOMPtr<nsIURL> url = do_QueryInterface(aURL);
|
||||
if(url)
|
||||
{
|
||||
nsXPIDLCString extension;
|
||||
url->GetFileExtension(getter_Copies(extension));
|
||||
|
||||
if(extension)
|
||||
{
|
||||
nsCOMPtr<nsIMIMEService> ms (do_GetService(NS_MIMESERVICE_CONTRACTID, &res));
|
||||
if(NS_SUCCEEDED(res) && ms)
|
||||
{
|
||||
res = ms->GetTypeFromExtension(extension, getter_Copies(mt));
|
||||
if(NS_SUCCEEDED(res))
|
||||
mimetype = mt;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set up the peer for the instance
|
||||
peer->Initialize(aOwner, mimetype);
|
||||
|
||||
|
@ -90,6 +90,9 @@
|
||||
#include "nsPluginDocLoaderFactory.h"
|
||||
#include "nsIDocumentLoaderFactory.h"
|
||||
|
||||
#include "nsIMIMEService.h"
|
||||
#include "nsCExternalHandlerService.h"
|
||||
|
||||
#ifdef XP_UNIX
|
||||
#include <gdk/gdkx.h> // for GDK_DISPLAY()
|
||||
#endif
|
||||
@ -2443,6 +2446,30 @@ nsresult nsPluginHostImpl::SetUpDefaultPluginInstance(const char *aMimeType, nsI
|
||||
if(peer == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
// if we don't have a mimetype, check by file extension
|
||||
nsXPIDLCString mt;
|
||||
if(mimetype == nsnull)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
nsCOMPtr<nsIURL> url = do_QueryInterface(aURL);
|
||||
if(url)
|
||||
{
|
||||
nsXPIDLCString extension;
|
||||
url->GetFileExtension(getter_Copies(extension));
|
||||
|
||||
if(extension)
|
||||
{
|
||||
nsCOMPtr<nsIMIMEService> ms (do_GetService(NS_MIMESERVICE_CONTRACTID, &res));
|
||||
if(NS_SUCCEEDED(res) && ms)
|
||||
{
|
||||
res = ms->GetTypeFromExtension(extension, getter_Copies(mt));
|
||||
if(NS_SUCCEEDED(res))
|
||||
mimetype = mt;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set up the peer for the instance
|
||||
peer->Initialize(aOwner, mimetype);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user