diff --git a/content/html/document/src/Makefile.in b/content/html/document/src/Makefile.in index 958405103842..322720604888 100644 --- a/content/html/document/src/Makefile.in +++ b/content/html/document/src/Makefile.in @@ -71,6 +71,7 @@ REQUIRES = xpcom \ xpconnect \ unicharutil \ commandhandler \ + mimetype \ composer \ editor \ plugin \ diff --git a/content/html/document/src/nsVideoDocument.cpp b/content/html/document/src/nsVideoDocument.cpp index 5e5de0100f74..fc5a6f2251af 100644 --- a/content/html/document/src/nsVideoDocument.cpp +++ b/content/html/document/src/nsVideoDocument.cpp @@ -40,6 +40,8 @@ #include "nsNodeInfoManager.h" #include "nsContentCreatorFunctions.h" #include "nsHTMLMediaElement.h" +#include "nsIMIMEService.h" +#include "nsIMIMEInfo.h" class nsVideoDocument : public nsMediaDocument { @@ -53,6 +55,10 @@ public: nsIContentSink* aSink = nsnull); protected: + + // Sets document to reflect the file name and description. + void UpdateTitle(nsIChannel* aChannel); + nsresult CreateSyntheticVideoDocument(nsIChannel* aChannel, nsIStreamListener** aListener); @@ -111,14 +117,48 @@ nsVideoDocument::CreateSyntheticVideoDocument(nsIChannel* aChannel, static_cast<nsHTMLMediaElement*>(NS_NewHTMLVideoElement(nodeInfo, PR_FALSE)); if (!element) return NS_ERROR_OUT_OF_MEMORY; - element->SetAutoplay(PR_TRUE); element->SetControls(PR_TRUE); element->LoadWithChannel(aChannel, aListener); - + UpdateTitle(aChannel); return body->AppendChildTo(element, PR_FALSE); } +void +nsVideoDocument::UpdateTitle(nsIChannel* aChannel) +{ + if (!aChannel) + return; + + nsCOMPtr<nsIMIMEService> mimeService(do_GetService("@mozilla.org/mime;1")); + if (!mimeService) + return; + + nsCAutoString contentType; + if (NS_FAILED(aChannel->GetContentType(contentType))) + return; + + nsCOMPtr<nsIMIMEInfo> mimeInfo; + mimeService->GetFromTypeAndExtension(contentType, + EmptyCString(), + getter_AddRefs(mimeInfo)); + nsAutoString description; + mimeInfo->GetDescription(description); + + static const char* const formatNames[4] = { + "VideoFileNameWithTypeAndDimensions", + "VideoFileNameWithType", + "VideoFileNameWithDimensions", + "VideoFileNameWithNeitherDimensionsNorFile", + }; + nsXPIDLString status; + nsMediaDocument::UpdateTitleAndCharset(NS_ConvertUTF16toUTF8(description), + formatNames, + 0, + 0, + status); +} + nsresult NS_NewVideoDocument(nsIDocument** aResult) { diff --git a/content/media/video/test/320x240.ogg b/content/media/video/test/320x240.ogv similarity index 100% rename from content/media/video/test/320x240.ogg rename to content/media/video/test/320x240.ogv diff --git a/content/media/video/test/Makefile.in b/content/media/video/test/Makefile.in index 1dd05e54790f..e995c3cabba7 100644 --- a/content/media/video/test/Makefile.in +++ b/content/media/video/test/Makefile.in @@ -79,9 +79,10 @@ _TEST_FILES += \ test_timeupdate1.html \ test_timeupdate2.html \ test_timeupdate3.html \ - 320x240.ogg \ + test_videoDocumentTitle.html \ + 320x240.ogv \ bug461281.ogg \ - seek.ogg \ + seek.ogv \ $(NULL) else _TEST_FILES += \ @@ -91,6 +92,7 @@ endif ifdef MOZ_WAVE _TEST_FILES += \ + test_audioDocumentTitle.html \ big.wav \ test_bug463162.xhtml \ test_can_play_type_wave.html \ diff --git a/content/media/video/test/seek.ogg b/content/media/video/test/seek.ogv similarity index 100% rename from content/media/video/test/seek.ogg rename to content/media/video/test/seek.ogv diff --git a/content/media/video/test/test_audioDocumentTitle.html b/content/media/video/test/test_audioDocumentTitle.html new file mode 100644 index 000000000000..bfd265ec005d --- /dev/null +++ b/content/media/video/test/test_audioDocumentTitle.html @@ -0,0 +1,53 @@ +<!DOCTYPE HTML> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=463830 +--> +<head> + <title>Test for Bug 463830 + + + + + +Mozilla Bug 463830 +

