Plugins should be scriptable

VERIFIED FIXED

Status

()

Core
Plug-ins
P3
normal
VERIFIED FIXED
18 years ago
18 years ago

People

(Reporter: Patrick C. Beard, Assigned: Mike McCabe)

Tracking

({arch})

Trunk
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

18 years ago
We should define an interface that can be used by plugins to advertise their
scriptable interfaces. Here's a first cut at such an interface. I think a plugin
should be able to provide more than one scriptable interface, so this interface
permits simple enumeration.

class nsIScriptableInterfaces : public nsISupports {
public:
  /**
   * Returns number of scriptable interfaces this plugin supports.
   */
  NS_IMETHOD GetInterfaceCount(PRUInt32* aCount) = 0;

  /**
   * Returns the IID of the Nth scriptable interface.
   */
  NS_IMETHOD GetIID(PRUInt32 aIndex, nsIID* aIID) = 0;

  /**
   * Returns the object that implements the interface of the specified IID.
   */
  NS_IMETHOD GetScriptableObject(nsIID* aIID, void* *aResult) = 0;
};
Is this a DUP of FIXED bug 32150, "Scriptable Plugin methods/members need to be 
accessable from JavaScript"? 

Or is it related to bug 38495, "need to support JS LiveConnect calls in existing 
content via upgraded plug-in binaries"?

Or is this bug really focused on the enhancement of enabling more than one 
scriptable interface?

Updated

18 years ago
Keywords: arch
(Assignee)

Comment 2

18 years ago
Nope, it's part of our proposed solution to making plugins scriptable from
javascript via the existing api.

Patrick: I just noticed that this interface supports returning multiple IIDs...
XPConnect doesn't currently support exposing an object with multiple
(superimposed) interfaces, so we won't be able to reflect multiple plugins on
interfaces.  We may be able to support it in the future.  Is it OK to use this
interface, with the caveat that we'll only reflect the first interface for a
while?
(Assignee)

Comment 3

18 years ago
I have plugins ready to be scriptable, I'm just missing this interface.  (The QI
can fail, but I need an interface to QI against.)

Patrick - This interface seems to allow returning different scriptable objects
for each IID needed.  If we were to support merging these interfaces in
XPConnect, would that mean supporting aggregation?  Flattening is in the future,
but I'm not sure that it means this; I'd imagined multiple interfaces on the
same object.  Or maybe aggregation is just easy and we should anticipate it.

Hm.

Would it make sense to dropthe nsIID* aIID parameter?
(Assignee)

Comment 4

18 years ago
My proposal -
[scriptable, uuid(c1188f50-1dd1-11b2-a4eb-cbb32e611eec)]
interface nsIScriptablePlugin : nsISupports
{
    readonly attribute PRUint32 interfaceCount;
    nsIIDPtr getIID(in PRUint32 aIndex);
    nsISupports getScriptableObject();
};
(Reporter)

Comment 5

18 years ago
Here's another stab at an "introspection" interface.

I think we should separate the notion of what interfaces a plugin supports from 
providing the object that is in fact scriptable itself. Thus, a plugin could 
provide an accessor method that returns an nsISupports. This object would be 
queried to ask it what interfaces it supports. Here's a simple interface for 
doing that:

interface nsIInterfaceCollection : nsISupports {
  /**
   * Returns array of valid interfaces that this object's class implements.
   */
  void getInterfaces(out PRUint32 count,
                     [retval, array, size_is(count)]
                     out nsIIDPtr interfaces);
};
(Reporter)

Comment 6

18 years ago
Perhaps the interfaces result could be marked "shared" so it can live in 
statically allocated memory.
(Assignee)

Comment 7

18 years ago
Reassigning to myself.
Assignee: av → mccabe
(Assignee)

Updated

18 years ago
Blocks: 32150
(Assignee)

Comment 8

18 years ago
Vidur pointed out that we really don't have any call for plugins to support
multiple scriptable interfaces at this time.  I'd also rather move forward with
this than try to finalize a general mechanism to fix this very specific problem.
Attaching what I hope to be the final revision of nsIScriptablePlugin.idl.  r=
and a= requested.
(Assignee)

Comment 9

18 years ago
Created attachment 9921 [details] [diff] [review]
interface for getting scriptable interface and peer
(Assignee)

Updated

18 years ago
Blocks: 38495
(Reporter)

Comment 10

18 years ago
Fine. Let's file another bug to at least table the more general solution.
(Assignee)

Comment 11

18 years ago
Created attachment 10029 [details]
changed nsISupports attribute to nsQIResult
(Assignee)

Comment 12

18 years ago
Fix checked in; thanks to Patrick for mac IDL project assistance.
Status: NEW → RESOLVED
Last Resolved: 18 years ago
Resolution: --- → FIXED

Comment 13

18 years ago
marking verified.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.