Bug 891986 - Keep the source ArrayBuffer to a decodeAudioData call alive until the...
[gecko.git] / dom / base / nsDOMClassInfo.h
blob9c803c8edaff6bac4216c92be61f361a1fb6973b
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=2 sw=2 et tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef nsDOMClassInfo_h___
8 #define nsDOMClassInfo_h___
10 #include "mozilla/Attributes.h"
11 #include "nsIDOMClassInfo.h"
12 #include "nsIXPCScriptable.h"
13 #include "jsapi.h"
14 #include "nsIScriptSecurityManager.h"
15 #include "nsIScriptContext.h"
16 #include "nsDOMJSUtils.h" // for GetScriptContextFromJSContext
17 #include "nsIScriptGlobalObject.h"
18 #include "xpcpublic.h"
19 #include "nsIRunnable.h"
21 #ifdef XP_WIN
22 #undef GetClassName
23 #endif
25 class nsContentList;
26 class nsDocument;
27 class nsGlobalWindow;
28 class nsIDOMWindow;
29 class nsIForm;
30 class nsNPAPIPluginInstance;
31 class nsObjectLoadingContent;
32 class nsIObjectLoadingContent;
34 class nsIDOMCrypto;
35 #ifndef MOZ_DISABLE_CRYPTOLEGACY
36 class nsIDOMCRMFObject;
37 #endif
39 struct nsDOMClassInfoData;
41 typedef nsIClassInfo* (*nsDOMClassInfoConstructorFnc)
42 (nsDOMClassInfoData* aData);
44 typedef nsresult (*nsDOMConstructorFunc)(nsISupports** aNewObject);
46 struct nsDOMClassInfoData
48 const char *mName;
49 const PRUnichar *mNameUTF16;
50 union {
51 nsDOMClassInfoConstructorFnc mConstructorFptr;
52 nsDOMClassInfoExternalConstructorFnc mExternalConstructorFptr;
53 } u;
55 nsIClassInfo *mCachedClassInfo; // low bit is set to 1 if external,
56 // so be sure to mask if necessary!
57 const nsIID *mProtoChainInterface;
58 const nsIID **mInterfaces;
59 uint32_t mScriptableFlags : 31; // flags must not use more than 31 bits!
60 uint32_t mHasClassInterface : 1;
61 uint32_t mInterfacesBitmap;
62 bool mChromeOnly;
63 bool mDisabled;
64 #ifdef DEBUG
65 uint32_t mDebugID;
66 #endif
69 struct nsExternalDOMClassInfoData : public nsDOMClassInfoData
71 const nsCID *mConstructorCID;
75 // To be used with the nsDOMClassInfoData::mCachedClassInfo pointer.
76 // The low bit is set when we created a generic helper for an external
77 // (which holds on to the nsDOMClassInfoData).
78 #define GET_CLEAN_CI_PTR(_ptr) (nsIClassInfo*)(uintptr_t(_ptr) & ~0x1)
79 #define MARK_EXTERNAL(_ptr) (nsIClassInfo*)(uintptr_t(_ptr) | 0x1)
80 #define IS_EXTERNAL(_ptr) (uintptr_t(_ptr) & 0x1)
83 class nsDOMClassInfo : public nsXPCClassInfo
85 friend class nsHTMLDocumentSH;
86 public:
87 nsDOMClassInfo(nsDOMClassInfoData* aData);
88 virtual ~nsDOMClassInfo();
90 NS_DECL_NSIXPCSCRIPTABLE
92 NS_DECL_ISUPPORTS
94 NS_DECL_NSICLASSINFO
96 // Helper method that returns a *non* refcounted pointer to a
97 // helper. So please note, don't release this pointer, if you do,
98 // you better make sure you've addreffed before release.
100 // Whaaaaa! I wanted to name this method GetClassInfo, but nooo,
101 // some of Microsoft devstudio's headers #defines GetClassInfo to
102 // GetClassInfoA so I can't, those $%#@^! bastards!!! What gives
103 // them the right to do that?
105 static nsIClassInfo* GetClassInfoInstance(nsDOMClassInfoData* aData);
107 static void ShutDown();
109 static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
111 return new nsDOMClassInfo(aData);
115 * The following two functions exist because of the way that Xray wrappers
116 * work. In order to allow scriptable helpers to define non-IDL defined but
117 * still "safe" properties for Xray wrappers, we call into the scriptable
118 * helper with |obj| being the wrapper.
120 * Ideally, that would be the end of the story, however due to complications
121 * dealing with document.domain, it's possible to end up in a scriptable
122 * helper with a wrapper, even though we should be treating the lookup as a
123 * transparent one.
125 * Note: So ObjectIsNativeWrapper(cx, obj) check usually means "through xray
126 * wrapper this part is not visible" while combined with
127 * || xpc::WrapperFactory::XrayWrapperNotShadowing(obj) it means "through
128 * xray wrapper it is visible only if it does not hide any native property."
130 static bool ObjectIsNativeWrapper(JSContext* cx, JSObject* obj);
132 static nsISupports *GetNative(nsIXPConnectWrappedNative *wrapper, JSObject *obj);
134 static nsIXPConnect *XPConnect()
136 return sXPConnect;
139 protected:
140 friend nsIClassInfo* NS_GetDOMClassInfoInstance(nsDOMClassInfoID aID);
142 const nsDOMClassInfoData* mData;
144 virtual void PreserveWrapper(nsISupports *aNative) MOZ_OVERRIDE
148 virtual uint32_t GetInterfacesBitmap() MOZ_OVERRIDE
150 return mData->mInterfacesBitmap;
153 static nsresult Init();
154 static nsresult RegisterClassProtos(int32_t aDOMClassInfoID);
155 static nsresult RegisterExternalClasses();
156 nsresult ResolveConstructor(JSContext *cx, JSObject *obj,
157 JSObject **objp);
159 // Checks if id is a number and returns the number, if aIsNumber is
160 // non-null it's set to true if the id is a number and false if it's
161 // not a number. If id is not a number this method returns -1
162 static int32_t GetArrayIndexFromId(JSContext *cx, JS::Handle<jsid> id,
163 bool *aIsNumber = nullptr);
165 static inline bool IsReadonlyReplaceable(jsid id)
167 return (id == sParent_id ||
168 id == sScrollbars_id ||
169 id == sContent_id ||
170 id == sMenubar_id ||
171 id == sToolbar_id ||
172 id == sLocationbar_id ||
173 id == sPersonalbar_id ||
174 id == sStatusbar_id ||
175 id == sControllers_id ||
176 id == sScrollX_id ||
177 id == sScrollY_id ||
178 id == sScrollMaxX_id ||
179 id == sScrollMaxY_id ||
180 id == sLength_id ||
181 id == sFrames_id ||
182 id == sSelf_id);
185 static nsIXPConnect *sXPConnect;
186 static nsIScriptSecurityManager *sSecMan;
188 // nsIXPCScriptable code
189 static nsresult DefineStaticJSVals(JSContext *cx);
191 static bool sIsInitialized;
193 public:
194 static jsid sParent_id;
195 static jsid sScrollbars_id;
196 static jsid sLocation_id;
197 static jsid sConstructor_id;
198 static jsid s_content_id;
199 static jsid sContent_id;
200 static jsid sMenubar_id;
201 static jsid sToolbar_id;
202 static jsid sLocationbar_id;
203 static jsid sPersonalbar_id;
204 static jsid sStatusbar_id;
205 static jsid sControllers_id;
206 static jsid sLength_id;
207 static jsid sScrollX_id;
208 static jsid sScrollY_id;
209 static jsid sScrollMaxX_id;
210 static jsid sScrollMaxY_id;
211 static jsid sItem_id;
212 static jsid sNamedItem_id;
213 static jsid sEnumerate_id;
214 static jsid sNavigator_id;
215 static jsid sTop_id;
216 static jsid sDocument_id;
217 static jsid sFrames_id;
218 static jsid sSelf_id;
219 static jsid sJava_id;
220 static jsid sWrappedJSObject_id;
223 // THIS ONE ISN'T SAFE!! It assumes that the private of the JSObject is
224 // an nsISupports.
225 inline
226 const nsQueryInterface
227 do_QueryWrappedNative(nsIXPConnectWrappedNative *wrapper, JSObject *obj)
229 return nsQueryInterface(nsDOMClassInfo::GetNative(wrapper, obj));
232 // THIS ONE ISN'T SAFE!! It assumes that the private of the JSObject is
233 // an nsISupports.
234 inline
235 const nsQueryInterfaceWithError
236 do_QueryWrappedNative(nsIXPConnectWrappedNative *wrapper, JSObject *obj,
237 nsresult *aError)
240 return nsQueryInterfaceWithError(nsDOMClassInfo::GetNative(wrapper, obj),
241 aError);
244 inline
245 nsQueryInterface
246 do_QueryWrapper(JSContext *cx, JSObject *obj)
248 nsISupports *native =
249 nsDOMClassInfo::XPConnect()->GetNativeOfWrapper(cx, obj);
250 return nsQueryInterface(native);
253 inline
254 nsQueryInterfaceWithError
255 do_QueryWrapper(JSContext *cx, JSObject *obj, nsresult* error)
257 nsISupports *native =
258 nsDOMClassInfo::XPConnect()->GetNativeOfWrapper(cx, obj);
259 return nsQueryInterfaceWithError(native, error);
263 typedef nsDOMClassInfo nsDOMGenericSH;
265 // Makes sure that the wrapper is preserved if new properties are added.
266 class nsEventTargetSH : public nsDOMGenericSH
268 protected:
269 nsEventTargetSH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData)
273 virtual ~nsEventTargetSH()
276 public:
277 NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
278 JSObject *globalObj, JSObject **parentObj) MOZ_OVERRIDE;
279 NS_IMETHOD AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
280 JSObject *obj, jsid id, jsval *vp, bool *_retval) MOZ_OVERRIDE;
282 virtual void PreserveWrapper(nsISupports *aNative) MOZ_OVERRIDE;
284 static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
286 return new nsEventTargetSH(aData);
290 // Window scriptable helper
292 class nsWindowSH : public nsDOMGenericSH
294 protected:
295 nsWindowSH(nsDOMClassInfoData *aData) : nsDOMGenericSH(aData)
299 virtual ~nsWindowSH()
303 static nsresult GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
304 JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
305 bool *did_resolve);
307 public:
308 NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
309 JSObject *globalObj, JSObject **parentObj) MOZ_OVERRIDE;
310 #ifdef DEBUG
311 NS_IMETHOD PostCreate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
312 JSObject *obj) MOZ_OVERRIDE
314 nsCOMPtr<nsIScriptGlobalObject> sgo(do_QueryWrappedNative(wrapper));
316 NS_ASSERTION(!sgo || sgo->GetGlobalJSObject() == nullptr,
317 "Multiple wrappers created for global object!");
319 return NS_OK;
321 virtual uint32_t GetScriptableFlags() MOZ_OVERRIDE
323 return nsDOMGenericSH::GetScriptableFlags() |
324 nsIXPCScriptable::WANT_POSTCREATE;
326 #endif
327 NS_IMETHOD Enumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
328 JSObject *obj, bool *_retval) MOZ_OVERRIDE;
329 NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
330 JSObject *obj, jsid id, uint32_t flags,
331 JSObject **objp, bool *_retval) MOZ_OVERRIDE;
332 NS_IMETHOD Finalize(nsIXPConnectWrappedNative *wrapper, JSFreeOp *fop,
333 JSObject *obj) MOZ_OVERRIDE;
334 NS_IMETHOD OuterObject(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
335 JSObject * obj, JSObject * *_retval) MOZ_OVERRIDE;
337 static JSBool GlobalScopePolluterNewResolve(JSContext *cx, JS::Handle<JSObject*> obj,
338 JS::Handle<jsid> id, unsigned flags,
339 JS::MutableHandle<JSObject*> objp);
340 static JSBool GlobalScopePolluterGetProperty(JSContext *cx, JS::Handle<JSObject*> obj,
341 JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp);
342 static JSBool InvalidateGlobalScopePolluter(JSContext *cx,
343 JS::Handle<JSObject*> obj);
344 static nsresult InstallGlobalScopePolluter(JSContext *cx,
345 JS::Handle<JSObject*> obj);
346 static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
348 return new nsWindowSH(aData);
352 // Location scriptable helper
354 class nsLocationSH : public nsDOMGenericSH
356 protected:
357 nsLocationSH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData)
361 virtual ~nsLocationSH()
365 public:
366 NS_IMETHOD CheckAccess(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
367 JSObject *obj, jsid id, uint32_t mode,
368 jsval *vp, bool *_retval) MOZ_OVERRIDE;
370 NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
371 JSObject *globalObj, JSObject **parentObj) MOZ_OVERRIDE;
372 NS_IMETHODIMP AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
373 JSObject *obj, jsid id, jsval *vp, bool *_retval);
375 static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
377 return new nsLocationSH(aData);
382 // Navigator scriptable helper
384 class nsNavigatorSH : public nsDOMGenericSH
386 protected:
387 nsNavigatorSH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData)
391 virtual ~nsNavigatorSH()
395 public:
396 NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
397 JSObject *globalObj, JSObject **parentObj) MOZ_OVERRIDE;
398 NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
399 JSObject *obj, jsid id, uint32_t flags,
400 JSObject **objp, bool *_retval) MOZ_OVERRIDE;
402 static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
404 return new nsNavigatorSH(aData);
408 // Generic array scriptable helper
410 class nsGenericArraySH : public nsDOMClassInfo
412 protected:
413 nsGenericArraySH(nsDOMClassInfoData* aData) : nsDOMClassInfo(aData)
417 virtual ~nsGenericArraySH()
421 public:
422 NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
423 JSObject *obj, jsid id, uint32_t flags,
424 JSObject **objp, bool *_retval) MOZ_OVERRIDE;
425 NS_IMETHOD Enumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
426 JSObject *obj, bool *_retval) MOZ_OVERRIDE;
428 virtual nsresult GetLength(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
429 JSObject *obj, uint32_t *length);
431 static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
433 return new nsGenericArraySH(aData);
438 // Array scriptable helper
440 class nsArraySH : public nsGenericArraySH
442 protected:
443 nsArraySH(nsDOMClassInfoData* aData) : nsGenericArraySH(aData)
447 virtual ~nsArraySH()
451 // Subclasses need to override this, if the implementation can't fail it's
452 // allowed to not set *aResult.
453 virtual nsISupports* GetItemAt(nsISupports *aNative, uint32_t aIndex,
454 nsWrapperCache **aCache, nsresult *aResult) = 0;
456 public:
457 NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
458 JSObject *obj, jsid id, jsval *vp, bool *_retval) MOZ_OVERRIDE;
460 private:
461 // Not implemented, nothing should create an instance of this class.
462 static nsIClassInfo *doCreate(nsDOMClassInfoData* aData);
466 // NamedArray helper
468 class nsNamedArraySH : public nsArraySH
470 protected:
471 nsNamedArraySH(nsDOMClassInfoData* aData) : nsArraySH(aData)
475 virtual ~nsNamedArraySH()
479 NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
480 JSObject *obj, jsid id, uint32_t flags,
481 JSObject **objp, bool *_retval) MOZ_OVERRIDE;
483 virtual nsISupports* GetNamedItem(nsISupports *aNative,
484 const nsAString& aName,
485 nsWrapperCache **cache,
486 nsresult *aResult) = 0;
488 public:
489 NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
490 JSObject *obj, jsid id, jsval *vp, bool *_retval) MOZ_OVERRIDE;
492 private:
493 // Not implemented, nothing should create an instance of this class.
494 static nsIClassInfo *doCreate(nsDOMClassInfoData* aData);
498 // HTMLAllCollection
500 extern JSClass sHTMLDocumentAllClass;
502 class nsHTMLDocumentSH
504 protected:
505 static JSBool GetDocumentAllNodeList(JSContext *cx, JS::Handle<JSObject*> obj,
506 nsDocument *doc,
507 nsContentList **nodeList);
508 public:
509 static JSBool DocumentAllGetProperty(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
510 JS::MutableHandle<JS::Value> vp);
511 static JSBool DocumentAllNewResolve(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
512 unsigned flags, JS::MutableHandle<JSObject*> objp);
513 static void ReleaseDocument(JSFreeOp *fop, JSObject *obj);
514 static JSBool CallToGetPropMapper(JSContext *cx, unsigned argc, jsval *vp);
518 // String array helper
520 class nsStringArraySH : public nsGenericArraySH
522 protected:
523 nsStringArraySH(nsDOMClassInfoData* aData) : nsGenericArraySH(aData)
527 virtual ~nsStringArraySH()
531 virtual nsresult GetStringAt(nsISupports *aNative, int32_t aIndex,
532 nsAString& aResult) = 0;
534 public:
535 NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
536 JSObject *obj, jsid id, jsval *vp, bool *_retval) MOZ_OVERRIDE;
540 // History helper
542 class nsHistorySH : public nsStringArraySH
544 protected:
545 nsHistorySH(nsDOMClassInfoData* aData) : nsStringArraySH(aData)
549 virtual ~nsHistorySH()
553 virtual nsresult GetStringAt(nsISupports *aNative, int32_t aIndex,
554 nsAString& aResult) MOZ_OVERRIDE;
556 public:
557 NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
558 JSObject *globalObj, JSObject **parentObj) MOZ_OVERRIDE;
559 NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
560 JSObject *obj, jsid id, jsval *vp, bool *_retval) MOZ_OVERRIDE;
562 static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
564 return new nsHistorySH(aData);
568 // StringList scriptable helper
570 class nsStringListSH : public nsStringArraySH
572 protected:
573 nsStringListSH(nsDOMClassInfoData* aData) : nsStringArraySH(aData)
577 virtual ~nsStringListSH()
581 virtual nsresult GetStringAt(nsISupports *aNative, int32_t aIndex,
582 nsAString& aResult) MOZ_OVERRIDE;
584 public:
585 // Inherit GetProperty, Enumerate from nsStringArraySH
587 static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
589 return new nsStringListSH(aData);
594 // MediaList helper
596 class nsMediaListSH : public nsStringArraySH
598 protected:
599 nsMediaListSH(nsDOMClassInfoData* aData) : nsStringArraySH(aData)
603 virtual ~nsMediaListSH()
607 virtual nsresult GetStringAt(nsISupports *aNative, int32_t aIndex,
608 nsAString& aResult) MOZ_OVERRIDE;
610 public:
611 static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
613 return new nsMediaListSH(aData);
618 // StyleSheetList helper
620 class nsStyleSheetListSH : public nsArraySH
622 protected:
623 nsStyleSheetListSH(nsDOMClassInfoData* aData) : nsArraySH(aData)
627 virtual ~nsStyleSheetListSH()
631 virtual nsISupports* GetItemAt(nsISupports *aNative, uint32_t aIndex,
632 nsWrapperCache **aCache, nsresult *aResult) MOZ_OVERRIDE;
634 public:
635 static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
637 return new nsStyleSheetListSH(aData);
642 // CSSRuleList helper
644 class nsCSSRuleListSH : public nsArraySH
646 protected:
647 nsCSSRuleListSH(nsDOMClassInfoData* aData) : nsArraySH(aData)
651 virtual ~nsCSSRuleListSH()
655 virtual nsISupports* GetItemAt(nsISupports *aNative, uint32_t aIndex,
656 nsWrapperCache **aCache, nsresult *aResult) MOZ_OVERRIDE;
658 public:
659 static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
661 return new nsCSSRuleListSH(aData);
665 // WebApps Storage helpers
667 class nsStorage2SH : public nsDOMGenericSH
669 protected:
670 nsStorage2SH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData)
674 virtual ~nsStorage2SH()
678 NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
679 JSObject *obj, jsid id, uint32_t flags,
680 JSObject **objp, bool *_retval) MOZ_OVERRIDE;
681 NS_IMETHOD SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
682 JSObject *obj, jsid id, jsval *vp, bool *_retval) MOZ_OVERRIDE;
683 NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
684 JSObject *obj, jsid id, jsval *vp, bool *_retval) MOZ_OVERRIDE;
685 NS_IMETHOD DelProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
686 JSObject *obj, jsid id, bool *_retval) MOZ_OVERRIDE;
687 NS_IMETHOD NewEnumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
688 JSObject *obj, uint32_t enum_op, jsval *statep,
689 jsid *idp, bool *_retval) MOZ_OVERRIDE;
691 public:
692 static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
694 return new nsStorage2SH(aData);
698 // Event handler 'this' translator class, this is called by XPConnect
699 // when a "function interface" (nsIDOMEventListener) is called, this
700 // class extracts 'this' fomr the first argument to the called
701 // function (nsIDOMEventListener::HandleEvent(in nsIDOMEvent)), this
702 // class will pass back nsIDOMEvent::currentTarget to be used as
703 // 'this'.
705 class nsEventListenerThisTranslator : public nsIXPCFunctionThisTranslator
707 public:
708 nsEventListenerThisTranslator()
712 virtual ~nsEventListenerThisTranslator()
716 // nsISupports
717 NS_DECL_ISUPPORTS
719 // nsIXPCFunctionThisTranslator
720 NS_DECL_NSIXPCFUNCTIONTHISTRANSLATOR
723 class nsDOMConstructorSH : public nsDOMGenericSH
725 protected:
726 nsDOMConstructorSH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData)
730 public:
731 NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
732 JSObject *globalObj, JSObject **parentObj) MOZ_OVERRIDE;
733 NS_IMETHOD PostCreatePrototype(JSContext * cx, JSObject * proto) MOZ_OVERRIDE
735 return NS_OK;
737 NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
738 JSObject *obj, jsid id, uint32_t flags,
739 JSObject **objp, bool *_retval) MOZ_OVERRIDE;
740 NS_IMETHOD Call(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
741 JSObject *obj, const JS::CallArgs &args, bool *_retval) MOZ_OVERRIDE;
743 NS_IMETHOD Construct(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
744 JSObject *obj, const JS::CallArgs &args, bool *_retval) MOZ_OVERRIDE;
746 NS_IMETHOD HasInstance(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
747 JSObject *obj, const jsval &val, bool *bp,
748 bool *_retval);
750 static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
752 return new nsDOMConstructorSH(aData);
756 class nsNonDOMObjectSH : public nsDOMGenericSH
758 protected:
759 nsNonDOMObjectSH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData)
763 virtual ~nsNonDOMObjectSH()
767 public:
768 NS_IMETHOD GetFlags(uint32_t *aFlags) MOZ_OVERRIDE;
770 static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
772 return new nsNonDOMObjectSH(aData);
776 #endif /* nsDOMClassInfo_h___ */