Bug 487145 - Update language helpers to follow style guidelines
authorShawn Wilsher <sdwilsh@shawnwilsher.com>
Wed, 08 Apr 2009 12:24:25 -0400
changeset 27085 a41ec1a6b8fcf08db5ce425827c872899f429776
parent 27084 5c54a147468feb0dfc1b7f99441a12a3344f197a
child 27086 0ea22856b5d9e25e2b687e3fb6f3da557274f42a
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs487145
milestone1.9.2a1pre
Bug 487145 - Update language helpers to follow style guidelines Consistent spacing, consistent naming, and namespaces - OH MY! r=asuth
storage/src/mozStorageStatement.cpp
storage/src/mozStorageStatement.h
storage/src/mozStorageStatementJSHelper.cpp
storage/src/mozStorageStatementJSHelper.h
storage/src/mozStorageStatementParams.cpp
storage/src/mozStorageStatementParams.h
storage/src/mozStorageStatementRow.cpp
storage/src/mozStorageStatementRow.h
storage/src/mozStorageStatementWrapper.cpp
--- a/storage/src/mozStorageStatement.cpp
+++ b/storage/src/mozStorageStatement.cpp
@@ -44,30 +44,32 @@
 #include "nsAutoLock.h"
 #include "nsError.h"
 #include "nsISimpleEnumerator.h"
 #include "nsMemory.h"
 #include "nsIClassInfoImpl.h"
 #include "nsIProgrammingLanguage.h"
 
 #include "mozStorageConnection.h"
-#include "mozStorageStatement.h"
 #include "mozStorageStatementJSHelper.h"
 #include "mozStorageValueArray.h"
 #include "mozStoragePrivateHelpers.h"
 #include "mozStorageEvents.h"
 #include "mozStorageStatementParams.h"
 #include "mozStorageStatementRow.h"
+#include "mozStorageStatement.h"
 
 #include "prlog.h"
 
 #ifdef PR_LOGGING
 extern PRLogModuleInfo* gStorageLog;
 #endif
 
+using namespace mozilla::storage;
+
 ////////////////////////////////////////////////////////////////////////////////
 //// nsIClassInfo
 
 NS_IMPL_CI_INTERFACE_GETTER2(
     mozStorageStatement
 ,   mozIStorageStatement
 ,   mozIStorageValueArray
 )
@@ -82,17 +84,17 @@ public:
     {
         return NS_CI_INTERFACE_GETTER_NAME(mozStorageStatement)(_count, _array);
     }
 
     NS_IMETHODIMP
     GetHelperForLanguage(PRUint32 aLanguage, nsISupports **_helper)
     {
         if (aLanguage == nsIProgrammingLanguage::JAVASCRIPT) {
-            static mozStorageStatementJSHelper sJSHelper;
+            static StatementJSHelper sJSHelper;
             *_helper = &sJSHelper;
             return NS_OK;
         }
 
         *_helper = nsnull;
         return NS_OK;
     }
 
@@ -305,29 +307,27 @@ mozStorageStatement::Finalize()
 
     // We are considered dead at this point, so any wrappers for row or params
     // need to lose their reference to us.
     if (mStatementParamsHolder) {
         nsCOMPtr<nsIXPConnectWrappedNative> wrapper =
             do_QueryInterface(mStatementParamsHolder);
         nsCOMPtr<mozIStorageStatementParams> iParams =
             do_QueryWrappedNative(wrapper);
-        mozStorageStatementParams *params =
-            static_cast<mozStorageStatementParams *>(iParams.get());
+        StatementParams *params = static_cast<StatementParams *>(iParams.get());
         params->mStatement = nsnull;
         mStatementParamsHolder = nsnull;
     }
 
     if (mStatementRowHolder) {
         nsCOMPtr<nsIXPConnectWrappedNative> wrapper =
             do_QueryInterface(mStatementRowHolder);
         nsCOMPtr<mozIStorageStatementRow> iRow =
             do_QueryWrappedNative(wrapper);
-        mozStorageStatementRow *row =
-            static_cast<mozStorageStatementRow *>(iRow.get());
+        StatementRow *row = static_cast<StatementRow *>(iRow.get());
         row->mStatement = nsnull;
         mStatementRowHolder = nsnull;
     }
 
     return ConvertResultCode(srv);
 }
 
 /* readonly attribute unsigned long parameterCount; */
--- a/storage/src/mozStorageStatement.h
+++ b/storage/src/mozStorageStatement.h
@@ -45,17 +45,22 @@
 #include "nsTArray.h"
 
 #include "mozIStorageStatement.h"
 
 #include <sqlite3.h>
 
 class mozStorageConnection;
 class nsIXPConnectJSObjectHolder;
-class mozStorageStatementJSHelper;
+
+namespace mozilla {
+namespace storage {
+class StatementJSHelper;
+}
+}
 
 class mozStorageStatement : public mozIStorageStatement
 {
 public:
     mozStorageStatement();
 
     // interfaces
     NS_DECL_ISUPPORTS
@@ -93,12 +98,12 @@ protected:
 
     /**
      * The following two members are only used with the JS helper.  They cache
      * the row and params objects.
      */
     nsCOMPtr<nsIXPConnectJSObjectHolder> mStatementParamsHolder;
     nsCOMPtr<nsIXPConnectJSObjectHolder> mStatementRowHolder;
 
-    friend class mozStorageStatementJSHelper;
+    friend class mozilla::storage::StatementJSHelper;
 };
 
 #endif /* _MOZSTORAGESTATEMENT_H_ */
--- a/storage/src/mozStorageStatementJSHelper.cpp
+++ b/storage/src/mozStorageStatementJSHelper.cpp
@@ -1,10 +1,10 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * vim: sw=2 ts=2 sts=2 expandtab
+ * vim: sw=2 ts=2 sts=2 et :
  * ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  *
  * The contents of this file are subject to the Mozilla Public License Version
  * 1.1 (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
  *
@@ -47,29 +47,35 @@
 
 #include "mozStorageStatementJSHelper.h"
 
 #include "mozStorageStatementRow.h"
 #include "mozStorageStatementParams.h"
 
 #include "jsapi.h"
 
-using namespace mozilla::storage;
+namespace mozilla {
+namespace storage {
+
+////////////////////////////////////////////////////////////////////////////////
+//// Global Functions
 
 static
 JSBool
-stepFunc(JSContext *aCtx, PRUint32, jsval *_vp)
+stepFunc(JSContext *aCtx,
+         PRUint32,
+         jsval *_vp)
 {
   nsCOMPtr<nsIXPConnect> xpc(Service::getXPConnect());
   nsCOMPtr<nsIXPConnectWrappedNative> wrapper;
   nsresult rv = xpc->GetWrappedNativeOfJSObject(
     aCtx, JS_THIS_OBJECT(aCtx, _vp), getter_AddRefs(wrapper)
   );
   if (NS_FAILED(rv)) {
-    JS_ReportError(aCtx, "mozIStorageStatement::step() could not obtain native statement");
+    ::JS_ReportError(aCtx, "mozIStorageStatement::step() could not obtain native statement");
     return JS_FALSE;
   }
 
   mozStorageStatement *stmt =
     static_cast<mozStorageStatement *>(wrapper->Native());
 
 #ifdef DEBUG
   {
@@ -82,39 +88,42 @@ stepFunc(JSContext *aCtx, PRUint32, jsva
   rv = stmt->ExecuteStep(&hasMore);
   if (NS_SUCCEEDED(rv) && !hasMore) {
     *_vp = JSVAL_FALSE;
     (void)stmt->Reset();
     return JS_TRUE;
   }
 
   if (NS_FAILED(rv)) {
-    JS_ReportError(aCtx, "mozIStorageStatement::step() returned an error");
+    ::JS_ReportError(aCtx, "mozIStorageStatement::step() returned an error");
     return JS_FALSE;
   }
 
   *_vp = BOOLEAN_TO_JSVAL(hasMore);
   return JS_TRUE;
 }
 
+////////////////////////////////////////////////////////////////////////////////
+//// StatementJSHelper
+
 nsresult
-mozStorageStatementJSHelper::getRow(mozStorageStatement *aStatement,
-                                    JSContext *aCtx, JSObject *aScopeObj,
-                                    jsval *_row)
+StatementJSHelper::getRow(mozStorageStatement *aStatement,
+                          JSContext *aCtx,
+                          JSObject *aScopeObj,
+                          jsval *_row)
 {
   nsresult rv;
 
   PRInt32 state;
   (void)aStatement->GetState(&state);
   if (state != mozIStorageStatement::MOZ_STORAGE_STATEMENT_EXECUTING)
     return NS_ERROR_UNEXPECTED;
 
   if (!aStatement->mStatementRowHolder) {
-    nsCOMPtr<mozIStorageStatementRow> row =
-      new mozStorageStatementRow(aStatement);
+    nsCOMPtr<mozIStorageStatementRow> row(new StatementRow(aStatement));
     NS_ENSURE_TRUE(row, NS_ERROR_OUT_OF_MEMORY);
 
     nsCOMPtr<nsIXPConnect> xpc(Service::getXPConnect());
     rv = xpc->WrapNative(
       aCtx,
       ::JS_GetGlobalForObject(aCtx, aScopeObj),
       row,
       NS_GET_IID(mozIStorageStatementRow),
@@ -127,30 +136,31 @@ mozStorageStatementJSHelper::getRow(mozS
   rv = aStatement->mStatementRowHolder->GetJSObject(&obj);
   NS_ENSURE_SUCCESS(rv, rv);
 
   *_row = OBJECT_TO_JSVAL(obj);
   return NS_OK;
 }
 
 nsresult
-mozStorageStatementJSHelper::getParams(mozStorageStatement *aStatement,
-                                       JSContext *aCtx, JSObject *aScopeObj,
-                                       jsval *_params)
+StatementJSHelper::getParams(mozStorageStatement *aStatement,
+                             JSContext *aCtx,
+                             JSObject *aScopeObj,
+                             jsval *_params)
 {
   nsresult rv;
 
   PRInt32 state;
   (void)aStatement->GetState(&state);
   if (state != mozIStorageStatement::MOZ_STORAGE_STATEMENT_READY)
     return NS_ERROR_UNEXPECTED;
 
   if (!aStatement->mStatementParamsHolder) {
     nsCOMPtr<mozIStorageStatementParams> params =
-      new mozStorageStatementParams(aStatement);
+      new StatementParams(aStatement);
     NS_ENSURE_TRUE(params, NS_ERROR_OUT_OF_MEMORY);
 
     nsCOMPtr<nsIXPConnect> xpc(Service::getXPConnect());
     rv = xpc->WrapNative(
       aCtx,
       ::JS_GetGlobalForObject(aCtx, aScopeObj),
       params,
       NS_GET_IID(mozIStorageStatementParams),
@@ -162,73 +172,81 @@ mozStorageStatementJSHelper::getParams(m
   JSObject *obj = nsnull;
   rv = aStatement->mStatementParamsHolder->GetJSObject(&obj);
   NS_ENSURE_SUCCESS(rv, rv);
 
   *_params = OBJECT_TO_JSVAL(obj);
   return NS_OK;
 }
 
-NS_IMETHODIMP_(nsrefcnt) mozStorageStatementJSHelper::AddRef() { return 2; }
-NS_IMETHODIMP_(nsrefcnt) mozStorageStatementJSHelper::Release() { return 1; }
-NS_INTERFACE_MAP_BEGIN(mozStorageStatementJSHelper)
+NS_IMETHODIMP_(nsrefcnt) StatementJSHelper::AddRef() { return 2; }
+NS_IMETHODIMP_(nsrefcnt) StatementJSHelper::Release() { return 1; }
+NS_INTERFACE_MAP_BEGIN(StatementJSHelper)
   NS_INTERFACE_MAP_ENTRY(nsIXPCScriptable)
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
 ////////////////////////////////////////////////////////////////////////////////
 //// nsIXPCScriptable
 
-#define XPC_MAP_CLASSNAME mozStorageStatementJSHelper
-#define XPC_MAP_QUOTED_CLASSNAME "mozStorageStatementJSHelper"
+#define XPC_MAP_CLASSNAME StatementJSHelper
+#define XPC_MAP_QUOTED_CLASSNAME "StatementJSHelper"
 #define XPC_MAP_WANT_GETPROPERTY
 #define XPC_MAP_WANT_NEWRESOLVE
 #define XPC_MAP_FLAGS nsIXPCScriptable::ALLOW_PROP_MODS_DURING_RESOLVE
 #include "xpc_map_end.h"
 
 NS_IMETHODIMP
-mozStorageStatementJSHelper::GetProperty(nsIXPConnectWrappedNative *aWrapper,
-                                         JSContext *aCtx, JSObject *aScopeObj,
-                                         jsval aId, jsval *_result,
-                                         PRBool *_retval)
+StatementJSHelper::GetProperty(nsIXPConnectWrappedNative *aWrapper,
+                               JSContext *aCtx,
+                               JSObject *aScopeObj,
+                               jsval aId,
+                               jsval *_result,
+                               PRBool *_retval)
 {
   if (!JSVAL_IS_STRING(aId))
     return NS_OK;
 
   mozStorageStatement *stmt =
     static_cast<mozStorageStatement *>(aWrapper->Native());
 
 #ifdef DEBUG
   {
     nsCOMPtr<mozIStorageStatement> isStatement(do_QueryInterface(stmt));
     NS_ASSERTION(isStatement, "How is this not a statement?!");
   }
 #endif
 
-  const char *propName = JS_GetStringBytes(JSVAL_TO_STRING(aId));
-  if (strcmp(propName, "row") == 0)
+  const char *propName = ::JS_GetStringBytes(JSVAL_TO_STRING(aId));
+  if (::strcmp(propName, "row") == 0)
     return getRow(stmt, aCtx, aScopeObj, _result);
 
-  if (strcmp(propName, "params") == 0)
+  if (::strcmp(propName, "params") == 0)
     return getParams(stmt, aCtx, aScopeObj, _result);
 
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
-mozStorageStatementJSHelper::NewResolve(nsIXPConnectWrappedNative *aWrapper,
-                                        JSContext *aCtx, JSObject *aScopeObj,
-                                        jsval aId, PRUint32 aFlags,
-                                        JSObject **_objp, PRBool *_retval)
+StatementJSHelper::NewResolve(nsIXPConnectWrappedNative *aWrapper,
+                              JSContext *aCtx,
+                              JSObject *aScopeObj,
+                              jsval aId,
+                              PRUint32 aFlags,
+                              JSObject **_objp,
+                              PRBool *_retval)
 {
   if (!JSVAL_IS_STRING(aId))
     return NS_OK;
 
-  const char *name = JS_GetStringBytes(JSVAL_TO_STRING(aId));
-  if (strcmp(name, "step") == 0) {
-    *_retval = JS_DefineFunction(aCtx, aScopeObj, "step", (JSNative)stepFunc, 0,
-                                 JSFUN_FAST_NATIVE) != nsnull;
+  const char *name = ::JS_GetStringBytes(JSVAL_TO_STRING(aId));
+  if (::strcmp(name, "step") == 0) {
+    *_retval = ::JS_DefineFunction(aCtx, aScopeObj, "step", (JSNative)stepFunc,
+                                   0, JSFUN_FAST_NATIVE) != nsnull;
     *_objp = aScopeObj;
     return NS_OK;
   }
   return NS_OK;
 }
+
+} // namespace storage
+} // namespace mozilla
--- a/storage/src/mozStorageStatementJSHelper.h
+++ b/storage/src/mozStorageStatementJSHelper.h
@@ -39,20 +39,26 @@
 
 #ifndef __MOZSTORAGESTATEMENTJSHELPER_H__
 #define __MOZSTORAGESTATEMENTJSHELPER_H__
 
 #include "nsIXPCScriptable.h"
 
 class mozStorageStatement;
 
-class mozStorageStatementJSHelper : public nsIXPCScriptable
+namespace mozilla {
+namespace storage {
+
+class StatementJSHelper : public nsIXPCScriptable
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIXPCSCRIPTABLE
 
 private:
   nsresult getRow(mozStorageStatement *, JSContext *, JSObject *, jsval *);
   nsresult getParams(mozStorageStatement *, JSContext *, JSObject *, jsval *);
 };
 
+} // namespace storage
+} // namespace mozilla
+
 #endif // __MOZSTORAGESTATEMENTJSHELPER_H__
--- a/storage/src/mozStorageStatementParams.cpp
+++ b/storage/src/mozStorageStatementParams.cpp
@@ -1,10 +1,10 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- * vim: sw=4 ts=4 sts=4
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ * vim: sw=2 ts=2 sts=2 et :
  * ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  *
  * The contents of this file are subject to the Mozilla Public License Version
  * 1.1 (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
  *
@@ -38,341 +38,198 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsMemory.h"
 #include "nsString.h"
 
 #include "mozStorageStatementParams.h"
 
-
-/*************************************************************************
- ****
- **** mozStorageStatementParams
- ****
- *************************************************************************/
-
-NS_IMPL_ISUPPORTS2(mozStorageStatementParams, mozIStorageStatementParams, nsIXPCScriptable)
+namespace mozilla {
+namespace storage {
 
-mozStorageStatementParams::mozStorageStatementParams(mozIStorageStatement *aStatement)
-    : mStatement(aStatement)
-{
-    NS_ASSERTION(mStatement != nsnull, "mStatement is null");
-    mStatement->GetParameterCount(&mParamCount);
-}
+////////////////////////////////////////////////////////////////////////////////
+//// StatementParams
 
-/*
- * nsIXPCScriptable impl
- */
-
-/* readonly attribute string className; */
-NS_IMETHODIMP
-mozStorageStatementParams::GetClassName(char * *aClassName)
+StatementParams::StatementParams(mozIStorageStatement *aStatement) :
+    mStatement(aStatement)
 {
-    NS_ENSURE_ARG_POINTER(aClassName);
-    *aClassName = (char *) nsMemory::Clone("mozStorageStatementParams", 26);
-    if (!*aClassName)
-        return NS_ERROR_OUT_OF_MEMORY;
-    return NS_OK;
-}
-
-/* readonly attribute PRUint32 scriptableFlags; */
-NS_IMETHODIMP
-mozStorageStatementParams::GetScriptableFlags(PRUint32 *aScriptableFlags)
-{
-    *aScriptableFlags =
-        nsIXPCScriptable::WANT_SETPROPERTY |
-        nsIXPCScriptable::WANT_NEWENUMERATE |
-        nsIXPCScriptable::WANT_NEWRESOLVE |
-        nsIXPCScriptable::ALLOW_PROP_MODS_DURING_RESOLVE;
-    return NS_OK;
-}
-
-/* PRBool getProperty (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal id, in JSValPtr vp); */
-NS_IMETHODIMP
-mozStorageStatementParams::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                         JSObject * obj, jsval id, jsval * vp, PRBool *_retval)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
+  NS_ASSERTION(mStatement != nsnull, "mStatement is null");
+  (void)mStatement->GetParameterCount(&mParamCount);
 }
 
+NS_IMPL_ISUPPORTS2(
+  StatementParams,
+  mozIStorageStatementParams,
+  nsIXPCScriptable
+)
 
-/* PRBool setProperty (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal id, in JSValPtr vp); */
-NS_IMETHODIMP
-mozStorageStatementParams::SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                         JSObject * obj, jsval id, jsval * vp, PRBool *_retval)
-{
-    NS_ENSURE_TRUE(mStatement, NS_ERROR_NOT_INITIALIZED);
-
-    if (JSVAL_IS_INT(id)) {
-        int idx = JSVAL_TO_INT(id);
+////////////////////////////////////////////////////////////////////////////////
+//// nsIXPCScriptable
 
-        PRBool res = JSValStorageStatementBinder(cx, mStatement, idx, *vp);
-        NS_ENSURE_TRUE(res, NS_ERROR_UNEXPECTED);
-    }
-    else if (JSVAL_IS_STRING(id)) {
-        JSString *str = JSVAL_TO_STRING(id);
-        nsCAutoString name(":");
-        name.Append(NS_ConvertUTF16toUTF8(::JS_GetStringChars(str),
-                                          ::JS_GetStringLength(str)));
+#define XPC_MAP_CLASSNAME StatementParams
+#define XPC_MAP_QUOTED_CLASSNAME "StatementParams"
+#define XPC_MAP_WANT_SETPROPERTY
+#define XPC_MAP_WANT_NEWENUMERATE
+#define XPC_MAP_WANT_NEWRESOLVE
+#define XPC_MAP_FLAGS nsIXPCScriptable::ALLOW_PROP_MODS_DURING_RESOLVE
+#include "xpc_map_end.h"
 
-        // check to see if there's a parameter with this name
-        PRUint32 index;
-        nsresult rv = mStatement->GetParameterIndex(name, &index);
-        NS_ENSURE_SUCCESS(rv, rv);
-
-        PRBool res = JSValStorageStatementBinder(cx, mStatement, index, *vp);
-        NS_ENSURE_TRUE(res, NS_ERROR_UNEXPECTED);
-    }
-    else {
-        return NS_ERROR_INVALID_ARG;
-    }
-
-    *_retval = PR_TRUE;
-    return NS_OK;
-}
-
-/* void preCreate (in nsISupports nativeObj, in JSContextPtr cx, in JSObjectPtr globalObj, out JSObjectPtr parentObj); */
 NS_IMETHODIMP
-mozStorageStatementParams::PreCreate(nsISupports *nativeObj, JSContext * cx,
-                       JSObject * globalObj, JSObject * *parentObj)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void create (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj); */
-NS_IMETHODIMP
-mozStorageStatementParams::Create(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj)
+StatementParams::SetProperty(nsIXPConnectWrappedNative *aWrapper,
+                             JSContext *aCtx,
+                             JSObject *aScopeObj,
+                             jsval aId,
+                             jsval *_vp,
+                             PRBool *_retval)
 {
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
+  NS_ENSURE_TRUE(mStatement, NS_ERROR_NOT_INITIALIZED);
 
-/* void postCreate (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj); */
-NS_IMETHODIMP
-mozStorageStatementParams::PostCreate(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
+  if (JSVAL_IS_INT(aId)) {
+    int idx = JSVAL_TO_INT(aId);
 
-/* PRBool addProperty (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal id, in JSValPtr vp); */
-NS_IMETHODIMP
-mozStorageStatementParams::AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                                    JSObject * obj, jsval id, jsval * vp, PRBool *_retval)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
+    PRBool res = JSValStorageStatementBinder(aCtx, mStatement, idx, *_vp);
+    NS_ENSURE_TRUE(res, NS_ERROR_UNEXPECTED);
+  }
+  else if (JSVAL_IS_STRING(aId)) {
+    JSString *str = JSVAL_TO_STRING(aId);
+    nsCAutoString name(":");
+    name.Append(NS_ConvertUTF16toUTF8(::JS_GetStringChars(str),
+                                      ::JS_GetStringLength(str)));
 
-/* PRBool delProperty (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal id, in JSValPtr vp); */
-NS_IMETHODIMP
-mozStorageStatementParams::DelProperty(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                                    JSObject * obj, jsval id, jsval * vp, PRBool *_retval)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
+    // check to see if there's a parameter with this name
+    PRUint32 index;
+    nsresult rv = mStatement->GetParameterIndex(name, &index);
+    NS_ENSURE_SUCCESS(rv, rv);
 
-/* PRBool enumerate (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj); */
-NS_IMETHODIMP
-mozStorageStatementParams::Enumerate(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                                  JSObject * obj, PRBool *_retval)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
+    PRBool res = JSValStorageStatementBinder(aCtx, mStatement, index, *_vp);
+    NS_ENSURE_TRUE(res, NS_ERROR_UNEXPECTED);
+  }
+  else {
+    return NS_ERROR_INVALID_ARG;
+  }
+
+  *_retval = PR_TRUE;
+  return NS_OK;
 }
 
-/* PRBool newEnumerate (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in PRUint32 enum_op, in JSValPtr statep, out JSID idp); */
 NS_IMETHODIMP
-mozStorageStatementParams::NewEnumerate(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                                     JSObject * obj, PRUint32 enum_op, jsval * statep, jsid *idp, PRBool *_retval)
+StatementParams::NewEnumerate(nsIXPConnectWrappedNative *aWrapper,
+                              JSContext *aCtx,
+                              JSObject *aScopeObj,
+                              PRUint32 aEnumOp,
+                              jsval *_statep,
+                              jsid *_idp,
+                              PRBool *_retval)
 {
-    NS_ENSURE_TRUE(mStatement, NS_ERROR_NOT_INITIALIZED);
-
-    switch (enum_op) {
-        case JSENUMERATE_INIT:
-        {
-            // Start our internal index at zero.
-            *statep = JSVAL_ZERO;
+  NS_ENSURE_TRUE(mStatement, NS_ERROR_NOT_INITIALIZED);
 
-            // And set our length, if needed.
-            if (idp)
-                *idp = INT_TO_JSVAL(mParamCount);
+  switch (aEnumOp) {
+    case JSENUMERATE_INIT:
+    {
+      // Start our internal index at zero.
+      *_statep = JSVAL_ZERO;
 
-            break;
-        }
-        case JSENUMERATE_NEXT:
-        {
-            NS_ASSERTION(*statep != JSVAL_NULL, "Internal state is null!");
+      // And set our length, if needed.
+      if (_idp)
+        *_idp = INT_TO_JSVAL(mParamCount);
 
-            // Make sure we are in range first.
-            PRUint32 index = static_cast<PRUint32>(JSVAL_TO_INT(*statep));
-            if (index >= mParamCount) {
-                *statep = JSVAL_NULL;
-                return NS_OK;
-            }
+      break;
+    }
+    case JSENUMERATE_NEXT:
+    {
+      NS_ASSERTION(*_statep != JSVAL_NULL, "Internal state is null!");
 
-            // Get the name of our parameter.
-            nsCAutoString name;
-            nsresult rv = mStatement->GetParameterName(index, name);
-            NS_ENSURE_SUCCESS(rv, rv);
+      // Make sure we are in range first.
+      PRUint32 index = static_cast<PRUint32>(JSVAL_TO_INT(*_statep));
+      if (index >= mParamCount) {
+        *_statep = JSVAL_NULL;
+        return NS_OK;
+      }
 
-            // But drop the first character, which is going to be a ':'.
-            JSString *jsname = JS_NewStringCopyN(cx, &(name.get()[1]),
-                                                 name.Length() - 1);
-            NS_ENSURE_TRUE(jsname, NS_ERROR_OUT_OF_MEMORY);
+      // Get the name of our parameter.
+      nsCAutoString name;
+      nsresult rv = mStatement->GetParameterName(index, name);
+      NS_ENSURE_SUCCESS(rv, rv);
 
-            // Set our name.
-            if (!JS_ValueToId(cx, STRING_TO_JSVAL(jsname), idp)) {
-                *_retval = PR_FALSE;
-                return NS_OK;
-            }
+      // But drop the first character, which is going to be a ':'.
+      JSString *jsname = ::JS_NewStringCopyN(aCtx, &(name.get()[1]),
+                                             name.Length() - 1);
+      NS_ENSURE_TRUE(jsname, NS_ERROR_OUT_OF_MEMORY);
 
-            // And increment our index.
-            *statep = INT_TO_JSVAL(++index);
+      // Set our name.
+      if (!::JS_ValueToId(aCtx, STRING_TO_JSVAL(jsname), _idp)) {
+        *_retval = PR_FALSE;
+        return NS_OK;
+      }
+
+      // And increment our index.
+      *_statep = INT_TO_JSVAL(++index);
 
-            break;
-        }
-        case JSENUMERATE_DESTROY:
-        {
-            // Clear our state.
-            *statep = JSVAL_NULL;
+      break;
+    }
+    case JSENUMERATE_DESTROY:
+    {
+      // Clear our state.
+      *_statep = JSVAL_NULL;
 
-            break;
-        }
+      break;
     }
+  }
 
-    return NS_OK;
+  return NS_OK;
 }
 
-/* PRBool newResolve (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal id, in PRUint32 flags, out JSObjectPtr objp); */
 NS_IMETHODIMP
-mozStorageStatementParams::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                                   JSObject * obj, jsval id, PRUint32 flags, JSObject * *objp, PRBool *_retval)
+StatementParams::NewResolve(nsIXPConnectWrappedNative *aWrapper,
+                            JSContext *aCtx,
+                            JSObject *aScopeObj,
+                            jsval aId,
+                            PRUint32 aFlags,
+                            JSObject **_objp,
+                            PRBool *_retval)
 {
-    NS_ENSURE_TRUE(mStatement, NS_ERROR_NOT_INITIALIZED);
-    // We do not throw at any point after this unless our index is out of range
-    // because we want to allow the prototype chain to be checked for the
-    // property.
-
-    PRUint32 idx;
+  NS_ENSURE_TRUE(mStatement, NS_ERROR_NOT_INITIALIZED);
+  // We do not throw at any point after this unless our index is out of range
+  // because we want to allow the prototype chain to be checked for the
+  // property.
 
-    if (JSVAL_IS_INT(id)) {
-        idx = JSVAL_TO_INT(id);
+  PRUint32 idx;
 
-        // Ensure that our index is within range.
-        if (idx >= mParamCount)
-            return NS_ERROR_INVALID_ARG;
-    }
-    else if (JSVAL_IS_STRING(id)) {
-        JSString *str = JSVAL_TO_STRING(id);
-        jschar *nameChars = JS_GetStringChars(str);
-        size_t nameLength = JS_GetStringLength(str);
-
-        nsCAutoString name(":");
-        name.Append(NS_ConvertUTF16toUTF8(nameChars, nameLength));
+  if (JSVAL_IS_INT(aId)) {
+    idx = JSVAL_TO_INT(aId);
 
-        // Check to see if there's a parameter with this name, and if not, let
-        // the rest of the prototype chain be checked.
-        nsresult rv = mStatement->GetParameterIndex(name, &idx);
-        if (NS_FAILED(rv))
-            return NS_OK;
+    // Ensure that our index is within range.
+    if (idx >= mParamCount)
+      return NS_ERROR_INVALID_ARG;
+  }
+  else if (JSVAL_IS_STRING(aId)) {
+    JSString *str = JSVAL_TO_STRING(aId);
+    jschar *nameChars = ::JS_GetStringChars(str);
+    size_t nameLength = ::JS_GetStringLength(str);
 
-        *_retval = JS_DefineUCProperty(cx, obj, nameChars, nameLength,
-                                       JSVAL_VOID, nsnull, nsnull, 0);
-        NS_ENSURE_TRUE(*_retval, NS_OK);
-    }
-    else {
-        // We do not handle other types.
-        return NS_OK;
-    }
+    nsCAutoString name(":");
+    name.Append(NS_ConvertUTF16toUTF8(nameChars, nameLength));
 
-    *_retval = ::JS_DefineElement(cx, obj, idx, JSVAL_VOID, nsnull, nsnull, 0);
-    if (*_retval)
-        *objp = obj;
-    return NS_OK;
-}
+    // Check to see if there's a parameter with this name, and if not, let
+    // the rest of the prototype chain be checked.
+    nsresult rv = mStatement->GetParameterIndex(name, &idx);
+    if (NS_FAILED(rv))
+      return NS_OK;
 
-/* PRBool convert (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in PRUint32 type, in JSValPtr vp); */
-NS_IMETHODIMP
-mozStorageStatementParams::Convert(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                                JSObject * obj, PRUint32 type, jsval * vp, PRBool *_retval)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
+    *_retval = ::JS_DefineUCProperty(aCtx, aScopeObj, nameChars, nameLength,
+                                     JSVAL_VOID, nsnull, nsnull, 0);
+    NS_ENSURE_TRUE(*_retval, NS_OK);
+  }
+  else {
+    // We do not handle other types.
+    return NS_OK;
+  }
 
-/* void finalize (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj); */
-NS_IMETHODIMP
-mozStorageStatementParams::Finalize(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                                 JSObject * obj)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
+  *_retval = ::JS_DefineElement(aCtx, aScopeObj, idx, JSVAL_VOID, nsnull,
+                                nsnull, 0);
+  if (*_retval)
+    *_objp = aScopeObj;
+  return NS_OK;
 }
 
-/* PRBool checkAccess (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal id, in PRUint32 mode, in JSValPtr vp); */
-NS_IMETHODIMP
-mozStorageStatementParams::CheckAccess(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                                    JSObject * obj, jsval id, PRUint32 mode, jsval * vp, PRBool *_retval)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* PRBool call (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in PRUint32 argc, in JSValPtr argv, in JSValPtr vp); */
-NS_IMETHODIMP
-mozStorageStatementParams::Call(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                             JSObject * obj, PRUint32 argc, jsval * argv, jsval * vp, PRBool *_retval)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* PRBool construct (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in PRUint32 argc, in JSValPtr argv, in JSValPtr vp); */
-NS_IMETHODIMP
-mozStorageStatementParams::Construct(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                                  JSObject * obj, PRUint32 argc, jsval * argv, jsval * vp, PRBool *_retval)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* PRBool hasInstance (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal val, out PRBool bp); */
-NS_IMETHODIMP
-mozStorageStatementParams::HasInstance(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                                    JSObject * obj, jsval val, PRBool *bp, PRBool *_retval)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void trace (in nsIXPConnectWrappedNative wrapper, in JSTracerPtr trc, in JSObjectPtr obj); */
-NS_IMETHODIMP
-mozStorageStatementParams::Trace(nsIXPConnectWrappedNative *wrapper,
-                                JSTracer *trc, JSObject * obj)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* PRBool equality(in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal val); */
-NS_IMETHODIMP
-mozStorageStatementParams::Equality(nsIXPConnectWrappedNative *wrapper,
-                                    JSContext *cx, JSObject *obj, jsval val,
-                                    PRBool *_retval)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* JSObjectPtr outerObject(in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj); */
-NS_IMETHODIMP
-mozStorageStatementParams::OuterObject(nsIXPConnectWrappedNative *wrapper,
-                                       JSContext *cx, JSObject *obj,
-                                       JSObject **_retval)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* JSObjectPtr innerObject(in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj); */
-NS_IMETHODIMP
-mozStorageStatementParams::InnerObject(nsIXPConnectWrappedNative *wrapper,
-                                       JSContext *cx, JSObject *obj,
-                                       JSObject **_retval)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void postCreatePrototype (in JSContextPtr cx, in JSObjectPtr proto); */
-NS_IMETHODIMP
-mozStorageStatementParams::PostCreatePrototype(JSContext * cx, JSObject * proto)
-{
-    return NS_OK;
-}
+} // namespace storage
+} // namespace mozilla
--- a/storage/src/mozStorageStatementParams.h
+++ b/storage/src/mozStorageStatementParams.h
@@ -1,10 +1,11 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ * vim: sw=2 ts=2 sts=2 et :
+ * ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  *
  * The contents of this file are subject to the Mozilla Public License Version
  * 1.1 (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
  *
  * Software distributed under the License is distributed on an "AS IS" basis,
@@ -34,75 +35,93 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef _MOZSTORAGESTATEMENTPARAMS_H_
 #define _MOZSTORAGESTATEMENTPARAMS_H_
 
-#include "mozIStorageStatement.h"
 #include "mozIStorageStatementWrapper.h"
 #include "nsIXPCScriptable.h"
 
 #include "jsapi.h"
 #include "jsdate.h"
 
+class mozIStorageStatement;
 class mozStorageStatement;
 
-class mozStorageStatementParams : public mozIStorageStatementParams,
-                                  public nsIXPCScriptable
+namespace mozilla {
+namespace storage {
+
+class StatementParams : public mozIStorageStatementParams
+                      , public nsIXPCScriptable
 {
 public:
-    mozStorageStatementParams(mozIStorageStatement *aStatement);
+  StatementParams(mozIStorageStatement *aStatement);
 
-    // interfaces
-    NS_DECL_ISUPPORTS
-    NS_DECL_MOZISTORAGESTATEMENTPARAMS
-    NS_DECL_NSIXPCSCRIPTABLE
+  // interfaces
+  NS_DECL_ISUPPORTS
+  NS_DECL_MOZISTORAGESTATEMENTPARAMS
+  NS_DECL_NSIXPCSCRIPTABLE
 
 protected:
-    mozIStorageStatement *mStatement;
-    PRUint32 mParamCount;
+  mozIStorageStatement *mStatement;
+  PRUint32 mParamCount;
 
-    friend class mozStorageStatement;
+  friend class ::mozStorageStatement;
 };
 
-static PRBool
-JSValStorageStatementBinder (JSContext *cx,
-                             mozIStorageStatement *aStatement,
-                             int aIdx,
-                             jsval val)
+static
+PRBool
+JSValStorageStatementBinder(JSContext *aCtx,
+                            mozIStorageStatement *aStatement,
+                            int aIdx,
+                            jsval aValue)
 {
-    if (JSVAL_IS_INT(val)) {
-        int v = JSVAL_TO_INT(val);
-        (void)aStatement->BindInt32Parameter(aIdx, v);
-    } else if (JSVAL_IS_DOUBLE(val)) {
-        double d = *JSVAL_TO_DOUBLE(val);
-        (void)aStatement->BindDoubleParameter(aIdx, d);
-    } else if (JSVAL_IS_STRING(val)) {
-        JSString *str = JSVAL_TO_STRING(val);
-        (void)aStatement->BindStringParameter(aIdx, nsDependentString(reinterpret_cast<PRUnichar*>(JS_GetStringChars(str)), JS_GetStringLength(str)));
-    } else if (JSVAL_IS_BOOLEAN(val)) {
-        (void)aStatement->BindInt32Parameter(aIdx, (val == JSVAL_TRUE) ? 1 : 0);
-    } else if (JSVAL_IS_NULL(val)) {
-        (void)aStatement->BindNullParameter(aIdx);
-    } else if (JSVAL_IS_OBJECT(val)) {
-        JSObject *obj = JSVAL_TO_OBJECT(val);
-        // some special things
-        if (js_DateIsValid (cx, obj)) {
-            double msecd = js_DateGetMsecSinceEpoch(cx, obj);
-            msecd *= 1000.0;
-            PRInt64 msec;
-            LL_D2L(msec, msecd);
+  if (JSVAL_IS_INT(aValue)) {
+    int v = JSVAL_TO_INT(aValue);
+    (void)aStatement->BindInt32Parameter(aIdx, v);
+  }
+  else if (JSVAL_IS_DOUBLE(aValue)) {
+    double d = *JSVAL_TO_DOUBLE(aValue);
+    (void)aStatement->BindDoubleParameter(aIdx, d);
+  }
+  else if (JSVAL_IS_STRING(aValue)) {
+    JSString *str = JSVAL_TO_STRING(aValue);
+    nsDependentString value(
+      reinterpret_cast<PRUnichar *>(::JS_GetStringChars(str)),
+      ::JS_GetStringLength(str)
+    );
+    (void)aStatement->BindStringParameter(aIdx, value);
+  }
+  else if (JSVAL_IS_BOOLEAN(aValue)) {
+    (void)aStatement->BindInt32Parameter(aIdx, (aValue == JSVAL_TRUE) ? 1 : 0);
+  }
+  else if (JSVAL_IS_NULL(aValue)) {
+    (void)aStatement->BindNullParameter(aIdx);
+  }
+  else if (JSVAL_IS_OBJECT(aValue)) {
+    JSObject *obj = JSVAL_TO_OBJECT(aValue);
+    // some special things
+    if (::js_DateIsValid (aCtx, obj)) {
+      double msecd = ::js_DateGetMsecSinceEpoch(aCtx, obj);
+      msecd *= 1000.0;
+      PRInt64 msec;
+      LL_D2L(msec, msecd);
 
-            (void)aStatement->BindInt64Parameter(aIdx, msec);
-        } else {
-            return PR_FALSE;
-        }
-    } else {
-        return PR_FALSE;
+      (void)aStatement->BindInt64Parameter(aIdx, msec);
+    }
+    else {
+      return PR_FALSE;
     }
+  }
+  else {
+    return PR_FALSE;
+  }
 
-    return PR_TRUE;
+  return PR_TRUE;
 }
 
+} // namespace storage
+} // namespace mozilla
+
 #endif /* _MOZSTORAGESTATEMENTPARAMS_H_ */
--- a/storage/src/mozStorageStatementRow.cpp
+++ b/storage/src/mozStorageStatementRow.cpp
@@ -1,10 +1,10 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- * vim: sw=4 ts=4 sts=4
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ * vim: sw=2 ts=2 sts=2 et :
  * ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  *
  * The contents of this file are subject to the Mozilla Public License Version
  * 1.1 (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
  *
@@ -37,299 +37,145 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsMemory.h"
 #include "nsString.h"
 
 #include "mozStorageStatementRow.h"
+#include "mozStorageStatement.h"
 
 #include "jsapi.h"
 #include "jsdate.h"
 
-/*************************************************************************
- ****
- **** mozStorageStatementRow
- ****
- *************************************************************************/
+namespace mozilla {
+namespace storage {
 
-NS_IMPL_ISUPPORTS2(mozStorageStatementRow, mozIStorageStatementRow, nsIXPCScriptable)
+////////////////////////////////////////////////////////////////////////////////
+//// StatementRow
 
-mozStorageStatementRow::mozStorageStatementRow(mozStorageStatement *aStatement)
-    : mStatement(aStatement)
+StatementRow::StatementRow(mozStorageStatement *aStatement) :
+    mStatement(aStatement)
 {
 }
 
-/*
- * nsIXPCScriptable impl
- */
+NS_IMPL_ISUPPORTS2(
+  StatementRow,
+  mozIStorageStatementRow,
+  nsIXPCScriptable
+)
 
-/* readonly attribute string className; */
-NS_IMETHODIMP
-mozStorageStatementRow::GetClassName(char * *aClassName)
-{
-    NS_ENSURE_ARG_POINTER(aClassName);
-    *aClassName = (char *) nsMemory::Clone("mozStorageStatementRow", 23);
-    if (!*aClassName)
-        return NS_ERROR_OUT_OF_MEMORY;
-    return NS_OK;
-}
+////////////////////////////////////////////////////////////////////////////////
+//// nsIXPCScriptable
 
-/* readonly attribute PRUint32 scriptableFlags; */
+#define XPC_MAP_CLASSNAME StatementRow
+#define XPC_MAP_QUOTED_CLASSNAME "StatementRow"
+#define XPC_MAP_WANT_GETPROPERTY
+#define XPC_MAP_WANT_NEWRESOLVE
+#define XPC_MAP_FLAGS nsIXPCScriptable::ALLOW_PROP_MODS_DURING_RESOLVE
+#include "xpc_map_end.h"
+
 NS_IMETHODIMP
-mozStorageStatementRow::GetScriptableFlags(PRUint32 *aScriptableFlags)
-{
-    *aScriptableFlags =
-        nsIXPCScriptable::WANT_GETPROPERTY |
-        nsIXPCScriptable::WANT_NEWRESOLVE |
-        nsIXPCScriptable::ALLOW_PROP_MODS_DURING_RESOLVE;
-    return NS_OK;
-}
-
-/* PRBool getProperty (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal id, in JSValPtr vp); */
-NS_IMETHODIMP
-mozStorageStatementRow::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                         JSObject * obj, jsval id, jsval * vp, PRBool *_retval)
+StatementRow::GetProperty(nsIXPConnectWrappedNative *aWrapper,
+                          JSContext *aCtx,
+                          JSObject *aScopeObj,
+                          jsval aId,
+                          jsval *_vp,
+                          PRBool *_retval)
 {
-    NS_ENSURE_TRUE(mStatement, NS_ERROR_NOT_INITIALIZED);
+  NS_ENSURE_TRUE(mStatement, NS_ERROR_NOT_INITIALIZED);
 
-    if (JSVAL_IS_STRING(id)) {
-        nsDependentCString jsid(::JS_GetStringBytes(JSVAL_TO_STRING(id)));
+  if (JSVAL_IS_STRING(aId)) {
+    nsDependentCString jsid(::JS_GetStringBytes(JSVAL_TO_STRING(aId)));
 
-        PRUint32 idx;
-        nsresult rv = mStatement->GetColumnIndex(jsid, &idx);
-        NS_ENSURE_SUCCESS(rv, rv);
-        PRInt32 type;
-        rv = mStatement->GetTypeOfIndex(idx, &type);
-        NS_ENSURE_SUCCESS(rv, rv);
+    PRUint32 idx;
+    nsresult rv = mStatement->GetColumnIndex(jsid, &idx);
+    NS_ENSURE_SUCCESS(rv, rv);
+    PRInt32 type;
+    rv = mStatement->GetTypeOfIndex(idx, &type);
+    NS_ENSURE_SUCCESS(rv, rv);
 
-        if (type == mozIStorageValueArray::VALUE_TYPE_INTEGER ||
-            type == mozIStorageValueArray::VALUE_TYPE_FLOAT) {
-            double dval;
-            rv = mStatement->GetDouble(idx, &dval);
-            NS_ENSURE_SUCCESS(rv, rv);
-            if (!JS_NewNumberValue(cx, dval, vp)) {
-                *_retval = PR_FALSE;
-                return NS_OK;
-            }
-        }
-        else if (type == mozIStorageValueArray::VALUE_TYPE_TEXT) {
-            PRUint32 bytes;
-            const jschar *sval = reinterpret_cast<const jschar *>(
-                mStatement->AsSharedWString(idx, &bytes)
-            );
-            JSString *str = JS_NewUCStringCopyN(cx, sval, bytes / 2);
-            if (!str) {
-                *_retval = PR_FALSE;
-                return NS_OK;
-            }
-            *vp = STRING_TO_JSVAL(str);
+    if (type == mozIStorageValueArray::VALUE_TYPE_INTEGER ||
+        type == mozIStorageValueArray::VALUE_TYPE_FLOAT) {
+      double dval;
+      rv = mStatement->GetDouble(idx, &dval);
+      NS_ENSURE_SUCCESS(rv, rv);
+      if (!::JS_NewNumberValue(aCtx, dval, _vp)) {
+        *_retval = PR_FALSE;
+        return NS_OK;
+      }
+    }
+    else if (type == mozIStorageValueArray::VALUE_TYPE_TEXT) {
+      PRUint32 bytes;
+      const jschar *sval = reinterpret_cast<const jschar *>(
+        mStatement->AsSharedWString(idx, &bytes)
+      );
+      JSString *str = ::JS_NewUCStringCopyN(aCtx, sval, bytes / 2);
+      if (!str) {
+        *_retval = PR_FALSE;
+        return NS_OK;
+      }
+      *_vp = STRING_TO_JSVAL(str);
+    }
+    else if (type == mozIStorageValueArray::VALUE_TYPE_BLOB) {
+      PRUint32 length;
+      const PRUint8 *blob = mStatement->AsSharedBlob(idx, &length);
+      JSObject *obj = ::JS_NewArrayObject(aCtx, length, nsnull);
+      if (!obj) {
+        *_retval = PR_FALSE;
+        return NS_OK;
+      }
+      *_vp = OBJECT_TO_JSVAL(obj);
+
+      // Copy the blob over to the JS array.
+      for (PRUint32 i = 0; i < length; i++) {
+        jsval val = INT_TO_JSVAL(blob[i]);
+        if (!::JS_SetElement(aCtx, aScopeObj, i, &val)) {
+          *_retval = PR_FALSE;
+          return NS_OK;
         }
-        else if (type == mozIStorageValueArray::VALUE_TYPE_BLOB) {
-            PRUint32 length;
-            const PRUint8 *blob = mStatement->AsSharedBlob(idx, &length);
-            JSObject *obj = JS_NewArrayObject(cx, length, nsnull);
-            if (!obj) {
-                *_retval = PR_FALSE;
-                return NS_OK;
-            }
-            *vp = OBJECT_TO_JSVAL(obj);
-
-            // Copy the blob over to the JS array.
-            for (PRUint32 i = 0; i < length; i++) {
-                jsval val = INT_TO_JSVAL(blob[i]);
-                if (!JS_SetElement(cx, obj, i, &val)) {
-                    *_retval = PR_FALSE;
-                    return NS_OK;
-                }
-            }
-        }
-        else if (type == mozIStorageValueArray::VALUE_TYPE_NULL) {
-            *vp = JSVAL_NULL;
-        }
-        else {
-            NS_ERROR("sqlite3_column_type returned unknown column type, what's going on?");
-        }
+      }
+    }
+    else if (type == mozIStorageValueArray::VALUE_TYPE_NULL) {
+      *_vp = JSVAL_NULL;
     }
-
-    return NS_OK;
-}
-
+    else {
+      NS_ERROR("unknown column type returned, what's going on?");
+    }
+  }
 
-/* PRBool setProperty (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal id, in JSValPtr vp); */
-NS_IMETHODIMP
-mozStorageStatementRow::SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                         JSObject * obj, jsval id, jsval * vp, PRBool *_retval)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void preCreate (in nsISupports nativeObj, in JSContextPtr cx, in JSObjectPtr globalObj, out JSObjectPtr parentObj); */
-NS_IMETHODIMP
-mozStorageStatementRow::PreCreate(nsISupports *nativeObj, JSContext * cx,
-                       JSObject * globalObj, JSObject * *parentObj)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void create (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj); */
-NS_IMETHODIMP
-mozStorageStatementRow::Create(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void postCreate (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj); */
-NS_IMETHODIMP
-mozStorageStatementRow::PostCreate(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* PRBool addProperty (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal id, in JSValPtr vp); */
-NS_IMETHODIMP
-mozStorageStatementRow::AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                                    JSObject * obj, jsval id, jsval * vp, PRBool *_retval)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
+  return NS_OK;
 }
 
-/* PRBool delProperty (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal id, in JSValPtr vp); */
 NS_IMETHODIMP
-mozStorageStatementRow::DelProperty(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                                    JSObject * obj, jsval id, jsval * vp, PRBool *_retval)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* PRBool enumerate (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj); */
-NS_IMETHODIMP
-mozStorageStatementRow::Enumerate(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                                  JSObject * obj, PRBool *_retval)
+StatementRow::NewResolve(nsIXPConnectWrappedNative *aWrapper,
+                         JSContext *aCtx,
+                         JSObject *aScopeObj,
+                         jsval aId,
+                         PRUint32 aFlags,
+                         JSObject **_objp,
+                         PRBool *_retval)
 {
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
+  NS_ENSURE_TRUE(mStatement, NS_ERROR_NOT_INITIALIZED);
 
-/* PRBool newEnumerate (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in PRUint32 enum_op, in JSValPtr statep, out JSID idp); */
-NS_IMETHODIMP
-mozStorageStatementRow::NewEnumerate(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                                     JSObject * obj, PRUint32 enum_op, jsval * statep, jsid *idp, PRBool *_retval)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* PRBool newResolve (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal id, in PRUint32 flags, out JSObjectPtr objp); */
-NS_IMETHODIMP
-mozStorageStatementRow::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                                   JSObject * obj, jsval id, PRUint32 flags, JSObject * *objp, PRBool *_retval)
-{
-    NS_ENSURE_TRUE(mStatement, NS_ERROR_NOT_INITIALIZED);
+  if (JSVAL_IS_STRING(aId)) {
+    JSString *str = JSVAL_TO_STRING(aId);
+    nsDependentCString name(::JS_GetStringBytes(str));
 
-    if (JSVAL_IS_STRING(id)) {
-        JSString *str = JSVAL_TO_STRING(id);
-        nsDependentCString name(::JS_GetStringBytes(str));
-
-        PRUint32 idx;
-        nsresult rv = mStatement->GetColumnIndex(name, &idx);
-        NS_ENSURE_SUCCESS(rv, rv);
-
-        *_retval = ::JS_DefineUCProperty(cx, obj, ::JS_GetStringChars(str),
-                                         ::JS_GetStringLength(str),
-                                         JSVAL_VOID,
-                                         nsnull, nsnull, 0);
-        *objp = obj;
-        return *_retval ? NS_OK : NS_ERROR_FAILURE;
-    }
+    PRUint32 idx;
+    nsresult rv = mStatement->GetColumnIndex(name, &idx);
+    NS_ENSURE_SUCCESS(rv, rv);
 
-    *_retval = PR_TRUE;
-    return NS_OK;
-}
+    *_retval = ::JS_DefineUCProperty(aCtx, aScopeObj, ::JS_GetStringChars(str),
+                                     ::JS_GetStringLength(str),
+                                     JSVAL_VOID,
+                                     nsnull, nsnull, 0);
+    *_objp = aScopeObj;
+    return *_retval ? NS_OK : NS_ERROR_FAILURE;
+  }
 
-/* PRBool convert (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in PRUint32 type, in JSValPtr vp); */
-NS_IMETHODIMP
-mozStorageStatementRow::Convert(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                                JSObject * obj, PRUint32 type, jsval * vp, PRBool *_retval)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void finalize (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj); */
-NS_IMETHODIMP
-mozStorageStatementRow::Finalize(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                                 JSObject * obj)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
+  *_retval = PR_TRUE;
+  return NS_OK;
 }
 
-/* PRBool checkAccess (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal id, in PRUint32 mode, in JSValPtr vp); */
-NS_IMETHODIMP
-mozStorageStatementRow::CheckAccess(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                                    JSObject * obj, jsval id, PRUint32 mode, jsval * vp, PRBool *_retval)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* PRBool call (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in PRUint32 argc, in JSValPtr argv, in JSValPtr vp); */
-NS_IMETHODIMP
-mozStorageStatementRow::Call(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                             JSObject * obj, PRUint32 argc, jsval * argv, jsval * vp, PRBool *_retval)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* PRBool construct (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in PRUint32 argc, in JSValPtr argv, in JSValPtr vp); */
-NS_IMETHODIMP
-mozStorageStatementRow::Construct(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                                  JSObject * obj, PRUint32 argc, jsval * argv, jsval * vp, PRBool *_retval)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* PRBool hasInstance (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal val, out PRBool bp); */
-NS_IMETHODIMP
-mozStorageStatementRow::HasInstance(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
-                                    JSObject * obj, jsval val, PRBool *bp, PRBool *_retval)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void trace (in nsIXPConnectWrappedNative wrapper, in JSTracerPtr trc, in JSObjectPtr obj); */
-NS_IMETHODIMP
-mozStorageStatementRow::Trace(nsIXPConnectWrappedNative *wrapper,
-                              JSTracer * trc, JSObject * obj)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* PRBool equality(in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in JSVal val); */
-NS_IMETHODIMP
-mozStorageStatementRow::Equality(nsIXPConnectWrappedNative *wrapper,
-                                 JSContext *cx, JSObject *obj, jsval val,
-                                 PRBool *_retval)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* JSObjectPtr outerObject(in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj); */
-NS_IMETHODIMP
-mozStorageStatementRow::OuterObject(nsIXPConnectWrappedNative *wrapper,
-                                    JSContext *cx, JSObject *obj,
-                                    JSObject **_retval)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* JSObjectPtr innerObject(in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj); */
-NS_IMETHODIMP
-mozStorageStatementRow::InnerObject(nsIXPConnectWrappedNative *wrapper,
-                                    JSContext *cx, JSObject *obj,
-                                    JSObject **_retval)
-{
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void postCreatePrototype (in JSContextPtr cx, in JSObjectPtr proto); */
-NS_IMETHODIMP
-mozStorageStatementRow::PostCreatePrototype(JSContext * cx, JSObject * proto)
-{
-    return NS_OK;
-}
+} // namespace storage
+} // namescape mozilla
--- a/storage/src/mozStorageStatementRow.h
+++ b/storage/src/mozStorageStatementRow.h
@@ -1,10 +1,11 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ * vim: sw=2 ts=2 sts=2 et :
+ * ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  *
  * The contents of this file are subject to the Mozilla Public License Version
  * 1.1 (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
  *
  * Software distributed under the License is distributed on an "AS IS" basis,
@@ -36,34 +37,35 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef _MOZSTORAGESTATEMENTROW_H_
 #define _MOZSTORAGESTATEMENTROW_H_
 
 #include "mozIStorageStatementWrapper.h"
 #include "nsIXPCScriptable.h"
-#include "mozStorageStatement.h"
-#include "nsString.h"
-#include "nsVoidArray.h"
+
+class mozStorageStatement;
+
 
-class mozStorageStatementRow : public mozIStorageStatementRow,
-                               public nsIXPCScriptable
+namespace mozilla {
+namespace storage {
+
+class StatementRow : public mozIStorageStatementRow
+                   , public nsIXPCScriptable
 {
 public:
-    mozStorageStatementRow(mozStorageStatement *aStatement);
-
-    // nsISupports interface
-    NS_DECL_ISUPPORTS
+  NS_DECL_ISUPPORTS
+  NS_DECL_MOZISTORAGESTATEMENTROW
+  NS_DECL_NSIXPCSCRIPTABLE
 
-    // mozIStorageStatementRow interface (empty)
-    NS_DECL_MOZISTORAGESTATEMENTROW
-
-    // nsIXPCScriptable interface
-    NS_DECL_NSIXPCSCRIPTABLE
+  StatementRow(mozStorageStatement *aStatement);
 protected:
 
-    mozStorageStatement *mStatement;
+  mozStorageStatement *mStatement;
 
-    friend class mozStorageStatement;
+  friend class ::mozStorageStatement;
 };
 
+} // namespace storage
+} // namespace mozilla
+
 #endif /* _MOZSTORAGESTATEMENTROW_H_ */
--- a/storage/src/mozStorageStatementWrapper.cpp
+++ b/storage/src/mozStorageStatementWrapper.cpp
@@ -42,16 +42,17 @@
 #include "nsString.h"
 
 #include "mozStorageStatementWrapper.h"
 #include "mozStorageStatementParams.h"
 #include "mozStorageStatementRow.h"
 
 #include "sqlite3.h"
 
+using namespace mozilla::storage;
 
 /*************************************************************************
  ****
  **** mozStorageStatementWrapper
  ****
  *************************************************************************/
 
 NS_IMPL_ISUPPORTS2(mozStorageStatementWrapper, mozIStorageStatementWrapper, nsIXPCScriptable)
@@ -138,33 +139,33 @@ mozStorageStatementWrapper::GetRow(mozIS
         return NS_ERROR_FAILURE;
 
     PRInt32 state;
     mStatement->GetState(&state);
     if (state != mozIStorageStatement::MOZ_STORAGE_STATEMENT_EXECUTING)
         return NS_ERROR_FAILURE;
 
     if (!mStatementRow) {
-        mozStorageStatementRow *row = new mozStorageStatementRow(mStatement);
+        StatementRow *row = new StatementRow(mStatement);
         if (!row)
             return NS_ERROR_OUT_OF_MEMORY;
         mStatementRow = row;
     }
 
     NS_ADDREF(*aRow = mStatementRow);
     return NS_OK;
 }
 
 NS_IMETHODIMP
 mozStorageStatementWrapper::GetParams(mozIStorageStatementParams **aParams)
 {
     NS_ENSURE_ARG_POINTER(aParams);
 
     if (!mStatementParams) {
-        mozStorageStatementParams *params = new mozStorageStatementParams(mStatement);
+        StatementParams *params = new StatementParams(mStatement);
         if (!params)
             return NS_ERROR_OUT_OF_MEMORY;
         mStatementParams = params;
     }
 
     NS_ADDREF(*aParams = mStatementParams);
     return NS_OK;
 }