js/xpconnect/idl/nsIXPCScriptable.idl

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: 4 -*-
michael@0 2 *
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 #include "nsISupports.idl"
michael@0 8 #include "nsIClassInfo.idl"
michael@0 9
michael@0 10 %{C++
michael@0 11 #ifdef XP_WIN
michael@0 12 #undef GetClassName
michael@0 13 #endif
michael@0 14
michael@0 15 #include "js/TypeDecls.h"
michael@0 16
michael@0 17 struct JSFreeOp;
michael@0 18 %}
michael@0 19
michael@0 20 interface nsIXPConnectWrappedNative;
michael@0 21
michael@0 22 [ptr] native JSContextPtr(JSContext);
michael@0 23 [ptr] native JSObjectPtr(JSObject);
michael@0 24 [ptr] native JSValPtr(JS::Value);
michael@0 25 [ptr] native JSFreeOpPtr(JSFreeOp);
michael@0 26 [ref] native JSCallArgsRef(const JS::CallArgs);
michael@0 27
michael@0 28 /**
michael@0 29 * Note: This is not really an XPCOM interface. For example, callers must
michael@0 30 * guarantee that they set the *_retval of the various methods that return a
michael@0 31 * boolean to PR_TRUE before making the call. Implementations may skip writing
michael@0 32 * to *_retval unless they want to return PR_FALSE.
michael@0 33 */
michael@0 34 [uuid(9bae4ff5-5618-4ccd-b106-8e21e3fb64d3)]
michael@0 35 interface nsIXPCScriptable : nsISupports
michael@0 36 {
michael@0 37 /* bitflags used for 'flags' (only 32 bits available!) */
michael@0 38
michael@0 39 const uint32_t WANT_PRECREATE = 1 << 0;
michael@0 40 const uint32_t WANT_CREATE = 1 << 1;
michael@0 41 const uint32_t WANT_POSTCREATE = 1 << 2;
michael@0 42 const uint32_t WANT_ADDPROPERTY = 1 << 3;
michael@0 43 const uint32_t WANT_DELPROPERTY = 1 << 4;
michael@0 44 const uint32_t WANT_GETPROPERTY = 1 << 5;
michael@0 45 const uint32_t WANT_SETPROPERTY = 1 << 6;
michael@0 46 const uint32_t WANT_ENUMERATE = 1 << 7;
michael@0 47 const uint32_t WANT_NEWENUMERATE = 1 << 8;
michael@0 48 const uint32_t WANT_NEWRESOLVE = 1 << 9;
michael@0 49 const uint32_t WANT_CONVERT = 1 << 10;
michael@0 50 const uint32_t WANT_FINALIZE = 1 << 11;
michael@0 51 // unused bit here!
michael@0 52 const uint32_t WANT_CALL = 1 << 13;
michael@0 53 const uint32_t WANT_CONSTRUCT = 1 << 14;
michael@0 54 const uint32_t WANT_HASINSTANCE = 1 << 15;
michael@0 55 // Unused bit here!
michael@0 56 const uint32_t USE_JSSTUB_FOR_ADDPROPERTY = 1 << 17;
michael@0 57 const uint32_t USE_JSSTUB_FOR_DELPROPERTY = 1 << 18;
michael@0 58 const uint32_t USE_JSSTUB_FOR_SETPROPERTY = 1 << 19;
michael@0 59 const uint32_t DONT_ENUM_STATIC_PROPS = 1 << 20;
michael@0 60 const uint32_t DONT_ENUM_QUERY_INTERFACE = 1 << 21;
michael@0 61 const uint32_t DONT_ASK_INSTANCE_FOR_SCRIPTABLE = 1 << 22;
michael@0 62 const uint32_t CLASSINFO_INTERFACES_ONLY = 1 << 23;
michael@0 63 const uint32_t ALLOW_PROP_MODS_DURING_RESOLVE = 1 << 24;
michael@0 64 const uint32_t ALLOW_PROP_MODS_TO_PROTOTYPE = 1 << 25;
michael@0 65 const uint32_t IS_GLOBAL_OBJECT = 1 << 26;
michael@0 66 const uint32_t DONT_REFLECT_INTERFACE_NAMES = 1 << 27;
michael@0 67 // Unused bit here!
michael@0 68 const uint32_t WANT_OUTER_OBJECT = 1 << 29;
michael@0 69
michael@0 70 // The high order bit is RESERVED for consumers of these flags.
michael@0 71 // No implementor of this interface should ever return flags
michael@0 72 // with this bit set.
michael@0 73 const uint32_t RESERVED = 1 << 31;
michael@0 74
michael@0 75 readonly attribute string className;
michael@0 76 [notxpcom,nostdcall] uint32_t getScriptableFlags();
michael@0 77
michael@0 78 void preCreate(in nsISupports nativeObj, in JSContextPtr cx,
michael@0 79 in JSObjectPtr globalObj, out JSObjectPtr parentObj);
michael@0 80
michael@0 81 void create(in nsIXPConnectWrappedNative wrapper,
michael@0 82 in JSContextPtr cx, in JSObjectPtr obj);
michael@0 83
michael@0 84 // Both methods here are protected by WANT_POSTCREATE. If you want to do
michael@0 85 // something after a wrapper is created, there's a good chance you also
michael@0 86 // want to do something when the wrapper is transplanted to a new
michael@0 87 // compartment.
michael@0 88 void postCreate(in nsIXPConnectWrappedNative wrapper,
michael@0 89 in JSContextPtr cx, in JSObjectPtr obj);
michael@0 90
michael@0 91 void postTransplant(in nsIXPConnectWrappedNative wrapper,
michael@0 92 in JSContextPtr cx, in JSObjectPtr obj);
michael@0 93
michael@0 94 boolean addProperty(in nsIXPConnectWrappedNative wrapper,
michael@0 95 in JSContextPtr cx, in JSObjectPtr obj, in jsid id,
michael@0 96 in JSValPtr vp);
michael@0 97
michael@0 98 boolean delProperty(in nsIXPConnectWrappedNative wrapper,
michael@0 99 in JSContextPtr cx, in JSObjectPtr obj, in jsid id);
michael@0 100
michael@0 101 // The returnCode should be set to NS_SUCCESS_I_DID_SOMETHING if
michael@0 102 // this method does something.
michael@0 103 boolean getProperty(in nsIXPConnectWrappedNative wrapper,
michael@0 104 in JSContextPtr cx, in JSObjectPtr obj, in jsid id,
michael@0 105 in JSValPtr vp);
michael@0 106
michael@0 107 // The returnCode should be set to NS_SUCCESS_I_DID_SOMETHING if
michael@0 108 // this method does something.
michael@0 109 boolean setProperty(in nsIXPConnectWrappedNative wrapper,
michael@0 110 in JSContextPtr cx, in JSObjectPtr obj, in jsid id,
michael@0 111 in JSValPtr vp);
michael@0 112
michael@0 113 boolean enumerate(in nsIXPConnectWrappedNative wrapper,
michael@0 114 in JSContextPtr cx, in JSObjectPtr obj);
michael@0 115
michael@0 116 boolean newEnumerate(in nsIXPConnectWrappedNative wrapper,
michael@0 117 in JSContextPtr cx, in JSObjectPtr obj,
michael@0 118 in uint32_t enum_op, in JSValPtr statep, out jsid idp);
michael@0 119
michael@0 120 boolean newResolve(in nsIXPConnectWrappedNative wrapper,
michael@0 121 in JSContextPtr cx, in JSObjectPtr obj, in jsid id,
michael@0 122 out JSObjectPtr objp);
michael@0 123
michael@0 124 boolean convert(in nsIXPConnectWrappedNative wrapper,
michael@0 125 in JSContextPtr cx, in JSObjectPtr obj,
michael@0 126 in uint32_t type, in JSValPtr vp);
michael@0 127
michael@0 128 void finalize(in nsIXPConnectWrappedNative wrapper,
michael@0 129 in JSFreeOpPtr fop, in JSObjectPtr obj);
michael@0 130
michael@0 131 boolean call(in nsIXPConnectWrappedNative wrapper,
michael@0 132 in JSContextPtr cx, in JSObjectPtr obj,
michael@0 133 in JSCallArgsRef args);
michael@0 134
michael@0 135 boolean construct(in nsIXPConnectWrappedNative wrapper,
michael@0 136 in JSContextPtr cx, in JSObjectPtr obj,
michael@0 137 in JSCallArgsRef args);
michael@0 138
michael@0 139 boolean hasInstance(in nsIXPConnectWrappedNative wrapper,
michael@0 140 in JSContextPtr cx, in JSObjectPtr obj,
michael@0 141 in jsval val, out boolean bp);
michael@0 142
michael@0 143 JSObjectPtr outerObject(in nsIXPConnectWrappedNative wrapper,
michael@0 144 in JSContextPtr cx, in JSObjectPtr obj);
michael@0 145
michael@0 146 void postCreatePrototype(in JSContextPtr cx, in JSObjectPtr proto);
michael@0 147 };
michael@0 148
michael@0 149 %{ C++
michael@0 150
michael@0 151 #include "nsAutoPtr.h"
michael@0 152
michael@0 153 #define NS_XPCCLASSINFO_IID \
michael@0 154 { 0x9a5b0342, 0x0f70, 0x4d31, \
michael@0 155 { 0xb7, 0xd7, 0x29, 0x68, 0xa5, 0x70, 0x4b, 0xd8 } }
michael@0 156
michael@0 157 class NS_NO_VTABLE nsXPCClassInfo : public nsIClassInfo,
michael@0 158 public nsIXPCScriptable
michael@0 159 {
michael@0 160 public:
michael@0 161 NS_DECLARE_STATIC_IID_ACCESSOR(NS_XPCCLASSINFO_IID)
michael@0 162
michael@0 163 NS_IMETHOD_(MozExternalRefCountType) AddRef() = 0;
michael@0 164 NS_IMETHOD_(MozExternalRefCountType) Release() = 0;
michael@0 165
michael@0 166 virtual void PreserveWrapper(nsISupports *aNative) = 0;
michael@0 167
michael@0 168 virtual uint32_t GetInterfacesBitmap() = 0;
michael@0 169 };
michael@0 170
michael@0 171 NS_DEFINE_STATIC_IID_ACCESSOR(nsXPCClassInfo, NS_XPCCLASSINFO_IID)
michael@0 172
michael@0 173 inline
michael@0 174 nsresult
michael@0 175 CallQueryInterface(nsISupports* aSourcePtr,
michael@0 176 nsRefPtrGetterAddRefs<nsXPCClassInfo> aDestPtr)
michael@0 177 {
michael@0 178 return CallQueryInterface(aSourcePtr,
michael@0 179 static_cast<nsXPCClassInfo**>(aDestPtr));
michael@0 180 }
michael@0 181
michael@0 182 %}

mercurial