LCOV - code coverage report
Current view: directory - dom/base - nsDOMClassInfo.h (source / functions) Found Hit Coverage
Test: app.info Lines: 365 93 25.5 %
Date: 2012-06-02 Functions: 208 48 23.1 %

       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                 : /* ***** BEGIN LICENSE BLOCK *****
       4                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       5                 :  *
       6                 :  * The contents of this file are subject to the Mozilla Public License Version
       7                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       8                 :  * the License. You may obtain a copy of the License at
       9                 :  * http://www.mozilla.org/MPL/
      10                 :  *
      11                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      12                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      13                 :  * for the specific language governing rights and limitations under the
      14                 :  * License.
      15                 :  *
      16                 :  * The Original Code is mozilla.org code.
      17                 :  *
      18                 :  * The Initial Developer of the Original Code is
      19                 :  * Netscape Communications Corporation.
      20                 :  * Portions created by the Initial Developer are Copyright (C) 2000
      21                 :  * the Initial Developer. All Rights Reserved.
      22                 :  *
      23                 :  * Contributor(s):
      24                 :  *   Johnny Stenback <jst@netscape.com> (original author)
      25                 :  *
      26                 :  * Alternatively, the contents of this file may be used under the terms of
      27                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
      28                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      29                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      30                 :  * of those above. If you wish to allow use of your version of this file only
      31                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      32                 :  * use your version of this file under the terms of the MPL, indicate your
      33                 :  * decision by deleting the provisions above and replace them with the notice
      34                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      35                 :  * the provisions above, a recipient may use your version of this file under
      36                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      37                 :  *
      38                 :  * ***** END LICENSE BLOCK ***** */
      39                 : 
      40                 : #ifndef nsDOMClassInfo_h___
      41                 : #define nsDOMClassInfo_h___
      42                 : 
      43                 : #include "nsIDOMClassInfo.h"
      44                 : #include "nsIXPCScriptable.h"
      45                 : #include "jsapi.h"
      46                 : #include "nsIScriptSecurityManager.h"
      47                 : #include "nsIScriptContext.h"
      48                 : #include "nsDOMJSUtils.h" // for GetScriptContextFromJSContext
      49                 : #include "nsIScriptGlobalObject.h"
      50                 : #include "nsContentUtils.h"
      51                 : #include "xpcpublic.h"
      52                 : 
      53                 : namespace mozilla {
      54                 : class DOMSVGLengthList;
      55                 : class DOMSVGNumberList;
      56                 : class DOMSVGPathSegList;
      57                 : class DOMSVGPointList;
      58                 : class DOMSVGStringList;
      59                 : class DOMSVGTransformList;
      60                 : }
      61                 : class nsGlobalWindow;
      62                 : class nsIDOMDocument;
      63                 : class nsIDOMHTMLOptionsCollection;
      64                 : class nsIDOMSVGLength;
      65                 : class nsIDOMSVGLengthList;
      66                 : class nsIDOMSVGNumber;
      67                 : class nsIDOMSVGNumberList;
      68                 : class nsIDOMSVGPathSeg;
      69                 : class nsIDOMSVGPathSegList;
      70                 : class nsIDOMSVGPoint;
      71                 : class nsIDOMSVGPointList;
      72                 : class nsIDOMSVGStringList;
      73                 : class nsIDOMSVGTests;
      74                 : class nsIDOMSVGTransform;
      75                 : class nsIDOMSVGTransformList;
      76                 : class nsIDOMWindow;
      77                 : class nsIForm;
      78                 : class nsIHTMLDocument;
      79                 : class nsNPAPIPluginInstance;
      80                 : 
      81                 : struct nsDOMClassInfoData;
      82                 : 
      83                 : typedef nsIClassInfo* (*nsDOMClassInfoConstructorFnc)
      84                 :   (nsDOMClassInfoData* aData);
      85                 : 
      86                 : typedef nsresult (*nsDOMConstructorFunc)(nsISupports** aNewObject);
      87                 : 
      88                 : struct nsDOMClassInfoData
      89                 : {
      90                 :   const char *mName;
      91                 :   const PRUnichar *mNameUTF16;
      92                 :   union {
      93                 :     nsDOMClassInfoConstructorFnc mConstructorFptr;
      94                 :     nsDOMClassInfoExternalConstructorFnc mExternalConstructorFptr;
      95                 :   } u;
      96                 : 
      97                 :   nsIClassInfo *mCachedClassInfo; // low bit is set to 1 if external,
      98                 :                                   // so be sure to mask if necessary!
      99                 :   const nsIID *mProtoChainInterface;
     100                 :   const nsIID **mInterfaces;
     101                 :   PRUint32 mScriptableFlags : 31; // flags must not use more than 31 bits!
     102                 :   PRUint32 mHasClassInterface : 1;
     103                 :   PRUint32 mInterfacesBitmap;
     104                 :   bool mChromeOnly;
     105                 :   bool mDisabled;
     106                 :   // For new style DOM bindings.
     107                 :   mozilla::dom::binding::DefineInterface mDefineDOMInterface;
     108                 : #ifdef NS_DEBUG
     109                 :   PRUint32 mDebugID;
     110                 : #endif
     111                 : };
     112                 : 
     113                 : struct nsExternalDOMClassInfoData : public nsDOMClassInfoData
     114                 : {
     115                 :   const nsCID *mConstructorCID;
     116                 : };
     117                 : 
     118                 : 
     119                 : typedef PRUptrdiff PtrBits;
     120                 : 
     121                 : // To be used with the nsDOMClassInfoData::mCachedClassInfo pointer.
     122                 : // The low bit is set when we created a generic helper for an external
     123                 : // (which holds on to the nsDOMClassInfoData).
     124                 : #define GET_CLEAN_CI_PTR(_ptr) (nsIClassInfo*)(PtrBits(_ptr) & ~0x1)
     125                 : #define MARK_EXTERNAL(_ptr) (nsIClassInfo*)(PtrBits(_ptr) | 0x1)
     126                 : #define IS_EXTERNAL(_ptr) (PtrBits(_ptr) & 0x1)
     127                 : 
     128                 : 
     129                 : class nsDOMClassInfo : public nsXPCClassInfo
     130                 : {
     131                 : public:
     132                 :   nsDOMClassInfo(nsDOMClassInfoData* aData);
     133                 :   virtual ~nsDOMClassInfo();
     134                 : 
     135                 :   NS_DECL_NSIXPCSCRIPTABLE
     136                 : 
     137                 :   NS_DECL_ISUPPORTS
     138                 : 
     139                 :   NS_DECL_NSICLASSINFO
     140                 : 
     141                 :   // Helper method that returns a *non* refcounted pointer to a
     142                 :   // helper. So please note, don't release this pointer, if you do,
     143                 :   // you better make sure you've addreffed before release.
     144                 :   //
     145                 :   // Whaaaaa! I wanted to name this method GetClassInfo, but nooo,
     146                 :   // some of Microsoft devstudio's headers #defines GetClassInfo to
     147                 :   // GetClassInfoA so I can't, those $%#@^! bastards!!! What gives
     148                 :   // them the right to do that?
     149                 : 
     150                 :   static nsIClassInfo* GetClassInfoInstance(nsDOMClassInfoData* aData);
     151                 : 
     152                 :   static void ShutDown();
     153                 : 
     154             629 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
     155                 :   {
     156             629 :     return new nsDOMClassInfo(aData);
     157                 :   }
     158                 : 
     159                 :   static nsresult ThrowJSException(JSContext *cx, nsresult aResult);
     160                 : 
     161                 :   /*
     162                 :    * The following two functions exist because of the way that Xray wrappers
     163                 :    * work. In order to allow scriptable helpers to define non-IDL defined but
     164                 :    * still "safe" properties for Xray wrappers, we call into the scriptable
     165                 :    * helper with |obj| being the wrapper.
     166                 :    *
     167                 :    * Ideally, that would be the end of the story, however due to complications
     168                 :    * dealing with document.domain, it's possible to end up in a scriptable
     169                 :    * helper with a wrapper, even though we should be treating the lookup as a
     170                 :    * transparent one.
     171                 :    */
     172                 :   static bool ObjectIsNativeWrapper(JSContext* cx, JSObject* obj);
     173                 : 
     174                 :   static nsISupports *GetNative(nsIXPConnectWrappedNative *wrapper, JSObject *obj);
     175                 : 
     176            9863 :   static nsIXPConnect *XPConnect()
     177                 :   {
     178            9863 :     return sXPConnect;
     179                 :   }
     180                 : 
     181                 : protected:
     182                 :   friend nsIClassInfo* NS_GetDOMClassInfoInstance(nsDOMClassInfoID aID);
     183                 : 
     184                 :   const nsDOMClassInfoData* mData;
     185                 : 
     186               0 :   virtual void PreserveWrapper(nsISupports *aNative)
     187                 :   {
     188               0 :   }
     189                 : 
     190           26837 :   virtual PRUint32 GetInterfacesBitmap()
     191                 :   {
     192           26837 :     return mData->mInterfacesBitmap;
     193                 :   }
     194                 : 
     195                 :   static nsresult Init();
     196                 :   static nsresult RegisterClassName(PRInt32 aDOMClassInfoID);
     197                 :   static nsresult RegisterClassProtos(PRInt32 aDOMClassInfoID);
     198                 :   static nsresult RegisterExternalClasses();
     199                 :   nsresult ResolveConstructor(JSContext *cx, JSObject *obj,
     200                 :                               JSObject **objp);
     201                 : 
     202                 :   // Checks if id is a number and returns the number, if aIsNumber is
     203                 :   // non-null it's set to true if the id is a number and false if it's
     204                 :   // not a number. If id is not a number this method returns -1
     205                 :   static PRInt32 GetArrayIndexFromId(JSContext *cx, jsid id,
     206                 :                                      bool *aIsNumber = nsnull);
     207                 : 
     208               0 :   static inline bool IsReadonlyReplaceable(jsid id)
     209                 :   {
     210               0 :     return (id == sParent_id       ||
     211               0 :             id == sScrollbars_id   ||
     212               0 :             id == sContent_id      ||
     213               0 :             id == sMenubar_id      ||
     214               0 :             id == sToolbar_id      ||
     215               0 :             id == sLocationbar_id  ||
     216               0 :             id == sPersonalbar_id  ||
     217               0 :             id == sStatusbar_id    ||
     218               0 :             id == sControllers_id  ||
     219               0 :             id == sScrollX_id      ||
     220               0 :             id == sScrollY_id      ||
     221               0 :             id == sScrollMaxX_id   ||
     222               0 :             id == sScrollMaxY_id   ||
     223               0 :             id == sLength_id       ||
     224               0 :             id == sFrames_id       ||
     225               0 :             id == sSelf_id         ||
     226               0 :             id == sURL_id);
     227                 :   }
     228                 : 
     229               0 :   static inline bool IsWritableReplaceable(jsid id)
     230                 :   {
     231               0 :     return (id == sInnerHeight_id  ||
     232               0 :             id == sInnerWidth_id   ||
     233               0 :             id == sOpener_id       ||
     234               0 :             id == sOuterHeight_id  ||
     235               0 :             id == sOuterWidth_id   ||
     236               0 :             id == sScreenX_id      ||
     237               0 :             id == sScreenY_id      ||
     238               0 :             id == sStatus_id       ||
     239               0 :             id == sName_id);
     240                 :   }
     241                 : 
     242                 :   static nsIXPConnect *sXPConnect;
     243                 :   static nsIScriptSecurityManager *sSecMan;
     244                 : 
     245                 :   // nsIXPCScriptable code
     246                 :   static nsresult DefineStaticJSVals(JSContext *cx);
     247                 : 
     248                 :   static bool sIsInitialized;
     249                 :   static bool sDisableDocumentAllSupport;
     250                 :   static bool sDisableGlobalScopePollutionSupport;
     251                 : 
     252                 : public:
     253                 :   static jsid sParent_id;
     254                 :   static jsid sScrollbars_id;
     255                 :   static jsid sLocation_id;
     256                 :   static jsid sConstructor_id;
     257                 :   static jsid s_content_id;
     258                 :   static jsid sContent_id;
     259                 :   static jsid sMenubar_id;
     260                 :   static jsid sToolbar_id;
     261                 :   static jsid sLocationbar_id;
     262                 :   static jsid sPersonalbar_id;
     263                 :   static jsid sStatusbar_id;
     264                 :   static jsid sDialogArguments_id;
     265                 :   static jsid sControllers_id;
     266                 :   static jsid sLength_id;
     267                 :   static jsid sInnerHeight_id;
     268                 :   static jsid sInnerWidth_id;
     269                 :   static jsid sOuterHeight_id;
     270                 :   static jsid sOuterWidth_id;
     271                 :   static jsid sScreenX_id;
     272                 :   static jsid sScreenY_id;
     273                 :   static jsid sStatus_id;
     274                 :   static jsid sName_id;
     275                 :   static jsid sScrollX_id;
     276                 :   static jsid sScrollY_id;
     277                 :   static jsid sScrollMaxX_id;
     278                 :   static jsid sScrollMaxY_id;
     279                 :   static jsid sItem_id;
     280                 :   static jsid sNamedItem_id;
     281                 :   static jsid sEnumerate_id;
     282                 :   static jsid sNavigator_id;
     283                 :   static jsid sDocument_id;
     284                 :   static jsid sFrames_id;
     285                 :   static jsid sSelf_id;
     286                 :   static jsid sOpener_id;
     287                 :   static jsid sAll_id;
     288                 :   static jsid sTags_id;
     289                 :   static jsid sAddEventListener_id;
     290                 :   static jsid sBaseURIObject_id;
     291                 :   static jsid sNodePrincipal_id;
     292                 :   static jsid sDocumentURIObject_id;
     293                 :   static jsid sJava_id;
     294                 :   static jsid sPackages_id;
     295                 :   static jsid sWrappedJSObject_id;
     296                 :   static jsid sURL_id;
     297                 :   static jsid sKeyPath_id;
     298                 :   static jsid sAutoIncrement_id;
     299                 :   static jsid sUnique_id;
     300                 :   static jsid sMultiEntry_id;
     301                 :   static jsid sOnload_id;
     302                 :   static jsid sOnerror_id;
     303                 : 
     304                 : protected:
     305                 :   static JSPropertyOp sXPCNativeWrapperGetPropertyOp;
     306                 :   static JSPropertyOp sXrayWrapperPropertyHolderGetPropertyOp;
     307                 : };
     308                 : 
     309                 : 
     310                 : inline
     311                 : const nsQueryInterface
     312               0 : do_QueryWrappedNative(nsIXPConnectWrappedNative *wrapper, JSObject *obj)
     313                 : {
     314               0 :   return nsQueryInterface(nsDOMClassInfo::GetNative(wrapper, obj));
     315                 : }
     316                 : 
     317                 : inline
     318                 : const nsQueryInterfaceWithError
     319                 : do_QueryWrappedNative(nsIXPConnectWrappedNative *wrapper, JSObject *obj,
     320                 :                       nsresult *aError)
     321                 : 
     322                 : {
     323                 :   return nsQueryInterfaceWithError(nsDOMClassInfo::GetNative(wrapper, obj),
     324                 :                                    aError);
     325                 : }
     326                 : 
     327                 : inline
     328                 : nsQueryInterface
     329            7077 : do_QueryWrapper(JSContext *cx, JSObject *obj)
     330                 : {
     331                 :   nsISupports *native =
     332            7077 :     nsDOMClassInfo::XPConnect()->GetNativeOfWrapper(cx, obj);
     333            7077 :   return nsQueryInterface(native);
     334                 : }
     335                 : 
     336                 : inline
     337                 : nsQueryInterfaceWithError
     338               0 : do_QueryWrapper(JSContext *cx, JSObject *obj, nsresult* error)
     339                 : {
     340                 :   nsISupports *native =
     341               0 :     nsDOMClassInfo::XPConnect()->GetNativeOfWrapper(cx, obj);
     342               0 :   return nsQueryInterfaceWithError(native, error);
     343                 : }
     344                 : 
     345                 : 
     346                 : typedef nsDOMClassInfo nsDOMGenericSH;
     347                 : 
     348                 : // Makes sure that the wrapper is preserved if new properties are added.
     349                 : class nsEventTargetSH : public nsDOMGenericSH
     350                 : {
     351                 : protected:
     352             284 :   nsEventTargetSH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData)
     353                 :   {
     354             284 :   }
     355                 : 
     356             394 :   virtual ~nsEventTargetSH()
     357             284 :   {
     358             788 :   }
     359                 : public:
     360                 :   NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
     361                 :                        JSObject *globalObj, JSObject **parentObj);
     362                 :   NS_IMETHOD AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     363                 :                          JSObject *obj, jsid id, jsval *vp, bool *_retval);
     364                 : 
     365                 :   virtual void PreserveWrapper(nsISupports *aNative);
     366                 : 
     367             110 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
     368                 :   {
     369             110 :     return new nsEventTargetSH(aData);
     370                 :   }
     371                 : };
     372                 : 
     373                 : // Window scriptable helper
     374                 : 
     375                 : class nsWindowSH : public nsDOMGenericSH
     376                 : {
     377                 : protected:
     378               0 :   nsWindowSH(nsDOMClassInfoData *aData) : nsDOMGenericSH(aData)
     379                 :   {
     380               0 :   }
     381                 : 
     382               0 :   virtual ~nsWindowSH()
     383               0 :   {
     384               0 :   }
     385                 : 
     386                 :   static nsresult GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
     387                 :                                 JSObject *obj, jsid id, bool *did_resolve);
     388                 : 
     389                 : public:
     390                 :   NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
     391                 :                        JSObject *globalObj, JSObject **parentObj);
     392                 : #ifdef DEBUG
     393               0 :   NS_IMETHOD PostCreate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     394                 :                         JSObject *obj)
     395                 :   {
     396               0 :     nsCOMPtr<nsIScriptGlobalObject> sgo(do_QueryWrappedNative(wrapper));
     397                 : 
     398               0 :     NS_ASSERTION(!sgo || sgo->GetGlobalJSObject() == nsnull,
     399                 :                  "Multiple wrappers created for global object!");
     400                 : 
     401               0 :     return NS_OK;
     402                 :   }
     403               0 :   NS_IMETHOD GetScriptableFlags(PRUint32 *aFlags)
     404                 :   {
     405                 :     PRUint32 flags;
     406               0 :     nsresult rv = nsDOMGenericSH::GetScriptableFlags(&flags);
     407               0 :     if (NS_SUCCEEDED(rv)) {
     408               0 :       *aFlags = flags | nsIXPCScriptable::WANT_POSTCREATE;
     409                 :     }
     410                 : 
     411               0 :     return rv;
     412                 :   }
     413                 : #endif
     414                 :   NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     415                 :                          JSObject *obj, jsid id, jsval *vp, bool *_retval);
     416                 :   NS_IMETHOD Enumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     417                 :                        JSObject *obj, bool *_retval);
     418                 :   NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     419                 :                         JSObject *obj, jsid id, PRUint32 flags,
     420                 :                         JSObject **objp, bool *_retval);
     421                 :   NS_IMETHOD Finalize(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     422                 :                       JSObject *obj);
     423                 :   NS_IMETHOD OuterObject(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
     424                 :                          JSObject * obj, JSObject * *_retval);
     425                 : 
     426                 :   static JSBool GlobalScopePolluterNewResolve(JSContext *cx, JSObject *obj,
     427                 :                                               jsid id, unsigned flags,
     428                 :                                               JSObject **objp);
     429                 :   static JSBool GlobalScopePolluterGetProperty(JSContext *cx, JSObject *obj,
     430                 :                                                jsid id, jsval *vp);
     431                 :   static JSBool SecurityCheckOnAddDelProp(JSContext *cx, JSObject *obj, jsid id,
     432                 :                                           jsval *vp);
     433                 :   static JSBool SecurityCheckOnSetProp(JSContext *cx, JSObject *obj, jsid id,
     434                 :                                        JSBool strict, jsval *vp);
     435                 :   static void InvalidateGlobalScopePolluter(JSContext *cx, JSObject *obj);
     436                 :   static nsresult InstallGlobalScopePolluter(JSContext *cx, JSObject *obj,
     437                 :                                              nsIHTMLDocument *doc);
     438               0 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
     439                 :   {
     440               0 :     return new nsWindowSH(aData);
     441                 :   }
     442                 : };
     443                 : 
     444                 : // Location scriptable helper
     445                 : 
     446                 : class nsLocationSH : public nsDOMGenericSH
     447                 : {
     448                 : protected:
     449               0 :   nsLocationSH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData)
     450                 :   {
     451               0 :   }
     452                 : 
     453               0 :   virtual ~nsLocationSH()
     454               0 :   {
     455               0 :   }
     456                 : 
     457                 : public:
     458                 :   NS_IMETHOD CheckAccess(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     459                 :                          JSObject *obj, jsid id, PRUint32 mode,
     460                 :                          jsval *vp, bool *_retval);
     461                 : 
     462                 :   NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
     463                 :                        JSObject *globalObj, JSObject **parentObj);
     464                 : 
     465               0 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
     466                 :   {
     467               0 :     return new nsLocationSH(aData);
     468                 :   }
     469                 : };
     470                 : 
     471                 : 
     472                 : // Navigator scriptable helper
     473                 : 
     474                 : class nsNavigatorSH : public nsDOMGenericSH
     475                 : {
     476                 : protected:
     477               0 :   nsNavigatorSH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData)
     478                 :   {
     479               0 :   }
     480                 : 
     481               0 :   virtual ~nsNavigatorSH()
     482               0 :   {
     483               0 :   }
     484                 : 
     485                 : public:
     486                 :   NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
     487                 :                        JSObject *globalObj, JSObject **parentObj);
     488                 :   NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     489                 :                         JSObject *obj, jsid id, PRUint32 flags,
     490                 :                         JSObject **objp, bool *_retval);
     491                 : 
     492               0 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
     493                 :   {
     494               0 :     return new nsNavigatorSH(aData);
     495                 :   }
     496                 : };
     497                 : 
     498                 : 
     499                 : // DOM Node helper, this class deals with setting the parent for the
     500                 : // wrappers
     501                 : 
     502                 : class nsNodeSH : public nsDOMGenericSH
     503                 : {
     504                 : protected:
     505             735 :   nsNodeSH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData)
     506                 :   {
     507             735 :   }
     508                 : 
     509             964 :   virtual ~nsNodeSH()
     510             732 :   {
     511            1928 :   }
     512                 : 
     513                 :   // Helper to check whether a capability is enabled
     514                 :   bool IsCapabilityEnabled(const char* aCapability);
     515                 : 
     516           17082 :   inline bool IsPrivilegedScript() {
     517           17082 :     return IsCapabilityEnabled("UniversalXPConnect");
     518                 :   }
     519                 : 
     520                 : public:
     521                 :   NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
     522                 :                        JSObject *globalObj, JSObject **parentObj);
     523                 :   NS_IMETHOD PostCreatePrototype(JSContext * cx, JSObject * proto);
     524                 :   NS_IMETHOD AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     525                 :                          JSObject *obj, jsid id, jsval *vp, bool *_retval);
     526                 :   NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     527                 :                         JSObject *obj, jsid id, PRUint32 flags,
     528                 :                         JSObject **objp, bool *_retval);
     529                 :   NS_IMETHOD GetFlags(PRUint32 *aFlags);
     530                 : 
     531                 :   virtual void PreserveWrapper(nsISupports *aNative);
     532                 : 
     533             233 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
     534                 :   {
     535             233 :     return new nsNodeSH(aData);
     536                 :   }
     537                 : };
     538                 : 
     539                 : 
     540                 : // Element helper
     541                 : 
     542                 : class nsElementSH : public nsNodeSH
     543                 : {
     544                 : protected:
     545             243 :   nsElementSH(nsDOMClassInfoData* aData) : nsNodeSH(aData)
     546                 :   {
     547             243 :   }
     548                 : 
     549             484 :   virtual ~nsElementSH()
     550             242 :   {
     551             968 :   }
     552                 : 
     553                 : public:
     554                 :   NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
     555                 :                        JSObject *globalObj, JSObject **parentObj);
     556                 :   NS_IMETHOD PostCreate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     557                 :                         JSObject *obj);
     558                 :   NS_IMETHOD Enumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     559                 :                        JSObject *obj, bool *_retval);
     560                 : 
     561             243 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
     562                 :   {
     563             243 :     return new nsElementSH(aData);
     564                 :   }
     565                 : };
     566                 : 
     567                 : 
     568                 : // Generic array scriptable helper
     569                 : 
     570                 : class nsGenericArraySH : public nsDOMClassInfo
     571                 : {
     572                 : protected:
     573              33 :   nsGenericArraySH(nsDOMClassInfoData* aData) : nsDOMClassInfo(aData)
     574                 :   {
     575              33 :   }
     576                 : 
     577              33 :   virtual ~nsGenericArraySH()
     578              33 :   {
     579              66 :   }
     580                 :   
     581                 : public:
     582                 :   NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     583                 :                         JSObject *obj, jsid id, PRUint32 flags,
     584                 :                         JSObject **objp, bool *_retval);
     585                 :   NS_IMETHOD Enumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     586                 :                        JSObject *obj, bool *_retval);
     587                 :   
     588                 :   virtual nsresult GetLength(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     589                 :                              JSObject *obj, PRUint32 *length);
     590                 : 
     591                 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
     592                 :   {
     593                 :     return new nsGenericArraySH(aData);
     594                 :   }
     595                 : };
     596                 : 
     597                 : 
     598                 : // Array scriptable helper
     599                 : 
     600                 : class nsArraySH : public nsGenericArraySH
     601                 : {
     602                 : protected:
     603              17 :   nsArraySH(nsDOMClassInfoData* aData) : nsGenericArraySH(aData)
     604                 :   {
     605              17 :   }
     606                 : 
     607              17 :   virtual ~nsArraySH()
     608              17 :   {
     609              34 :   }
     610                 : 
     611                 :   // Subclasses need to override this, if the implementation can't fail it's
     612                 :   // allowed to not set *aResult.
     613                 :   virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
     614                 :                                  nsWrapperCache **aCache, nsresult *aResult) = 0;
     615                 : 
     616                 : public:
     617                 :   NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     618                 :                          JSObject *obj, jsid id, jsval *vp, bool *_retval);
     619                 : 
     620                 : private:
     621                 :   // Not implemented, nothing should create an instance of this class.
     622                 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData);
     623                 : };
     624                 : 
     625                 : 
     626                 : // NamedArray helper
     627                 : 
     628                 : class nsNamedArraySH : public nsArraySH
     629                 : {
     630                 : protected:
     631              17 :   nsNamedArraySH(nsDOMClassInfoData* aData) : nsArraySH(aData)
     632                 :   {
     633              17 :   }
     634                 : 
     635              17 :   virtual ~nsNamedArraySH()
     636              17 :   {
     637              34 :   }
     638                 : 
     639                 :   NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     640                 :                         JSObject *obj, jsid id, PRUint32 flags,
     641                 :                         JSObject **objp, bool *_retval);
     642                 : 
     643                 :   virtual nsISupports* GetNamedItem(nsISupports *aNative,
     644                 :                                     const nsAString& aName,
     645                 :                                     nsWrapperCache **cache,
     646                 :                                     nsresult *aResult) = 0;
     647                 : 
     648                 : public:
     649                 :   NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     650                 :                          JSObject *obj, jsid id, jsval *vp, bool *_retval);
     651                 : 
     652                 : private:
     653                 :   // Not implemented, nothing should create an instance of this class.
     654                 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData);
     655                 : };
     656                 : 
     657                 : 
     658                 : // NamedNodeMap helper
     659                 : 
     660                 : class nsNamedNodeMapSH : public nsNamedArraySH
     661                 : {
     662                 : protected:
     663              17 :   nsNamedNodeMapSH(nsDOMClassInfoData* aData) : nsNamedArraySH(aData)
     664                 :   {
     665              17 :   }
     666                 : 
     667              34 :   virtual ~nsNamedNodeMapSH()
     668              17 :   {
     669              68 :   }
     670                 : 
     671                 :   virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
     672                 :                                  nsWrapperCache **aCache, nsresult *aResult);
     673                 : 
     674                 :   // Override nsNamedArraySH::GetNamedItem()
     675                 :   virtual nsISupports* GetNamedItem(nsISupports *aNative,
     676                 :                                     const nsAString& aName,
     677                 :                                     nsWrapperCache **cache,
     678                 :                                     nsresult *aResult);
     679                 : 
     680                 : public:
     681              17 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
     682                 :   {
     683              17 :     return new nsNamedNodeMapSH(aData);
     684                 :   }
     685                 : };
     686                 : 
     687                 : 
     688                 : // DOMStringMap helper for .dataset property on elements.
     689                 : 
     690                 : class nsDOMStringMapSH : public nsDOMGenericSH
     691                 : {
     692                 : public:
     693               0 :   nsDOMStringMapSH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData)
     694                 :   {
     695               0 :   }
     696                 : 
     697               0 :   virtual ~nsDOMStringMapSH()
     698               0 :   {
     699               0 :   }
     700                 : 
     701                 : public:
     702                 :   NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     703                 :                         JSObject *obj, jsid id, PRUint32 flags,
     704                 :                         JSObject **objp, bool *_retval);
     705                 :   NS_IMETHOD Enumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     706                 :                        JSObject *obj, bool *_retval);
     707                 :   NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
     708                 :                        JSObject *globalObj, JSObject **parentObj);
     709                 :   NS_IMETHOD DelProperty(nsIXPConnectWrappedNative *wrapper,
     710                 :                          JSContext *cx, JSObject *obj, jsid id,
     711                 :                          jsval *vp, bool *_retval);
     712                 :   NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     713                 :                          JSObject *obj, jsid id, jsval *vp, bool *_retval);
     714                 :   NS_IMETHOD SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     715                 :                          JSObject *obj, jsid id, jsval *vp, bool *_retval);
     716                 : 
     717                 :   bool JSIDToProp(const jsid& aId, nsAString& aResult);
     718                 : 
     719               0 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
     720                 :   {
     721               0 :     return new nsDOMStringMapSH(aData);
     722                 :   }
     723                 : };
     724                 : 
     725                 : 
     726                 : // Document helper, for document.location and document.on*
     727                 : 
     728                 : class nsDocumentSH : public nsNodeSH
     729                 : {
     730                 : public:
     731             242 :   nsDocumentSH(nsDOMClassInfoData* aData) : nsNodeSH(aData)
     732                 :   {
     733             242 :   }
     734                 : 
     735             482 :   virtual ~nsDocumentSH()
     736             241 :   {
     737             964 :   }
     738                 : 
     739                 : public:
     740                 :   NS_IMETHOD PostCreatePrototype(JSContext * cx, JSObject * proto);
     741                 :   NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     742                 :                         JSObject *obj, jsid id, PRUint32 flags,
     743                 :                         JSObject **objp, bool *_retval);
     744                 :   NS_IMETHOD GetFlags(PRUint32* aFlags);
     745                 :   NS_IMETHOD PostCreate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     746                 :                         JSObject *obj);
     747                 : 
     748             242 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
     749                 :   {
     750             242 :     return new nsDocumentSH(aData);
     751                 :   }
     752                 : };
     753                 : 
     754                 : 
     755                 : // HTMLDocument helper
     756                 : 
     757                 : class nsHTMLDocumentSH : public nsDocumentSH
     758                 : {
     759                 : protected:
     760               0 :   nsHTMLDocumentSH(nsDOMClassInfoData* aData) : nsDocumentSH(aData)
     761                 :   {
     762               0 :   }
     763                 : 
     764               0 :   virtual ~nsHTMLDocumentSH()
     765               0 :   {
     766               0 :   }
     767                 : 
     768                 :   static JSBool GetDocumentAllNodeList(JSContext *cx, JSObject *obj,
     769                 :                                        nsDocument *doc,
     770                 :                                        nsContentList **nodeList);
     771                 : 
     772                 : public:
     773                 :   static JSBool DocumentAllGetProperty(JSContext *cx, JSObject *obj, jsid id,
     774                 :                                        jsval *vp);
     775                 :   static JSBool DocumentAllNewResolve(JSContext *cx, JSObject *obj, jsid id,
     776                 :                                       unsigned flags, JSObject **objp);
     777                 :   static void ReleaseDocument(JSContext *cx, JSObject *obj);
     778                 :   static JSBool CallToGetPropMapper(JSContext *cx, unsigned argc, jsval *vp);
     779                 :   static JSBool DocumentAllHelperGetProperty(JSContext *cx, JSObject *obj,
     780                 :                                              jsid id, jsval *vp);
     781                 :   static JSBool DocumentAllHelperNewResolve(JSContext *cx, JSObject *obj,
     782                 :                                             jsid id, unsigned flags,
     783                 :                                             JSObject **objp);
     784                 :   static JSBool DocumentAllTagsNewResolve(JSContext *cx, JSObject *obj,
     785                 :                                           jsid id, unsigned flags,
     786                 :                                           JSObject **objp);
     787                 : 
     788                 :   NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     789                 :                         JSObject *obj, jsid id, PRUint32 flags,
     790                 :                         JSObject **objp, bool *_retval);
     791                 :   NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     792                 :                          JSObject *obj, jsid id, jsval *vp, bool *_retval);
     793                 : 
     794               0 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
     795                 :   {
     796               0 :     return new nsHTMLDocumentSH(aData);
     797                 :   }
     798                 : };
     799                 : 
     800                 : 
     801                 : // HTMLFormElement helper
     802                 : 
     803                 : class nsHTMLFormElementSH : public nsElementSH
     804                 : {
     805                 : protected:
     806               0 :   nsHTMLFormElementSH(nsDOMClassInfoData* aData) : nsElementSH(aData)
     807                 :   {
     808               0 :   }
     809                 : 
     810               0 :   virtual ~nsHTMLFormElementSH()
     811               0 :   {
     812               0 :   }
     813                 : 
     814                 :   static nsresult FindNamedItem(nsIForm *aForm, jsid id,
     815                 :                                 nsISupports **aResult, nsWrapperCache **aCache);
     816                 : 
     817                 : public:
     818                 :   NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     819                 :                         JSObject *obj, jsid id, PRUint32 flags,
     820                 :                         JSObject **objp, bool *_retval);
     821                 :   NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     822                 :                          JSObject *obj, jsid id, jsval *vp,
     823                 :                          bool *_retval);
     824                 : 
     825                 :   NS_IMETHOD NewEnumerate(nsIXPConnectWrappedNative *wrapper,
     826                 :                           JSContext *cx, JSObject *obj,
     827                 :                           PRUint32 enum_op, jsval *statep,
     828                 :                           jsid *idp, bool *_retval);
     829                 : 
     830               0 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
     831                 :   {
     832               0 :     return new nsHTMLFormElementSH(aData);
     833                 :   }
     834                 : };
     835                 : 
     836                 : 
     837                 : // HTMLSelectElement helper
     838                 : 
     839                 : class nsHTMLSelectElementSH : public nsElementSH
     840                 : {
     841                 : protected:
     842               0 :   nsHTMLSelectElementSH(nsDOMClassInfoData* aData) : nsElementSH(aData)
     843                 :   {
     844               0 :   }
     845                 : 
     846               0 :   virtual ~nsHTMLSelectElementSH()
     847               0 :   {
     848               0 :   }
     849                 : 
     850                 : public:
     851                 :   NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     852                 :                         JSObject *obj, jsid id, PRUint32 flags,
     853                 :                         JSObject **objp, bool *_retval);
     854                 :   NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     855                 :                          JSObject *obj, jsid id, jsval *vp,
     856                 :                          bool *_retval);
     857                 :   NS_IMETHOD SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     858                 :                          JSObject *obj, jsid id, jsval *vp, bool *_retval);
     859                 : 
     860                 :   static nsresult SetOption(JSContext *cx, jsval *vp, PRUint32 aIndex,
     861                 :                             nsIDOMHTMLOptionsCollection *aOptCollection);
     862                 : 
     863               0 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
     864                 :   {
     865               0 :     return new nsHTMLSelectElementSH(aData);
     866                 :   }
     867                 : };
     868                 : 
     869                 : 
     870                 : // HTMLEmbed/Object/AppletElement helper
     871                 : 
     872                 : class nsHTMLPluginObjElementSH : public nsElementSH
     873                 : {
     874                 : protected:
     875               0 :   nsHTMLPluginObjElementSH(nsDOMClassInfoData* aData)
     876               0 :     : nsElementSH(aData)
     877                 :   {
     878               0 :   }
     879                 : 
     880               0 :   virtual ~nsHTMLPluginObjElementSH()
     881               0 :   {
     882               0 :   }
     883                 : 
     884                 :   static nsresult GetPluginInstanceIfSafe(nsIXPConnectWrappedNative *aWrapper,
     885                 :                                           JSObject *obj,
     886                 :                                           nsNPAPIPluginInstance **aResult);
     887                 : 
     888                 :   static nsresult GetPluginJSObject(JSContext *cx, JSObject *obj,
     889                 :                                     nsNPAPIPluginInstance *plugin_inst,
     890                 :                                     JSObject **plugin_obj,
     891                 :                                     JSObject **plugin_proto);
     892                 : 
     893                 : public:
     894                 :   NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     895                 :                         JSObject *obj, jsid id, PRUint32 flags,
     896                 :                         JSObject **objp, bool *_retval);
     897                 :   NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
     898                 :                        JSObject *globalObj, JSObject **parentObj);
     899                 :   NS_IMETHOD PostCreate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     900                 :                         JSObject *obj);
     901                 :   NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     902                 :                          JSObject *obj, jsid id, jsval *vp, bool *_retval);
     903                 :   NS_IMETHOD SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     904                 :                          JSObject *obj, jsid id, jsval *vp, bool *_retval);
     905                 :   NS_IMETHOD Call(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
     906                 :                   JSObject *obj, PRUint32 argc, jsval *argv, jsval *vp,
     907                 :                   bool *_retval);
     908                 : 
     909                 : 
     910                 :   static nsresult SetupProtoChain(nsIXPConnectWrappedNative *wrapper,
     911                 :                                   JSContext *cx, JSObject *obj);
     912                 : 
     913               0 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
     914                 :   {
     915               0 :     return new nsHTMLPluginObjElementSH(aData);
     916                 :   }
     917                 : };
     918                 : 
     919                 : 
     920                 : // Plugin helper
     921                 : 
     922                 : class nsPluginSH : public nsNamedArraySH
     923                 : {
     924                 : protected:
     925               0 :   nsPluginSH(nsDOMClassInfoData* aData) : nsNamedArraySH(aData)
     926                 :   {
     927               0 :   }
     928                 : 
     929               0 :   virtual ~nsPluginSH()
     930               0 :   {
     931               0 :   }
     932                 : 
     933                 :   virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
     934                 :                                  nsWrapperCache **aCache, nsresult *aResult);
     935                 : 
     936                 :   // Override nsNamedArraySH::GetNamedItem()
     937                 :   virtual nsISupports* GetNamedItem(nsISupports *aNative,
     938                 :                                     const nsAString& aName,
     939                 :                                     nsWrapperCache **cache,
     940                 :                                     nsresult *aResult);
     941                 : 
     942                 : public:
     943               0 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
     944                 :   {
     945               0 :     return new nsPluginSH(aData);
     946                 :   }
     947                 : };
     948                 : 
     949                 : 
     950                 : // PluginArray helper
     951                 : 
     952                 : class nsPluginArraySH : public nsNamedArraySH
     953                 : {
     954                 : protected:
     955               0 :   nsPluginArraySH(nsDOMClassInfoData* aData) : nsNamedArraySH(aData)
     956                 :   {
     957               0 :   }
     958                 : 
     959               0 :   virtual ~nsPluginArraySH()
     960               0 :   {
     961               0 :   }
     962                 : 
     963                 :   virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
     964                 :                                  nsWrapperCache **aCache, nsresult *aResult);
     965                 : 
     966                 :   // Override nsNamedArraySH::GetNamedItem()
     967                 :   virtual nsISupports* GetNamedItem(nsISupports *aNative,
     968                 :                                     const nsAString& aName,
     969                 :                                     nsWrapperCache **cache,
     970                 :                                     nsresult *aResult);
     971                 : 
     972                 : public:
     973               0 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
     974                 :   {
     975               0 :     return new nsPluginArraySH(aData);
     976                 :   }
     977                 : };
     978                 : 
     979                 : 
     980                 : // MimeTypeArray helper
     981                 : 
     982                 : class nsMimeTypeArraySH : public nsNamedArraySH
     983                 : {
     984                 : protected:
     985               0 :   nsMimeTypeArraySH(nsDOMClassInfoData* aData) : nsNamedArraySH(aData)
     986                 :   {
     987               0 :   }
     988                 : 
     989               0 :   virtual ~nsMimeTypeArraySH()
     990               0 :   {
     991               0 :   }
     992                 : 
     993                 :   virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
     994                 :                                  nsWrapperCache **aCache, nsresult *aResult);
     995                 : 
     996                 :   // Override nsNamedArraySH::GetNamedItem()
     997                 :   virtual nsISupports* GetNamedItem(nsISupports *aNative,
     998                 :                                     const nsAString& aName,
     999                 :                                     nsWrapperCache **cache,
    1000                 :                                     nsresult *aResult);
    1001                 : 
    1002                 : public:
    1003               0 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
    1004                 :   {
    1005               0 :     return new nsMimeTypeArraySH(aData);
    1006                 :   }
    1007                 : };
    1008                 : 
    1009                 : 
    1010                 : // String array helper
    1011                 : 
    1012                 : class nsStringArraySH : public nsGenericArraySH
    1013                 : {
    1014                 : protected:
    1015              16 :   nsStringArraySH(nsDOMClassInfoData* aData) : nsGenericArraySH(aData)
    1016                 :   {
    1017              16 :   }
    1018                 : 
    1019              16 :   virtual ~nsStringArraySH()
    1020              16 :   {
    1021              32 :   }
    1022                 : 
    1023                 :   virtual nsresult GetStringAt(nsISupports *aNative, PRInt32 aIndex,
    1024                 :                                nsAString& aResult) = 0;
    1025                 : 
    1026                 : public:
    1027                 :   NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
    1028                 :                          JSObject *obj, jsid id, jsval *vp, bool *_retval);
    1029                 : };
    1030                 : 
    1031                 : 
    1032                 : // History helper
    1033                 : 
    1034                 : class nsHistorySH : public nsStringArraySH
    1035                 : {
    1036                 : protected:
    1037               0 :   nsHistorySH(nsDOMClassInfoData* aData) : nsStringArraySH(aData)
    1038                 :   {
    1039               0 :   }
    1040                 : 
    1041               0 :   virtual ~nsHistorySH()
    1042               0 :   {
    1043               0 :   }
    1044                 : 
    1045                 :   virtual nsresult GetStringAt(nsISupports *aNative, PRInt32 aIndex,
    1046                 :                                nsAString& aResult);
    1047                 : 
    1048                 : public:
    1049                 :   NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
    1050                 :                        JSObject *globalObj, JSObject **parentObj);
    1051                 :   NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
    1052                 :                          JSObject *obj, jsid id, jsval *vp, bool *_retval);
    1053                 : 
    1054               0 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
    1055                 :   {
    1056               0 :     return new nsHistorySH(aData);
    1057                 :   }
    1058                 : };
    1059                 : 
    1060                 : // StringList scriptable helper
    1061                 : 
    1062                 : class nsStringListSH : public nsStringArraySH
    1063                 : {
    1064                 : protected:
    1065              16 :   nsStringListSH(nsDOMClassInfoData* aData) : nsStringArraySH(aData)
    1066                 :   {
    1067              16 :   }
    1068                 : 
    1069              32 :   virtual ~nsStringListSH()
    1070              16 :   {
    1071              64 :   }
    1072                 : 
    1073                 :   virtual nsresult GetStringAt(nsISupports *aNative, PRInt32 aIndex,
    1074                 :                                nsAString& aResult);
    1075                 : 
    1076                 : public:
    1077                 :   // Inherit GetProperty, Enumerate from nsStringArraySH
    1078                 :   
    1079              16 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
    1080                 :   {
    1081              16 :     return new nsStringListSH(aData);
    1082                 :   }
    1083                 : };
    1084                 : 
    1085                 : 
    1086                 : // DOMTokenList scriptable helper
    1087                 : 
    1088                 : class nsDOMTokenListSH : public nsStringArraySH
    1089                 : {
    1090                 : protected:
    1091               0 :   nsDOMTokenListSH(nsDOMClassInfoData* aData) : nsStringArraySH(aData)
    1092                 :   {
    1093               0 :   }
    1094                 : 
    1095               0 :   virtual ~nsDOMTokenListSH()
    1096               0 :   {
    1097               0 :   }
    1098                 : 
    1099                 :   virtual nsresult GetStringAt(nsISupports *aNative, PRInt32 aIndex,
    1100                 :                                nsAString& aResult);
    1101                 : 
    1102                 : public:
    1103                 : 
    1104               0 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
    1105                 :   {
    1106               0 :     return new nsDOMTokenListSH(aData);
    1107                 :   }
    1108                 : };
    1109                 : 
    1110                 : 
    1111                 : // MediaList helper
    1112                 : 
    1113                 : class nsMediaListSH : public nsStringArraySH
    1114                 : {
    1115                 : protected:
    1116               0 :   nsMediaListSH(nsDOMClassInfoData* aData) : nsStringArraySH(aData)
    1117                 :   {
    1118               0 :   }
    1119                 : 
    1120               0 :   virtual ~nsMediaListSH()
    1121               0 :   {
    1122               0 :   }
    1123                 : 
    1124                 :   virtual nsresult GetStringAt(nsISupports *aNative, PRInt32 aIndex,
    1125                 :                                nsAString& aResult);
    1126                 : 
    1127                 : public:
    1128               0 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
    1129                 :   {
    1130               0 :     return new nsMediaListSH(aData);
    1131                 :   }
    1132                 : };
    1133                 : 
    1134                 : 
    1135                 : // StyleSheetList helper
    1136                 : 
    1137                 : class nsStyleSheetListSH : public nsArraySH
    1138                 : {
    1139                 : protected:
    1140               0 :   nsStyleSheetListSH(nsDOMClassInfoData* aData) : nsArraySH(aData)
    1141                 :   {
    1142               0 :   }
    1143                 : 
    1144               0 :   virtual ~nsStyleSheetListSH()
    1145               0 :   {
    1146               0 :   }
    1147                 : 
    1148                 :   virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
    1149                 :                                  nsWrapperCache **aCache, nsresult *aResult);
    1150                 : 
    1151                 : public:
    1152               0 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
    1153                 :   {
    1154               0 :     return new nsStyleSheetListSH(aData);
    1155                 :   }
    1156                 : };
    1157                 : 
    1158                 : 
    1159                 : // CSSValueList helper
    1160                 : 
    1161                 : class nsCSSValueListSH : public nsArraySH
    1162                 : {
    1163                 : protected:
    1164               0 :   nsCSSValueListSH(nsDOMClassInfoData* aData) : nsArraySH(aData)
    1165                 :   {
    1166               0 :   }
    1167                 : 
    1168               0 :   virtual ~nsCSSValueListSH()
    1169               0 :   {
    1170               0 :   }
    1171                 : 
    1172                 :   virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
    1173                 :                                  nsWrapperCache **aCache, nsresult *aResult);
    1174                 : 
    1175                 : public:
    1176               0 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
    1177                 :   {
    1178               0 :     return new nsCSSValueListSH(aData);
    1179                 :   }
    1180                 : };
    1181                 : 
    1182                 : 
    1183                 : // CSSStyleDeclaration helper
    1184                 : 
    1185                 : class nsCSSStyleDeclSH : public nsStringArraySH
    1186                 : {
    1187                 : protected:
    1188               0 :   nsCSSStyleDeclSH(nsDOMClassInfoData* aData) : nsStringArraySH(aData)
    1189                 :   {
    1190               0 :   }
    1191                 : 
    1192               0 :   virtual ~nsCSSStyleDeclSH()
    1193               0 :   {
    1194               0 :   }
    1195                 : 
    1196                 :   virtual nsresult GetStringAt(nsISupports *aNative, PRInt32 aIndex,
    1197                 :                                nsAString& aResult);
    1198                 : 
    1199                 : public:
    1200                 :   NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
    1201                 :                        JSObject *globalObj, JSObject **parentObj);
    1202                 : 
    1203               0 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
    1204                 :   {
    1205               0 :     return new nsCSSStyleDeclSH(aData);
    1206                 :   }
    1207                 : };
    1208                 : 
    1209                 : 
    1210                 : // CSSRuleList helper
    1211                 : 
    1212                 : class nsCSSRuleListSH : public nsArraySH
    1213                 : {
    1214                 : protected:
    1215               0 :   nsCSSRuleListSH(nsDOMClassInfoData* aData) : nsArraySH(aData)
    1216                 :   {
    1217               0 :   }
    1218                 : 
    1219               0 :   virtual ~nsCSSRuleListSH()
    1220               0 :   {
    1221               0 :   }
    1222                 : 
    1223                 :   virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
    1224                 :                                  nsWrapperCache **aCache, nsresult *aResult);
    1225                 : 
    1226                 : public:
    1227               0 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
    1228                 :   {
    1229               0 :     return new nsCSSRuleListSH(aData);
    1230                 :   }
    1231                 : };
    1232                 : 
    1233                 : // ClientRectList helper
    1234                 : 
    1235                 : class nsClientRectListSH : public nsArraySH
    1236                 : {
    1237                 : protected:
    1238               0 :   nsClientRectListSH(nsDOMClassInfoData* aData) : nsArraySH(aData)
    1239                 :   {
    1240               0 :   }
    1241                 : 
    1242               0 :   virtual ~nsClientRectListSH()
    1243               0 :   {
    1244               0 :   }
    1245                 : 
    1246                 :   virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
    1247                 :                                  nsWrapperCache **aCache, nsresult *aResult);
    1248                 : 
    1249                 : public:
    1250               0 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
    1251                 :   {
    1252               0 :     return new nsClientRectListSH(aData);
    1253                 :   }
    1254                 : };
    1255                 : 
    1256                 : 
    1257                 : // PaintRequestList helper
    1258                 : 
    1259                 : class nsPaintRequestListSH : public nsArraySH
    1260                 : {
    1261                 : protected:
    1262               0 :   nsPaintRequestListSH(nsDOMClassInfoData* aData) : nsArraySH(aData)
    1263                 :   {
    1264               0 :   }
    1265                 : 
    1266               0 :   virtual ~nsPaintRequestListSH()
    1267               0 :   {
    1268               0 :   }
    1269                 : 
    1270                 :   virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
    1271                 :                                  nsWrapperCache **aCache, nsresult *aResult);
    1272                 : 
    1273                 : public:
    1274               0 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
    1275                 :   {
    1276               0 :     return new nsPaintRequestListSH(aData);
    1277                 :   }
    1278                 : };
    1279                 : 
    1280                 : class nsDOMTouchListSH : public nsArraySH
    1281                 : {
    1282                 : protected:
    1283               0 :   nsDOMTouchListSH(nsDOMClassInfoData* aData) : nsArraySH(aData)
    1284                 :   {
    1285               0 :   }
    1286                 : 
    1287               0 :   virtual ~nsDOMTouchListSH()
    1288               0 :   {
    1289               0 :   }
    1290                 : 
    1291                 :   virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
    1292                 :                                  nsWrapperCache **aCache, nsresult *aResult);
    1293                 : 
    1294                 : public:
    1295               0 :   static nsIClassInfo* doCreate(nsDOMClassInfoData* aData)
    1296                 :   {
    1297               0 :     return new nsDOMTouchListSH(aData);
    1298                 :   }
    1299                 : };
    1300                 : 
    1301                 : #ifdef MOZ_XUL
    1302                 : // TreeColumns helper
    1303                 : 
    1304                 : class nsTreeColumnsSH : public nsNamedArraySH
    1305                 : {
    1306                 : protected:
    1307               0 :   nsTreeColumnsSH(nsDOMClassInfoData* aData) : nsNamedArraySH(aData)
    1308                 :   {
    1309               0 :   }
    1310                 : 
    1311               0 :   virtual ~nsTreeColumnsSH()
    1312               0 :   {
    1313               0 :   }
    1314                 : 
    1315                 :   virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
    1316                 :                                  nsWrapperCache **aCache, nsresult *aResult);
    1317                 : 
    1318                 :   // Override nsNamedArraySH::GetNamedItem()
    1319                 :   virtual nsISupports* GetNamedItem(nsISupports *aNative,
    1320                 :                                     const nsAString& aName,
    1321                 :                                     nsWrapperCache **cache,
    1322                 :                                     nsresult *aResult);
    1323                 : 
    1324                 : public:
    1325               0 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
    1326                 :   {
    1327               0 :     return new nsTreeColumnsSH(aData);
    1328                 :   }
    1329                 : };
    1330                 : #endif
    1331                 : 
    1332                 : // WebApps Storage helpers
    1333                 : 
    1334                 : class nsStorageSH : public nsNamedArraySH
    1335                 : {
    1336                 : protected:
    1337               0 :   nsStorageSH(nsDOMClassInfoData* aData) : nsNamedArraySH(aData)
    1338                 :   {
    1339               0 :   }
    1340                 : 
    1341               0 :   virtual ~nsStorageSH()
    1342               0 :   {
    1343               0 :   }
    1344                 : 
    1345                 :   NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
    1346                 :                         JSObject *obj, jsid id, PRUint32 flags,
    1347                 :                         JSObject **objp, bool *_retval);
    1348                 :   NS_IMETHOD SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
    1349                 :                          JSObject *obj, jsid id, jsval *vp, bool *_retval);
    1350                 :   NS_IMETHOD DelProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
    1351                 :                          JSObject *obj, jsid id, jsval *vp, bool *_retval);
    1352                 :   NS_IMETHOD NewEnumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
    1353                 :                           JSObject *obj, PRUint32 enum_op, jsval *statep,
    1354                 :                           jsid *idp, bool *_retval);
    1355                 : 
    1356               0 :   virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
    1357                 :                                  nsWrapperCache **aCache, nsresult *aResult)
    1358                 :   {
    1359               0 :     return nsnull;
    1360                 :   }
    1361                 :   // Override nsNamedArraySH::GetNamedItem()
    1362                 :   virtual nsISupports* GetNamedItem(nsISupports *aNative,
    1363                 :                                     const nsAString& aName,
    1364                 :                                     nsWrapperCache **cache,
    1365                 :                                     nsresult *aResult);
    1366                 : 
    1367                 : public:
    1368               0 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
    1369                 :   {
    1370               0 :     return new nsStorageSH(aData);
    1371                 :   }
    1372                 : };
    1373                 : 
    1374                 : 
    1375                 : class nsStorage2SH : public nsDOMGenericSH
    1376                 : {
    1377                 : protected:
    1378               3 :   nsStorage2SH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData)
    1379                 :   {
    1380               3 :   }
    1381                 : 
    1382               6 :   virtual ~nsStorage2SH()
    1383               3 :   {
    1384              12 :   }
    1385                 : 
    1386                 :   NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
    1387                 :                         JSObject *obj, jsid id, PRUint32 flags,
    1388                 :                         JSObject **objp, bool *_retval);
    1389                 :   NS_IMETHOD SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
    1390                 :                          JSObject *obj, jsid id, jsval *vp, bool *_retval);
    1391                 :   NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
    1392                 :                          JSObject *obj, jsid id, jsval *vp, bool *_retval);
    1393                 :   NS_IMETHOD DelProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
    1394                 :                          JSObject *obj, jsid id, jsval *vp, bool *_retval);
    1395                 :   NS_IMETHOD NewEnumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
    1396                 :                           JSObject *obj, PRUint32 enum_op, jsval *statep,
    1397                 :                           jsid *idp, bool *_retval);
    1398                 : 
    1399                 : public:
    1400               3 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
    1401                 :   {
    1402               3 :     return new nsStorage2SH(aData);
    1403                 :   }
    1404                 : };
    1405                 : 
    1406                 : class nsStorageListSH : public nsNamedArraySH
    1407                 : {
    1408                 : protected:
    1409               0 :   nsStorageListSH(nsDOMClassInfoData* aData) : nsNamedArraySH(aData)
    1410                 :   {
    1411               0 :   }
    1412                 : 
    1413               0 :   virtual ~nsStorageListSH()
    1414               0 :   {
    1415               0 :   }
    1416                 : 
    1417               0 :   virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
    1418                 :                                  nsWrapperCache **aCache, nsresult *aResult)
    1419                 :   {
    1420               0 :     return nsnull;
    1421                 :   }
    1422                 :   // Override nsNamedArraySH::GetNamedItem()
    1423                 :   virtual nsISupports* GetNamedItem(nsISupports *aNative,
    1424                 :                                     const nsAString& aName,
    1425                 :                                     nsWrapperCache **cache,
    1426                 :                                     nsresult *aResult);
    1427                 : 
    1428                 : public:
    1429               0 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
    1430                 :   {
    1431               0 :     return new nsStorageListSH(aData);
    1432                 :   }
    1433                 : };
    1434                 : 
    1435                 : 
    1436                 : // Event handler 'this' translator class, this is called by XPConnect
    1437                 : // when a "function interface" (nsIDOMEventListener) is called, this
    1438                 : // class extracts 'this' fomr the first argument to the called
    1439                 : // function (nsIDOMEventListener::HandleEvent(in nsIDOMEvent)), this
    1440                 : // class will pass back nsIDOMEvent::currentTarget to be used as
    1441                 : // 'this'.
    1442                 : 
    1443                 : class nsEventListenerThisTranslator : public nsIXPCFunctionThisTranslator
    1444                 : {
    1445                 : public:
    1446             306 :   nsEventListenerThisTranslator()
    1447             306 :   {
    1448             306 :   }
    1449                 : 
    1450             610 :   virtual ~nsEventListenerThisTranslator()
    1451             305 :   {
    1452            1220 :   }
    1453                 : 
    1454                 :   // nsISupports
    1455                 :   NS_DECL_ISUPPORTS
    1456                 : 
    1457                 :   // nsIXPCFunctionThisTranslator
    1458                 :   NS_DECL_NSIXPCFUNCTIONTHISTRANSLATOR
    1459                 : };
    1460                 : 
    1461                 : class nsDOMConstructorSH : public nsDOMGenericSH
    1462               0 : {
    1463                 : protected:
    1464               0 :   nsDOMConstructorSH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData)
    1465                 :   {
    1466               0 :   }
    1467                 : 
    1468                 : public:
    1469                 :   NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
    1470                 :                        JSObject *globalObj, JSObject **parentObj);
    1471               0 :   NS_IMETHOD PostCreatePrototype(JSContext * cx, JSObject * proto)
    1472                 :   {
    1473               0 :     return NS_OK;
    1474                 :   }
    1475                 :   NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
    1476                 :                         JSObject *obj, jsid id, PRUint32 flags,
    1477                 :                         JSObject **objp, bool *_retval);
    1478                 :   NS_IMETHOD Call(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
    1479                 :                   JSObject *obj, PRUint32 argc, jsval *argv, jsval *vp,
    1480                 :                   bool *_retval);
    1481                 : 
    1482                 :   NS_IMETHOD Construct(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
    1483                 :                        JSObject *obj, PRUint32 argc, jsval *argv,
    1484                 :                        jsval *vp, bool *_retval);
    1485                 : 
    1486                 :   NS_IMETHOD HasInstance(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
    1487                 :                          JSObject *obj, const jsval &val, bool *bp,
    1488                 :                          bool *_retval);
    1489                 : 
    1490               0 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
    1491                 :   {
    1492               0 :     return new nsDOMConstructorSH(aData);
    1493                 :   }
    1494                 : };
    1495                 : 
    1496                 : class nsNonDOMObjectSH : public nsDOMGenericSH
    1497                 : {
    1498                 : protected:
    1499               0 :   nsNonDOMObjectSH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData)
    1500                 :   {
    1501               0 :   }
    1502                 : 
    1503               0 :   virtual ~nsNonDOMObjectSH()
    1504               0 :   {
    1505               0 :   }
    1506                 : 
    1507                 : public:
    1508                 :   NS_IMETHOD GetFlags(PRUint32 *aFlags);
    1509                 : 
    1510               0 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
    1511                 :   {
    1512               0 :     return new nsNonDOMObjectSH(aData);
    1513                 :   }
    1514                 : };
    1515                 : 
    1516                 : // Need this to override GetFlags() on nsNodeSH
    1517                 : class nsAttributeSH : public nsNodeSH
    1518                 : {
    1519                 : protected:
    1520              17 :   nsAttributeSH(nsDOMClassInfoData* aData) : nsNodeSH(aData)
    1521                 :   {
    1522              17 :   }
    1523                 : 
    1524              34 :   virtual ~nsAttributeSH()
    1525              17 :   {
    1526              68 :   }
    1527                 : 
    1528                 : public:
    1529                 :   NS_IMETHOD GetFlags(PRUint32 *aFlags);
    1530                 : 
    1531              17 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
    1532                 :   {
    1533              17 :     return new nsAttributeSH(aData);
    1534                 :   }
    1535                 : };
    1536                 : 
    1537                 : class nsOfflineResourceListSH : public nsStringArraySH
    1538                 : {
    1539                 : protected:
    1540               0 :   nsOfflineResourceListSH(nsDOMClassInfoData* aData) : nsStringArraySH(aData)
    1541                 :   {
    1542               0 :   }
    1543                 : 
    1544               0 :   virtual ~nsOfflineResourceListSH()
    1545               0 :   {
    1546               0 :   }
    1547                 : 
    1548                 :   virtual nsresult GetStringAt(nsISupports *aNative, PRInt32 aIndex,
    1549                 :                                nsAString& aResult);
    1550                 : 
    1551                 : public:
    1552               0 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
    1553                 :   {
    1554               0 :     return new nsOfflineResourceListSH(aData);
    1555                 :   }
    1556                 : };
    1557                 : 
    1558                 : class nsFileListSH : public nsArraySH
    1559                 : {
    1560                 : protected:
    1561               0 :   nsFileListSH(nsDOMClassInfoData *aData) : nsArraySH(aData)
    1562                 :   {
    1563               0 :   }
    1564                 : 
    1565               0 :   virtual ~nsFileListSH()
    1566               0 :   {
    1567               0 :   }
    1568                 : 
    1569                 :   virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
    1570                 :                                  nsWrapperCache **aCache, nsresult *aResult);
    1571                 : 
    1572                 : public:
    1573               0 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
    1574                 :   {
    1575               0 :     return new nsFileListSH(aData);
    1576                 :   }
    1577                 : };
    1578                 : 
    1579                 : class nsWebGLViewportHandlerSH : public nsDOMGenericSH
    1580                 : {
    1581                 : protected:
    1582               0 :   nsWebGLViewportHandlerSH(nsDOMClassInfoData *aData) : nsDOMGenericSH(aData)
    1583                 :   {
    1584               0 :   }
    1585                 : 
    1586               0 :   virtual ~nsWebGLViewportHandlerSH()
    1587               0 :   {
    1588               0 :   }
    1589                 : 
    1590                 : public:
    1591               0 :   NS_IMETHOD PostCreatePrototype(JSContext * cx, JSObject * proto) {
    1592               0 :     nsresult rv = nsDOMGenericSH::PostCreatePrototype(cx, proto);
    1593               0 :     if (NS_SUCCEEDED(rv)) {
    1594               0 :       if (!::JS_DefineProperty(cx, proto, "VIEWPORT", INT_TO_JSVAL(0x0BA2),
    1595               0 :                                nsnull, nsnull, JSPROP_ENUMERATE))
    1596                 :       {
    1597               0 :         return NS_ERROR_UNEXPECTED;
    1598                 :       }
    1599                 :     }
    1600               0 :     return rv;
    1601                 :   }
    1602                 : 
    1603               0 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
    1604                 :   {
    1605               0 :     return new nsWebGLViewportHandlerSH(aData);
    1606                 :   }
    1607                 : };
    1608                 : 
    1609                 : 
    1610                 : // Template for SVGXXXList helpers
    1611                 :  
    1612                 : template<class ListInterfaceType, class ListType>
    1613                 : class nsSVGListSH : public nsArraySH
    1614               0 : {
    1615                 : protected:
    1616               0 :   nsSVGListSH(nsDOMClassInfoData* aData) : nsArraySH(aData)
    1617                 :   {
    1618               0 :   }
    1619                 : 
    1620                 : public:
    1621               0 :   virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
    1622                 :                                  nsWrapperCache **aCache, nsresult *aResult);
    1623                 :  
    1624               0 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
    1625                 :   {
    1626               0 :     return new nsSVGListSH(aData);
    1627                 :   }
    1628                 : };
    1629                 : 
    1630                 : typedef nsSVGListSH<nsIDOMSVGLengthList, mozilla::DOMSVGLengthList> nsSVGLengthListSH;
    1631                 : typedef nsSVGListSH<nsIDOMSVGNumberList, mozilla::DOMSVGNumberList> nsSVGNumberListSH;
    1632                 : typedef nsSVGListSH<nsIDOMSVGPathSegList, mozilla::DOMSVGPathSegList> nsSVGPathSegListSH;
    1633                 : typedef nsSVGListSH<nsIDOMSVGPointList, mozilla::DOMSVGPointList> nsSVGPointListSH;
    1634                 : typedef nsSVGListSH<nsIDOMSVGTransformList, mozilla::DOMSVGTransformList> nsSVGTransformListSH;
    1635                 : 
    1636                 : // SVGStringList helper
    1637                 : 
    1638                 : class nsSVGStringListSH : public nsStringArraySH
    1639                 : {
    1640                 : protected:
    1641               0 :   nsSVGStringListSH(nsDOMClassInfoData* aData) : nsStringArraySH(aData)
    1642                 :   {
    1643               0 :   }
    1644                 :   
    1645               0 :   virtual ~nsSVGStringListSH()
    1646               0 :   {
    1647               0 :   }
    1648                 :   
    1649                 :   virtual nsresult GetStringAt(nsISupports *aNative, PRInt32 aIndex,
    1650                 :                                nsAString& aResult);
    1651                 :   
    1652                 : public:
    1653               0 :   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
    1654                 :   {
    1655               0 :     return new nsSVGStringListSH(aData);
    1656                 :   }
    1657                 : };
    1658                 : 
    1659                 : #endif /* nsDOMClassInfo_h___ */

Generated by: LCOV version 1.7