dom/plugins/base/nsJSNPRuntime.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: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef nsJSNPRuntime_h_
michael@0 7 #define nsJSNPRuntime_h_
michael@0 8
michael@0 9 #include "nscore.h"
michael@0 10 #include "npapi.h"
michael@0 11 #include "npruntime.h"
michael@0 12 #include "pldhash.h"
michael@0 13
michael@0 14 class nsJSNPRuntime
michael@0 15 {
michael@0 16 public:
michael@0 17 static void OnPluginDestroy(NPP npp);
michael@0 18 };
michael@0 19
michael@0 20 class nsJSObjWrapperKey
michael@0 21 {
michael@0 22 public:
michael@0 23 nsJSObjWrapperKey(JSObject *obj, NPP npp)
michael@0 24 : mJSObj(obj), mNpp(npp)
michael@0 25 {
michael@0 26 }
michael@0 27
michael@0 28 bool operator==(const nsJSObjWrapperKey& other) const {
michael@0 29 return mJSObj == other.mJSObj && mNpp == other.mNpp;
michael@0 30 }
michael@0 31 bool operator!=(const nsJSObjWrapperKey& other) const {
michael@0 32 return !(*this == other);
michael@0 33 }
michael@0 34
michael@0 35 JSObject * mJSObj;
michael@0 36 const NPP mNpp;
michael@0 37 };
michael@0 38
michael@0 39 extern const JSClass sNPObjectJSWrapperClass;
michael@0 40
michael@0 41 class nsJSObjWrapper : public NPObject
michael@0 42 {
michael@0 43 public:
michael@0 44 JS::PersistentRooted<JSObject *> mJSObj;
michael@0 45 const NPP mNpp;
michael@0 46
michael@0 47 static NPObject *GetNewOrUsed(NPP npp, JSContext *cx,
michael@0 48 JS::Handle<JSObject*> obj);
michael@0 49
michael@0 50 protected:
michael@0 51 nsJSObjWrapper(NPP npp);
michael@0 52 ~nsJSObjWrapper();
michael@0 53
michael@0 54 static NPObject * NP_Allocate(NPP npp, NPClass *aClass);
michael@0 55 static void NP_Deallocate(NPObject *obj);
michael@0 56 static void NP_Invalidate(NPObject *obj);
michael@0 57 static bool NP_HasMethod(NPObject *, NPIdentifier identifier);
michael@0 58 static bool NP_Invoke(NPObject *obj, NPIdentifier method,
michael@0 59 const NPVariant *args, uint32_t argCount,
michael@0 60 NPVariant *result);
michael@0 61 static bool NP_InvokeDefault(NPObject *obj, const NPVariant *args,
michael@0 62 uint32_t argCount, NPVariant *result);
michael@0 63 static bool NP_HasProperty(NPObject * obj, NPIdentifier property);
michael@0 64 static bool NP_GetProperty(NPObject *obj, NPIdentifier property,
michael@0 65 NPVariant *result);
michael@0 66 static bool NP_SetProperty(NPObject *obj, NPIdentifier property,
michael@0 67 const NPVariant *value);
michael@0 68 static bool NP_RemoveProperty(NPObject *obj, NPIdentifier property);
michael@0 69 static bool NP_Enumerate(NPObject *npobj, NPIdentifier **identifier,
michael@0 70 uint32_t *count);
michael@0 71 static bool NP_Construct(NPObject *obj, const NPVariant *args,
michael@0 72 uint32_t argCount, NPVariant *result);
michael@0 73
michael@0 74 public:
michael@0 75 static NPClass sJSObjWrapperNPClass;
michael@0 76 };
michael@0 77
michael@0 78 class nsNPObjWrapper
michael@0 79 {
michael@0 80 public:
michael@0 81 static void OnDestroy(NPObject *npobj);
michael@0 82 static JSObject *GetNewOrUsed(NPP npp, JSContext *cx, NPObject *npobj);
michael@0 83 };
michael@0 84
michael@0 85 bool
michael@0 86 JSValToNPVariant(NPP npp, JSContext *cx, JS::Value val, NPVariant *variant);
michael@0 87
michael@0 88
michael@0 89 #endif // nsJSNPRuntime_h_

mercurial