зеркало из https://github.com/mozilla/pjs.git
Support (in a shaky way) some various and sundry mime types for plugins
This commit is contained in:
Родитель
3fa1dd6425
Коммит
406fcd2c21
|
@ -178,6 +178,13 @@ public:
|
||||||
nsIContentViewerContainer* aContainer,
|
nsIContentViewerContainer* aContainer,
|
||||||
nsIStreamListener** aDocListener,
|
nsIStreamListener** aDocListener,
|
||||||
nsIContentViewer** aDocViewer);
|
nsIContentViewer** aDocViewer);
|
||||||
|
|
||||||
|
nsresult CreatePluginDocument(nsIURL* aURL,
|
||||||
|
const char* aCommand,
|
||||||
|
const char* aContentType,
|
||||||
|
nsIContentViewerContainer* aContainer,
|
||||||
|
nsIStreamListener** aDocListener,
|
||||||
|
nsIContentViewer** aDocViewer);
|
||||||
};
|
};
|
||||||
|
|
||||||
static nsIStyleSheet* gUAStyleSheet;
|
static nsIStyleSheet* gUAStyleSheet;
|
||||||
|
@ -196,6 +203,24 @@ static char* gValidTypes[] = {"text/html","text/xml","application/rtf",0};
|
||||||
|
|
||||||
static char* gImageTypes[] = {"image/gif", "image/jpeg", 0 };
|
static char* gImageTypes[] = {"image/gif", "image/jpeg", 0 };
|
||||||
|
|
||||||
|
static char* gPluginTypes[] = {
|
||||||
|
"video/quicktime",
|
||||||
|
"video/msvideo",
|
||||||
|
"video/x-msvideo",
|
||||||
|
"application/vnd.netfpx",
|
||||||
|
"image/vnd.fpx",
|
||||||
|
"model/vrml",
|
||||||
|
"x-world/x-vrml",
|
||||||
|
"audio/midi",
|
||||||
|
"audio/x-midi",
|
||||||
|
"audio/wav",
|
||||||
|
"audio/x-wav",
|
||||||
|
"audio/aiff",
|
||||||
|
"audio/x-aiff",
|
||||||
|
"audio/basic",
|
||||||
|
0
|
||||||
|
};
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocFactoryImpl::CreateInstance(nsIURL* aURL,
|
nsDocFactoryImpl::CreateInstance(nsIURL* aURL,
|
||||||
const char* aContentType,
|
const char* aContentType,
|
||||||
|
@ -215,7 +240,7 @@ nsDocFactoryImpl::CreateInstance(nsIURL* aURL,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try secondary types
|
// Try image types
|
||||||
typeIndex = 0;
|
typeIndex = 0;
|
||||||
while(gImageTypes[typeIndex]) {
|
while(gImageTypes[typeIndex]) {
|
||||||
if (0== PL_strcmp(gImageTypes[typeIndex++], aContentType)) {
|
if (0== PL_strcmp(gImageTypes[typeIndex++], aContentType)) {
|
||||||
|
@ -225,6 +250,17 @@ nsDocFactoryImpl::CreateInstance(nsIURL* aURL,
|
||||||
aDocViewer);
|
aDocViewer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Try plugin types
|
||||||
|
typeIndex = 0;
|
||||||
|
while(gPluginTypes[typeIndex]) {
|
||||||
|
if (0== PL_strcmp(gPluginTypes[typeIndex++], aContentType)) {
|
||||||
|
return CreatePluginDocument(aURL, aCommand, aContentType,
|
||||||
|
aContainer,
|
||||||
|
aDocListener,
|
||||||
|
aDocViewer);
|
||||||
|
}
|
||||||
|
}
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
nextstep:
|
nextstep:
|
||||||
|
@ -329,6 +365,28 @@ done:
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern nsresult
|
||||||
|
NS_NewPluginContentViewer(const char* aCommand,
|
||||||
|
nsIStreamListener** aDocListener,
|
||||||
|
nsIContentViewer** aDocViewer);
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
nsDocFactoryImpl::CreatePluginDocument(nsIURL* aURL,
|
||||||
|
const char* aCommand,
|
||||||
|
const char* aContentType,
|
||||||
|
nsIContentViewerContainer* aContainer,
|
||||||
|
nsIStreamListener** aDocListener,
|
||||||
|
nsIContentViewer** aDocViewer)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Create the plugin content viewer and stream listener...
|
||||||
|
*/
|
||||||
|
nsresult rv = NS_NewPluginContentViewer(aCommand,
|
||||||
|
aDocListener,
|
||||||
|
aDocViewer);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
#define UA_CSS_URL "resource:/res/ua.css"
|
#define UA_CSS_URL "resource:/res/ua.css"
|
||||||
|
|
||||||
nsresult nsDocFactoryImpl::InitUAStyleSheet()
|
nsresult nsDocFactoryImpl::InitUAStyleSheet()
|
||||||
|
@ -803,14 +861,7 @@ nsresult nsDocumentBindInfo::Bind(const nsString& aURLSpec,
|
||||||
* end nsIContentViewerContainer for refreshing urls.
|
* end nsIContentViewerContainer for refreshing urls.
|
||||||
*/
|
*/
|
||||||
if (m_Container) {
|
if (m_Container) {
|
||||||
nsISupports* container = nsnull;
|
rv = NS_NewURL(&m_Url, aURLSpec, m_Container);
|
||||||
rv = m_Container->QueryInterface(kISupportsIID, (void**)&container);
|
|
||||||
if (rv != NS_OK) {
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
rv = NS_NewURL(&m_Url, aURLSpec, container);
|
|
||||||
NS_RELEASE(container);
|
|
||||||
container = nsnull;
|
|
||||||
if (NS_OK != rv) {
|
if (NS_OK != rv) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,6 +178,13 @@ public:
|
||||||
nsIContentViewerContainer* aContainer,
|
nsIContentViewerContainer* aContainer,
|
||||||
nsIStreamListener** aDocListener,
|
nsIStreamListener** aDocListener,
|
||||||
nsIContentViewer** aDocViewer);
|
nsIContentViewer** aDocViewer);
|
||||||
|
|
||||||
|
nsresult CreatePluginDocument(nsIURL* aURL,
|
||||||
|
const char* aCommand,
|
||||||
|
const char* aContentType,
|
||||||
|
nsIContentViewerContainer* aContainer,
|
||||||
|
nsIStreamListener** aDocListener,
|
||||||
|
nsIContentViewer** aDocViewer);
|
||||||
};
|
};
|
||||||
|
|
||||||
static nsIStyleSheet* gUAStyleSheet;
|
static nsIStyleSheet* gUAStyleSheet;
|
||||||
|
@ -196,6 +203,24 @@ static char* gValidTypes[] = {"text/html","text/xml","application/rtf",0};
|
||||||
|
|
||||||
static char* gImageTypes[] = {"image/gif", "image/jpeg", 0 };
|
static char* gImageTypes[] = {"image/gif", "image/jpeg", 0 };
|
||||||
|
|
||||||
|
static char* gPluginTypes[] = {
|
||||||
|
"video/quicktime",
|
||||||
|
"video/msvideo",
|
||||||
|
"video/x-msvideo",
|
||||||
|
"application/vnd.netfpx",
|
||||||
|
"image/vnd.fpx",
|
||||||
|
"model/vrml",
|
||||||
|
"x-world/x-vrml",
|
||||||
|
"audio/midi",
|
||||||
|
"audio/x-midi",
|
||||||
|
"audio/wav",
|
||||||
|
"audio/x-wav",
|
||||||
|
"audio/aiff",
|
||||||
|
"audio/x-aiff",
|
||||||
|
"audio/basic",
|
||||||
|
0
|
||||||
|
};
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocFactoryImpl::CreateInstance(nsIURL* aURL,
|
nsDocFactoryImpl::CreateInstance(nsIURL* aURL,
|
||||||
const char* aContentType,
|
const char* aContentType,
|
||||||
|
@ -215,7 +240,7 @@ nsDocFactoryImpl::CreateInstance(nsIURL* aURL,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try secondary types
|
// Try image types
|
||||||
typeIndex = 0;
|
typeIndex = 0;
|
||||||
while(gImageTypes[typeIndex]) {
|
while(gImageTypes[typeIndex]) {
|
||||||
if (0== PL_strcmp(gImageTypes[typeIndex++], aContentType)) {
|
if (0== PL_strcmp(gImageTypes[typeIndex++], aContentType)) {
|
||||||
|
@ -225,6 +250,17 @@ nsDocFactoryImpl::CreateInstance(nsIURL* aURL,
|
||||||
aDocViewer);
|
aDocViewer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Try plugin types
|
||||||
|
typeIndex = 0;
|
||||||
|
while(gPluginTypes[typeIndex]) {
|
||||||
|
if (0== PL_strcmp(gPluginTypes[typeIndex++], aContentType)) {
|
||||||
|
return CreatePluginDocument(aURL, aCommand, aContentType,
|
||||||
|
aContainer,
|
||||||
|
aDocListener,
|
||||||
|
aDocViewer);
|
||||||
|
}
|
||||||
|
}
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
nextstep:
|
nextstep:
|
||||||
|
@ -329,6 +365,28 @@ done:
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern nsresult
|
||||||
|
NS_NewPluginContentViewer(const char* aCommand,
|
||||||
|
nsIStreamListener** aDocListener,
|
||||||
|
nsIContentViewer** aDocViewer);
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
nsDocFactoryImpl::CreatePluginDocument(nsIURL* aURL,
|
||||||
|
const char* aCommand,
|
||||||
|
const char* aContentType,
|
||||||
|
nsIContentViewerContainer* aContainer,
|
||||||
|
nsIStreamListener** aDocListener,
|
||||||
|
nsIContentViewer** aDocViewer)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Create the plugin content viewer and stream listener...
|
||||||
|
*/
|
||||||
|
nsresult rv = NS_NewPluginContentViewer(aCommand,
|
||||||
|
aDocListener,
|
||||||
|
aDocViewer);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
#define UA_CSS_URL "resource:/res/ua.css"
|
#define UA_CSS_URL "resource:/res/ua.css"
|
||||||
|
|
||||||
nsresult nsDocFactoryImpl::InitUAStyleSheet()
|
nsresult nsDocFactoryImpl::InitUAStyleSheet()
|
||||||
|
@ -803,14 +861,7 @@ nsresult nsDocumentBindInfo::Bind(const nsString& aURLSpec,
|
||||||
* end nsIContentViewerContainer for refreshing urls.
|
* end nsIContentViewerContainer for refreshing urls.
|
||||||
*/
|
*/
|
||||||
if (m_Container) {
|
if (m_Container) {
|
||||||
nsISupports* container = nsnull;
|
rv = NS_NewURL(&m_Url, aURLSpec, m_Container);
|
||||||
rv = m_Container->QueryInterface(kISupportsIID, (void**)&container);
|
|
||||||
if (rv != NS_OK) {
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
rv = NS_NewURL(&m_Url, aURLSpec, container);
|
|
||||||
NS_RELEASE(container);
|
|
||||||
container = nsnull;
|
|
||||||
if (NS_OK != rv) {
|
if (NS_OK != rv) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче