LCOV - app.info - objdir/js/xpconnect/src/DictionaryHelpers.cpp

LCOV - code coverage report
| Current view: | directory - objdir/js/xpconnect/src - DictionaryHelpers.cpp (source / functions) |  | Found | Hit | Coverage |
| Test: | app.info | Lines: | 498 | 126 | 25.3 %
| Date: | 2012-04-21 | Functions: | 53 | 12 | 22.6 %

           1                 : /* THIS FILE IS AUTOGENERATED - DO NOT EDIT */
           2                 :
           3                 : #include "DictionaryHelpers.h"
           4                 : #include "nsContentUtils.h"
           5                 : #include "XPCQuickStubs.h"
           6                 : #include "nsIDOMEvent.h"
           7                 : #include "nsIDOMCustomEvent.h"
           8                 : #include "nsIDOMPopStateEvent.h"
           9                 : #include "nsIDOMHashChangeEvent.h"
          10                 : #include "nsIDOMPageTransitionEvent.h"
          11                 : #include "nsIDOMCloseEvent.h"
          12                 : #include "nsIDOMUIEvent.h"
          13                 : #include "nsIDOMMouseEvent.h"
          14                 : #include "nsIIDBDatabase.h"
          15                 : #include "nsIIDBObjectStore.h"
          16                 : #include "nsIDOMStorageEvent.h"
          17                 : #include "nsIDOMFile.h"
          18                 : #include "nsIVariant.h"
          19                 : #include "nsIDOMWindow.h"
          20                 : #include "nsIDOMEventTarget.h"
          21                 : #include "nsIDOMStorage.h"
          22                 :
          23                 : using namespace mozilla::dom;
          24                 :
          25            1396 : static jsid gDictionary_id_bubbles = JSID_VOID;
          26            1396 : static jsid gDictionary_id_cancelable = JSID_VOID;
          27            1396 : static jsid gDictionary_id_detail = JSID_VOID;
          28            1396 : static jsid gDictionary_id_state = JSID_VOID;
          29            1396 : static jsid gDictionary_id_oldURL = JSID_VOID;
          30            1396 : static jsid gDictionary_id_newURL = JSID_VOID;
          31            1396 : static jsid gDictionary_id_persisted = JSID_VOID;
          32            1396 : static jsid gDictionary_id_wasClean = JSID_VOID;
          33            1396 : static jsid gDictionary_id_code = JSID_VOID;
          34            1396 : static jsid gDictionary_id_reason = JSID_VOID;
          35            1396 : static jsid gDictionary_id_view = JSID_VOID;
          36            1396 : static jsid gDictionary_id_screenX = JSID_VOID;
          37            1396 : static jsid gDictionary_id_screenY = JSID_VOID;
          38            1396 : static jsid gDictionary_id_clientX = JSID_VOID;
          39            1396 : static jsid gDictionary_id_clientY = JSID_VOID;
          40            1396 : static jsid gDictionary_id_ctrlKey = JSID_VOID;
          41            1396 : static jsid gDictionary_id_shiftKey = JSID_VOID;
          42            1396 : static jsid gDictionary_id_altKey = JSID_VOID;
          43            1396 : static jsid gDictionary_id_metaKey = JSID_VOID;
          44            1396 : static jsid gDictionary_id_button = JSID_VOID;
          45            1396 : static jsid gDictionary_id_relatedTarget = JSID_VOID;
          46            1396 : static jsid gDictionary_id_keyPath = JSID_VOID;
          47            1396 : static jsid gDictionary_id_autoIncrement = JSID_VOID;
          48            1396 : static jsid gDictionary_id_unique = JSID_VOID;
          49            1396 : static jsid gDictionary_id_multiEntry = JSID_VOID;
          50            1396 : static jsid gDictionary_id_key = JSID_VOID;
          51            1396 : static jsid gDictionary_id_oldValue = JSID_VOID;
          52            1396 : static jsid gDictionary_id_newValue = JSID_VOID;
          53            1396 : static jsid gDictionary_id_url = JSID_VOID;
          54            1396 : static jsid gDictionary_id_storageArea = JSID_VOID;
          55            1396 : static jsid gDictionary_id_type = JSID_VOID;
          56            1396 : static jsid gDictionary_id_endings = JSID_VOID;
          57                 :
          58                 : static bool
          59           43680 : InternStaticJSVal(JSContext* aCx, jsid &id, const char* aString)
          60                 : {
          61           43680 :   if (JSString* str = JS_InternString(aCx, aString)) {
          62           43680 :     id = INTERNED_STRING_TO_JSID(aCx, str);
          63           43680 :     return true;
          64                 :   }
          65               0 :   return false;
          66                 : }
          67                 :
          68                 : bool
          69            1365 : InternStaticDictionaryJSVals(JSContext* aCx)
          70                 : {
          71            2730 :   JSAutoRequest ar(aCx);
          72                 :   return
          73            1365 :     InternStaticJSVal(aCx, gDictionary_id_bubbles, "bubbles") &&
          74            1365 :     InternStaticJSVal(aCx, gDictionary_id_cancelable, "cancelable") &&
          75            1365 :     InternStaticJSVal(aCx, gDictionary_id_detail, "detail") &&
          76            1365 :     InternStaticJSVal(aCx, gDictionary_id_state, "state") &&
          77            1365 :     InternStaticJSVal(aCx, gDictionary_id_oldURL, "oldURL") &&
          78            1365 :     InternStaticJSVal(aCx, gDictionary_id_newURL, "newURL") &&
          79            1365 :     InternStaticJSVal(aCx, gDictionary_id_persisted, "persisted") &&
          80            1365 :     InternStaticJSVal(aCx, gDictionary_id_wasClean, "wasClean") &&
          81            1365 :     InternStaticJSVal(aCx, gDictionary_id_code, "code") &&
          82            1365 :     InternStaticJSVal(aCx, gDictionary_id_reason, "reason") &&
          83            1365 :     InternStaticJSVal(aCx, gDictionary_id_view, "view") &&
          84            1365 :     InternStaticJSVal(aCx, gDictionary_id_screenX, "screenX") &&
          85            1365 :     InternStaticJSVal(aCx, gDictionary_id_screenY, "screenY") &&
          86            1365 :     InternStaticJSVal(aCx, gDictionary_id_clientX, "clientX") &&
          87            1365 :     InternStaticJSVal(aCx, gDictionary_id_clientY, "clientY") &&
          88            1365 :     InternStaticJSVal(aCx, gDictionary_id_ctrlKey, "ctrlKey") &&
          89            1365 :     InternStaticJSVal(aCx, gDictionary_id_shiftKey, "shiftKey") &&
          90            1365 :     InternStaticJSVal(aCx, gDictionary_id_altKey, "altKey") &&
          91            1365 :     InternStaticJSVal(aCx, gDictionary_id_metaKey, "metaKey") &&
          92            1365 :     InternStaticJSVal(aCx, gDictionary_id_button, "button") &&
          93            1365 :     InternStaticJSVal(aCx, gDictionary_id_relatedTarget, "relatedTarget") &&
          94            1365 :     InternStaticJSVal(aCx, gDictionary_id_keyPath, "keyPath") &&
          95            1365 :     InternStaticJSVal(aCx, gDictionary_id_autoIncrement, "autoIncrement") &&
          96            1365 :     InternStaticJSVal(aCx, gDictionary_id_unique, "unique") &&
          97            1365 :     InternStaticJSVal(aCx, gDictionary_id_multiEntry, "multiEntry") &&
          98            1365 :     InternStaticJSVal(aCx, gDictionary_id_key, "key") &&
          99            1365 :     InternStaticJSVal(aCx, gDictionary_id_oldValue, "oldValue") &&
         100            1365 :     InternStaticJSVal(aCx, gDictionary_id_newValue, "newValue") &&
         101            1365 :     InternStaticJSVal(aCx, gDictionary_id_url, "url") &&
         102            1365 :     InternStaticJSVal(aCx, gDictionary_id_storageArea, "storageArea") &&
         103            1365 :     InternStaticJSVal(aCx, gDictionary_id_type, "type") &&
         104            1365 :     InternStaticJSVal(aCx, gDictionary_id_endings, "endings") &&
         105           43680 :     true;
         106                 : }
         107                 :
         108               0 : EventInit::EventInit() :
         109                 :   bubbles(false),
         110               0 :   cancelable(false)
         111               0 : {}
         112                 :
         113               0 : EventInit::~EventInit() {}
         114                 :
         115                 : static nsresult
         116               0 : EventInit_InitInternal(EventInit& aDict, JSContext* aCx, JSObject* aObj)
         117                 : {
         118               0 :   JSBool found = PR_FALSE;
         119               0 :   jsval v = JSVAL_VOID;
         120               0 :   NS_ENSURE_STATE(JS_HasPropertyById(aCx, aObj, gDictionary_id_bubbles, &found));
         121               0 :   if (found) {
         122               0 :     NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, gDictionary_id_bubbles, &v));
         123                 :     JSBool b;
         124               0 :     MOZ_ALWAYS_TRUE(JS_ValueToBoolean(aCx, v, &b));
         125               0 :     aDict.bubbles = b;
         126                 :   }
         127               0 :   NS_ENSURE_STATE(JS_HasPropertyById(aCx, aObj, gDictionary_id_cancelable, &found));
         128               0 :   if (found) {
         129               0 :     NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, gDictionary_id_cancelable, &v));
         130                 :     JSBool b;
         131               0 :     MOZ_ALWAYS_TRUE(JS_ValueToBoolean(aCx, v, &b));
         132               0 :     aDict.cancelable = b;
         133                 :   }
         134               0 :   return NS_OK;
         135                 : }
         136                 :
         137                 : nsresult
         138               0 : EventInit::Init(JSContext* aCx, const jsval* aVal)
         139                 : {
         140               0 :   if (!aCx || !aVal) {
         141               0 :     return NS_OK;
         142                 :   }
         143               0 :   NS_ENSURE_STATE(aVal->isObject());
         144                 :
         145               0 :   JSObject* obj = &aVal->toObject();
         146               0 :   nsCxPusher pusher;
         147               0 :   NS_ENSURE_STATE(pusher.Push(aCx, false));
         148               0 :   JSAutoRequest ar(aCx);
         149               0 :   JSAutoEnterCompartment ac;
         150               0 :   NS_ENSURE_STATE(ac.enter(aCx, obj));
         151               0 :   return EventInit_InitInternal(*this, aCx, obj);
         152                 : }
         153                 :
         154               0 : CustomEventInit::CustomEventInit() :
         155                 :   EventInit(),
         156               0 :   detail(nsnull)
         157               0 : {}
         158                 :
         159               0 : CustomEventInit::~CustomEventInit() {}
         160                 :
         161                 : static nsresult
         162               0 : CustomEventInit_InitInternal(CustomEventInit& aDict, JSContext* aCx, JSObject* aObj)
         163                 : {
         164               0 :   nsresult rv = EventInit_InitInternal(aDict, aCx, aObj);
         165               0 :   NS_ENSURE_SUCCESS(rv, rv);
         166               0 :   JSBool found = PR_FALSE;
         167               0 :   jsval v = JSVAL_VOID;
         168               0 :   XPCCallContext ccx(NATIVE_CALLER, aCx);
         169               0 :   NS_ENSURE_STATE(ccx.IsValid());
         170               0 :   NS_ENSURE_STATE(JS_HasPropertyById(aCx, aObj, gDictionary_id_detail, &found));
         171               0 :   if (found) {
         172               0 :     NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, gDictionary_id_detail, &v));
         173               0 :     nsCOMPtr<nsIVariant> d(already_AddRefed<nsIVariant>(XPCVariant::newVariant(ccx, v)));
         174               0 :     NS_ENSURE_STATE(d);
         175               0 :     aDict.detail = d;
         176                 :   }
         177               0 :   return NS_OK;
         178                 : }
         179                 :
         180                 : nsresult
         181               0 : CustomEventInit::Init(JSContext* aCx, const jsval* aVal)
         182                 : {
         183               0 :   if (!aCx || !aVal) {
         184               0 :     return NS_OK;
         185                 :   }
         186               0 :   NS_ENSURE_STATE(aVal->isObject());
         187                 :
         188               0 :   JSObject* obj = &aVal->toObject();
         189               0 :   nsCxPusher pusher;
         190               0 :   NS_ENSURE_STATE(pusher.Push(aCx, false));
         191               0 :   JSAutoRequest ar(aCx);
         192               0 :   JSAutoEnterCompartment ac;
         193               0 :   NS_ENSURE_STATE(ac.enter(aCx, obj));
         194               0 :   return CustomEventInit_InitInternal(*this, aCx, obj);
         195                 : }
         196                 :
         197               0 : PopStateEventInit::PopStateEventInit() :
         198                 :   EventInit(),
         199               0 :   state(nsnull)
         200               0 : {}
         201                 :
         202               0 : PopStateEventInit::~PopStateEventInit() {}
         203                 :
         204                 : static nsresult
         205               0 : PopStateEventInit_InitInternal(PopStateEventInit& aDict, JSContext* aCx, JSObject* aObj)
         206                 : {
         207               0 :   nsresult rv = EventInit_InitInternal(aDict, aCx, aObj);
         208               0 :   NS_ENSURE_SUCCESS(rv, rv);
         209               0 :   JSBool found = PR_FALSE;
         210               0 :   jsval v = JSVAL_VOID;
         211               0 :   XPCCallContext ccx(NATIVE_CALLER, aCx);
         212               0 :   NS_ENSURE_STATE(ccx.IsValid());
         213               0 :   NS_ENSURE_STATE(JS_HasPropertyById(aCx, aObj, gDictionary_id_state, &found));
         214               0 :   if (found) {
         215               0 :     NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, gDictionary_id_state, &v));
         216               0 :     nsCOMPtr<nsIVariant> d(already_AddRefed<nsIVariant>(XPCVariant::newVariant(ccx, v)));
         217               0 :     NS_ENSURE_STATE(d);
         218               0 :     aDict.state = d;
         219                 :   }
         220               0 :   return NS_OK;
         221                 : }
         222                 :
         223                 : nsresult
         224               0 : PopStateEventInit::Init(JSContext* aCx, const jsval* aVal)
         225                 : {
         226               0 :   if (!aCx || !aVal) {
         227               0 :     return NS_OK;
         228                 :   }
         229               0 :   NS_ENSURE_STATE(aVal->isObject());
         230                 :
         231               0 :   JSObject* obj = &aVal->toObject();
         232               0 :   nsCxPusher pusher;
         233               0 :   NS_ENSURE_STATE(pusher.Push(aCx, false));
         234               0 :   JSAutoRequest ar(aCx);
         235               0 :   JSAutoEnterCompartment ac;
         236               0 :   NS_ENSURE_STATE(ac.enter(aCx, obj));
         237               0 :   return PopStateEventInit_InitInternal(*this, aCx, obj);
         238                 : }
         239                 :
         240               0 : HashChangeEventInit::HashChangeEventInit() :
         241                 :   EventInit(),
         242                 :   oldURL(),
         243               0 :   newURL()
         244               0 : {}
         245                 :
         246               0 : HashChangeEventInit::~HashChangeEventInit() {}
         247                 :
         248                 : static nsresult
         249               0 : HashChangeEventInit_InitInternal(HashChangeEventInit& aDict, JSContext* aCx, JSObject* aObj)
         250                 : {
         251               0 :   nsresult rv = EventInit_InitInternal(aDict, aCx, aObj);
         252               0 :   NS_ENSURE_SUCCESS(rv, rv);
         253               0 :   JSBool found = PR_FALSE;
         254               0 :   jsval v = JSVAL_VOID;
         255               0 :   NS_ENSURE_STATE(JS_HasPropertyById(aCx, aObj, gDictionary_id_oldURL, &found));
         256               0 :   if (found) {
         257               0 :     NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, gDictionary_id_oldURL, &v));
         258               0 :     xpc_qsDOMString d(aCx, v, &v, xpc_qsDOMString::eStringify, xpc_qsDOMString::eStringify);
         259               0 :     NS_ENSURE_STATE(d.IsValid());
         260               0 :     aDict.oldURL = d;
         261                 :   }
         262               0 :   NS_ENSURE_STATE(JS_HasPropertyById(aCx, aObj, gDictionary_id_newURL, &found));
         263               0 :   if (found) {
         264               0 :     NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, gDictionary_id_newURL, &v));
         265               0 :     xpc_qsDOMString d(aCx, v, &v, xpc_qsDOMString::eStringify, xpc_qsDOMString::eStringify);
         266               0 :     NS_ENSURE_STATE(d.IsValid());
         267               0 :     aDict.newURL = d;
         268                 :   }
         269               0 :   return NS_OK;
         270                 : }
         271                 :
         272                 : nsresult
         273               0 : HashChangeEventInit::Init(JSContext* aCx, const jsval* aVal)
         274                 : {
         275               0 :   if (!aCx || !aVal) {
         276               0 :     return NS_OK;
         277                 :   }
         278               0 :   NS_ENSURE_STATE(aVal->isObject());
         279                 :
         280               0 :   JSObject* obj = &aVal->toObject();
         281               0 :   nsCxPusher pusher;
         282               0 :   NS_ENSURE_STATE(pusher.Push(aCx, false));
         283               0 :   JSAutoRequest ar(aCx);
         284               0 :   JSAutoEnterCompartment ac;
         285               0 :   NS_ENSURE_STATE(ac.enter(aCx, obj));
         286               0 :   return HashChangeEventInit_InitInternal(*this, aCx, obj);
         287                 : }
         288                 :
         289               0 : PageTransitionEventInit::PageTransitionEventInit() :
         290                 :   EventInit(),
         291               0 :   persisted(false)
         292               0 : {}
         293                 :
         294               0 : PageTransitionEventInit::~PageTransitionEventInit() {}
         295                 :
         296                 : static nsresult
         297               0 : PageTransitionEventInit_InitInternal(PageTransitionEventInit& aDict, JSContext* aCx, JSObject* aObj)
         298                 : {
         299               0 :   nsresult rv = EventInit_InitInternal(aDict, aCx, aObj);
         300               0 :   NS_ENSURE_SUCCESS(rv, rv);
         301               0 :   JSBool found = PR_FALSE;
         302               0 :   jsval v = JSVAL_VOID;
         303               0 :   NS_ENSURE_STATE(JS_HasPropertyById(aCx, aObj, gDictionary_id_persisted, &found));
         304               0 :   if (found) {
         305               0 :     NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, gDictionary_id_persisted, &v));
         306                 :     JSBool b;
         307               0 :     MOZ_ALWAYS_TRUE(JS_ValueToBoolean(aCx, v, &b));
         308               0 :     aDict.persisted = b;
         309                 :   }
         310               0 :   return NS_OK;
         311                 : }
         312                 :
         313                 : nsresult
         314               0 : PageTransitionEventInit::Init(JSContext* aCx, const jsval* aVal)
         315                 : {
         316               0 :   if (!aCx || !aVal) {
         317               0 :     return NS_OK;
         318                 :   }
         319               0 :   NS_ENSURE_STATE(aVal->isObject());
         320                 :
         321               0 :   JSObject* obj = &aVal->toObject();
         322               0 :   nsCxPusher pusher;
         323               0 :   NS_ENSURE_STATE(pusher.Push(aCx, false));
         324               0 :   JSAutoRequest ar(aCx);
         325               0 :   JSAutoEnterCompartment ac;
         326               0 :   NS_ENSURE_STATE(ac.enter(aCx, obj));
         327               0 :   return PageTransitionEventInit_InitInternal(*this, aCx, obj);
         328                 : }
         329                 :
         330               0 : CloseEventInit::CloseEventInit() :
         331                 :   EventInit(),
         332                 :   wasClean(false),
         333                 :   code(0),
         334               0 :   reason()
         335               0 : {}
         336                 :
         337               0 : CloseEventInit::~CloseEventInit() {}
         338                 :
         339                 : static nsresult
         340               0 : CloseEventInit_InitInternal(CloseEventInit& aDict, JSContext* aCx, JSObject* aObj)
         341                 : {
         342               0 :   nsresult rv = EventInit_InitInternal(aDict, aCx, aObj);
         343               0 :   NS_ENSURE_SUCCESS(rv, rv);
         344               0 :   JSBool found = PR_FALSE;
         345               0 :   jsval v = JSVAL_VOID;
         346               0 :   NS_ENSURE_STATE(JS_HasPropertyById(aCx, aObj, gDictionary_id_wasClean, &found));
         347               0 :   if (found) {
         348               0 :     NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, gDictionary_id_wasClean, &v));
         349                 :     JSBool b;
         350               0 :     MOZ_ALWAYS_TRUE(JS_ValueToBoolean(aCx, v, &b));
         351               0 :     aDict.wasClean = b;
         352                 :   }
         353               0 :   NS_ENSURE_STATE(JS_HasPropertyById(aCx, aObj, gDictionary_id_code, &found));
         354               0 :   if (found) {
         355               0 :     NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, gDictionary_id_code, &v));
         356                 :     uint32_t u;
         357               0 :     NS_ENSURE_STATE(JS_ValueToECMAUint32(aCx, v, &u));
         358               0 :     aDict.code = u;
         359                 :   }
         360               0 :   NS_ENSURE_STATE(JS_HasPropertyById(aCx, aObj, gDictionary_id_reason, &found));
         361               0 :   if (found) {
         362               0 :     NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, gDictionary_id_reason, &v));
         363               0 :     xpc_qsDOMString d(aCx, v, &v, xpc_qsDOMString::eStringify, xpc_qsDOMString::eStringify);
         364               0 :     NS_ENSURE_STATE(d.IsValid());
         365               0 :     aDict.reason = d;
         366                 :   }
         367               0 :   return NS_OK;
         368                 : }
         369                 :
         370                 : nsresult
         371               0 : CloseEventInit::Init(JSContext* aCx, const jsval* aVal)
         372                 : {
         373               0 :   if (!aCx || !aVal) {
         374               0 :     return NS_OK;
         375                 :   }
         376               0 :   NS_ENSURE_STATE(aVal->isObject());
         377                 :
         378               0 :   JSObject* obj = &aVal->toObject();
         379               0 :   nsCxPusher pusher;
         380               0 :   NS_ENSURE_STATE(pusher.Push(aCx, false));
         381               0 :   JSAutoRequest ar(aCx);
         382               0 :   JSAutoEnterCompartment ac;
         383               0 :   NS_ENSURE_STATE(ac.enter(aCx, obj));
         384               0 :   return CloseEventInit_InitInternal(*this, aCx, obj);
         385                 : }
         386                 :
         387               0 : UIEventInit::UIEventInit() :
         388                 :   EventInit(),
         389                 :   view(nsnull),
         390               0 :   detail(0)
         391               0 : {}
         392                 :
         393               0 : UIEventInit::~UIEventInit() {}
         394                 :
         395                 : static nsresult
         396               0 : UIEventInit_InitInternal(UIEventInit& aDict, JSContext* aCx, JSObject* aObj)
         397                 : {
         398               0 :   nsresult rv = EventInit_InitInternal(aDict, aCx, aObj);
         399               0 :   NS_ENSURE_SUCCESS(rv, rv);
         400               0 :   JSBool found = PR_FALSE;
         401               0 :   jsval v = JSVAL_VOID;
         402               0 :   NS_ENSURE_STATE(JS_HasPropertyById(aCx, aObj, gDictionary_id_view, &found));
         403               0 :   if (found) {
         404               0 :     NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, gDictionary_id_view, &v));
         405                 :     nsIDOMWindow * d;
         406               0 :     xpc_qsSelfRef ref;
         407               0 :     nsresult rv = xpc_qsUnwrapArg<nsIDOMWindow>(aCx, v, &d, &ref.ptr, &v);
         408               0 :     NS_ENSURE_SUCCESS(rv, rv);
         409               0 :     aDict.view = d;
         410                 :   }
         411               0 :   NS_ENSURE_STATE(JS_HasPropertyById(aCx, aObj, gDictionary_id_detail, &found));
         412               0 :   if (found) {
         413               0 :     NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, gDictionary_id_detail, &v));
         414               0 :     NS_ENSURE_STATE(JS_ValueToECMAInt32(aCx, v, &aDict.detail));
         415                 :   }
         416               0 :   return NS_OK;
         417                 : }
         418                 :
         419                 : nsresult
         420               0 : UIEventInit::Init(JSContext* aCx, const jsval* aVal)
         421                 : {
         422               0 :   if (!aCx || !aVal) {
         423               0 :     return NS_OK;
         424                 :   }
         425               0 :   NS_ENSURE_STATE(aVal->isObject());
         426                 :
         427               0 :   JSObject* obj = &aVal->toObject();
         428               0 :   nsCxPusher pusher;
         429               0 :   NS_ENSURE_STATE(pusher.Push(aCx, false));
         430               0 :   JSAutoRequest ar(aCx);
         431               0 :   JSAutoEnterCompartment ac;
         432               0 :   NS_ENSURE_STATE(ac.enter(aCx, obj));
         433               0 :   return UIEventInit_InitInternal(*this, aCx, obj);
         434                 : }
         435                 :
         436               0 : MouseEventInit::MouseEventInit() :
         437                 :   UIEventInit(),
         438                 :   screenX(0),
         439                 :   screenY(0),
         440                 :   clientX(0),
         441                 :   clientY(0),
         442                 :   ctrlKey(false),
         443                 :   shiftKey(false),
         444                 :   altKey(false),
         445                 :   metaKey(false),
         446                 :   button(0),
         447               0 :   relatedTarget(nsnull)
         448               0 : {}
         449                 :
         450               0 : MouseEventInit::~MouseEventInit() {}
         451                 :
         452                 : static nsresult
         453               0 : MouseEventInit_InitInternal(MouseEventInit& aDict, JSContext* aCx, JSObject* aObj)
         454                 : {
         455               0 :   nsresult rv = UIEventInit_InitInternal(aDict, aCx, aObj);
         456               0 :   NS_ENSURE_SUCCESS(rv, rv);
         457               0 :   JSBool found = PR_FALSE;
         458               0 :   jsval v = JSVAL_VOID;
         459               0 :   NS_ENSURE_STATE(JS_HasPropertyById(aCx, aObj, gDictionary_id_screenX, &found));
         460               0 :   if (found) {
         461               0 :     NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, gDictionary_id_screenX, &v));
         462               0 :     NS_ENSURE_STATE(JS_ValueToECMAInt32(aCx, v, &aDict.screenX));
         463                 :   }
         464               0 :   NS_ENSURE_STATE(JS_HasPropertyById(aCx, aObj, gDictionary_id_screenY, &found));
         465               0 :   if (found) {
         466               0 :     NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, gDictionary_id_screenY, &v));
         467               0 :     NS_ENSURE_STATE(JS_ValueToECMAInt32(aCx, v, &aDict.screenY));
         468                 :   }
         469               0 :   NS_ENSURE_STATE(JS_HasPropertyById(aCx, aObj, gDictionary_id_clientX, &found));
         470               0 :   if (found) {
         471               0 :     NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, gDictionary_id_clientX, &v));
         472               0 :     NS_ENSURE_STATE(JS_ValueToECMAInt32(aCx, v, &aDict.clientX));
         473                 :   }
         474               0 :   NS_ENSURE_STATE(JS_HasPropertyById(aCx, aObj, gDictionary_id_clientY, &found));
         475               0 :   if (found) {
         476               0 :     NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, gDictionary_id_clientY, &v));
         477               0 :     NS_ENSURE_STATE(JS_ValueToECMAInt32(aCx, v, &aDict.clientY));
         478                 :   }
         479               0 :   NS_ENSURE_STATE(JS_HasPropertyById(aCx, aObj, gDictionary_id_ctrlKey, &found));
         480               0 :   if (found) {
         481               0 :     NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, gDictionary_id_ctrlKey, &v));
         482                 :     JSBool b;
         483               0 :     MOZ_ALWAYS_TRUE(JS_ValueToBoolean(aCx, v, &b));
         484               0 :     aDict.ctrlKey = b;
         485                 :   }
         486               0 :   NS_ENSURE_STATE(JS_HasPropertyById(aCx, aObj, gDictionary_id_shiftKey, &found));
         487               0 :   if (found) {
         488               0 :     NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, gDictionary_id_shiftKey, &v));
         489                 :     JSBool b;
         490               0 :     MOZ_ALWAYS_TRUE(JS_ValueToBoolean(aCx, v, &b));
         491               0 :     aDict.shiftKey = b;
         492                 :   }
         493               0 :   NS_ENSURE_STATE(JS_HasPropertyById(aCx, aObj, gDictionary_id_altKey, &found));
         494               0 :   if (found) {
         495               0 :     NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, gDictionary_id_altKey, &v));
         496                 :     JSBool b;
         497               0 :     MOZ_ALWAYS_TRUE(JS_ValueToBoolean(aCx, v, &b));
         498               0 :     aDict.altKey = b;
         499                 :   }
         500               0 :   NS_ENSURE_STATE(JS_HasPropertyById(aCx, aObj, gDictionary_id_metaKey, &found));
         501               0 :   if (found) {
         502               0 :     NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, gDictionary_id_metaKey, &v));
         503                 :     JSBool b;
         504               0 :     MOZ_ALWAYS_TRUE(JS_ValueToBoolean(aCx, v, &b));
         505               0 :     aDict.metaKey = b;
         506                 :   }
         507               0 :   NS_ENSURE_STATE(JS_HasPropertyById(aCx, aObj, gDictionary_id_button, &found));
         508               0 :   if (found) {
         509               0 :     NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, gDictionary_id_button, &v));
         510                 :     uint32_t u;
         511               0 :     NS_ENSURE_STATE(JS_ValueToECMAUint32(aCx, v, &u));
         512               0 :     aDict.button = u;
         513                 :   }
         514               0 :   NS_ENSURE_STATE(JS_HasPropertyById(aCx, aObj, gDictionary_id_relatedTarget, &found));
         515               0 :   if (found) {
         516               0 :     NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, gDictionary_id_relatedTarget, &v));
         517                 :     nsIDOMEventTarget * d;
         518               0 :     xpc_qsSelfRef ref;
         519               0 :     nsresult rv = xpc_qsUnwrapArg<nsIDOMEventTarget>(aCx, v, &d, &ref.ptr, &v);
         520               0 :     NS_ENSURE_SUCCESS(rv, rv);
         521               0 :     aDict.relatedTarget = d;
         522                 :   }
         523               0 :   return NS_OK;
         524                 : }
         525                 :
         526                 : nsresult
         527               0 : MouseEventInit::Init(JSContext* aCx, const jsval* aVal)
         528                 : {
         529               0 :   if (!aCx || !aVal) {
         530               0 :     return NS_OK;
         531                 :   }
         532               0 :   NS_ENSURE_STATE(aVal->isObject());
         533                 :
         534               0 :   JSObject* obj = &aVal->toObject();
         535               0 :   nsCxPusher pusher;
         536               0 :   NS_ENSURE_STATE(pusher.Push(aCx, false));
         537               0 :   JSAutoRequest ar(aCx);
         538               0 :   JSAutoEnterCompartment ac;
         539               0 :   NS_ENSURE_STATE(ac.enter(aCx, obj));
         540               0 :   return MouseEventInit_InitInternal(*this, aCx, obj);
         541                 : }
         542                 :
         543             202 : IDBObjectStoreParameters::IDBObjectStoreParameters() :
         544                 :   keyPath(JSVAL_VOID),
         545             202 :   autoIncrement(false)
         546             202 : {}
         547                 :
         548             202 : IDBObjectStoreParameters::~IDBObjectStoreParameters() {}
         549                 :
         550                 : static nsresult
         551             184 : IDBObjectStoreParameters_InitInternal(IDBObjectStoreParameters& aDict, JSContext* aCx, JSObject* aObj)
         552                 : {
         553             184 :   JSBool found = PR_FALSE;
         554             184 :   jsval v = JSVAL_VOID;
         555             184 :   NS_ENSURE_STATE(JS_HasPropertyById(aCx, aObj, gDictionary_id_keyPath, &found));
         556             184 :   if (found) {
         557             164 :     NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, gDictionary_id_keyPath, &aDict.keyPath));
         558                 :   }
         559             184 :   NS_ENSURE_STATE(JS_HasPropertyById(aCx, aObj, gDictionary_id_autoIncrement, &found));
         560             184 :   if (found) {
         561             158 :     NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, gDictionary_id_autoIncrement, &v));
         562                 :     JSBool b;
         563             158 :     MOZ_ALWAYS_TRUE(JS_ValueToBoolean(aCx, v, &b));
         564             158 :     aDict.autoIncrement = b;
         565                 :   }
         566             184 :   return NS_OK;
         567                 : }
         568                 :
         569                 : nsresult
         570             185 : IDBObjectStoreParameters::Init(JSContext* aCx, const jsval* aVal)
         571                 : {
         572             185 :   if (!aCx || !aVal) {
         573               0 :     return NS_OK;
         574                 :   }
         575             185 :   NS_ENSURE_STATE(aVal->isObject());
         576                 :
         577             184 :   JSObject* obj = &aVal->toObject();
         578             368 :   nsCxPusher pusher;
         579             184 :   NS_ENSURE_STATE(pusher.Push(aCx, false));
         580             368 :   JSAutoRequest ar(aCx);
         581             368 :   JSAutoEnterCompartment ac;
         582             184 :   NS_ENSURE_STATE(ac.enter(aCx, obj));
         583             184 :   return IDBObjectStoreParameters_InitInternal(*this, aCx, obj);
         584                 : }
         585                 :
         586              89 : IDBIndexParameters::IDBIndexParameters() :
         587                 :   unique(false),
         588              89 :   multiEntry(false)
         589              89 : {}
         590                 :
         591              89 : IDBIndexParameters::~IDBIndexParameters() {}
         592                 :
         593                 : static nsresult
         594              77 : IDBIndexParameters_InitInternal(IDBIndexParameters& aDict, JSContext* aCx, JSObject* aObj)
         595                 : {
         596              77 :   JSBool found = PR_FALSE;
         597              77 :   jsval v = JSVAL_VOID;
         598              77 :   NS_ENSURE_STATE(JS_HasPropertyById(aCx, aObj, gDictionary_id_unique, &found));
         599              77 :   if (found) {
         600              54 :     NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, gDictionary_id_unique, &v));
         601                 :     JSBool b;
         602              54 :     MOZ_ALWAYS_TRUE(JS_ValueToBoolean(aCx, v, &b));
         603              54 :     aDict.unique = b;
         604                 :   }
         605              77 :   NS_ENSURE_STATE(JS_HasPropertyById(aCx, aObj, gDictionary_id_multiEntry, &found));
         606              77 :   if (found) {
         607              24 :     NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, gDictionary_id_multiEntry, &v));
         608                 :     JSBool b;
         609              24 :     MOZ_ALWAYS_TRUE(JS_ValueToBoolean(aCx, v, &b));
         610              24 :     aDict.multiEntry = b;
         611                 :   }
         612              77 :   return NS_OK;
         613                 : }
         614                 :
         615                 : nsresult
         616              79 : IDBIndexParameters::Init(JSContext* aCx, const jsval* aVal)
         617                 : {
         618              79 :   if (!aCx || !aVal) {
         619               0 :     return NS_OK;
         620                 :   }
         621              79 :   NS_ENSURE_STATE(aVal->isObject());
         622                 :
         623              77 :   JSObject* obj = &aVal->toObject();
         624             154 :   nsCxPusher pusher;
         625              77 :   NS_ENSURE_STATE(pusher.Push(aCx, false));
         626             154 :   JSAutoRequest ar(aCx);
         627             154 :   JSAutoEnterCompartment ac;
         628              77 :   NS_ENSURE_STATE(ac.enter(aCx, obj));
         629              77 :   return IDBIndexParameters_InitInternal(*this, aCx, obj);
         630                 : }
         631                 :
         632               0 : StorageEventInit::StorageEventInit() :
         633                 :   EventInit(),
         634                 :   key(),
         635                 :   oldValue(),
         636                 :   newValue(),
         637                 :   url(),
         638               0 :   storageArea(nsnull)
         639                 : {
         640               0 :   oldValue.SetIsVoid(true);
         641               0 :   newValue.SetIsVoid(true);
         642               0 : }
         643                 :
         644               0 : StorageEventInit::~StorageEventInit() {}
         645                 :
         646                 : static nsresult
         647               0 : StorageEventInit_InitInternal(StorageEventInit& aDict, JSContext* aCx, JSObject* aObj)
         648                 : {
         649               0 :   nsresult rv = EventInit_InitInternal(aDict, aCx, aObj);
         650               0 :   NS_ENSURE_SUCCESS(rv, rv);
         651               0 :   JSBool found = PR_FALSE;
         652               0 :   jsval v = JSVAL_VOID;
         653               0 :   NS_ENSURE_STATE(JS_HasPropertyById(aCx, aObj, gDictionary_id_key, &found));
         654               0 :   if (found) {
         655               0 :     NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, gDictionary_id_key, &v));
         656               0 :     xpc_qsDOMString d(aCx, v, &v, xpc_qsDOMString::eStringify, xpc_qsDOMString::eStringify);
         657               0 :     NS_ENSURE_STATE(d.IsValid());
         658               0 :     aDict.key = d;
         659                 :   }
         660               0 :   NS_ENSURE_STATE(JS_HasPropertyById(aCx, aObj, gDictionary_id_oldValue, &found));
         661               0 :   if (found) {
         662               0 :     NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, gDictionary_id_oldValue, &v));
         663               0 :     xpc_qsDOMString d(aCx, v, &v, xpc_qsDOMString::eNull, xpc_qsDOMString::eNull);
         664               0 :     NS_ENSURE_STATE(d.IsValid());
         665               0 :     aDict.oldValue = d;
         666                 :   }
         667               0 :   NS_ENSURE_STATE(JS_HasPropertyById(aCx, aObj, gDictionary_id_newValue, &found));
         668               0 :   if (found) {
         669               0 :     NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, gDictionary_id_newValue, &v));
         670               0 :     xpc_qsDOMString d(aCx, v, &v, xpc_qsDOMString::eNull, xpc_qsDOMString::eNull);
         671               0 :     NS_ENSURE_STATE(d.IsValid());
         672               0 :     aDict.newValue = d;
         673                 :   }
         674               0 :   NS_ENSURE_STATE(JS_HasPropertyById(aCx, aObj, gDictionary_id_url, &found));
         675               0 :   if (found) {
         676               0 :     NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, gDictionary_id_url, &v));
         677               0 :     xpc_qsDOMString d(aCx, v, &v, xpc_qsDOMString::eStringify, xpc_qsDOMString::eStringify);
         678               0 :     NS_ENSURE_STATE(d.IsValid());
         679               0 :     aDict.url = d;
         680                 :   }
         681               0 :   NS_ENSURE_STATE(JS_HasPropertyById(aCx, aObj, gDictionary_id_storageArea, &found));
         682               0 :   if (found) {
         683               0 :     NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, gDictionary_id_storageArea, &v));
         684                 :     nsIDOMStorage * d;
         685               0 :     xpc_qsSelfRef ref;
         686               0 :     nsresult rv = xpc_qsUnwrapArg<nsIDOMStorage>(aCx, v, &d, &ref.ptr, &v);
         687               0 :     NS_ENSURE_SUCCESS(rv, rv);
         688               0 :     aDict.storageArea = d;
         689                 :   }
         690               0 :   return NS_OK;
         691                 : }
         692                 :
         693                 : nsresult
         694               0 : StorageEventInit::Init(JSContext* aCx, const jsval* aVal)
         695                 : {
         696               0 :   if (!aCx || !aVal) {
         697               0 :     return NS_OK;
         698                 :   }
         699               0 :   NS_ENSURE_STATE(aVal->isObject());
         700                 :
         701               0 :   JSObject* obj = &aVal->toObject();
         702               0 :   nsCxPusher pusher;
         703               0 :   NS_ENSURE_STATE(pusher.Push(aCx, false));
         704               0 :   JSAutoRequest ar(aCx);
         705               0 :   JSAutoEnterCompartment ac;
         706               0 :   NS_ENSURE_STATE(ac.enter(aCx, obj));
         707               0 :   return StorageEventInit_InitInternal(*this, aCx, obj);
         708                 : }
         709                 :
         710               0 : BlobPropertyBag::BlobPropertyBag() :
         711                 :   type(),
         712               0 :   endings(NS_LITERAL_STRING("transparent"))
         713               0 : {}
         714                 :
         715               0 : BlobPropertyBag::~BlobPropertyBag() {}
         716                 :
         717                 : static nsresult
         718               0 : BlobPropertyBag_InitInternal(BlobPropertyBag& aDict, JSContext* aCx, JSObject* aObj)
         719                 : {
         720               0 :   JSBool found = PR_FALSE;
         721               0 :   jsval v = JSVAL_VOID;
         722               0 :   NS_ENSURE_STATE(JS_HasPropertyById(aCx, aObj, gDictionary_id_type, &found));
         723               0 :   if (found) {
         724               0 :     NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, gDictionary_id_type, &v));
         725               0 :     xpc_qsDOMString d(aCx, v, &v, xpc_qsDOMString::eStringify, xpc_qsDOMString::eStringify);
         726               0 :     NS_ENSURE_STATE(d.IsValid());
         727               0 :     aDict.type = d;
         728                 :   }
         729               0 :   NS_ENSURE_STATE(JS_HasPropertyById(aCx, aObj, gDictionary_id_endings, &found));
         730               0 :   if (found) {
         731               0 :     NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, gDictionary_id_endings, &v));
         732               0 :     xpc_qsDOMString d(aCx, v, &v, xpc_qsDOMString::eStringify, xpc_qsDOMString::eStringify);
         733               0 :     NS_ENSURE_STATE(d.IsValid());
         734               0 :     aDict.endings = d;
         735                 :   }
         736               0 :   return NS_OK;
         737                 : }
         738                 :
         739                 : nsresult
         740               0 : BlobPropertyBag::Init(JSContext* aCx, const jsval* aVal)
         741                 : {
         742               0 :   if (!aCx || !aVal) {
         743               0 :     return NS_OK;
         744                 :   }
         745               0 :   NS_ENSURE_STATE(aVal->isObject());
         746                 :
         747               0 :   JSObject* obj = &aVal->toObject();
         748               0 :   nsCxPusher pusher;
         749               0 :   NS_ENSURE_STATE(pusher.Push(aCx, false));
         750               0 :   JSAutoRequest ar(aCx);
         751               0 :   JSAutoEnterCompartment ac;
         752               0 :   NS_ENSURE_STATE(ac.enter(aCx, obj));
         753               0 :   return BlobPropertyBag_InitInternal(*this, aCx, obj);
         754            4188 : }
         755                 :

Generated by: LCOV version 1.7