dom/plugins/ipc/PluginScriptableObjectParent.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
michael@0 2 * vim: sw=2 ts=2 et :
michael@0 3 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #ifndef dom_plugins_PluginScriptableObjectParent_h
michael@0 8 #define dom_plugins_PluginScriptableObjectParent_h 1
michael@0 9
michael@0 10 #include "mozilla/plugins/PPluginScriptableObjectParent.h"
michael@0 11 #include "mozilla/plugins/PluginMessageUtils.h"
michael@0 12
michael@0 13 #include "npfunctions.h"
michael@0 14 #include "npruntime.h"
michael@0 15
michael@0 16 namespace mozilla {
michael@0 17 namespace plugins {
michael@0 18
michael@0 19 class PluginInstanceParent;
michael@0 20 class PluginScriptableObjectParent;
michael@0 21 class PPluginIdentifierParent;
michael@0 22
michael@0 23 struct ParentNPObject : NPObject
michael@0 24 {
michael@0 25 ParentNPObject()
michael@0 26 : NPObject(), parent(nullptr), invalidated(false) { }
michael@0 27
michael@0 28 // |parent| is always valid as long as the actor is alive. Once the actor is
michael@0 29 // destroyed this will be set to null.
michael@0 30 PluginScriptableObjectParent* parent;
michael@0 31 bool invalidated;
michael@0 32 };
michael@0 33
michael@0 34 class PluginScriptableObjectParent : public PPluginScriptableObjectParent
michael@0 35 {
michael@0 36 friend class PluginInstanceParent;
michael@0 37
michael@0 38 public:
michael@0 39 PluginScriptableObjectParent(ScriptableObjectType aType);
michael@0 40 virtual ~PluginScriptableObjectParent();
michael@0 41
michael@0 42 void
michael@0 43 InitializeProxy();
michael@0 44
michael@0 45 void
michael@0 46 InitializeLocal(NPObject* aObject);
michael@0 47
michael@0 48 virtual bool
michael@0 49 AnswerHasMethod(PPluginIdentifierParent* aId,
michael@0 50 bool* aHasMethod) MOZ_OVERRIDE;
michael@0 51
michael@0 52 virtual bool
michael@0 53 AnswerInvoke(PPluginIdentifierParent* aId,
michael@0 54 const InfallibleTArray<Variant>& aArgs,
michael@0 55 Variant* aResult,
michael@0 56 bool* aSuccess) MOZ_OVERRIDE;
michael@0 57
michael@0 58 virtual bool
michael@0 59 AnswerInvokeDefault(const InfallibleTArray<Variant>& aArgs,
michael@0 60 Variant* aResult,
michael@0 61 bool* aSuccess) MOZ_OVERRIDE;
michael@0 62
michael@0 63 virtual bool
michael@0 64 AnswerHasProperty(PPluginIdentifierParent* aId,
michael@0 65 bool* aHasProperty) MOZ_OVERRIDE;
michael@0 66
michael@0 67 virtual bool
michael@0 68 AnswerGetParentProperty(PPluginIdentifierParent* aId,
michael@0 69 Variant* aResult,
michael@0 70 bool* aSuccess) MOZ_OVERRIDE;
michael@0 71
michael@0 72 virtual bool
michael@0 73 AnswerSetProperty(PPluginIdentifierParent* aId,
michael@0 74 const Variant& aValue,
michael@0 75 bool* aSuccess) MOZ_OVERRIDE;
michael@0 76
michael@0 77 virtual bool
michael@0 78 AnswerRemoveProperty(PPluginIdentifierParent* aId,
michael@0 79 bool* aSuccess) MOZ_OVERRIDE;
michael@0 80
michael@0 81 virtual bool
michael@0 82 AnswerEnumerate(InfallibleTArray<PPluginIdentifierParent*>* aProperties,
michael@0 83 bool* aSuccess) MOZ_OVERRIDE;
michael@0 84
michael@0 85 virtual bool
michael@0 86 AnswerConstruct(const InfallibleTArray<Variant>& aArgs,
michael@0 87 Variant* aResult,
michael@0 88 bool* aSuccess) MOZ_OVERRIDE;
michael@0 89
michael@0 90 virtual bool
michael@0 91 AnswerNPN_Evaluate(const nsCString& aScript,
michael@0 92 Variant* aResult,
michael@0 93 bool* aSuccess) MOZ_OVERRIDE;
michael@0 94
michael@0 95 virtual bool
michael@0 96 RecvProtect() MOZ_OVERRIDE;
michael@0 97
michael@0 98 virtual bool
michael@0 99 RecvUnprotect() MOZ_OVERRIDE;
michael@0 100
michael@0 101 static const NPClass*
michael@0 102 GetClass()
michael@0 103 {
michael@0 104 return &sNPClass;
michael@0 105 }
michael@0 106
michael@0 107 PluginInstanceParent*
michael@0 108 GetInstance() const
michael@0 109 {
michael@0 110 return mInstance;
michael@0 111 }
michael@0 112
michael@0 113 NPObject*
michael@0 114 GetObject(bool aCanResurrect);
michael@0 115
michael@0 116 // Protect only affects LocalObject actors. It is called by the
michael@0 117 // ProtectedVariant/Actor helper classes before the actor is used as an
michael@0 118 // argument to an IPC call and when the child process resurrects a
michael@0 119 // proxy object to the NPObject associated with this actor.
michael@0 120 void Protect();
michael@0 121
michael@0 122 // Unprotect only affects LocalObject actors. It is called by the
michael@0 123 // ProtectedVariant/Actor helper classes after the actor is used as an
michael@0 124 // argument to an IPC call and when the child process is no longer using this
michael@0 125 // actor.
michael@0 126 void Unprotect();
michael@0 127
michael@0 128 // DropNPObject is only used for Proxy actors and is called when the parent
michael@0 129 // process is no longer using the NPObject associated with this actor. The
michael@0 130 // child process may subsequently use this actor again in which case a new
michael@0 131 // NPObject will be created and associated with this actor (see
michael@0 132 // ResurrectProxyObject).
michael@0 133 void DropNPObject();
michael@0 134
michael@0 135 ScriptableObjectType
michael@0 136 Type() const {
michael@0 137 return mType;
michael@0 138 }
michael@0 139
michael@0 140 bool GetPropertyHelper(NPIdentifier aName,
michael@0 141 bool* aHasProperty,
michael@0 142 bool* aHasMethod,
michael@0 143 NPVariant* aResult);
michael@0 144
michael@0 145 private:
michael@0 146 static NPObject*
michael@0 147 ScriptableAllocate(NPP aInstance,
michael@0 148 NPClass* aClass);
michael@0 149
michael@0 150 static void
michael@0 151 ScriptableInvalidate(NPObject* aObject);
michael@0 152
michael@0 153 static void
michael@0 154 ScriptableDeallocate(NPObject* aObject);
michael@0 155
michael@0 156 static bool
michael@0 157 ScriptableHasMethod(NPObject* aObject,
michael@0 158 NPIdentifier aName);
michael@0 159
michael@0 160 static bool
michael@0 161 ScriptableInvoke(NPObject* aObject,
michael@0 162 NPIdentifier aName,
michael@0 163 const NPVariant* aArgs,
michael@0 164 uint32_t aArgCount,
michael@0 165 NPVariant* aResult);
michael@0 166
michael@0 167 static bool
michael@0 168 ScriptableInvokeDefault(NPObject* aObject,
michael@0 169 const NPVariant* aArgs,
michael@0 170 uint32_t aArgCount,
michael@0 171 NPVariant* aResult);
michael@0 172
michael@0 173 static bool
michael@0 174 ScriptableHasProperty(NPObject* aObject,
michael@0 175 NPIdentifier aName);
michael@0 176
michael@0 177 static bool
michael@0 178 ScriptableGetProperty(NPObject* aObject,
michael@0 179 NPIdentifier aName,
michael@0 180 NPVariant* aResult);
michael@0 181
michael@0 182 static bool
michael@0 183 ScriptableSetProperty(NPObject* aObject,
michael@0 184 NPIdentifier aName,
michael@0 185 const NPVariant* aValue);
michael@0 186
michael@0 187 static bool
michael@0 188 ScriptableRemoveProperty(NPObject* aObject,
michael@0 189 NPIdentifier aName);
michael@0 190
michael@0 191 static bool
michael@0 192 ScriptableEnumerate(NPObject* aObject,
michael@0 193 NPIdentifier** aIdentifiers,
michael@0 194 uint32_t* aCount);
michael@0 195
michael@0 196 static bool
michael@0 197 ScriptableConstruct(NPObject* aObject,
michael@0 198 const NPVariant* aArgs,
michael@0 199 uint32_t aArgCount,
michael@0 200 NPVariant* aResult);
michael@0 201
michael@0 202 NPObject*
michael@0 203 CreateProxyObject();
michael@0 204
michael@0 205 // ResurrectProxyObject is only used with Proxy actors. It is called when the
michael@0 206 // child process uses an actor whose NPObject was deleted by the parent
michael@0 207 // process.
michael@0 208 bool ResurrectProxyObject();
michael@0 209
michael@0 210 private:
michael@0 211 PluginInstanceParent* mInstance;
michael@0 212
michael@0 213 // This may be a ParentNPObject or some other kind depending on who created
michael@0 214 // it. Have to check its class to find out.
michael@0 215 NPObject* mObject;
michael@0 216 int mProtectCount;
michael@0 217
michael@0 218 ScriptableObjectType mType;
michael@0 219
michael@0 220 static const NPClass sNPClass;
michael@0 221 };
michael@0 222
michael@0 223 } /* namespace plugins */
michael@0 224 } /* namespace mozilla */
michael@0 225
michael@0 226 #endif /* dom_plugins_PluginScriptableObjectParent_h */

mercurial