diff --git a/uriloader/base/nsDocLoader.cpp b/uriloader/base/nsDocLoader.cpp index 5b592658c09..ef9a4274d77 100644 --- a/uriloader/base/nsDocLoader.cpp +++ b/uriloader/base/nsDocLoader.cpp @@ -178,6 +178,13 @@ public: nsIContentViewerContainer* aContainer, nsIStreamListener** aDocListener, nsIContentViewer** aDocViewer); + + nsresult CreatePluginDocument(nsIURL* aURL, + const char* aCommand, + const char* aContentType, + nsIContentViewerContainer* aContainer, + nsIStreamListener** aDocListener, + nsIContentViewer** aDocViewer); }; 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* 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 nsDocFactoryImpl::CreateInstance(nsIURL* aURL, const char* aContentType, @@ -215,7 +240,7 @@ nsDocFactoryImpl::CreateInstance(nsIURL* aURL, } } - // Try secondary types + // Try image types typeIndex = 0; while(gImageTypes[typeIndex]) { if (0== PL_strcmp(gImageTypes[typeIndex++], aContentType)) { @@ -225,6 +250,17 @@ nsDocFactoryImpl::CreateInstance(nsIURL* aURL, 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; nextstep: @@ -329,6 +365,28 @@ done: 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" nsresult nsDocFactoryImpl::InitUAStyleSheet() @@ -803,14 +861,7 @@ nsresult nsDocumentBindInfo::Bind(const nsString& aURLSpec, * end nsIContentViewerContainer for refreshing urls. */ if (m_Container) { - nsISupports* container = nsnull; - 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; + rv = NS_NewURL(&m_Url, aURLSpec, m_Container); if (NS_OK != rv) { return rv; } diff --git a/webshell/src/nsDocLoader.cpp b/webshell/src/nsDocLoader.cpp index 5b592658c09..ef9a4274d77 100644 --- a/webshell/src/nsDocLoader.cpp +++ b/webshell/src/nsDocLoader.cpp @@ -178,6 +178,13 @@ public: nsIContentViewerContainer* aContainer, nsIStreamListener** aDocListener, nsIContentViewer** aDocViewer); + + nsresult CreatePluginDocument(nsIURL* aURL, + const char* aCommand, + const char* aContentType, + nsIContentViewerContainer* aContainer, + nsIStreamListener** aDocListener, + nsIContentViewer** aDocViewer); }; 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* 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 nsDocFactoryImpl::CreateInstance(nsIURL* aURL, const char* aContentType, @@ -215,7 +240,7 @@ nsDocFactoryImpl::CreateInstance(nsIURL* aURL, } } - // Try secondary types + // Try image types typeIndex = 0; while(gImageTypes[typeIndex]) { if (0== PL_strcmp(gImageTypes[typeIndex++], aContentType)) { @@ -225,6 +250,17 @@ nsDocFactoryImpl::CreateInstance(nsIURL* aURL, 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; nextstep: @@ -329,6 +365,28 @@ done: 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" nsresult nsDocFactoryImpl::InitUAStyleSheet() @@ -803,14 +861,7 @@ nsresult nsDocumentBindInfo::Bind(const nsString& aURLSpec, * end nsIContentViewerContainer for refreshing urls. */ if (m_Container) { - nsISupports* container = nsnull; - 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; + rv = NS_NewURL(&m_Url, aURLSpec, m_Container); if (NS_OK != rv) { return rv; }