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(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 mimeService(do_GetService("@mozilla.org/mime;1"));
+ if (!mimeService)
+ return;
+
+ nsCAutoString contentType;
+ if (NS_FAILED(aChannel->GetContentType(contentType)))
+ return;
+
+ nsCOMPtr 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 @@
+
+
+
+
+ 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
+
+
+
+
+
+
+
+
+