1/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
2/* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6include protocol PPluginInstance;
7include PluginTypes;
8
9using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
10using struct mozilla::null_t from "ipc/IPCMessageUtils.h";
11
12namespace mozilla {
13namespace plugins {
14
15union Variant {
16  void_t;
17  null_t;
18  bool;
19  int;
20  double;
21  nsCString;
22  nullable PPluginScriptableObject;
23};
24
25intr protocol PPluginScriptableObject
26{
27  manager PPluginInstance;
28
29both:
30  async __delete__();
31
32parent:
33  intr NPN_Evaluate(nsCString aScript)
34    returns (Variant aResult,
35             bool aSuccess);
36
37child:
38  intr Invalidate();
39
40both:
41  // NPClass methods
42  intr HasMethod(PluginIdentifier aId)
43    returns (bool aHasMethod);
44
45  intr Invoke(PluginIdentifier aId,
46             Variant[] aArgs)
47    returns (Variant aResult,
48             bool aSuccess);
49
50  intr InvokeDefault(Variant[] aArgs)
51    returns (Variant aResult,
52             bool aSuccess);
53
54  intr HasProperty(PluginIdentifier aId)
55    returns (bool aHasProperty);
56
57  intr SetProperty(PluginIdentifier aId,
58                  Variant aValue)
59    returns (bool aSuccess);
60
61  intr RemoveProperty(PluginIdentifier aId)
62    returns (bool aSuccess);
63
64  intr Enumerate()
65    returns (PluginIdentifier[] aProperties,
66             bool aSuccess);
67
68  intr Construct(Variant[] aArgs)
69    returns (Variant aResult,
70             bool aSuccess);
71
72  // Objects are initially unprotected, and the Protect and Unprotect functions
73  // only affect protocol objects that represent NPObjects created in the same
74  // process (rather than protocol objects that are a proxy for an NPObject
75  // created in another process). Protocol objects representing local NPObjects
76  // are protected after an NPObject has been associated with the protocol
77  // object. Sending the protocol object as an argument to the other process
78  // temporarily protects the protocol object again for the duration of the call.
79  async Protect();
80  async Unprotect();
81
82  /**
83   * GetProperty is slightly wonky due to the way we support NPObjects that have
84   * methods and properties with the same name. When child calls parent we
85   * simply return a property. When parent calls child, however, we need to do
86   * several checks at once and return all the results simultaneously.
87   */
88parent:
89  intr GetParentProperty(PluginIdentifier aId)
90    returns (Variant aResult,
91             bool aSuccess);
92
93child:
94  intr GetChildProperty(PluginIdentifier aId)
95    returns (bool aHasProperty,
96             bool aHasMethod,
97             Variant aResult,
98             bool aSuccess);
99};
100
101} // namespace plugins
102} // namespace mozilla
103