Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* vim: set ts=2 sw=2 et tw=80: */ |
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 nsDOMClassInfo_h___ |
michael@0 | 8 | #define nsDOMClassInfo_h___ |
michael@0 | 9 | |
michael@0 | 10 | #include "mozilla/Attributes.h" |
michael@0 | 11 | #include "nsIXPCScriptable.h" |
michael@0 | 12 | #include "nsIScriptGlobalObject.h" |
michael@0 | 13 | #include "nsIDOMScriptObjectFactory.h" |
michael@0 | 14 | #include "js/Id.h" |
michael@0 | 15 | #include "nsIXPConnect.h" |
michael@0 | 16 | |
michael@0 | 17 | #ifdef XP_WIN |
michael@0 | 18 | #undef GetClassName |
michael@0 | 19 | #endif |
michael@0 | 20 | |
michael@0 | 21 | class nsContentList; |
michael@0 | 22 | class nsDocument; |
michael@0 | 23 | struct nsGlobalNameStruct; |
michael@0 | 24 | class nsGlobalWindow; |
michael@0 | 25 | class nsIScriptSecurityManager; |
michael@0 | 26 | |
michael@0 | 27 | struct nsDOMClassInfoData; |
michael@0 | 28 | |
michael@0 | 29 | typedef nsIClassInfo* (*nsDOMClassInfoConstructorFnc) |
michael@0 | 30 | (nsDOMClassInfoData* aData); |
michael@0 | 31 | |
michael@0 | 32 | typedef nsresult (*nsDOMConstructorFunc)(nsISupports** aNewObject); |
michael@0 | 33 | |
michael@0 | 34 | struct nsDOMClassInfoData |
michael@0 | 35 | { |
michael@0 | 36 | const char *mName; |
michael@0 | 37 | const char16_t *mNameUTF16; |
michael@0 | 38 | union { |
michael@0 | 39 | nsDOMClassInfoConstructorFnc mConstructorFptr; |
michael@0 | 40 | nsDOMClassInfoExternalConstructorFnc mExternalConstructorFptr; |
michael@0 | 41 | } u; |
michael@0 | 42 | |
michael@0 | 43 | nsIClassInfo *mCachedClassInfo; // low bit is set to 1 if external, |
michael@0 | 44 | // so be sure to mask if necessary! |
michael@0 | 45 | const nsIID *mProtoChainInterface; |
michael@0 | 46 | const nsIID **mInterfaces; |
michael@0 | 47 | uint32_t mScriptableFlags : 31; // flags must not use more than 31 bits! |
michael@0 | 48 | uint32_t mHasClassInterface : 1; |
michael@0 | 49 | uint32_t mInterfacesBitmap; |
michael@0 | 50 | bool mChromeOnly : 1; |
michael@0 | 51 | bool mAllowXBL : 1; |
michael@0 | 52 | bool mDisabled : 1; |
michael@0 | 53 | #ifdef DEBUG |
michael@0 | 54 | uint32_t mDebugID; |
michael@0 | 55 | #endif |
michael@0 | 56 | }; |
michael@0 | 57 | |
michael@0 | 58 | struct nsExternalDOMClassInfoData : public nsDOMClassInfoData |
michael@0 | 59 | { |
michael@0 | 60 | const nsCID *mConstructorCID; |
michael@0 | 61 | }; |
michael@0 | 62 | |
michael@0 | 63 | |
michael@0 | 64 | // To be used with the nsDOMClassInfoData::mCachedClassInfo pointer. |
michael@0 | 65 | // The low bit is set when we created a generic helper for an external |
michael@0 | 66 | // (which holds on to the nsDOMClassInfoData). |
michael@0 | 67 | #define GET_CLEAN_CI_PTR(_ptr) (nsIClassInfo*)(uintptr_t(_ptr) & ~0x1) |
michael@0 | 68 | #define MARK_EXTERNAL(_ptr) (nsIClassInfo*)(uintptr_t(_ptr) | 0x1) |
michael@0 | 69 | #define IS_EXTERNAL(_ptr) (uintptr_t(_ptr) & 0x1) |
michael@0 | 70 | |
michael@0 | 71 | |
michael@0 | 72 | class nsDOMClassInfo : public nsXPCClassInfo |
michael@0 | 73 | { |
michael@0 | 74 | friend class nsHTMLDocumentSH; |
michael@0 | 75 | public: |
michael@0 | 76 | nsDOMClassInfo(nsDOMClassInfoData* aData); |
michael@0 | 77 | virtual ~nsDOMClassInfo(); |
michael@0 | 78 | |
michael@0 | 79 | NS_DECL_NSIXPCSCRIPTABLE |
michael@0 | 80 | |
michael@0 | 81 | NS_DECL_ISUPPORTS |
michael@0 | 82 | |
michael@0 | 83 | NS_DECL_NSICLASSINFO |
michael@0 | 84 | |
michael@0 | 85 | // Helper method that returns a *non* refcounted pointer to a |
michael@0 | 86 | // helper. So please note, don't release this pointer, if you do, |
michael@0 | 87 | // you better make sure you've addreffed before release. |
michael@0 | 88 | // |
michael@0 | 89 | // Whaaaaa! I wanted to name this method GetClassInfo, but nooo, |
michael@0 | 90 | // some of Microsoft devstudio's headers #defines GetClassInfo to |
michael@0 | 91 | // GetClassInfoA so I can't, those $%#@^! bastards!!! What gives |
michael@0 | 92 | // them the right to do that? |
michael@0 | 93 | |
michael@0 | 94 | static nsIClassInfo* GetClassInfoInstance(nsDOMClassInfoData* aData); |
michael@0 | 95 | |
michael@0 | 96 | static void ShutDown(); |
michael@0 | 97 | |
michael@0 | 98 | static nsIClassInfo *doCreate(nsDOMClassInfoData* aData) |
michael@0 | 99 | { |
michael@0 | 100 | return new nsDOMClassInfo(aData); |
michael@0 | 101 | } |
michael@0 | 102 | |
michael@0 | 103 | /* |
michael@0 | 104 | * The following two functions exist because of the way that Xray wrappers |
michael@0 | 105 | * work. In order to allow scriptable helpers to define non-IDL defined but |
michael@0 | 106 | * still "safe" properties for Xray wrappers, we call into the scriptable |
michael@0 | 107 | * helper with |obj| being the wrapper. |
michael@0 | 108 | * |
michael@0 | 109 | * Ideally, that would be the end of the story, however due to complications |
michael@0 | 110 | * dealing with document.domain, it's possible to end up in a scriptable |
michael@0 | 111 | * helper with a wrapper, even though we should be treating the lookup as a |
michael@0 | 112 | * transparent one. |
michael@0 | 113 | * |
michael@0 | 114 | * Note: So ObjectIsNativeWrapper(cx, obj) check usually means "through xray |
michael@0 | 115 | * wrapper this part is not visible" while combined with |
michael@0 | 116 | * || xpc::WrapperFactory::XrayWrapperNotShadowing(obj) it means "through |
michael@0 | 117 | * xray wrapper it is visible only if it does not hide any native property." |
michael@0 | 118 | */ |
michael@0 | 119 | static bool ObjectIsNativeWrapper(JSContext* cx, JSObject* obj); |
michael@0 | 120 | |
michael@0 | 121 | static nsISupports *GetNative(nsIXPConnectWrappedNative *wrapper, JSObject *obj); |
michael@0 | 122 | |
michael@0 | 123 | static nsIXPConnect *XPConnect() |
michael@0 | 124 | { |
michael@0 | 125 | return sXPConnect; |
michael@0 | 126 | } |
michael@0 | 127 | static nsIScriptSecurityManager *ScriptSecurityManager() |
michael@0 | 128 | { |
michael@0 | 129 | return sSecMan; |
michael@0 | 130 | } |
michael@0 | 131 | |
michael@0 | 132 | protected: |
michael@0 | 133 | friend nsIClassInfo* NS_GetDOMClassInfoInstance(nsDOMClassInfoID aID); |
michael@0 | 134 | |
michael@0 | 135 | const nsDOMClassInfoData* mData; |
michael@0 | 136 | |
michael@0 | 137 | virtual void PreserveWrapper(nsISupports *aNative) MOZ_OVERRIDE |
michael@0 | 138 | { |
michael@0 | 139 | } |
michael@0 | 140 | |
michael@0 | 141 | virtual uint32_t GetInterfacesBitmap() MOZ_OVERRIDE |
michael@0 | 142 | { |
michael@0 | 143 | return mData->mInterfacesBitmap; |
michael@0 | 144 | } |
michael@0 | 145 | |
michael@0 | 146 | static nsresult Init(); |
michael@0 | 147 | static nsresult RegisterClassProtos(int32_t aDOMClassInfoID); |
michael@0 | 148 | static nsresult RegisterExternalClasses(); |
michael@0 | 149 | nsresult ResolveConstructor(JSContext *cx, JSObject *obj, |
michael@0 | 150 | JSObject **objp); |
michael@0 | 151 | |
michael@0 | 152 | // Checks if id is a number and returns the number, if aIsNumber is |
michael@0 | 153 | // non-null it's set to true if the id is a number and false if it's |
michael@0 | 154 | // not a number. If id is not a number this method returns -1 |
michael@0 | 155 | static int32_t GetArrayIndexFromId(JSContext *cx, JS::Handle<jsid> id, |
michael@0 | 156 | bool *aIsNumber = nullptr); |
michael@0 | 157 | |
michael@0 | 158 | static nsIXPConnect *sXPConnect; |
michael@0 | 159 | static nsIScriptSecurityManager *sSecMan; |
michael@0 | 160 | |
michael@0 | 161 | // nsIXPCScriptable code |
michael@0 | 162 | static nsresult DefineStaticJSVals(JSContext *cx); |
michael@0 | 163 | |
michael@0 | 164 | static bool sIsInitialized; |
michael@0 | 165 | |
michael@0 | 166 | public: |
michael@0 | 167 | static jsid sLocation_id; |
michael@0 | 168 | static jsid sConstructor_id; |
michael@0 | 169 | static jsid sLength_id; |
michael@0 | 170 | static jsid sItem_id; |
michael@0 | 171 | static jsid sNamedItem_id; |
michael@0 | 172 | static jsid sEnumerate_id; |
michael@0 | 173 | static jsid sTop_id; |
michael@0 | 174 | static jsid sDocument_id; |
michael@0 | 175 | static jsid sWrappedJSObject_id; |
michael@0 | 176 | }; |
michael@0 | 177 | |
michael@0 | 178 | // THIS ONE ISN'T SAFE!! It assumes that the private of the JSObject is |
michael@0 | 179 | // an nsISupports. |
michael@0 | 180 | inline |
michael@0 | 181 | const nsQueryInterface |
michael@0 | 182 | do_QueryWrappedNative(nsIXPConnectWrappedNative *wrapper, JSObject *obj) |
michael@0 | 183 | { |
michael@0 | 184 | return nsQueryInterface(nsDOMClassInfo::GetNative(wrapper, obj)); |
michael@0 | 185 | } |
michael@0 | 186 | |
michael@0 | 187 | // THIS ONE ISN'T SAFE!! It assumes that the private of the JSObject is |
michael@0 | 188 | // an nsISupports. |
michael@0 | 189 | inline |
michael@0 | 190 | const nsQueryInterfaceWithError |
michael@0 | 191 | do_QueryWrappedNative(nsIXPConnectWrappedNative *wrapper, JSObject *obj, |
michael@0 | 192 | nsresult *aError) |
michael@0 | 193 | |
michael@0 | 194 | { |
michael@0 | 195 | return nsQueryInterfaceWithError(nsDOMClassInfo::GetNative(wrapper, obj), |
michael@0 | 196 | aError); |
michael@0 | 197 | } |
michael@0 | 198 | |
michael@0 | 199 | inline |
michael@0 | 200 | nsQueryInterface |
michael@0 | 201 | do_QueryWrapper(JSContext *cx, JSObject *obj) |
michael@0 | 202 | { |
michael@0 | 203 | nsISupports *native = |
michael@0 | 204 | nsDOMClassInfo::XPConnect()->GetNativeOfWrapper(cx, obj); |
michael@0 | 205 | return nsQueryInterface(native); |
michael@0 | 206 | } |
michael@0 | 207 | |
michael@0 | 208 | inline |
michael@0 | 209 | nsQueryInterfaceWithError |
michael@0 | 210 | do_QueryWrapper(JSContext *cx, JSObject *obj, nsresult* error) |
michael@0 | 211 | { |
michael@0 | 212 | nsISupports *native = |
michael@0 | 213 | nsDOMClassInfo::XPConnect()->GetNativeOfWrapper(cx, obj); |
michael@0 | 214 | return nsQueryInterfaceWithError(native, error); |
michael@0 | 215 | } |
michael@0 | 216 | |
michael@0 | 217 | |
michael@0 | 218 | typedef nsDOMClassInfo nsDOMGenericSH; |
michael@0 | 219 | |
michael@0 | 220 | // Makes sure that the wrapper is preserved if new properties are added. |
michael@0 | 221 | class nsEventTargetSH : public nsDOMGenericSH |
michael@0 | 222 | { |
michael@0 | 223 | protected: |
michael@0 | 224 | nsEventTargetSH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData) |
michael@0 | 225 | { |
michael@0 | 226 | } |
michael@0 | 227 | |
michael@0 | 228 | virtual ~nsEventTargetSH() |
michael@0 | 229 | { |
michael@0 | 230 | } |
michael@0 | 231 | public: |
michael@0 | 232 | NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx, |
michael@0 | 233 | JSObject *globalObj, JSObject **parentObj) MOZ_OVERRIDE; |
michael@0 | 234 | NS_IMETHOD AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx, |
michael@0 | 235 | JSObject *obj, jsid id, JS::Value *vp, bool *_retval) MOZ_OVERRIDE; |
michael@0 | 236 | |
michael@0 | 237 | virtual void PreserveWrapper(nsISupports *aNative) MOZ_OVERRIDE; |
michael@0 | 238 | |
michael@0 | 239 | static nsIClassInfo *doCreate(nsDOMClassInfoData* aData) |
michael@0 | 240 | { |
michael@0 | 241 | return new nsEventTargetSH(aData); |
michael@0 | 242 | } |
michael@0 | 243 | }; |
michael@0 | 244 | |
michael@0 | 245 | // Window scriptable helper |
michael@0 | 246 | |
michael@0 | 247 | class nsWindowSH : public nsDOMGenericSH |
michael@0 | 248 | { |
michael@0 | 249 | protected: |
michael@0 | 250 | nsWindowSH(nsDOMClassInfoData *aData) : nsDOMGenericSH(aData) |
michael@0 | 251 | { |
michael@0 | 252 | } |
michael@0 | 253 | |
michael@0 | 254 | virtual ~nsWindowSH() |
michael@0 | 255 | { |
michael@0 | 256 | } |
michael@0 | 257 | |
michael@0 | 258 | static nsresult GlobalResolve(nsGlobalWindow *aWin, JSContext *cx, |
michael@0 | 259 | JS::Handle<JSObject*> obj, JS::Handle<jsid> id, |
michael@0 | 260 | JS::MutableHandle<JSPropertyDescriptor> desc); |
michael@0 | 261 | |
michael@0 | 262 | friend class nsGlobalWindow; |
michael@0 | 263 | public: |
michael@0 | 264 | NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx, |
michael@0 | 265 | JSObject *globalObj, JSObject **parentObj) MOZ_OVERRIDE; |
michael@0 | 266 | NS_IMETHOD PostCreatePrototype(JSContext * cx, JSObject * proto) MOZ_OVERRIDE; |
michael@0 | 267 | NS_IMETHOD PostCreate(nsIXPConnectWrappedNative *wrapper, JSContext *cx, |
michael@0 | 268 | JSObject *obj) MOZ_OVERRIDE; |
michael@0 | 269 | NS_IMETHOD Enumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx, |
michael@0 | 270 | JSObject *obj, bool *_retval) MOZ_OVERRIDE; |
michael@0 | 271 | NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx, |
michael@0 | 272 | JSObject *obj, jsid id, JSObject **objp, |
michael@0 | 273 | bool *_retval) MOZ_OVERRIDE; |
michael@0 | 274 | NS_IMETHOD OuterObject(nsIXPConnectWrappedNative *wrapper, JSContext * cx, |
michael@0 | 275 | JSObject * obj, JSObject * *_retval) MOZ_OVERRIDE; |
michael@0 | 276 | |
michael@0 | 277 | static bool NameStructEnabled(JSContext* aCx, nsGlobalWindow *aWin, |
michael@0 | 278 | const nsAString& aName, |
michael@0 | 279 | const nsGlobalNameStruct& aNameStruct); |
michael@0 | 280 | |
michael@0 | 281 | static nsIClassInfo *doCreate(nsDOMClassInfoData* aData) |
michael@0 | 282 | { |
michael@0 | 283 | return new nsWindowSH(aData); |
michael@0 | 284 | } |
michael@0 | 285 | }; |
michael@0 | 286 | |
michael@0 | 287 | // Location scriptable helper |
michael@0 | 288 | |
michael@0 | 289 | class nsLocationSH : public nsDOMGenericSH |
michael@0 | 290 | { |
michael@0 | 291 | protected: |
michael@0 | 292 | nsLocationSH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData) |
michael@0 | 293 | { |
michael@0 | 294 | } |
michael@0 | 295 | |
michael@0 | 296 | virtual ~nsLocationSH() |
michael@0 | 297 | { |
michael@0 | 298 | } |
michael@0 | 299 | |
michael@0 | 300 | public: |
michael@0 | 301 | NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx, |
michael@0 | 302 | JSObject *globalObj, JSObject **parentObj) MOZ_OVERRIDE; |
michael@0 | 303 | NS_IMETHODIMP AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx, |
michael@0 | 304 | JSObject *obj, jsid id, JS::Value *vp, bool *_retval); |
michael@0 | 305 | |
michael@0 | 306 | static nsIClassInfo *doCreate(nsDOMClassInfoData* aData) |
michael@0 | 307 | { |
michael@0 | 308 | return new nsLocationSH(aData); |
michael@0 | 309 | } |
michael@0 | 310 | }; |
michael@0 | 311 | |
michael@0 | 312 | |
michael@0 | 313 | // Generic array scriptable helper |
michael@0 | 314 | |
michael@0 | 315 | class nsGenericArraySH : public nsDOMClassInfo |
michael@0 | 316 | { |
michael@0 | 317 | protected: |
michael@0 | 318 | nsGenericArraySH(nsDOMClassInfoData* aData) : nsDOMClassInfo(aData) |
michael@0 | 319 | { |
michael@0 | 320 | } |
michael@0 | 321 | |
michael@0 | 322 | virtual ~nsGenericArraySH() |
michael@0 | 323 | { |
michael@0 | 324 | } |
michael@0 | 325 | |
michael@0 | 326 | public: |
michael@0 | 327 | NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx, |
michael@0 | 328 | JSObject *obj, jsid id, JSObject **objp, |
michael@0 | 329 | bool *_retval) MOZ_OVERRIDE; |
michael@0 | 330 | NS_IMETHOD Enumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx, |
michael@0 | 331 | JSObject *obj, bool *_retval) MOZ_OVERRIDE; |
michael@0 | 332 | |
michael@0 | 333 | virtual nsresult GetLength(nsIXPConnectWrappedNative *wrapper, JSContext *cx, |
michael@0 | 334 | JS::Handle<JSObject*> obj, uint32_t *length); |
michael@0 | 335 | |
michael@0 | 336 | static nsIClassInfo *doCreate(nsDOMClassInfoData* aData) |
michael@0 | 337 | { |
michael@0 | 338 | return new nsGenericArraySH(aData); |
michael@0 | 339 | } |
michael@0 | 340 | }; |
michael@0 | 341 | |
michael@0 | 342 | |
michael@0 | 343 | // Array scriptable helper |
michael@0 | 344 | |
michael@0 | 345 | class nsArraySH : public nsGenericArraySH |
michael@0 | 346 | { |
michael@0 | 347 | protected: |
michael@0 | 348 | nsArraySH(nsDOMClassInfoData* aData) : nsGenericArraySH(aData) |
michael@0 | 349 | { |
michael@0 | 350 | } |
michael@0 | 351 | |
michael@0 | 352 | virtual ~nsArraySH() |
michael@0 | 353 | { |
michael@0 | 354 | } |
michael@0 | 355 | |
michael@0 | 356 | // Subclasses need to override this, if the implementation can't fail it's |
michael@0 | 357 | // allowed to not set *aResult. |
michael@0 | 358 | virtual nsISupports* GetItemAt(nsISupports *aNative, uint32_t aIndex, |
michael@0 | 359 | nsWrapperCache **aCache, nsresult *aResult) = 0; |
michael@0 | 360 | |
michael@0 | 361 | public: |
michael@0 | 362 | NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx, |
michael@0 | 363 | JSObject *obj, jsid id, JS::Value *vp, bool *_retval) MOZ_OVERRIDE; |
michael@0 | 364 | |
michael@0 | 365 | private: |
michael@0 | 366 | // Not implemented, nothing should create an instance of this class. |
michael@0 | 367 | static nsIClassInfo *doCreate(nsDOMClassInfoData* aData); |
michael@0 | 368 | }; |
michael@0 | 369 | |
michael@0 | 370 | |
michael@0 | 371 | // CSSRuleList helper |
michael@0 | 372 | |
michael@0 | 373 | class nsCSSRuleListSH : public nsArraySH |
michael@0 | 374 | { |
michael@0 | 375 | protected: |
michael@0 | 376 | nsCSSRuleListSH(nsDOMClassInfoData* aData) : nsArraySH(aData) |
michael@0 | 377 | { |
michael@0 | 378 | } |
michael@0 | 379 | |
michael@0 | 380 | virtual ~nsCSSRuleListSH() |
michael@0 | 381 | { |
michael@0 | 382 | } |
michael@0 | 383 | |
michael@0 | 384 | virtual nsISupports* GetItemAt(nsISupports *aNative, uint32_t aIndex, |
michael@0 | 385 | nsWrapperCache **aCache, nsresult *aResult) MOZ_OVERRIDE; |
michael@0 | 386 | |
michael@0 | 387 | public: |
michael@0 | 388 | static nsIClassInfo *doCreate(nsDOMClassInfoData* aData) |
michael@0 | 389 | { |
michael@0 | 390 | return new nsCSSRuleListSH(aData); |
michael@0 | 391 | } |
michael@0 | 392 | }; |
michael@0 | 393 | |
michael@0 | 394 | // WebApps Storage helpers |
michael@0 | 395 | |
michael@0 | 396 | class nsStorage2SH : public nsDOMGenericSH |
michael@0 | 397 | { |
michael@0 | 398 | protected: |
michael@0 | 399 | nsStorage2SH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData) |
michael@0 | 400 | { |
michael@0 | 401 | } |
michael@0 | 402 | |
michael@0 | 403 | virtual ~nsStorage2SH() |
michael@0 | 404 | { |
michael@0 | 405 | } |
michael@0 | 406 | |
michael@0 | 407 | NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx, |
michael@0 | 408 | JSObject *obj, jsid id, JSObject **objp, |
michael@0 | 409 | bool *_retval) MOZ_OVERRIDE; |
michael@0 | 410 | NS_IMETHOD SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx, |
michael@0 | 411 | JSObject *obj, jsid id, JS::Value *vp, bool *_retval) MOZ_OVERRIDE; |
michael@0 | 412 | NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx, |
michael@0 | 413 | JSObject *obj, jsid id, JS::Value *vp, bool *_retval) MOZ_OVERRIDE; |
michael@0 | 414 | NS_IMETHOD DelProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx, |
michael@0 | 415 | JSObject *obj, jsid id, bool *_retval) MOZ_OVERRIDE; |
michael@0 | 416 | NS_IMETHOD NewEnumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx, |
michael@0 | 417 | JSObject *obj, uint32_t enum_op, JS::Value *statep, |
michael@0 | 418 | jsid *idp, bool *_retval) MOZ_OVERRIDE; |
michael@0 | 419 | |
michael@0 | 420 | public: |
michael@0 | 421 | static nsIClassInfo *doCreate(nsDOMClassInfoData* aData) |
michael@0 | 422 | { |
michael@0 | 423 | return new nsStorage2SH(aData); |
michael@0 | 424 | } |
michael@0 | 425 | }; |
michael@0 | 426 | |
michael@0 | 427 | // Event handler 'this' translator class, this is called by XPConnect |
michael@0 | 428 | // when a "function interface" (nsIDOMEventListener) is called, this |
michael@0 | 429 | // class extracts 'this' fomr the first argument to the called |
michael@0 | 430 | // function (nsIDOMEventListener::HandleEvent(in nsIDOMEvent)), this |
michael@0 | 431 | // class will pass back nsIDOMEvent::currentTarget to be used as |
michael@0 | 432 | // 'this'. |
michael@0 | 433 | |
michael@0 | 434 | class nsEventListenerThisTranslator : public nsIXPCFunctionThisTranslator |
michael@0 | 435 | { |
michael@0 | 436 | public: |
michael@0 | 437 | nsEventListenerThisTranslator() |
michael@0 | 438 | { |
michael@0 | 439 | } |
michael@0 | 440 | |
michael@0 | 441 | virtual ~nsEventListenerThisTranslator() |
michael@0 | 442 | { |
michael@0 | 443 | } |
michael@0 | 444 | |
michael@0 | 445 | // nsISupports |
michael@0 | 446 | NS_DECL_ISUPPORTS |
michael@0 | 447 | |
michael@0 | 448 | // nsIXPCFunctionThisTranslator |
michael@0 | 449 | NS_DECL_NSIXPCFUNCTIONTHISTRANSLATOR |
michael@0 | 450 | }; |
michael@0 | 451 | |
michael@0 | 452 | class nsDOMConstructorSH : public nsDOMGenericSH |
michael@0 | 453 | { |
michael@0 | 454 | protected: |
michael@0 | 455 | nsDOMConstructorSH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData) |
michael@0 | 456 | { |
michael@0 | 457 | } |
michael@0 | 458 | |
michael@0 | 459 | public: |
michael@0 | 460 | NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx, |
michael@0 | 461 | JSObject *globalObj, JSObject **parentObj) MOZ_OVERRIDE; |
michael@0 | 462 | NS_IMETHOD PostCreatePrototype(JSContext * cx, JSObject * proto) MOZ_OVERRIDE |
michael@0 | 463 | { |
michael@0 | 464 | return NS_OK; |
michael@0 | 465 | } |
michael@0 | 466 | NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx, |
michael@0 | 467 | JSObject *obj, jsid id, JSObject **objp, |
michael@0 | 468 | bool *_retval) MOZ_OVERRIDE; |
michael@0 | 469 | NS_IMETHOD Call(nsIXPConnectWrappedNative *wrapper, JSContext *cx, |
michael@0 | 470 | JSObject *obj, const JS::CallArgs &args, bool *_retval) MOZ_OVERRIDE; |
michael@0 | 471 | |
michael@0 | 472 | NS_IMETHOD Construct(nsIXPConnectWrappedNative *wrapper, JSContext *cx, |
michael@0 | 473 | JSObject *obj, const JS::CallArgs &args, bool *_retval) MOZ_OVERRIDE; |
michael@0 | 474 | |
michael@0 | 475 | NS_IMETHOD HasInstance(nsIXPConnectWrappedNative *wrapper, JSContext *cx, |
michael@0 | 476 | JSObject *obj, JS::Handle<JS::Value> val, bool *bp, |
michael@0 | 477 | bool *_retval); |
michael@0 | 478 | |
michael@0 | 479 | static nsIClassInfo *doCreate(nsDOMClassInfoData* aData) |
michael@0 | 480 | { |
michael@0 | 481 | return new nsDOMConstructorSH(aData); |
michael@0 | 482 | } |
michael@0 | 483 | }; |
michael@0 | 484 | |
michael@0 | 485 | class nsNonDOMObjectSH : public nsDOMGenericSH |
michael@0 | 486 | { |
michael@0 | 487 | protected: |
michael@0 | 488 | nsNonDOMObjectSH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData) |
michael@0 | 489 | { |
michael@0 | 490 | } |
michael@0 | 491 | |
michael@0 | 492 | virtual ~nsNonDOMObjectSH() |
michael@0 | 493 | { |
michael@0 | 494 | } |
michael@0 | 495 | |
michael@0 | 496 | public: |
michael@0 | 497 | NS_IMETHOD GetFlags(uint32_t *aFlags) MOZ_OVERRIDE; |
michael@0 | 498 | |
michael@0 | 499 | static nsIClassInfo *doCreate(nsDOMClassInfoData* aData) |
michael@0 | 500 | { |
michael@0 | 501 | return new nsNonDOMObjectSH(aData); |
michael@0 | 502 | } |
michael@0 | 503 | }; |
michael@0 | 504 | |
michael@0 | 505 | #endif /* nsDOMClassInfo_h___ */ |