dom/plugins/ipc/PPluginScriptableObject.ipdl

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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/. */
     6 include protocol PPluginInstance;
     7 include protocol PPluginIdentifier;
     9 using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
    10 using struct mozilla::null_t from "ipc/IPCMessageUtils.h";
    12 namespace mozilla {
    13 namespace plugins {
    15 union Variant {
    16   void_t;
    17   null_t;
    18   bool;
    19   int;
    20   double;
    21   nsCString;
    22   nullable PPluginScriptableObject;
    23 };
    25 intr protocol PPluginScriptableObject
    26 {
    27   manager PPluginInstance;
    29 both:
    30   async __delete__();
    32 parent:
    33   intr NPN_Evaluate(nsCString aScript)
    34     returns (Variant aResult,
    35              bool aSuccess);
    37 child:
    38   intr Invalidate();
    40 both:
    41   // NPClass methods
    42   intr HasMethod(PPluginIdentifier aId)
    43     returns (bool aHasMethod);
    45   intr Invoke(PPluginIdentifier aId,
    46              Variant[] aArgs)
    47     returns (Variant aResult,
    48              bool aSuccess);
    50   intr InvokeDefault(Variant[] aArgs)
    51     returns (Variant aResult,
    52              bool aSuccess);
    54   intr HasProperty(PPluginIdentifier aId)
    55     returns (bool aHasProperty);
    57   intr SetProperty(PPluginIdentifier aId,
    58                   Variant aValue)
    59     returns (bool aSuccess);
    61   intr RemoveProperty(PPluginIdentifier aId)
    62     returns (bool aSuccess);
    64   intr Enumerate()
    65     returns (PPluginIdentifier[] aProperties,
    66              bool aSuccess);
    68   intr Construct(Variant[] aArgs)
    69     returns (Variant aResult,
    70              bool aSuccess);
    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();
    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    */
    88 parent:
    89   intr GetParentProperty(PPluginIdentifier aId)
    90     returns (Variant aResult,
    91              bool aSuccess);
    93 child:
    94   intr GetChildProperty(PPluginIdentifier aId)
    95     returns (bool aHasProperty,
    96              bool aHasMethod,
    97              Variant aResult,
    98              bool aSuccess);
    99 };
   101 } // namespace plugins
   102 } // namespace mozilla

mercurial