+ +
+
+
+ + diff --git a/content/media/video/test/test_bug448534.html b/content/media/video/test/test_bug448534.html index 003783ceb719..dea2a3d7b540 100644 --- a/content/media/video/test/test_bug448534.html +++ b/content/media/video/test/test_bug448534.html @@ -14,7 +14,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=448534 Mozilla Bug 448534 diff --git a/content/media/video/test/test_decoder_disable.html b/content/media/video/test/test_decoder_disable.html index 1f2b65b5c037..cff3f85b3cd3 100644 --- a/content/media/video/test/test_decoder_disable.html +++ b/content/media/video/test/test_decoder_disable.html @@ -31,11 +31,11 @@ branch.setBoolPref("wave.enabled", false); - + + + + + +Mozilla Bug 463830 +

+ +
+
+
+ + diff --git a/dom/locales/en-US/chrome/layout/MediaDocument.properties b/dom/locales/en-US/chrome/layout/MediaDocument.properties index d163d01edba1..1532d5d833ca 100644 --- a/dom/locales/en-US/chrome/layout/MediaDocument.properties +++ b/dom/locales/en-US/chrome/layout/MediaDocument.properties @@ -41,12 +41,23 @@ #LOCALIZATION NOTE (ImageTitleWithoutDimensions): first %S is filename, second %S is type #LOCALIZATION NOTE (ImageTitleWithDimensions): first %S is type, second %S is width and third %S is height #LOCALIZATION NOTE (ImageTitleWithNeitherDimensionsNorFile): first %S is type +#LOCALIZATION NOTE (VideoFileNameWithTypeAndDimensions): first %S is filename, seond %S is type, third %S is width, fourth %S is height. +#LOCALIZATION NOTE (VideoFileNameWithType): first %S is filename, second %S is type +#LOCALIZATION NOTE (VideoFileNameWithDimensions): first %S is filename, seond $S is width, third %S is height +#LOCALIZATION NOTE (VideoFileNameWithNeitherDimensionsNorFile): first %S is filename. #LOCALIZATION NOTE (MediaTitleWithFile): first %S is filename, second %S is type #LOCALIZATION NOTE (MediaTitleWithNoInfo): first %S is type + ImageTitleWithDimensionsAndFile=%S (%S Image, %Sx%S pixels) ImageTitleWithoutDimensions=%S (%S Image) ImageTitleWithDimensions=(%S Image, %Sx%S pixels) ImageTitleWithNeitherDimensionsNorFile=(%S Image) + +VideoFileNameWithTypeAndDimensions=%S (%S, %Sx%S pixels) +VideoFileNameWithType=%S (%S) +VideoFileNameWithDimensions=%S (%Sx%S pixels) +VideoFileNameWithNeitherDimensionsNorFile=%S + MediaTitleWithFile=%S (%S Object) MediaTitleWithNoInfo=(%S Object) diff --git a/netwerk/mime/public/nsMimeTypes.h b/netwerk/mime/public/nsMimeTypes.h index c957c5ba0579..de3a9cba3688 100644 --- a/netwerk/mime/public/nsMimeTypes.h +++ b/netwerk/mime/public/nsMimeTypes.h @@ -96,6 +96,8 @@ #define APPLICATION_XPINSTALL "application/x-xpinstall" #define AUDIO_BASIC "audio/basic" +#define AUDIO_OGG "audio/ogg" +#define AUDIO_WAV "audio/x-wav" #define IMAGE_GIF "image/gif" #define IMAGE_JPG "image/jpeg" @@ -143,6 +145,7 @@ #define TEXT_XUL "application/vnd.mozilla.xul+xml" #define VIDEO_MPEG "video/mpeg" +#define VIDEO_OGG "video/ogg" /* x-uuencode-apple-single. QuickMail made me do this. */ #define UUENCODE_APPLE_SINGLE "x-uuencode-apple-single" diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp index fe595937039a..8268f4a2ed67 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.cpp +++ b/uriloader/exthandler/nsExternalHelperAppService.cpp @@ -538,10 +538,10 @@ static nsExtraMimeTypeEntry extraMimeEntries [] = { TEXT_XUL, "xul", "XML-Based User Interface Language", MAC_TYPE('TEXT'), MAC_TYPE('ttxt') }, { TEXT_XML, "xml,xsl,xbl", "Extensible Markup Language", MAC_TYPE('TEXT'), MAC_TYPE('ttxt') }, { TEXT_CSS, "css", "Style Sheet", MAC_TYPE('TEXT'), MAC_TYPE('ttxt') }, - { "audio/ogg", "oga", "Ogg Audio", 0, 0 }, - { "video/ogg", "ogv", "Ogg Video", 0, 0 }, - { "audio/ogg", "ogg", "Ogg Audio", 0, 0 }, - { "audio/x-wav", "wav", "Waveform Audio", 0, 0 } + { AUDIO_OGG, "oga", "Ogg Audio", 0, 0 }, + { VIDEO_OGG, "ogv", "Ogg Video", 0, 0 }, + { VIDEO_OGG, "ogg", "Ogg Video", 0, 0 }, + { AUDIO_WAV, "wav", "Waveform Audio", 0, 0 } }; #undef MAC_TYPE