Bug 427744: List plugin file version number under about:plugins. r=josh, sr=jst
authorDave Townsend <dtownsend@oxymoronical.com>
Wed, 22 Apr 2009 12:13:10 -0700
changeset 27645 bc97423f1193eff7a97a0ae65c7e294f0343d58f
parent 27644 d691bf8ac0fa715410af7901e3a9ad0fcaf0e6f4
child 27646 d50609a6b63e0c5977f9c034bbebfe03015607eb
push idunknown
push userunknown
push dateunknown
reviewersjosh, jst
bugs427744
milestone1.9.2a1pre
Bug 427744: List plugin file version number under about:plugins. r=josh, sr=jst
dom/base/nsPluginArray.cpp
dom/interfaces/base/nsIDOMPlugin.idl
dom/locales/en-US/chrome/plugins.properties
dom/tests/mochitest/bugs/Makefile.in
dom/tests/mochitest/bugs/test_bug427744.html
modules/plugin/base/src/nsPluginHostImpl.cpp
toolkit/content/plugins.html
--- a/dom/base/nsPluginArray.cpp
+++ b/dom/base/nsPluginArray.cpp
@@ -316,16 +316,22 @@ nsPluginElement::GetDescription(nsAStrin
 
 NS_IMETHODIMP
 nsPluginElement::GetFilename(nsAString& aFilename)
 {
   return mPlugin->GetFilename(aFilename);
 }
 
 NS_IMETHODIMP
+nsPluginElement::GetVersion(nsAString& aVersion)
+{
+  return mPlugin->GetVersion(aVersion);
+}
+
+NS_IMETHODIMP
 nsPluginElement::GetName(nsAString& aName)
 {
   return mPlugin->GetName(aName);
 }
 
 NS_IMETHODIMP
 nsPluginElement::GetLength(PRUint32* aLength)
 {
--- a/dom/interfaces/base/nsIDOMPlugin.idl
+++ b/dom/interfaces/base/nsIDOMPlugin.idl
@@ -34,19 +34,20 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "domstubs.idl"
 
-[scriptable, uuid(f6134681-f28b-11d2-8360-c90899049c3c)]
+[scriptable, uuid(ff69a292-c74d-4ef5-9d0f-86112fff2d5b)]
 interface nsIDOMPlugin : nsISupports
 {
   readonly attribute DOMString        description;
   readonly attribute DOMString        filename;
+  readonly attribute DOMString        version;
   readonly attribute DOMString        name;
 
   readonly attribute unsigned long    length;
   nsIDOMMimeType            item(in unsigned long index);
   nsIDOMMimeType            namedItem(in DOMString name);
 };
--- a/dom/locales/en-US/chrome/plugins.properties
+++ b/dom/locales/en-US/chrome/plugins.properties
@@ -3,14 +3,15 @@
 #    have to be escaped in a way that they show up correctly in HTML!
 
 title_label=About Plugins
 installedplugins_label=Installed plugins
 nopluginsareinstalled_label=No plugins are installed
 findmore_label=Find more information about browser plugins at
 installhelp_label=Help for installing plugins is available from
 filename_label=File name:
+version_label=Version:
 mimetype_label=MIME Type
 description_label=Description
 suffixes_label=Suffixes
 enabled_label=Enabled
 yes_label=Yes
 no_label=No
--- a/dom/tests/mochitest/bugs/Makefile.in
+++ b/dom/tests/mochitest/bugs/Makefile.in
@@ -92,12 +92,13 @@ include $(topsrcdir)/config/rules.mk
 		test_bug437361.html \
 		test_bug458091.html \
 		bug458091_child.html \
 		test_bug459848.html \
 		test_bug463000.html \
 		iframe_bug463000.html \
 		test_bug465263.html \
 		test_bug479143.html \
+		test_bug427744.html \
 		$(NULL)
 
 libs:: 	$(_TEST_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
new file mode 100644
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug427744.html
@@ -0,0 +1,35 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=427744
+-->
+<head>
+  <title>Test for Bug 427744</title>
+  <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>        
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=427744">Mozilla Bug 427744</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+  
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 427744 **/
+
+var found = false;
+for (var i = 0; i < navigator.plugins.length; i++) {
+  if (navigator.plugins[i].name == "Test Plug-in") {
+    found = true;
+    is(navigator.plugins[i].version, "1.0.0.0", "Should have seen the right version");
+  }
+}
+ok(found, "Should have seen the test plugin");
+
+</script>
+</pre>
+</body>
+</html>
--- a/modules/plugin/base/src/nsPluginHostImpl.cpp
+++ b/modules/plugin/base/src/nsPluginHostImpl.cpp
@@ -4019,16 +4019,22 @@ public:
 
     nsCString leafName;
     nsCOMPtr<nsILocalFile> pluginPath;
     NS_NewLocalFile(spec, PR_TRUE, getter_AddRefs(pluginPath));
 
     return pluginPath->GetLeafName(aFilename);
   }
 
+  NS_METHOD GetVersion(nsAString& aVersion)
+  {
+    CopyUTF8toUTF16(mPluginTag.mVersion, aVersion);
+    return NS_OK;
+  }
+
   NS_METHOD GetName(nsAString& aName)
   {
     CopyUTF8toUTF16(mPluginTag.mName, aName);
     return NS_OK;
   }
 
   NS_METHOD GetLength(PRUint32* aLength)
   {
--- a/toolkit/content/plugins.html
+++ b/toolkit/content/plugins.html
@@ -113,16 +113,18 @@
     if (plugin)
     {
       document.write("<h2 class=\"plugname\">");
       document.write(plugin.name);
       document.writeln("<\/h2>");
 
       document.writeln("<dl><dd><span class=\"label\">" + pluginsbundle.GetStringFromName("filename_label") + "<\/span> ");
       document.write(plugin.filename);
+      document.writeln("<\/dd><dd><span class=\"label\">" + pluginsbundle.GetStringFromName("version_label") + "<\/span> ");
+      document.write(plugin.version);
       document.writeln("<\/dd><dd>");
       document.write(plugin.description);
       document.writeln("<\/dd><\/dl>");
 
       document.writeln("<table border=\"1\" class=\"contenttable\">");
       document.writeln("<thead>");
       document.writeln("<tr><th class=\"type\">" + pluginsbundle.GetStringFromName("mimetype_label") + "<\/th>");
       document.writeln("<th class=\"desc\">" + pluginsbundle.GetStringFromName("description_label") + "<\/th>");