Closed Bug 552736 Opened 15 years ago Closed 15 years ago

Implement a plugins provider

Categories

(Toolkit :: Add-ons Manager, defect, P1)

defect

Tracking

()

VERIFIED FIXED
mozilla1.9.3a5

People

(Reporter: mossop, Assigned: mossop)

References

Details

(Whiteboard: [rewrite])

Attachments

(1 file, 1 obsolete file)

      No description provided.
Depends on: 552799
Should be litmus tests for using plugins from the add-ons manager already I think.
Flags: in-testsuite?
Flags: in-litmus?
First iteration of this landed in http://hg.mozilla.org/projects/addonsmgr/rev/ab1c52bb3ba6. Still needs work to support detecting when plugins are installed/uninstalled
Calling this fixed well enough for trunk purposes, filed bug 554780 to track the remaining pieces to be done later.
No longer depends on: 552799
Whiteboard: [rewrite] → [rewrite][fixed-in-addonsmgr][needs-review]
Attached patch patch rev 1 (obsolete) (deleted) β€” β€” Splinter Review
Implements the basic plugins provider.
Attachment #435797 - Flags: review?(robert.bugzilla)
Comment on attachment 435797 [details] [diff] [review]
patch rev 1

>diff --git a/toolkit/mozapps/extensions/PluginProvider.jsm b/toolkit/mozapps/extensions/PluginProvider.jsm
>...
>+# The Original Code is the Extension Manager.
>+#
>+# The Initial Developer of the Original Code is
>+# the Mozilla Foundation.
Yay! ;)

>...
>+var PluginProvider = {
>+  // A dictionary mapping IDs to names and descriptions
>+  plugins: null,
>+
>+  /**
>+   * Called to get an Addon with a particular ID.
>+   * @param   id
>+   *          The ID of the add-on to retrieve
>+   * @param   callback
>+   *          A callback to pass the Addon to
>+   */
>+  getAddon: function PL_getAddon(id, callback) {
See comment in bug 555942

>+    if (!this.plugins)
>+      this.buildPluginList();
>+
>+    if (id in this.plugins) {
>+      let name = this.plugins[id].name;
>+      let description = this.plugins[id].description;
>+
>+      let tags = Cc["@mozilla.org/plugin/host;1"].
>+                 getService(Ci.nsIPluginHost).
>+                 getPluginTags({});
>+      let selected = [];
>+      tags.forEach(function(tag) {
>+        if (tag.name == name && tag.description == description)
>+          selected.push(tag);
>+      }, this);
This could return multiple plugins whereas getAddon should only return a single add-on... unless I'm badly mistaken... wouldn't be the first time. :)
For example, on Windows I have multiple of
Name: QuickTime Plug-in 7.6.5
Description: The QuickTime Plugin allows you to view a wide variety of multimedia content in Web pages. For more information, visit the QuickTime Web site.
Version: Version: 7.6.5.0
The only things unique are the mimetypes and the file paths for this plugin.
Nevermind... spoke too soon
Comment on attachment 435797 [details] [diff] [review]
patch rev 1

This provider is pretty sweet.

>diff --git a/toolkit/mozapps/extensions/PluginProvider.jsm b/toolkit/mozapps/extensions/PluginProvider.jsm
>...
>+  this.uninstall = function() {
>+    throw new Error("Cannot uninstall plugins");
>+  };
>+
>+  this.cancelUninstall = function() {
>+    throw new Error("Cannot uninstall plugins");
>+  };
This seems wrong since it is throwing when asking to cancel an uninstall
For lwthemes you use "Item is not marked to be uninstalled"
Perhaps text without item in the text?


>diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_plugins.js b/toolkit/mozapps/extensions/test/xpcshell/test_plugins.js
>new file mode 100644
>--- /dev/null
>+++ b/toolkit/mozapps/extensions/test/xpcshell/test_plugins.js
>@@ -0,0 +1,132 @@
>+/* ***** BEGIN LICENSE BLOCK *****
>+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
>+ *
>+ * The contents of this file are subject to the Mozilla Public License Version
>+ * 1.1 (the "License"); you may not use this file except in compliance with
>+ * the License. You may obtain a copy of the License at
>+ * http://www.mozilla.org/MPL/
>+ *
>+ * Software distributed under the License is distributed on an "AS IS" basis,
>+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
>+ * for the specific language governing rights and limitations under the
>+ * License.
>+ *
>+ * The Original Code is mozilla.org code.
>+ *
>+ * The Initial Developer of the Original Code is
>+ * the Mozilla Foundation.
>+ *
>+ * Portions created by the Initial Developer are Copyright (C) 2010
>+ * the Initial Developer. All Rights Reserved.
>+ *
>+ * Contributor(s):
>+ *   Dave Townsend <dtownsend@oxymoronical.com>
>+ *
>+ * Alternatively, the contents of this file may be used under the terms of
>+ * either the GNU General Public License Version 2 or later (the "GPL"), or
>+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
>+ * in which case the provisions of the GPL or the LGPL are applicable instead
>+ * of those above. If you wish to allow use of your version of this file only
>+ * under the terms of either the GPL or the LGPL, and not to allow others to
>+ * use your version of this file under the terms of the MPL, indicate your
>+ * decision by deleting the provisions above and replace them with the notice
>+ * 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 *****
>+ */
Do you want to switch this to the creative commons license?
Attachment #435797 - Flags: review?(robert.bugzilla) → review+
Whiteboard: [rewrite][fixed-in-addonsmgr][needs-review] → [rewrite][fixed-in-addonsmgr]
Attached patch patch rev 2 (deleted) β€” β€” Splinter Review
Addressed comments, ready to land.
Attachment #435797 - Attachment is obsolete: true
Attachment #437074 - Flags: review+
Status: NEW → ASSIGNED
Flags: in-testsuite? → in-testsuite+
Whiteboard: [rewrite][fixed-in-addonsmgr] → [rewrite][fixed-in-addonsmgr][needs-landing]
http://hg.mozilla.org/mozilla-central/rev/3c8795f3e134
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Whiteboard: [rewrite][fixed-in-addonsmgr][needs-landing] → [rewrite]
Target Milestone: --- → mozilla1.9.3a5
Dave, which types of manual tests do we need here? Something like:

* Detection of installed plugins
* Enabling / Disabling plugins
* Detailed plugin information
(In reply to comment #10)
> Dave, which types of manual tests do we need here? Something like:
> 
> * Detection of installed plugins
> * Enabling / Disabling plugins
> * Detailed plugin information

Yes those sound good.
verified fixed by hg log
Status: RESOLVED → VERIFIED
Flags: in-litmus? → in-litmus?(vlad.maniac)
We have those manual tests already in Litmus. I will only have to update those.
Flags: in-litmus?(vlad.maniac) → in-litmus+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: