1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/plugins/ipc/PPluginScriptableObject.ipdl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,102 @@ 1.4 +/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +include protocol PPluginInstance; 1.10 +include protocol PPluginIdentifier; 1.11 + 1.12 +using struct mozilla::void_t from "ipc/IPCMessageUtils.h"; 1.13 +using struct mozilla::null_t from "ipc/IPCMessageUtils.h"; 1.14 + 1.15 +namespace mozilla { 1.16 +namespace plugins { 1.17 + 1.18 +union Variant { 1.19 + void_t; 1.20 + null_t; 1.21 + bool; 1.22 + int; 1.23 + double; 1.24 + nsCString; 1.25 + nullable PPluginScriptableObject; 1.26 +}; 1.27 + 1.28 +intr protocol PPluginScriptableObject 1.29 +{ 1.30 + manager PPluginInstance; 1.31 + 1.32 +both: 1.33 + async __delete__(); 1.34 + 1.35 +parent: 1.36 + intr NPN_Evaluate(nsCString aScript) 1.37 + returns (Variant aResult, 1.38 + bool aSuccess); 1.39 + 1.40 +child: 1.41 + intr Invalidate(); 1.42 + 1.43 +both: 1.44 + // NPClass methods 1.45 + intr HasMethod(PPluginIdentifier aId) 1.46 + returns (bool aHasMethod); 1.47 + 1.48 + intr Invoke(PPluginIdentifier aId, 1.49 + Variant[] aArgs) 1.50 + returns (Variant aResult, 1.51 + bool aSuccess); 1.52 + 1.53 + intr InvokeDefault(Variant[] aArgs) 1.54 + returns (Variant aResult, 1.55 + bool aSuccess); 1.56 + 1.57 + intr HasProperty(PPluginIdentifier aId) 1.58 + returns (bool aHasProperty); 1.59 + 1.60 + intr SetProperty(PPluginIdentifier aId, 1.61 + Variant aValue) 1.62 + returns (bool aSuccess); 1.63 + 1.64 + intr RemoveProperty(PPluginIdentifier aId) 1.65 + returns (bool aSuccess); 1.66 + 1.67 + intr Enumerate() 1.68 + returns (PPluginIdentifier[] aProperties, 1.69 + bool aSuccess); 1.70 + 1.71 + intr Construct(Variant[] aArgs) 1.72 + returns (Variant aResult, 1.73 + bool aSuccess); 1.74 + 1.75 + // Objects are initially unprotected, and the Protect and Unprotect functions 1.76 + // only affect protocol objects that represent NPObjects created in the same 1.77 + // process (rather than protocol objects that are a proxy for an NPObject 1.78 + // created in another process). Protocol objects representing local NPObjects 1.79 + // are protected after an NPObject has been associated with the protocol 1.80 + // object. Sending the protocol object as an argument to the other process 1.81 + // temporarily protects the protocol object again for the duration of the call. 1.82 + async Protect(); 1.83 + async Unprotect(); 1.84 + 1.85 + /** 1.86 + * GetProperty is slightly wonky due to the way we support NPObjects that have 1.87 + * methods and properties with the same name. When child calls parent we 1.88 + * simply return a property. When parent calls child, however, we need to do 1.89 + * several checks at once and return all the results simultaneously. 1.90 + */ 1.91 +parent: 1.92 + intr GetParentProperty(PPluginIdentifier aId) 1.93 + returns (Variant aResult, 1.94 + bool aSuccess); 1.95 + 1.96 +child: 1.97 + intr GetChildProperty(PPluginIdentifier aId) 1.98 + returns (bool aHasProperty, 1.99 + bool aHasMethod, 1.100 + Variant aResult, 1.101 + bool aSuccess); 1.102 +}; 1.103 + 1.104 +} // namespace plugins 1.105 +} // namespace mozilla