Browser builds
authorLuke Wagner <lw@mozilla.com>
Thu, 17 Jun 2010 23:51:54 -0700
changeset 52927 5ad4532aa996fc7564419a53fd3ebd6809f508eb
parent 52926 ed7ecdee54cd5bbdbdb3cfbdfd23481e01f02890
child 52928 aca966fb2c3af2fc36c472a6cc5b6cb5d12a3f4c
push idunknown
push userunknown
push dateunknown
milestone1.9.3a5pre
Browser builds
caps/idl/nsIScriptSecurityManager.idl
caps/include/nsScriptSecurityManager.h
caps/src/nsScriptSecurityManager.cpp
content/canvas/src/CustomQS_Canvas2D.h
content/events/src/nsEventListenerManager.cpp
content/events/src/nsEventListenerManager.h
content/html/document/src/nsHTMLDocument.cpp
content/html/document/src/nsHTMLDocument.h
content/xbl/src/nsXBLDocumentInfo.cpp
content/xul/document/src/nsXULPrototypeDocument.cpp
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfo.h
dom/base/nsGlobalWindow.cpp
dom/base/nsGlobalWindow.h
dom/base/nsJSEnvironment.cpp
dom/base/nsJSUtils.h
dom/src/threads/nsDOMWorker.cpp
dom/src/threads/nsDOMWorkerSecurityManager.cpp
dom/src/threads/nsDOMWorkerSecurityManager.h
extensions/pref/autoconfig/src/nsJSConfigTriggers.cpp
js/jsd/jsd_val.c
js/src/ctypes/CTypes.cpp
js/src/ctypes/CTypes.h
js/src/jsapi.cpp
js/src/jsapi.h
js/src/jsarray.cpp
js/src/jsatom.h
js/src/jsobj.h
js/src/jsops.cpp
js/src/jspubtd.h
js/src/jsscope.h
js/src/jsxml.cpp
js/src/xpconnect/idl/nsIXPCScriptable.idl
js/src/xpconnect/idl/nsIXPCSecurityManager.idl
js/src/xpconnect/idl/nsIXPConnect.idl
js/src/xpconnect/public/xpc_map_end.h
js/src/xpconnect/shell/xpcshell.cpp
js/src/xpconnect/src/XPCChromeObjectWrapper.cpp
js/src/xpconnect/src/XPCCrossOriginWrapper.cpp
js/src/xpconnect/src/XPCNativeWrapper.cpp
js/src/xpconnect/src/XPCSafeJSObjectWrapper.cpp
js/src/xpconnect/src/XPCSystemOnlyWrapper.cpp
js/src/xpconnect/src/XPCWrapper.cpp
js/src/xpconnect/src/XPCWrapper.h
js/src/xpconnect/src/nsXPConnect.cpp
js/src/xpconnect/src/qsgen.py
js/src/xpconnect/src/xpccallcontext.cpp
js/src/xpconnect/src/xpccomponents.cpp
js/src/xpconnect/src/xpcinlines.h
js/src/xpconnect/src/xpcjsid.cpp
js/src/xpconnect/src/xpcjsruntime.cpp
js/src/xpconnect/src/xpcprivate.h
js/src/xpconnect/src/xpcquickstubs.cpp
js/src/xpconnect/src/xpcquickstubs.h
js/src/xpconnect/src/xpcruntimesvc.cpp
js/src/xpconnect/src/xpcthreadcontext.cpp
js/src/xpconnect/src/xpcwrappednative.cpp
js/src/xpconnect/src/xpcwrappednativeinfo.cpp
js/src/xpconnect/src/xpcwrappednativejsops.cpp
js/src/xpconnect/tests/TestXPC.cpp
modules/plugin/base/src/nsJSNPRuntime.cpp
modules/plugin/base/src/nsNPAPIPlugin.h
storage/src/mozStorageAsyncStatementJSHelper.cpp
storage/src/mozStorageAsyncStatementParams.cpp
storage/src/mozStorageStatementJSHelper.cpp
storage/src/mozStorageStatementParams.cpp
storage/src/mozStorageStatementRow.cpp
xpcom/base/nsrootidl.idl
--- a/caps/idl/nsIScriptSecurityManager.idl
+++ b/caps/idl/nsIScriptSecurityManager.idl
@@ -46,17 +46,17 @@ interface nsIScriptSecurityManager : nsI
 {
     ///////////////// Security Checks //////////////////
     /**
      * Checks whether the running script is allowed to access aProperty.
      */
     [noscript] void checkPropertyAccess(in JSContextPtr aJSContext,
                                         in JSObjectPtr aJSObject,
                                         in string aClassName,
-                                        in jsval aProperty,
+                                        in jsid aProperty,
                                         in PRUint32 aAction);
 
     /**
      * Check that the script currently running in context "cx" can load "uri".
      *
      * Will return error code NS_ERROR_DOM_BAD_URI if the load request 
      * should be denied.
      *
--- a/caps/include/nsScriptSecurityManager.h
+++ b/caps/include/nsScriptSecurityManager.h
@@ -424,17 +424,17 @@ public:
 private:
 
     // GetScriptSecurityManager is the only call that can make one
     nsScriptSecurityManager();
     virtual ~nsScriptSecurityManager();
 
     static JSBool
     CheckObjectAccess(JSContext *cx, JSObject *obj,
-                      jsval id, JSAccessMode mode,
+                      jsid id, JSAccessMode mode,
                       jsval *vp);
 
     // Decides, based on CSP, whether or not eval() and stuff can be executed.
     static JSBool
     ContentSecurityPolicyPermitsJSAction(JSContext *cx);
 
     // Returns null if a principal cannot be found; generally callers
     // should error out at that point.
@@ -451,27 +451,27 @@ private:
     doGetSubjectPrincipal(nsresult* rv);
     
     nsresult
     CheckPropertyAccessImpl(PRUint32 aAction,
                             nsAXPCNativeCallContext* aCallContext,
                             JSContext* cx, JSObject* aJSObject,
                             nsISupports* aObj, nsIURI* aTargetURI,
                             nsIClassInfo* aClassInfo,
-                            const char* aClassName, jsval aProperty,
+                            const char* aClassName, jsid aProperty,
                             void** aCachedClassPolicy);
 
     nsresult
     CheckSameOriginDOMProp(nsIPrincipal* aSubject, 
                            nsIPrincipal* aObject,
                            PRUint32 aAction);
 
     nsresult
     LookupPolicy(nsIPrincipal* principal,
-                 ClassInfoData& aClassData, jsval aProperty,
+                 ClassInfoData& aClassData, jsid aProperty,
                  PRUint32 aAction,
                  ClassPolicy** aCachedClassPolicy,
                  SecurityLevel* result);
 
     nsresult
     CreateCodebasePrincipal(nsIURI* aURI, nsIPrincipal** result);
 
     // This is just like the API method, but it doesn't check that the subject
@@ -611,17 +611,17 @@ private:
 
         ContextPrincipal *mNext;
         JSContext *mCx;
         JSStackFrame *mFp;
         nsCOMPtr<nsIPrincipal> mPrincipal;
     };
 
     // JS strings we need to clean up on shutdown
-    static jsval sEnabledID;
+    static jsid sEnabledID;
 
     inline void
     ScriptSecurityPrefChanged();
 
     static const char sJSEnabledPrefName[];
     static const char sFileOriginPolicyPrefName[];
 
     nsObjectHashtable* mOriginToPolicyMap;
--- a/caps/src/nsScriptSecurityManager.cpp
+++ b/caps/src/nsScriptSecurityManager.cpp
@@ -111,19 +111,25 @@ PRBool nsScriptSecurityManager::sStrictF
 static JSEqualityOp sXPCWrappedNativeEqualityOps;
 
 
 ///////////////////////////
 // Convenience Functions //
 ///////////////////////////
 // Result of this function should not be freed.
 static inline const PRUnichar *
-JSValIDToString(JSContext *cx, const jsval idval)
+IDToString(JSContext *cx, jsid id)
 {
+    if (JSID_IS_STRING(id))
+        return reinterpret_cast<PRUnichar*>(JS_GetStringChars(JSID_TO_STRING(id)));
+
     JSAutoRequest ar(cx);
+    jsval idval;
+    if (!JS_IdToValue(cx, id, &idval))
+        return nsnull;
     JSString *str = JS_ValueToString(cx, idval);
     if(!str)
         return nsnull;
     return reinterpret_cast<PRUnichar*>(JS_GetStringChars(str));
 }
 
 class nsAutoInPrincipalDomainOriginSetter {
 public:
@@ -561,17 +567,17 @@ nsScriptSecurityManager::ContentSecurity
     }
 
     return evalOK;
 }
 
 
 JSBool
 nsScriptSecurityManager::CheckObjectAccess(JSContext *cx, JSObject *obj,
-                                           jsval id, JSAccessMode mode,
+                                           jsid id, JSAccessMode mode,
                                            jsval *vp)
 {
     // Get the security manager
     nsScriptSecurityManager *ssm =
         nsScriptSecurityManager::GetScriptSecurityManager();
 
     NS_ASSERTION(ssm, "Failed to get security manager service");
     if (!ssm)
@@ -600,17 +606,17 @@ nsScriptSecurityManager::CheckObjectAcce
 
     return JS_TRUE;
 }
 
 NS_IMETHODIMP
 nsScriptSecurityManager::CheckPropertyAccess(JSContext* cx,
                                              JSObject* aJSObject,
                                              const char* aClassName,
-                                             jsval aProperty,
+                                             jsid aProperty,
                                              PRUint32 aAction)
 {
     return CheckPropertyAccessImpl(aAction, nsnull, cx, aJSObject,
                                    nsnull, nsnull, nsnull,
                                    aClassName, aProperty, nsnull);
 }
 
 NS_IMETHODIMP
@@ -680,17 +686,17 @@ nsScriptSecurityManager::CheckSameOrigin
 }
 
 nsresult
 nsScriptSecurityManager::CheckPropertyAccessImpl(PRUint32 aAction,
                                                  nsAXPCNativeCallContext* aCallContext,
                                                  JSContext* cx, JSObject* aJSObject,
                                                  nsISupports* aObj, nsIURI* aTargetURI,
                                                  nsIClassInfo* aClassInfo,
-                                                 const char* aClassName, jsval aProperty,
+                                                 const char* aClassName, jsid aProperty,
                                                  void** aCachedClassPolicy)
 {
     nsresult rv;
     nsIPrincipal* subjectPrincipal = GetSubjectPrincipal(cx, &rv);
     if (NS_FAILED(rv))
         return rv;
 
     if (!subjectPrincipal || subjectPrincipal == mSystemPrincipal)
@@ -699,17 +705,17 @@ nsScriptSecurityManager::CheckPropertyAc
 
     nsCOMPtr<nsIPrincipal> objectPrincipal;
 
     // Hold the class info data here so we don't have to go back to virtual
     // methods all the time
     ClassInfoData classInfoData(aClassInfo, aClassName);
 #ifdef DEBUG_CAPS_CheckPropertyAccessImpl
     nsCAutoString propertyName;
-    propertyName.AssignWithConversion((PRUnichar*)JSValIDToString(cx, aProperty));
+    propertyName.AssignWithConversion((PRUnichar*)IDToString(cx, aProperty));
     printf("### CanAccess(%s.%s, %i) ", classInfoData.GetName(), 
            propertyName.get(), aAction);
 #endif
 
     //-- Look up the security policy for this class and subject domain
     SecurityLevel securityLevel;
     rv = LookupPolicy(subjectPrincipal, classInfoData, aProperty, aAction, 
                       (ClassPolicy**)aCachedClassPolicy, &securityLevel);
@@ -821,27 +827,27 @@ nsScriptSecurityManager::CheckPropertyAc
         if (NS_SUCCEEDED(rv) && interfaceInfo)
             rv = interfaceInfo->GetIIDShared(&objIID);
         if (NS_SUCCEEDED(rv) && objIID)
         {
             switch (aAction)
             {
             case nsIXPCSecurityManager::ACCESS_GET_PROPERTY:
                 checkedComponent->CanGetProperty(objIID,
-                                                 JSValIDToString(cx, aProperty),
+                                                 IDToString(cx, aProperty),
                                                  getter_Copies(objectSecurityLevel));
                 break;
             case nsIXPCSecurityManager::ACCESS_SET_PROPERTY:
                 checkedComponent->CanSetProperty(objIID,
-                                                 JSValIDToString(cx, aProperty),
+                                                 IDToString(cx, aProperty),
                                                  getter_Copies(objectSecurityLevel));
                 break;
             case nsIXPCSecurityManager::ACCESS_CALL_METHOD:
                 checkedComponent->CanCallMethod(objIID,
-                                                JSValIDToString(cx, aProperty),
+                                                IDToString(cx, aProperty),
                                                 getter_Copies(objectSecurityLevel));
             }
         }
     }
     rv = CheckXPCPermissions(cx, aObj, aJSObject, subjectPrincipal,
                              objectSecurityLevel);
 #ifdef DEBUG_CAPS_CheckPropertyAccessImpl
     if(NS_SUCCEEDED(rv))
@@ -902,17 +908,17 @@ nsScriptSecurityManager::CheckPropertyAc
         NS_ConvertUTF8toUTF16 objectOriginUnicode(objectOrigin);
         NS_ConvertUTF8toUTF16 objectDomainUnicode(objectDomain);
 
         nsXPIDLString errorMsg;
         const PRUnichar *formatStrings[] =
         {
             subjectOriginUnicode.get(),
             className.get(),
-            JSValIDToString(cx, aProperty),
+            IDToString(cx, aProperty),
             objectOriginUnicode.get(),
             subjectDomainUnicode.get(),
             objectDomainUnicode.get()
         };
 
         PRUint32 length = NS_ARRAY_LENGTH(formatStrings);
 
         // XXXbz Our localization system is stupid and can't handle not showing
@@ -1071,17 +1077,17 @@ nsScriptSecurityManager::CheckSameOrigin
     ** Access tests failed, so now report error.
     */
     return NS_ERROR_DOM_PROP_ACCESS_DENIED;
 }
 
 nsresult
 nsScriptSecurityManager::LookupPolicy(nsIPrincipal* aPrincipal,
                                       ClassInfoData& aClassData,
-                                      jsval aProperty,
+                                      jsid aProperty,
                                       PRUint32 aAction,
                                       ClassPolicy** aCachedClassPolicy,
                                       SecurityLevel* result)
 {
     nsresult rv;
     result->level = SCRIPT_SECURITY_UNDEFINED_ACCESS;
 
     DomainPolicy* dpolicy = nsnull;
@@ -1182,24 +1188,24 @@ nsScriptSecurityManager::LookupPolicy(ns
 
         if (PL_DHASH_ENTRY_IS_FREE(cpolicy))
             cpolicy = NO_POLICY_FOR_CLASS;
 
         if ((dpolicy == mDefaultPolicy) && aCachedClassPolicy)
             *aCachedClassPolicy = cpolicy;
     }
 
-    NS_ASSERTION(JSVAL_IS_INT(aProperty) || JSVAL_IS_OBJECT(aProperty) ||
-                 JSVAL_IS_STRING(aProperty), "Property must be a valid id");
+    NS_ASSERTION(JSID_IS_INT(aProperty) || JSID_IS_OBJECT(aProperty) ||
+                 JSID_IS_STRING(aProperty), "Property must be a valid id");
 
     // Only atomized strings are stored in the policies' hash tables.
-    if (!JSVAL_IS_STRING(aProperty))
+    if (!JSID_IS_STRING(aProperty))
         return NS_OK;
 
-    JSString *propertyKey = JSVAL_TO_STRING(aProperty);
+    JSString *propertyKey = JSID_TO_STRING(aProperty);
 
     // We look for a PropertyPolicy in the following places:
     // 1)  The ClassPolicy for our class we got from our DomainPolicy
     // 2)  The mWildcardPolicy of our DomainPolicy
     // 3)  The ClassPolicy for our class we got from mDefaultPolicy
     // 4)  The mWildcardPolicy of our mDefaultPolicy
     PropertyPolicy* ppolicy = nsnull;
     if (cpolicy != NO_POLICY_FOR_CLASS)
@@ -3173,17 +3179,17 @@ nsScriptSecurityManager::CanGetService(J
 
 NS_IMETHODIMP
 nsScriptSecurityManager::CanAccess(PRUint32 aAction,
                                    nsAXPCNativeCallContext* aCallContext,
                                    JSContext* cx,
                                    JSObject* aJSObject,
                                    nsISupports* aObj,
                                    nsIClassInfo* aClassInfo,
-                                   jsval aPropertyName,
+                                   jsid aPropertyName,
                                    void** aPolicy)
 {
     return CheckPropertyAccessImpl(aAction, aCallContext, cx,
                                    aJSObject, aObj, nsnull, aClassInfo,
                                    nsnull, aPropertyName, aPolicy);
 }
 
 nsresult
@@ -3383,18 +3389,18 @@ nsresult nsScriptSecurityManager::Init()
 
     NS_ADDREF(sXPConnect = xpconnect);
     NS_ADDREF(sJSContextStack = xpconnect);
 
     JSContext* cx = GetSafeJSContext();
     if (!cx) return NS_ERROR_FAILURE;   // this can happen of xpt loading fails
     
     ::JS_BeginRequest(cx);
-    if (sEnabledID == JSVAL_VOID)
-        sEnabledID = STRING_TO_JSVAL(::JS_InternString(cx, "enabled"));
+    if (sEnabledID == JSID_VOID)
+        sEnabledID = INTERNED_STRING_TO_JSID(::JS_InternString(cx, "enabled"));
     ::JS_EndRequest(cx);
 
     InitPrefs();
 
     nsresult rv = CallGetService(NS_IOSERVICE_CONTRACTID, &sIOService);
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsCOMPtr<nsIStringBundleService> bundleService =
@@ -3437,17 +3443,17 @@ nsresult nsScriptSecurityManager::Init()
     NS_ASSERTION(!oldcallbacks, "Someone else set security callbacks!");
 
     sXPConnect->GetXPCWrappedNativeJSClassInfo(&sXPCWrappedNativeEqualityOps);
     return NS_OK;
 }
 
 static nsScriptSecurityManager *gScriptSecMan = nsnull;
 
-jsval nsScriptSecurityManager::sEnabledID   = JSVAL_VOID;
+jsid nsScriptSecurityManager::sEnabledID   = JSID_VOID;
 
 nsScriptSecurityManager::~nsScriptSecurityManager(void)
 {
     NS_ASSERTION(!mContextPrincipals, "Leaking mContextPrincipals");
     delete mOriginToPolicyMap;
     if(mDefaultPolicy)
         mDefaultPolicy->Drop();
     delete mCapabilities;
@@ -3456,17 +3462,17 @@ nsScriptSecurityManager::~nsScriptSecuri
 
 void
 nsScriptSecurityManager::Shutdown()
 {
     if (sRuntime) {
         JS_SetRuntimeSecurityCallbacks(sRuntime, NULL);
         sRuntime = nsnull;
     }
-    sEnabledID = JSVAL_VOID;
+    sEnabledID = JSID_VOID;
 
     NS_IF_RELEASE(sIOService);
     NS_IF_RELEASE(sXPConnect);
     NS_IF_RELEASE(sJSContextStack);
     NS_IF_RELEASE(sStrBundle);
 }
 
 nsScriptSecurityManager *
--- a/content/canvas/src/CustomQS_Canvas2D.h
+++ b/content/canvas/src/CustomQS_Canvas2D.h
@@ -39,17 +39,17 @@
 
 #include "nsDOMError.h"
 #include "nsIDOMCanvasRenderingContext2D.h"
 
 typedef nsresult (NS_STDCALL nsIDOMCanvasRenderingContext2D::*CanvasStyleSetterType)(const nsAString &, nsISupports *);
 typedef nsresult (NS_STDCALL nsIDOMCanvasRenderingContext2D::*CanvasStyleGetterType)(nsAString &, nsISupports **, PRInt32 *);
 
 static JSBool
-Canvas2D_SetStyleHelper(JSContext *cx, JSObject *obj, jsval id, jsval *vp,
+Canvas2D_SetStyleHelper(JSContext *cx, JSObject *obj, jsid id, jsval *vp,
                         CanvasStyleSetterType setfunc)
 {
     XPC_QS_ASSERT_CONTEXT_OK(cx);
     nsIDOMCanvasRenderingContext2D *self;
     xpc_qsSelfRef selfref;
     js::AutoValueRooter tvr(cx);
     if (!xpc_qsUnwrapThis(cx, obj, nsnull, &self, &selfref.ptr, tvr.jsval_addr(), nsnull))
         return JS_FALSE;
@@ -81,17 +81,17 @@ Canvas2D_SetStyleHelper(JSContext *cx, J
 
     if (NS_FAILED(rv))
         return xpc_qsThrowGetterSetterFailed(cx, rv, JSVAL_TO_OBJECT(*tvr.jsval_addr()), id);
 
     return JS_TRUE;
 }
 
 static JSBool
-Canvas2D_GetStyleHelper(JSContext *cx, JSObject *obj, jsval id, jsval *vp,
+Canvas2D_GetStyleHelper(JSContext *cx, JSObject *obj, jsid id, jsval *vp,
                         CanvasStyleGetterType getfunc)
 {
     XPC_QS_ASSERT_CONTEXT_OK(cx);
     nsIDOMCanvasRenderingContext2D *self;
     xpc_qsSelfRef selfref;
     XPCLazyCallContext lccx(JS_CALLER, cx, obj);
     if (!xpc_qsUnwrapThis(cx, obj, nsnull, &self, &selfref.ptr, vp, &lccx))
         return JS_FALSE;
@@ -117,35 +117,35 @@ Canvas2D_GetStyleHelper(JSContext *cx, J
                                         &NS_GET_IID(nsIDOMCanvasGradient), &interfaces[k_nsIDOMCanvasGradient], vp);
 
     default:
         return xpc_qsThrowGetterSetterFailed(cx, NS_ERROR_FAILURE, JSVAL_TO_OBJECT(*vp), id);
     }
 }
 
 static JSBool
-nsIDOMCanvasRenderingContext2D_SetStrokeStyle(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+nsIDOMCanvasRenderingContext2D_SetStrokeStyle(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
     return Canvas2D_SetStyleHelper(cx, obj, id, vp, &nsIDOMCanvasRenderingContext2D::SetStrokeStyle_multi);
 }
 
 static JSBool
-nsIDOMCanvasRenderingContext2D_GetStrokeStyle(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+nsIDOMCanvasRenderingContext2D_GetStrokeStyle(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
     return Canvas2D_GetStyleHelper(cx, obj, id, vp, &nsIDOMCanvasRenderingContext2D::GetStrokeStyle_multi);
 }
 
 static JSBool
-nsIDOMCanvasRenderingContext2D_SetFillStyle(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+nsIDOMCanvasRenderingContext2D_SetFillStyle(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
     return Canvas2D_SetStyleHelper(cx, obj, id, vp, &nsIDOMCanvasRenderingContext2D::SetFillStyle_multi);
 }
 
 static JSBool
-nsIDOMCanvasRenderingContext2D_GetFillStyle(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+nsIDOMCanvasRenderingContext2D_GetFillStyle(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
     return Canvas2D_GetStyleHelper(cx, obj, id, vp, &nsIDOMCanvasRenderingContext2D::GetFillStyle_multi);
 }
 
 static JSBool
 nsIDOMCanvasRenderingContext2D_CreateImageData(JSContext *cx, uintN argc, jsval *vp)
 {
     XPC_QS_ASSERT_CONTEXT_OK(cx);
--- a/content/events/src/nsEventListenerManager.cpp
+++ b/content/events/src/nsEventListenerManager.cpp
@@ -306,17 +306,17 @@ nsEventListenerManager::RemoveAllListene
 {
   mListeners.Clear();
   return NS_OK;
 }
 
 void
 nsEventListenerManager::Shutdown()
 {
-  sAddListenerID = JSVAL_VOID;
+  sAddListenerID = JSID_VOID;
   nsDOMEvent::Shutdown();
 }
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(nsEventListenerManager)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsEventListenerManager)
    NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIEventListenerManager)
    NS_INTERFACE_MAP_ENTRY(nsIEventListenerManager)
@@ -827,18 +827,18 @@ nsEventListenerManager::RemoveScriptEven
     mListeners.RemoveElementAt(PRUint32(ls - &mListeners.ElementAt(0)));
     mNoListenerForEvent = NS_EVENT_TYPE_NULL;
     mNoListenerForEventAtom = nsnull;
   }
 
   return NS_OK;
 }
 
-jsval
-nsEventListenerManager::sAddListenerID = JSVAL_VOID;
+jsid
+nsEventListenerManager::sAddListenerID = JSID_VOID;
 
 NS_IMETHODIMP
 nsEventListenerManager::RegisterScriptEventListener(nsIScriptContext *aContext,
                                                     void *aScope,
                                                     nsISupports *aObject, 
                                                     nsIAtom *aName)
 {
   // Check that we have access to set an event listener. Prevents
@@ -852,20 +852,20 @@ nsEventListenerManager::RegisterScriptEv
     do_GetService("@mozilla.org/js/xpc/ContextStack;1", &rv);
   if (NS_FAILED(rv))
     return rv;
   JSContext *cx;
   if (NS_FAILED(rv = stack->Peek(&cx)))
     return rv;
 
   if (cx) {
-    if (sAddListenerID == JSVAL_VOID) {
+    if (sAddListenerID == JSID_VOID) {
       JSAutoRequest ar(cx);
       sAddListenerID =
-        STRING_TO_JSVAL(::JS_InternString(cx, "addEventListener"));
+        INTERNED_STRING_TO_JSID(::JS_InternString(cx, "addEventListener"));
     }
 
     if (aContext->GetScriptTypeID() == nsIProgrammingLanguage::JAVASCRIPT) {
         nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
         jsval v;
         rv = nsContentUtils::WrapNative(cx, (JSObject *)aScope, aObject, &v,
                                         getter_AddRefs(holder));
         NS_ENSURE_SUCCESS(rv, rv);
--- a/content/events/src/nsEventListenerManager.h
+++ b/content/events/src/nsEventListenerManager.h
@@ -222,15 +222,15 @@ protected:
   PRBool ListenerCanHandle(nsListenerStruct* aLs, nsEvent* aEvent);
   nsPIDOMWindow* GetInnerWindowForTarget();
 
   nsAutoTObserverArray<nsListenerStruct, 2> mListeners;
   nsISupports*                              mTarget;  //WEAK
   nsCOMPtr<nsIAtom>                         mNoListenerForEventAtom;
 
   static PRUint32                           mInstanceCount;
-  static jsval                              sAddListenerID;
+  static jsid                               sAddListenerID;
 
   friend class nsEventTargetChainItem;
   static PRUint32                           sCreatedCount;
 };
 
 #endif // nsEventListenerManager_h__
--- a/content/html/document/src/nsHTMLDocument.cpp
+++ b/content/html/document/src/nsHTMLDocument.cpp
@@ -3631,20 +3631,20 @@ ConvertToMidasInternalCommand(const nsAS
   nsCAutoString dummyCString;
   nsAutoString dummyString;
   PRBool dummyBool;
   return ConvertToMidasInternalCommandInner(inCommandID, dummyString,
                                             outCommandID, dummyCString,
                                             dummyBool, dummyBool, PR_TRUE);
 }
 
-jsval
-nsHTMLDocument::sCutCopyInternal_id = JSVAL_VOID;
-jsval
-nsHTMLDocument::sPasteInternal_id = JSVAL_VOID;
+jsid
+nsHTMLDocument::sCutCopyInternal_id = JSID_VOID;
+jsid
+nsHTMLDocument::sPasteInternal_id = JSID_VOID;
 
 /* Helper function to check security of clipboard commands. If aPaste is */
 /* true, we check paste, else we check cutcopy */
 nsresult
 nsHTMLDocument::DoClipboardSecurityCheck(PRBool aPaste)
 {
   nsresult rv = NS_ERROR_FAILURE;
 
@@ -3660,27 +3660,27 @@ nsHTMLDocument::DoClipboardSecurityCheck
 
     JSAutoRequest ar(cx);
 
     NS_NAMED_LITERAL_CSTRING(classNameStr, "Clipboard");
 
     nsIScriptSecurityManager *secMan = nsContentUtils::GetSecurityManager();
 
     if (aPaste) {
-      if (nsHTMLDocument::sPasteInternal_id == JSVAL_VOID) {
+      if (nsHTMLDocument::sPasteInternal_id == JSID_VOID) {
         nsHTMLDocument::sPasteInternal_id =
-          STRING_TO_JSVAL(::JS_InternString(cx, "paste"));
+          INTERNED_STRING_TO_JSID(::JS_InternString(cx, "paste"));
       }
       rv = secMan->CheckPropertyAccess(cx, nsnull, classNameStr.get(),
                                        nsHTMLDocument::sPasteInternal_id,
                                        nsIXPCSecurityManager::ACCESS_GET_PROPERTY);
     } else {
-      if (nsHTMLDocument::sCutCopyInternal_id == JSVAL_VOID) {
+      if (nsHTMLDocument::sCutCopyInternal_id == JSID_VOID) {
         nsHTMLDocument::sCutCopyInternal_id =
-          STRING_TO_JSVAL(::JS_InternString(cx, "cutcopy"));
+          INTERNED_STRING_TO_JSID(::JS_InternString(cx, "cutcopy"));
       }
       rv = secMan->CheckPropertyAccess(cx, nsnull, classNameStr.get(),
                                        nsHTMLDocument::sCutCopyInternal_id,
                                        nsIXPCSecurityManager::ACCESS_GET_PROPERTY);
     }
   }
   return rv;
 }
--- a/content/html/document/src/nsHTMLDocument.h
+++ b/content/html/document/src/nsHTMLDocument.h
@@ -370,18 +370,18 @@ protected:
   nsresult TurnEditingOff();
   nsresult EditingStateChanged();
   void MaybeEditingStateChanged();
 
   PRUint32 mContentEditableCount;
   EditingState mEditingState;
 
   nsresult   DoClipboardSecurityCheck(PRBool aPaste);
-  static jsval       sCutCopyInternal_id;
-  static jsval       sPasteInternal_id;
+  static jsid        sCutCopyInternal_id;
+  static jsid        sPasteInternal_id;
 
   // When false, the .cookies property is completely disabled
   PRBool mDisableCookieAccess;
 
   // Parser used for constructing document fragments.
   nsCOMPtr<nsIParser> mFragmentParser;
 };
 
--- a/content/xbl/src/nsXBLDocumentInfo.cpp
+++ b/content/xbl/src/nsXBLDocumentInfo.cpp
@@ -76,17 +76,17 @@ public:
   virtual nsIScriptContext *GetContext();
   virtual JSObject *GetGlobalJSObject();
   virtual void OnFinalize(PRUint32 aLangID, void *aScriptGlobal);
   virtual void SetScriptsEnabled(PRBool aEnabled, PRBool aFireTimeouts);
 
   // nsIScriptObjectPrincipal methods
   virtual nsIPrincipal* GetPrincipal();
 
-  static JSBool doCheckAccess(JSContext *cx, JSObject *obj, jsval id,
+  static JSBool doCheckAccess(JSContext *cx, JSObject *obj, jsid id,
                               PRUint32 accessType);
 
   NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsXBLDocGlobalObject,
                                            nsIScriptGlobalObject)
 
   void ClearGlobalObjectOwner();
 
 protected:
@@ -99,17 +99,17 @@ protected:
   nsCOMPtr<nsIScriptContext> mScriptContext;
   JSObject *mJSObject;    // XXX JS language rabies bigotry badness
 
   nsIScriptGlobalObjectOwner* mGlobalObjectOwner; // weak reference
   static JSClass gSharedGlobalClass;
 };
 
 JSBool
-nsXBLDocGlobalObject::doCheckAccess(JSContext *cx, JSObject *obj, jsval id, PRUint32 accessType)
+nsXBLDocGlobalObject::doCheckAccess(JSContext *cx, JSObject *obj, jsid id, PRUint32 accessType)
 {
   nsIScriptSecurityManager *ssm = nsContentUtils::GetSecurityManager();
   if (!ssm) {
     ::JS_ReportError(cx, "Unable to verify access to a global object property.");
     return JS_FALSE;
   }
 
   // Make sure to actually operate on our object, and not some object further
@@ -124,32 +124,32 @@ nsXBLDocGlobalObject::doCheckAccess(JSCo
 
   nsresult rv = ssm->CheckPropertyAccess(cx, obj, JS_GET_CLASS(cx, obj)->name,
                                          id, accessType);
   return NS_SUCCEEDED(rv);
 }
 
 static JSBool
 nsXBLDocGlobalObject_getProperty(JSContext *cx, JSObject *obj,
-                                 jsval id, jsval *vp)
+                                 jsid id, jsval *vp)
 {
   return nsXBLDocGlobalObject::
     doCheckAccess(cx, obj, id, nsIXPCSecurityManager::ACCESS_GET_PROPERTY);
 }
 
 static JSBool
 nsXBLDocGlobalObject_setProperty(JSContext *cx, JSObject *obj,
-                                 jsval id, jsval *vp)
+                                 jsid id, jsval *vp)
 {
   return nsXBLDocGlobalObject::
     doCheckAccess(cx, obj, id, nsIXPCSecurityManager::ACCESS_SET_PROPERTY);
 }
 
 static JSBool
-nsXBLDocGlobalObject_checkAccess(JSContext *cx, JSObject *obj, jsval id,
+nsXBLDocGlobalObject_checkAccess(JSContext *cx, JSObject *obj, jsid id,
                                  JSAccessMode mode, jsval *vp)
 {
   PRUint32 translated;
   if (mode & JSACC_WRITE) {
     translated = nsIXPCSecurityManager::ACCESS_SET_PROPERTY;
   } else {
     translated = nsIXPCSecurityManager::ACCESS_GET_PROPERTY;
   }
@@ -168,17 +168,17 @@ nsXBLDocGlobalObject_finalize(JSContext 
   if (sgo)
     sgo->OnFinalize(nsIProgrammingLanguage::JAVASCRIPT, obj);
 
   // The addref was part of JSObject construction
   NS_RELEASE(nativeThis);
 }
 
 static JSBool
-nsXBLDocGlobalObject_resolve(JSContext *cx, JSObject *obj, jsval id)
+nsXBLDocGlobalObject_resolve(JSContext *cx, JSObject *obj, jsid id)
 {
   JSBool did_resolve = JS_FALSE;
   return JS_ResolveStandardClass(cx, obj, id, &did_resolve);
 }
 
 
 JSClass nsXBLDocGlobalObject::gSharedGlobalClass = {
     "nsXBLPrototypeScript compilation scope",
--- a/content/xul/document/src/nsXULPrototypeDocument.cpp
+++ b/content/xul/document/src/nsXULPrototypeDocument.cpp
@@ -127,17 +127,17 @@ nsXULPDGlobalObject_finalize(JSContext *
     }
 
     // The addref was part of JSObject construction
     NS_RELEASE(nativeThis);
 }
 
 
 JSBool
-nsXULPDGlobalObject_resolve(JSContext *cx, JSObject *obj, jsval id)
+nsXULPDGlobalObject_resolve(JSContext *cx, JSObject *obj, jsid id)
 {
     JSBool did_resolve = JS_FALSE;
 
     return JS_ResolveStandardClass(cx, obj, id, &did_resolve);
 }
 
 
 JSClass nsXULPDGlobalObject::gSharedGlobalClass = {
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -1434,100 +1434,100 @@ static const nsConstructorFuncMapData kC
 
 nsIXPConnect *nsDOMClassInfo::sXPConnect = nsnull;
 nsIScriptSecurityManager *nsDOMClassInfo::sSecMan = nsnull;
 PRBool nsDOMClassInfo::sIsInitialized = PR_FALSE;
 PRBool nsDOMClassInfo::sDisableDocumentAllSupport = PR_FALSE;
 PRBool nsDOMClassInfo::sDisableGlobalScopePollutionSupport = PR_FALSE;
 
 
-jsval nsDOMClassInfo::sTop_id             = JSVAL_VOID;
-jsval nsDOMClassInfo::sParent_id          = JSVAL_VOID;
-jsval nsDOMClassInfo::sScrollbars_id      = JSVAL_VOID;
-jsval nsDOMClassInfo::sLocation_id        = JSVAL_VOID;
-jsval nsDOMClassInfo::sConstructor_id     = JSVAL_VOID;
-jsval nsDOMClassInfo::s_content_id        = JSVAL_VOID;
-jsval nsDOMClassInfo::sContent_id         = JSVAL_VOID;
-jsval nsDOMClassInfo::sMenubar_id         = JSVAL_VOID;
-jsval nsDOMClassInfo::sToolbar_id         = JSVAL_VOID;
-jsval nsDOMClassInfo::sLocationbar_id     = JSVAL_VOID;
-jsval nsDOMClassInfo::sPersonalbar_id     = JSVAL_VOID;
-jsval nsDOMClassInfo::sStatusbar_id       = JSVAL_VOID;
-jsval nsDOMClassInfo::sDialogArguments_id = JSVAL_VOID;
-jsval nsDOMClassInfo::sControllers_id     = JSVAL_VOID;
-jsval nsDOMClassInfo::sLength_id          = JSVAL_VOID;
-jsval nsDOMClassInfo::sInnerHeight_id     = JSVAL_VOID;
-jsval nsDOMClassInfo::sInnerWidth_id      = JSVAL_VOID;
-jsval nsDOMClassInfo::sOuterHeight_id     = JSVAL_VOID;
-jsval nsDOMClassInfo::sOuterWidth_id      = JSVAL_VOID;
-jsval nsDOMClassInfo::sScreenX_id         = JSVAL_VOID;
-jsval nsDOMClassInfo::sScreenY_id         = JSVAL_VOID;
-jsval nsDOMClassInfo::sStatus_id          = JSVAL_VOID;
-jsval nsDOMClassInfo::sName_id            = JSVAL_VOID;
-jsval nsDOMClassInfo::sOnmousedown_id     = JSVAL_VOID;
-jsval nsDOMClassInfo::sOnmouseup_id       = JSVAL_VOID;
-jsval nsDOMClassInfo::sOnclick_id         = JSVAL_VOID;
-jsval nsDOMClassInfo::sOndblclick_id      = JSVAL_VOID;
-jsval nsDOMClassInfo::sOncontextmenu_id   = JSVAL_VOID;
-jsval nsDOMClassInfo::sOnmouseover_id     = JSVAL_VOID;
-jsval nsDOMClassInfo::sOnmouseout_id      = JSVAL_VOID;
-jsval nsDOMClassInfo::sOnkeydown_id       = JSVAL_VOID;
-jsval nsDOMClassInfo::sOnkeyup_id         = JSVAL_VOID;
-jsval nsDOMClassInfo::sOnkeypress_id      = JSVAL_VOID;
-jsval nsDOMClassInfo::sOnmousemove_id     = JSVAL_VOID;
-jsval nsDOMClassInfo::sOnfocus_id         = JSVAL_VOID;
-jsval nsDOMClassInfo::sOnblur_id          = JSVAL_VOID;
-jsval nsDOMClassInfo::sOnsubmit_id        = JSVAL_VOID;
-jsval nsDOMClassInfo::sOnreset_id         = JSVAL_VOID;
-jsval nsDOMClassInfo::sOnchange_id        = JSVAL_VOID;
-jsval nsDOMClassInfo::sOnselect_id        = JSVAL_VOID;
-jsval nsDOMClassInfo::sOnload_id          = JSVAL_VOID;
-jsval nsDOMClassInfo::sOnpopstate_id      = JSVAL_VOID;
-jsval nsDOMClassInfo::sOnbeforeunload_id  = JSVAL_VOID;
-jsval nsDOMClassInfo::sOnunload_id        = JSVAL_VOID;
-jsval nsDOMClassInfo::sOnhashchange_id    = JSVAL_VOID;
-jsval nsDOMClassInfo::sOnpageshow_id      = JSVAL_VOID;
-jsval nsDOMClassInfo::sOnpagehide_id      = JSVAL_VOID;
-jsval nsDOMClassInfo::sOnabort_id         = JSVAL_VOID;
-jsval nsDOMClassInfo::sOnerror_id         = JSVAL_VOID;
-jsval nsDOMClassInfo::sOnpaint_id         = JSVAL_VOID;
-jsval nsDOMClassInfo::sOnresize_id        = JSVAL_VOID;
-jsval nsDOMClassInfo::sOnscroll_id        = JSVAL_VOID;
-jsval nsDOMClassInfo::sOndrag_id          = JSVAL_VOID;
-jsval nsDOMClassInfo::sOndragend_id       = JSVAL_VOID;
-jsval nsDOMClassInfo::sOndragenter_id     = JSVAL_VOID;
-jsval nsDOMClassInfo::sOndragleave_id     = JSVAL_VOID;
-jsval nsDOMClassInfo::sOndragover_id      = JSVAL_VOID;
-jsval nsDOMClassInfo::sOndragstart_id     = JSVAL_VOID;
-jsval nsDOMClassInfo::sOndrop_id          = JSVAL_VOID;
-jsval nsDOMClassInfo::sScrollX_id         = JSVAL_VOID;
-jsval nsDOMClassInfo::sScrollY_id         = JSVAL_VOID;
-jsval nsDOMClassInfo::sScrollMaxX_id      = JSVAL_VOID;
-jsval nsDOMClassInfo::sScrollMaxY_id      = JSVAL_VOID;
-jsval nsDOMClassInfo::sOpen_id            = JSVAL_VOID;
-jsval nsDOMClassInfo::sItem_id            = JSVAL_VOID;
-jsval nsDOMClassInfo::sNamedItem_id       = JSVAL_VOID;
-jsval nsDOMClassInfo::sEnumerate_id       = JSVAL_VOID;
-jsval nsDOMClassInfo::sNavigator_id       = JSVAL_VOID;
-jsval nsDOMClassInfo::sDocument_id        = JSVAL_VOID;
-jsval nsDOMClassInfo::sWindow_id          = JSVAL_VOID;
-jsval nsDOMClassInfo::sFrames_id          = JSVAL_VOID;
-jsval nsDOMClassInfo::sSelf_id            = JSVAL_VOID;
-jsval nsDOMClassInfo::sOpener_id          = JSVAL_VOID;
-jsval nsDOMClassInfo::sAll_id             = JSVAL_VOID;
-jsval nsDOMClassInfo::sTags_id            = JSVAL_VOID;
-jsval nsDOMClassInfo::sAddEventListener_id= JSVAL_VOID;
-jsval nsDOMClassInfo::sBaseURIObject_id   = JSVAL_VOID;
-jsval nsDOMClassInfo::sNodePrincipal_id   = JSVAL_VOID;
-jsval nsDOMClassInfo::sDocumentURIObject_id=JSVAL_VOID;
-jsval nsDOMClassInfo::sOncopy_id          = JSVAL_VOID;
-jsval nsDOMClassInfo::sOncut_id           = JSVAL_VOID;
-jsval nsDOMClassInfo::sOnpaste_id         = JSVAL_VOID;
-jsval nsDOMClassInfo::sJava_id            = JSVAL_VOID;
-jsval nsDOMClassInfo::sPackages_id        = JSVAL_VOID;
+jsid nsDOMClassInfo::sTop_id             = JSID_VOID;
+jsid nsDOMClassInfo::sParent_id          = JSID_VOID;
+jsid nsDOMClassInfo::sScrollbars_id      = JSID_VOID;
+jsid nsDOMClassInfo::sLocation_id        = JSID_VOID;
+jsid nsDOMClassInfo::sConstructor_id     = JSID_VOID;
+jsid nsDOMClassInfo::s_content_id        = JSID_VOID;
+jsid nsDOMClassInfo::sContent_id         = JSID_VOID;
+jsid nsDOMClassInfo::sMenubar_id         = JSID_VOID;
+jsid nsDOMClassInfo::sToolbar_id         = JSID_VOID;
+jsid nsDOMClassInfo::sLocationbar_id     = JSID_VOID;
+jsid nsDOMClassInfo::sPersonalbar_id     = JSID_VOID;
+jsid nsDOMClassInfo::sStatusbar_id       = JSID_VOID;
+jsid nsDOMClassInfo::sDialogArguments_id = JSID_VOID;
+jsid nsDOMClassInfo::sControllers_id     = JSID_VOID;
+jsid nsDOMClassInfo::sLength_id          = JSID_VOID;
+jsid nsDOMClassInfo::sInnerHeight_id     = JSID_VOID;
+jsid nsDOMClassInfo::sInnerWidth_id      = JSID_VOID;
+jsid nsDOMClassInfo::sOuterHeight_id     = JSID_VOID;
+jsid nsDOMClassInfo::sOuterWidth_id      = JSID_VOID;
+jsid nsDOMClassInfo::sScreenX_id         = JSID_VOID;
+jsid nsDOMClassInfo::sScreenY_id         = JSID_VOID;
+jsid nsDOMClassInfo::sStatus_id          = JSID_VOID;
+jsid nsDOMClassInfo::sName_id            = JSID_VOID;
+jsid nsDOMClassInfo::sOnmousedown_id     = JSID_VOID;
+jsid nsDOMClassInfo::sOnmouseup_id       = JSID_VOID;
+jsid nsDOMClassInfo::sOnclick_id         = JSID_VOID;
+jsid nsDOMClassInfo::sOndblclick_id      = JSID_VOID;
+jsid nsDOMClassInfo::sOncontextmenu_id   = JSID_VOID;
+jsid nsDOMClassInfo::sOnmouseover_id     = JSID_VOID;
+jsid nsDOMClassInfo::sOnmouseout_id      = JSID_VOID;
+jsid nsDOMClassInfo::sOnkeydown_id       = JSID_VOID;
+jsid nsDOMClassInfo::sOnkeyup_id         = JSID_VOID;
+jsid nsDOMClassInfo::sOnkeypress_id      = JSID_VOID;
+jsid nsDOMClassInfo::sOnmousemove_id     = JSID_VOID;
+jsid nsDOMClassInfo::sOnfocus_id         = JSID_VOID;
+jsid nsDOMClassInfo::sOnblur_id          = JSID_VOID;
+jsid nsDOMClassInfo::sOnsubmit_id        = JSID_VOID;
+jsid nsDOMClassInfo::sOnreset_id         = JSID_VOID;
+jsid nsDOMClassInfo::sOnchange_id        = JSID_VOID;
+jsid nsDOMClassInfo::sOnselect_id        = JSID_VOID;
+jsid nsDOMClassInfo::sOnload_id          = JSID_VOID;
+jsid nsDOMClassInfo::sOnpopstate_id      = JSID_VOID;
+jsid nsDOMClassInfo::sOnbeforeunload_id  = JSID_VOID;
+jsid nsDOMClassInfo::sOnunload_id        = JSID_VOID;
+jsid nsDOMClassInfo::sOnhashchange_id    = JSID_VOID;
+jsid nsDOMClassInfo::sOnpageshow_id      = JSID_VOID;
+jsid nsDOMClassInfo::sOnpagehide_id      = JSID_VOID;
+jsid nsDOMClassInfo::sOnabort_id         = JSID_VOID;
+jsid nsDOMClassInfo::sOnerror_id         = JSID_VOID;
+jsid nsDOMClassInfo::sOnpaint_id         = JSID_VOID;
+jsid nsDOMClassInfo::sOnresize_id        = JSID_VOID;
+jsid nsDOMClassInfo::sOnscroll_id        = JSID_VOID;
+jsid nsDOMClassInfo::sOndrag_id          = JSID_VOID;
+jsid nsDOMClassInfo::sOndragend_id       = JSID_VOID;
+jsid nsDOMClassInfo::sOndragenter_id     = JSID_VOID;
+jsid nsDOMClassInfo::sOndragleave_id     = JSID_VOID;
+jsid nsDOMClassInfo::sOndragover_id      = JSID_VOID;
+jsid nsDOMClassInfo::sOndragstart_id     = JSID_VOID;
+jsid nsDOMClassInfo::sOndrop_id          = JSID_VOID;
+jsid nsDOMClassInfo::sScrollX_id         = JSID_VOID;
+jsid nsDOMClassInfo::sScrollY_id         = JSID_VOID;
+jsid nsDOMClassInfo::sScrollMaxX_id      = JSID_VOID;
+jsid nsDOMClassInfo::sScrollMaxY_id      = JSID_VOID;
+jsid nsDOMClassInfo::sOpen_id            = JSID_VOID;
+jsid nsDOMClassInfo::sItem_id            = JSID_VOID;
+jsid nsDOMClassInfo::sNamedItem_id       = JSID_VOID;
+jsid nsDOMClassInfo::sEnumerate_id       = JSID_VOID;
+jsid nsDOMClassInfo::sNavigator_id       = JSID_VOID;
+jsid nsDOMClassInfo::sDocument_id        = JSID_VOID;
+jsid nsDOMClassInfo::sWindow_id          = JSID_VOID;
+jsid nsDOMClassInfo::sFrames_id          = JSID_VOID;
+jsid nsDOMClassInfo::sSelf_id            = JSID_VOID;
+jsid nsDOMClassInfo::sOpener_id          = JSID_VOID;
+jsid nsDOMClassInfo::sAll_id             = JSID_VOID;
+jsid nsDOMClassInfo::sTags_id            = JSID_VOID;
+jsid nsDOMClassInfo::sAddEventListener_id= JSID_VOID;
+jsid nsDOMClassInfo::sBaseURIObject_id   = JSID_VOID;
+jsid nsDOMClassInfo::sNodePrincipal_id   = JSID_VOID;
+jsid nsDOMClassInfo::sDocumentURIObject_id=JSID_VOID;
+jsid nsDOMClassInfo::sOncopy_id          = JSID_VOID;
+jsid nsDOMClassInfo::sOncut_id           = JSID_VOID;
+jsid nsDOMClassInfo::sOnpaste_id         = JSID_VOID;
+jsid nsDOMClassInfo::sJava_id            = JSID_VOID;
+jsid nsDOMClassInfo::sPackages_id        = JSID_VOID;
 
 static const JSClass *sObjectClass = nsnull;
 JSPropertyOp nsDOMClassInfo::sXPCNativeWrapperGetPropertyOp = nsnull;
 
 /**
  * Set our JSClass pointer for the Object class
  */
 static void
@@ -1604,131 +1604,130 @@ PrintWarningOnConsole(JSContext *cx, con
                                   0, // column for error is not available
                                   nsIScriptError::warningFlag,
                                   "DOM:HTML");
   if (NS_SUCCEEDED(rv)){
     consoleService->LogMessage(scriptError);
   }
 }
 
-static jsval
-GetInternedJSVal(JSContext *cx, const char *str)
-{
-  JSString *s = ::JS_InternString(cx, str);
-
-  if (!s) {
-    return JSVAL_VOID;
-  }
-
-  return STRING_TO_JSVAL(s);
+static inline JSString *
+IdToString(JSContext *cx, jsid id)
+{
+  if (JSID_IS_STRING(id))
+    return JSID_TO_STRING(id);
+  jsval idval;
+  if (!::JS_IdToValue(cx, id, &idval))
+    return nsnull;
+  return JS_ValueToString(cx, idval);
 }
 
 // static
 
 nsISupports *
 nsDOMClassInfo::GetNative(nsIXPConnectWrappedNative *wrapper, JSObject *obj)
 {
   return wrapper ? wrapper->Native() : static_cast<nsISupports*>(obj->getPrivate());
 }
 
 nsresult
 nsDOMClassInfo::DefineStaticJSVals(JSContext *cx)
 {
-#define SET_JSVAL_TO_STRING(_val, _cx, _str)                                  \
-  _val = GetInternedJSVal(_cx, _str);                                         \
-  if (!JSVAL_IS_STRING(_val)) {                                               \
-    return NS_ERROR_OUT_OF_MEMORY;                                            \
-  }
+#define SET_JSID_TO_STRING(_id, _cx, _str)                                    \
+  if (JSString *str = ::JS_InternString(_cx, _str))                           \
+      _id = INTERNED_STRING_TO_JSID(str);                                     \
+  else                                                                        \
+      return NS_ERROR_OUT_OF_MEMORY;
 
   JSAutoRequest ar(cx);
 
-  SET_JSVAL_TO_STRING(sTop_id,             cx, "top");
-  SET_JSVAL_TO_STRING(sParent_id,          cx, "parent");
-  SET_JSVAL_TO_STRING(sScrollbars_id,      cx, "scrollbars");
-  SET_JSVAL_TO_STRING(sLocation_id,        cx, "location");
-  SET_JSVAL_TO_STRING(sConstructor_id,     cx, "constructor");
-  SET_JSVAL_TO_STRING(s_content_id,        cx, "_content");
-  SET_JSVAL_TO_STRING(sContent_id,         cx, "content");
-  SET_JSVAL_TO_STRING(sMenubar_id,         cx, "menubar");
-  SET_JSVAL_TO_STRING(sToolbar_id,         cx, "toolbar");
-  SET_JSVAL_TO_STRING(sLocationbar_id,     cx, "locationbar");
-  SET_JSVAL_TO_STRING(sPersonalbar_id,     cx, "personalbar");
-  SET_JSVAL_TO_STRING(sStatusbar_id,       cx, "statusbar");
-  SET_JSVAL_TO_STRING(sDialogArguments_id, cx, "dialogArguments");
-  SET_JSVAL_TO_STRING(sControllers_id,     cx, "controllers");
-  SET_JSVAL_TO_STRING(sLength_id,          cx, "length");
-  SET_JSVAL_TO_STRING(sInnerHeight_id,     cx, "innerHeight");
-  SET_JSVAL_TO_STRING(sInnerWidth_id,      cx, "innerWidth");
-  SET_JSVAL_TO_STRING(sOuterHeight_id,     cx, "outerHeight");
-  SET_JSVAL_TO_STRING(sOuterWidth_id,      cx, "outerWidth");
-  SET_JSVAL_TO_STRING(sScreenX_id,         cx, "screenX");
-  SET_JSVAL_TO_STRING(sScreenY_id,         cx, "screenY");
-  SET_JSVAL_TO_STRING(sStatus_id,          cx, "status");
-  SET_JSVAL_TO_STRING(sName_id,            cx, "name");
-  SET_JSVAL_TO_STRING(sOnmousedown_id,     cx, "onmousedown");
-  SET_JSVAL_TO_STRING(sOnmouseup_id,       cx, "onmouseup");
-  SET_JSVAL_TO_STRING(sOnclick_id,         cx, "onclick");
-  SET_JSVAL_TO_STRING(sOndblclick_id,      cx, "ondblclick");
-  SET_JSVAL_TO_STRING(sOncontextmenu_id,   cx, "oncontextmenu");
-  SET_JSVAL_TO_STRING(sOnmouseover_id,     cx, "onmouseover");
-  SET_JSVAL_TO_STRING(sOnmouseout_id,      cx, "onmouseout");
-  SET_JSVAL_TO_STRING(sOnkeydown_id,       cx, "onkeydown");
-  SET_JSVAL_TO_STRING(sOnkeyup_id,         cx, "onkeyup");
-  SET_JSVAL_TO_STRING(sOnkeypress_id,      cx, "onkeypress");
-  SET_JSVAL_TO_STRING(sOnmousemove_id,     cx, "onmousemove");
-  SET_JSVAL_TO_STRING(sOnfocus_id,         cx, "onfocus");
-  SET_JSVAL_TO_STRING(sOnblur_id,          cx, "onblur");
-  SET_JSVAL_TO_STRING(sOnsubmit_id,        cx, "onsubmit");
-  SET_JSVAL_TO_STRING(sOnreset_id,         cx, "onreset");
-  SET_JSVAL_TO_STRING(sOnchange_id,        cx, "onchange");
-  SET_JSVAL_TO_STRING(sOnselect_id,        cx, "onselect");
-  SET_JSVAL_TO_STRING(sOnload_id,          cx, "onload");
-  SET_JSVAL_TO_STRING(sOnpopstate_id,      cx, "onpopstate");
-  SET_JSVAL_TO_STRING(sOnbeforeunload_id,  cx, "onbeforeunload");
-  SET_JSVAL_TO_STRING(sOnunload_id,        cx, "onunload");
-  SET_JSVAL_TO_STRING(sOnhashchange_id,    cx, "onhashchange");
-  SET_JSVAL_TO_STRING(sOnpageshow_id,      cx, "onpageshow");
-  SET_JSVAL_TO_STRING(sOnpagehide_id,      cx, "onpagehide");
-  SET_JSVAL_TO_STRING(sOnabort_id,         cx, "onabort");
-  SET_JSVAL_TO_STRING(sOnerror_id,         cx, "onerror");
-  SET_JSVAL_TO_STRING(sOnpaint_id,         cx, "onpaint");
-  SET_JSVAL_TO_STRING(sOnresize_id,        cx, "onresize");
-  SET_JSVAL_TO_STRING(sOnscroll_id,        cx, "onscroll");
-  SET_JSVAL_TO_STRING(sOndrag_id,          cx, "ondrag");
-  SET_JSVAL_TO_STRING(sOndragend_id,       cx, "ondragend");
-  SET_JSVAL_TO_STRING(sOndragenter_id,     cx, "ondragenter");
-  SET_JSVAL_TO_STRING(sOndragleave_id,     cx, "ondragleave");
-  SET_JSVAL_TO_STRING(sOndragover_id,      cx, "ondragover");
-  SET_JSVAL_TO_STRING(sOndragstart_id,     cx, "ondragstart");
-  SET_JSVAL_TO_STRING(sOndrop_id,          cx, "ondrop");
-  SET_JSVAL_TO_STRING(sScrollX_id,         cx, "scrollX");
-  SET_JSVAL_TO_STRING(sScrollY_id,         cx, "scrollY");
-  SET_JSVAL_TO_STRING(sScrollMaxX_id,      cx, "scrollMaxX");
-  SET_JSVAL_TO_STRING(sScrollMaxY_id,      cx, "scrollMaxY");
-  SET_JSVAL_TO_STRING(sOpen_id,            cx, "open");
-  SET_JSVAL_TO_STRING(sItem_id,            cx, "item");
-  SET_JSVAL_TO_STRING(sNamedItem_id,       cx, "namedItem");
-  SET_JSVAL_TO_STRING(sEnumerate_id,       cx, "enumerateProperties");
-  SET_JSVAL_TO_STRING(sNavigator_id,       cx, "navigator");
-  SET_JSVAL_TO_STRING(sDocument_id,        cx, "document");
-  SET_JSVAL_TO_STRING(sWindow_id,          cx, "window");
-  SET_JSVAL_TO_STRING(sFrames_id,          cx, "frames");
-  SET_JSVAL_TO_STRING(sSelf_id,            cx, "self");
-  SET_JSVAL_TO_STRING(sOpener_id,          cx, "opener");
-  SET_JSVAL_TO_STRING(sAll_id,             cx, "all");
-  SET_JSVAL_TO_STRING(sTags_id,            cx, "tags");
-  SET_JSVAL_TO_STRING(sAddEventListener_id,cx, "addEventListener");
-  SET_JSVAL_TO_STRING(sBaseURIObject_id,   cx, "baseURIObject");
-  SET_JSVAL_TO_STRING(sNodePrincipal_id,   cx, "nodePrincipal");
-  SET_JSVAL_TO_STRING(sDocumentURIObject_id,cx,"documentURIObject");
-  SET_JSVAL_TO_STRING(sOncopy_id,          cx, "oncopy");
-  SET_JSVAL_TO_STRING(sOncut_id,           cx, "oncut");
-  SET_JSVAL_TO_STRING(sOnpaste_id,         cx, "onpaste");
-  SET_JSVAL_TO_STRING(sJava_id,            cx, "java");
-  SET_JSVAL_TO_STRING(sPackages_id,        cx, "Packages");
+  SET_JSID_TO_STRING(sTop_id,             cx, "top");
+  SET_JSID_TO_STRING(sParent_id,          cx, "parent");
+  SET_JSID_TO_STRING(sScrollbars_id,      cx, "scrollbars");
+  SET_JSID_TO_STRING(sLocation_id,        cx, "location");
+  SET_JSID_TO_STRING(sConstructor_id,     cx, "constructor");
+  SET_JSID_TO_STRING(s_content_id,        cx, "_content");
+  SET_JSID_TO_STRING(sContent_id,         cx, "content");
+  SET_JSID_TO_STRING(sMenubar_id,         cx, "menubar");
+  SET_JSID_TO_STRING(sToolbar_id,         cx, "toolbar");
+  SET_JSID_TO_STRING(sLocationbar_id,     cx, "locationbar");
+  SET_JSID_TO_STRING(sPersonalbar_id,     cx, "personalbar");
+  SET_JSID_TO_STRING(sStatusbar_id,       cx, "statusbar");
+  SET_JSID_TO_STRING(sDialogArguments_id, cx, "dialogArguments");
+  SET_JSID_TO_STRING(sControllers_id,     cx, "controllers");
+  SET_JSID_TO_STRING(sLength_id,          cx, "length");
+  SET_JSID_TO_STRING(sInnerHeight_id,     cx, "innerHeight");
+  SET_JSID_TO_STRING(sInnerWidth_id,      cx, "innerWidth");
+  SET_JSID_TO_STRING(sOuterHeight_id,     cx, "outerHeight");
+  SET_JSID_TO_STRING(sOuterWidth_id,      cx, "outerWidth");
+  SET_JSID_TO_STRING(sScreenX_id,         cx, "screenX");
+  SET_JSID_TO_STRING(sScreenY_id,         cx, "screenY");
+  SET_JSID_TO_STRING(sStatus_id,          cx, "status");
+  SET_JSID_TO_STRING(sName_id,            cx, "name");
+  SET_JSID_TO_STRING(sOnmousedown_id,     cx, "onmousedown");
+  SET_JSID_TO_STRING(sOnmouseup_id,       cx, "onmouseup");
+  SET_JSID_TO_STRING(sOnclick_id,         cx, "onclick");
+  SET_JSID_TO_STRING(sOndblclick_id,      cx, "ondblclick");
+  SET_JSID_TO_STRING(sOncontextmenu_id,   cx, "oncontextmenu");
+  SET_JSID_TO_STRING(sOnmouseover_id,     cx, "onmouseover");
+  SET_JSID_TO_STRING(sOnmouseout_id,      cx, "onmouseout");
+  SET_JSID_TO_STRING(sOnkeydown_id,       cx, "onkeydown");
+  SET_JSID_TO_STRING(sOnkeyup_id,         cx, "onkeyup");
+  SET_JSID_TO_STRING(sOnkeypress_id,      cx, "onkeypress");
+  SET_JSID_TO_STRING(sOnmousemove_id,     cx, "onmousemove");
+  SET_JSID_TO_STRING(sOnfocus_id,         cx, "onfocus");
+  SET_JSID_TO_STRING(sOnblur_id,          cx, "onblur");
+  SET_JSID_TO_STRING(sOnsubmit_id,        cx, "onsubmit");
+  SET_JSID_TO_STRING(sOnreset_id,         cx, "onreset");
+  SET_JSID_TO_STRING(sOnchange_id,        cx, "onchange");
+  SET_JSID_TO_STRING(sOnselect_id,        cx, "onselect");
+  SET_JSID_TO_STRING(sOnload_id,          cx, "onload");
+  SET_JSID_TO_STRING(sOnpopstate_id,      cx, "onpopstate");
+  SET_JSID_TO_STRING(sOnbeforeunload_id,  cx, "onbeforeunload");
+  SET_JSID_TO_STRING(sOnunload_id,        cx, "onunload");
+  SET_JSID_TO_STRING(sOnhashchange_id,    cx, "onhashchange");
+  SET_JSID_TO_STRING(sOnpageshow_id,      cx, "onpageshow");
+  SET_JSID_TO_STRING(sOnpagehide_id,      cx, "onpagehide");
+  SET_JSID_TO_STRING(sOnabort_id,         cx, "onabort");
+  SET_JSID_TO_STRING(sOnerror_id,         cx, "onerror");
+  SET_JSID_TO_STRING(sOnpaint_id,         cx, "onpaint");
+  SET_JSID_TO_STRING(sOnresize_id,        cx, "onresize");
+  SET_JSID_TO_STRING(sOnscroll_id,        cx, "onscroll");
+  SET_JSID_TO_STRING(sOndrag_id,          cx, "ondrag");
+  SET_JSID_TO_STRING(sOndragend_id,       cx, "ondragend");
+  SET_JSID_TO_STRING(sOndragenter_id,     cx, "ondragenter");
+  SET_JSID_TO_STRING(sOndragleave_id,     cx, "ondragleave");
+  SET_JSID_TO_STRING(sOndragover_id,      cx, "ondragover");
+  SET_JSID_TO_STRING(sOndragstart_id,     cx, "ondragstart");
+  SET_JSID_TO_STRING(sOndrop_id,          cx, "ondrop");
+  SET_JSID_TO_STRING(sScrollX_id,         cx, "scrollX");
+  SET_JSID_TO_STRING(sScrollY_id,         cx, "scrollY");
+  SET_JSID_TO_STRING(sScrollMaxX_id,      cx, "scrollMaxX");
+  SET_JSID_TO_STRING(sScrollMaxY_id,      cx, "scrollMaxY");
+  SET_JSID_TO_STRING(sOpen_id,            cx, "open");
+  SET_JSID_TO_STRING(sItem_id,            cx, "item");
+  SET_JSID_TO_STRING(sNamedItem_id,       cx, "namedItem");
+  SET_JSID_TO_STRING(sEnumerate_id,       cx, "enumerateProperties");
+  SET_JSID_TO_STRING(sNavigator_id,       cx, "navigator");
+  SET_JSID_TO_STRING(sDocument_id,        cx, "document");
+  SET_JSID_TO_STRING(sWindow_id,          cx, "window");
+  SET_JSID_TO_STRING(sFrames_id,          cx, "frames");
+  SET_JSID_TO_STRING(sSelf_id,            cx, "self");
+  SET_JSID_TO_STRING(sOpener_id,          cx, "opener");
+  SET_JSID_TO_STRING(sAll_id,             cx, "all");
+  SET_JSID_TO_STRING(sTags_id,            cx, "tags");
+  SET_JSID_TO_STRING(sAddEventListener_id,cx, "addEventListener");
+  SET_JSID_TO_STRING(sBaseURIObject_id,   cx, "baseURIObject");
+  SET_JSID_TO_STRING(sNodePrincipal_id,   cx, "nodePrincipal");
+  SET_JSID_TO_STRING(sDocumentURIObject_id,cx,"documentURIObject");
+  SET_JSID_TO_STRING(sOncopy_id,          cx, "oncopy");
+  SET_JSID_TO_STRING(sOncut_id,           cx, "oncut");
+  SET_JSID_TO_STRING(sOnpaste_id,         cx, "onpaste");
+  SET_JSID_TO_STRING(sJava_id,            cx, "java");
+  SET_JSID_TO_STRING(sPackages_id,        cx, "Packages");
 
   return NS_OK;
 }
 
 static nsresult
 CreateExceptionFromResult(JSContext *cx, nsresult aResult)
 {
   nsCOMPtr<nsIExceptionService> xs =
@@ -3911,34 +3910,35 @@ nsDOMClassInfo::Init()
 
   sIsInitialized = PR_TRUE;
 
   return NS_OK;
 }
 
 // static
 PRInt32
-nsDOMClassInfo::GetArrayIndexFromId(JSContext *cx, jsval id, PRBool *aIsNumber)
-{
-  jsdouble array_index;
-
+nsDOMClassInfo::GetArrayIndexFromId(JSContext *cx, jsid id, PRBool *aIsNumber)
+{
   if (aIsNumber) {
     *aIsNumber = PR_FALSE;
   }
 
-  JSAutoRequest ar(cx);
-
-  if (!::JS_ValueToNumber(cx, id, &array_index)) {
-    return -1;
-  }
-
-  jsint i = -1;
-
-  if (!::JS_DoubleIsInt32(array_index, &i)) {
-    return -1;
+  jsint i;
+  if (JSID_IS_INT(id)) {
+      i = JSID_TO_INT(id);
+  } else {
+      JSAutoRequest ar(cx);
+
+      jsval idval;
+      jsdouble array_index;
+      if (!::JS_IdToValue(cx, id, &idval) ||
+          !::JS_ValueToNumber(cx, idval, &array_index) ||
+          !::JS_DoubleIsInt32(array_index, &i)) {
+        return -1;
+      }
   }
 
   if (aIsNumber) {
     *aIsNumber = PR_TRUE;
   }
 
   return i;
 }
@@ -4090,47 +4090,47 @@ nsDOMClassInfo::PostCreate(nsIXPConnectW
 {
   NS_WARNING("nsDOMClassInfo::PostCreate Don't call me!");
 
   return NS_ERROR_UNEXPECTED;
 }
 
 NS_IMETHODIMP
 nsDOMClassInfo::AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                            JSObject *obj, jsval id, jsval *vp,
+                            JSObject *obj, jsid id, jsval *vp,
                             PRBool *_retval)
 {
   NS_WARNING("nsDOMClassInfo::AddProperty Don't call me!");
 
   return NS_ERROR_UNEXPECTED;
 }
 
 NS_IMETHODIMP
 nsDOMClassInfo::DelProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                            JSObject *obj, jsval id, jsval *vp,
+                            JSObject *obj, jsid id, jsval *vp,
                             PRBool *_retval)
 {
   NS_WARNING("nsDOMClassInfo::DelProperty Don't call me!");
 
   return NS_ERROR_UNEXPECTED;
 }
 
 NS_IMETHODIMP
 nsDOMClassInfo::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                            JSObject *obj, jsval id, jsval *vp,
+                            JSObject *obj, jsid id, jsval *vp,
                             PRBool *_retval)
 {
   NS_WARNING("nsDOMClassInfo::GetProperty Don't call me!");
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMClassInfo::SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                            JSObject *obj, jsval id, jsval *vp,
+                            JSObject *obj, jsid id, jsval *vp,
                             PRBool *_retval)
 {
   NS_WARNING("nsDOMClassInfo::SetProperty Don't call me!");
 
   return NS_ERROR_UNEXPECTED;
 }
 
 NS_IMETHODIMP
@@ -4178,32 +4178,30 @@ nsDOMClassInfo::ResolveConstructor(JSCon
   }
 
   if (!JSVAL_IS_PRIMITIVE(val)) {
     // If val is not an (non-null) object there either is no
     // constructor for this class, or someone messed with
     // window.classname, just fall through and let the JS engine
     // return the Object constructor.
 
-    JSString *str = JSVAL_TO_STRING(sConstructor_id);
-    if (!::JS_DefineUCProperty(cx, obj, ::JS_GetStringChars(str),
-                               ::JS_GetStringLength(str), val, nsnull, nsnull,
-                               JSPROP_ENUMERATE)) {
+    if (!::JS_DefinePropertyById(cx, obj, sConstructor_id, val, nsnull, nsnull,
+                                 JSPROP_ENUMERATE)) {
       return NS_ERROR_UNEXPECTED;
     }
 
     *objp = obj;
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMClassInfo::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                           JSObject *obj, jsval id, PRUint32 flags,
+                           JSObject *obj, jsid id, PRUint32 flags,
                            JSObject **objp, PRBool *_retval)
 {
   if (id == sConstructor_id && !(flags & JSRESOLVE_ASSIGNING)) {
     return ResolveConstructor(cx, obj, objp);
   }
 
   return NS_OK;
 }
@@ -4224,17 +4222,17 @@ nsDOMClassInfo::Finalize(nsIXPConnectWra
 {
   NS_WARNING("nsDOMClassInfo::Finalize Don't call me!");
 
   return NS_ERROR_UNEXPECTED;
 }
 
 NS_IMETHODIMP
 nsDOMClassInfo::CheckAccess(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                            JSObject *obj, jsval id, PRUint32 mode,
+                            JSObject *obj, jsid id, PRUint32 mode,
                             jsval *vp, PRBool *_retval)
 {
   PRUint32 mode_type = mode & JSACC_TYPEMASK;
 
   if ((mode_type == JSACC_WATCH ||
        mode_type == JSACC_PROTO ||
        mode_type == JSACC_PARENT) &&
       sSecMan) {
@@ -4534,98 +4532,98 @@ nsDOMClassInfo::ShutDown()
   if (sClassInfoData[0].u.mConstructorFptr) {
     PRUint32 i;
 
     for (i = 0; i < eDOMClassInfoIDCount; i++) {
       NS_IF_RELEASE(sClassInfoData[i].mCachedClassInfo);
     }
   }
 
-  sTop_id             = JSVAL_VOID;
-  sParent_id          = JSVAL_VOID;
-  sScrollbars_id      = JSVAL_VOID;
-  sLocation_id        = JSVAL_VOID;
-  sConstructor_id     = JSVAL_VOID;
-  s_content_id        = JSVAL_VOID;
-  sContent_id         = JSVAL_VOID;
-  sMenubar_id         = JSVAL_VOID;
-  sToolbar_id         = JSVAL_VOID;
-  sLocationbar_id     = JSVAL_VOID;
-  sPersonalbar_id     = JSVAL_VOID;
-  sStatusbar_id       = JSVAL_VOID;
-  sDialogArguments_id = JSVAL_VOID;
-  sControllers_id     = JSVAL_VOID;
-  sLength_id          = JSVAL_VOID;
-  sInnerHeight_id     = JSVAL_VOID;
-  sInnerWidth_id      = JSVAL_VOID;
-  sOuterHeight_id     = JSVAL_VOID;
-  sOuterWidth_id      = JSVAL_VOID;
-  sScreenX_id         = JSVAL_VOID;
-  sScreenY_id         = JSVAL_VOID;
-  sStatus_id          = JSVAL_VOID;
-  sName_id            = JSVAL_VOID;
-  sOnmousedown_id     = JSVAL_VOID;
-  sOnmouseup_id       = JSVAL_VOID;
-  sOnclick_id         = JSVAL_VOID;
-  sOndblclick_id      = JSVAL_VOID;
-  sOncontextmenu_id   = JSVAL_VOID;
-  sOnmouseover_id     = JSVAL_VOID;
-  sOnmouseout_id      = JSVAL_VOID;
-  sOnkeydown_id       = JSVAL_VOID;
-  sOnkeyup_id         = JSVAL_VOID;
-  sOnkeypress_id      = JSVAL_VOID;
-  sOnmousemove_id     = JSVAL_VOID;
-  sOnfocus_id         = JSVAL_VOID;
-  sOnblur_id          = JSVAL_VOID;
-  sOnsubmit_id        = JSVAL_VOID;
-  sOnreset_id         = JSVAL_VOID;
-  sOnchange_id        = JSVAL_VOID;
-  sOnselect_id        = JSVAL_VOID;
-  sOnload_id          = JSVAL_VOID;
-  sOnbeforeunload_id  = JSVAL_VOID;
-  sOnunload_id        = JSVAL_VOID;
-  sOnhashchange_id    = JSVAL_VOID;
-  sOnpageshow_id      = JSVAL_VOID;
-  sOnpagehide_id      = JSVAL_VOID;
-  sOnabort_id         = JSVAL_VOID;
-  sOnerror_id         = JSVAL_VOID;
-  sOnpaint_id         = JSVAL_VOID;
-  sOnresize_id        = JSVAL_VOID;
-  sOnscroll_id        = JSVAL_VOID;
-  sOndrag_id          = JSVAL_VOID;
-  sOndragend_id       = JSVAL_VOID;
-  sOndragenter_id     = JSVAL_VOID;
-  sOndragleave_id     = JSVAL_VOID;
-  sOndragover_id      = JSVAL_VOID;
-  sOndragstart_id     = JSVAL_VOID;
-  sOndrop_id          = JSVAL_VOID;
-  sScrollX_id         = JSVAL_VOID;
-  sScrollY_id         = JSVAL_VOID;
-  sScrollMaxX_id      = JSVAL_VOID;
-  sScrollMaxY_id      = JSVAL_VOID;
-  sOpen_id            = JSVAL_VOID;
-  sItem_id            = JSVAL_VOID;
-  sEnumerate_id       = JSVAL_VOID;
-  sNavigator_id       = JSVAL_VOID;
-  sDocument_id        = JSVAL_VOID;
-  sWindow_id          = JSVAL_VOID;
-  sFrames_id          = JSVAL_VOID;
-  sSelf_id            = JSVAL_VOID;
-  sOpener_id          = JSVAL_VOID;
-  sAll_id             = JSVAL_VOID;
-  sTags_id            = JSVAL_VOID;
-  sAddEventListener_id= JSVAL_VOID;
-  sBaseURIObject_id   = JSVAL_VOID;
-  sNodePrincipal_id   = JSVAL_VOID;
-  sDocumentURIObject_id=JSVAL_VOID;
-  sOncopy_id          = JSVAL_VOID;
-  sOncut_id           = JSVAL_VOID;
-  sOnpaste_id         = JSVAL_VOID;
-  sJava_id            = JSVAL_VOID;
-  sPackages_id        = JSVAL_VOID;
+  sTop_id             = JSID_VOID;
+  sParent_id          = JSID_VOID;
+  sScrollbars_id      = JSID_VOID;
+  sLocation_id        = JSID_VOID;
+  sConstructor_id     = JSID_VOID;
+  s_content_id        = JSID_VOID;
+  sContent_id         = JSID_VOID;
+  sMenubar_id         = JSID_VOID;
+  sToolbar_id         = JSID_VOID;
+  sLocationbar_id     = JSID_VOID;
+  sPersonalbar_id     = JSID_VOID;
+  sStatusbar_id       = JSID_VOID;
+  sDialogArguments_id = JSID_VOID;
+  sControllers_id     = JSID_VOID;
+  sLength_id          = JSID_VOID;
+  sInnerHeight_id     = JSID_VOID;
+  sInnerWidth_id      = JSID_VOID;
+  sOuterHeight_id     = JSID_VOID;
+  sOuterWidth_id      = JSID_VOID;
+  sScreenX_id         = JSID_VOID;
+  sScreenY_id         = JSID_VOID;
+  sStatus_id          = JSID_VOID;
+  sName_id            = JSID_VOID;
+  sOnmousedown_id     = JSID_VOID;
+  sOnmouseup_id       = JSID_VOID;
+  sOnclick_id         = JSID_VOID;
+  sOndblclick_id      = JSID_VOID;
+  sOncontextmenu_id   = JSID_VOID;
+  sOnmouseover_id     = JSID_VOID;
+  sOnmouseout_id      = JSID_VOID;
+  sOnkeydown_id       = JSID_VOID;
+  sOnkeyup_id         = JSID_VOID;
+  sOnkeypress_id      = JSID_VOID;
+  sOnmousemove_id     = JSID_VOID;
+  sOnfocus_id         = JSID_VOID;
+  sOnblur_id          = JSID_VOID;
+  sOnsubmit_id        = JSID_VOID;
+  sOnreset_id         = JSID_VOID;
+  sOnchange_id        = JSID_VOID;
+  sOnselect_id        = JSID_VOID;
+  sOnload_id          = JSID_VOID;
+  sOnbeforeunload_id  = JSID_VOID;
+  sOnunload_id        = JSID_VOID;
+  sOnhashchange_id    = JSID_VOID;
+  sOnpageshow_id      = JSID_VOID;
+  sOnpagehide_id      = JSID_VOID;
+  sOnabort_id         = JSID_VOID;
+  sOnerror_id         = JSID_VOID;
+  sOnpaint_id         = JSID_VOID;
+  sOnresize_id        = JSID_VOID;
+  sOnscroll_id        = JSID_VOID;
+  sOndrag_id          = JSID_VOID;
+  sOndragend_id       = JSID_VOID;
+  sOndragenter_id     = JSID_VOID;
+  sOndragleave_id     = JSID_VOID;
+  sOndragover_id      = JSID_VOID;
+  sOndragstart_id     = JSID_VOID;
+  sOndrop_id          = JSID_VOID;
+  sScrollX_id         = JSID_VOID;
+  sScrollY_id         = JSID_VOID;
+  sScrollMaxX_id      = JSID_VOID;
+  sScrollMaxY_id      = JSID_VOID;
+  sOpen_id            = JSID_VOID;
+  sItem_id            = JSID_VOID;
+  sEnumerate_id       = JSID_VOID;
+  sNavigator_id       = JSID_VOID;
+  sDocument_id        = JSID_VOID;
+  sWindow_id          = JSID_VOID;
+  sFrames_id          = JSID_VOID;
+  sSelf_id            = JSID_VOID;
+  sOpener_id          = JSID_VOID;
+  sAll_id             = JSID_VOID;
+  sTags_id            = JSID_VOID;
+  sAddEventListener_id= JSID_VOID;
+  sBaseURIObject_id   = JSID_VOID;
+  sNodePrincipal_id   = JSID_VOID;
+  sDocumentURIObject_id=JSID_VOID;
+  sOncopy_id          = JSID_VOID;
+  sOncut_id           = JSID_VOID;
+  sOnpaste_id         = JSID_VOID;
+  sJava_id            = JSID_VOID;
+  sPackages_id        = JSID_VOID;
 
   NS_IF_RELEASE(sXPConnect);
   NS_IF_RELEASE(sSecMan);
   sIsInitialized = PR_FALSE;
 }
 
 // Window helper
 
@@ -4677,17 +4675,17 @@ static JSClass sGlobalScopePolluterClass
   (JSResolveOp)nsWindowSH::GlobalScopePolluterNewResolve, JS_ConvertStub,
   nsHTMLDocumentSH::ReleaseDocument
 };
 
 
 // static
 JSBool
 nsWindowSH::GlobalScopePolluterGetProperty(JSContext *cx, JSObject *obj,
-                                           jsval id, jsval *vp)
+                                           jsid id, jsval *vp)
 {
   // Someone is accessing a element by referencing its name/id in the
   // global scope, do a security check to make sure that's ok.
 
   nsresult rv =
     sSecMan->CheckPropertyAccess(cx, ::JS_GetGlobalForObject(cx, obj),
                                  "Window", id,
                                  nsIXPCSecurityManager::ACCESS_GET_PROPERTY);
@@ -4703,17 +4701,17 @@ nsWindowSH::GlobalScopePolluterGetProper
   // catch and fix these mistakes.
   PrintWarningOnConsole(cx, "GlobalScopeElementReference");
 
   return JS_TRUE;
 }
 
 // static
 JSBool
-nsWindowSH::SecurityCheckOnSetProp(JSContext *cx, JSObject *obj, jsval id,
+nsWindowSH::SecurityCheckOnSetProp(JSContext *cx, JSObject *obj, jsid id,
                                    jsval *vp)
 {
   // Someone is accessing a element by referencing its name/id in the
   // global scope, do a security check to make sure that's ok.
 
   nsresult rv =
     sSecMan->CheckPropertyAccess(cx, ::JS_GetGlobalForObject(cx, obj),
                                  "Window", id,
@@ -4722,22 +4720,22 @@ nsWindowSH::SecurityCheckOnSetProp(JSCon
   // If !NS_SUCCEEDED(rv) the security check failed. The security
   // manager set a JS exception for us.
   return NS_SUCCEEDED(rv);
 }
 
 // static
 JSBool
 nsWindowSH::GlobalScopePolluterNewResolve(JSContext *cx, JSObject *obj,
-                                          jsval id, uintN flags,
+                                          jsid id, uintN flags,
                                           JSObject **objp)
 {
   if (flags & (JSRESOLVE_ASSIGNING | JSRESOLVE_DECLARING |
                JSRESOLVE_CLASSNAME | JSRESOLVE_QUALIFIED) ||
-      !JSVAL_IS_STRING(id)) {
+      !JSID_IS_STRING(id)) {
     // Nothing to do here if we're either assigning or declaring,
     // resolving a class name, doing a qualified resolve, or
     // resolving a number.
 
     return JS_TRUE;
   }
 
   nsIHTMLDocument *doc = (nsIHTMLDocument *)::JS_GetPrivate(cx, obj);
@@ -4747,21 +4745,20 @@ nsWindowSH::GlobalScopePolluterNewResolv
       document->GetCompatibilityMode() != eCompatibility_NavQuirks) {
     // If we don't have a document, or if the document is not in
     // quirks mode, return early.
 
     return JS_TRUE;
   }
 
   JSObject *proto = ::JS_GetPrototype(cx, obj);
-  JSString *jsstr = JSVAL_TO_STRING(id);
+  JSString *jsstr = JSID_TO_STRING(id);
   JSBool hasProp;
 
-  if (!proto || !::JS_HasUCProperty(cx, proto, ::JS_GetStringChars(jsstr),
-                                    ::JS_GetStringLength(jsstr), &hasProp) ||
+  if (!proto || !::JS_HasPropertyById(cx, proto, id, &hasProp) ||
       hasProp) {
     // No prototype, or the property exists on the prototype. Do
     // nothing.
 
     return JS_TRUE;
   }
 
   nsDependentJSString str(jsstr);
@@ -4782,19 +4779,17 @@ nsWindowSH::GlobalScopePolluterNewResolv
 
   if (result) {
     jsval v;
     nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
     nsresult rv = WrapNative(cx, obj, result, PR_TRUE, &v,
                              getter_AddRefs(holder));
     NS_ENSURE_SUCCESS(rv, JS_FALSE);
 
-    if (!::JS_DefineUCProperty(cx, obj, ::JS_GetStringChars(jsstr),
-                               ::JS_GetStringLength(jsstr), v, nsnull, nsnull,
-                               0)) {
+    if (!::JS_DefinePropertyById(cx, obj, id, v, nsnull, nsnull, 0)) {
       nsDOMClassInfo::ThrowJSException(cx, NS_ERROR_UNEXPECTED);
 
       return JS_FALSE;
     }
 
     *objp = obj;
   }
 
@@ -4878,33 +4873,33 @@ nsWindowSH::InstallGlobalScopePolluter(J
   // invalidation).
   NS_ADDREF(doc);
 
   return NS_OK;
 }
 
 static
 already_AddRefed<nsIDOMWindow>
-GetChildFrame(nsGlobalWindow *win, jsval id)
+GetChildFrame(nsGlobalWindow *win, jsid id)
 {
   nsCOMPtr<nsIDOMWindowCollection> frames;
   win->GetFrames(getter_AddRefs(frames));
 
   nsIDOMWindow *frame = nsnull;
 
   if (frames) {
-    frames->Item(JSVAL_TO_INT(id), &frame);
+    frames->Item(JSID_TO_INT(id), &frame);
   }
 
   return frame;
 }
 
 NS_IMETHODIMP
 nsWindowSH::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                        JSObject *obj, jsval id, jsval *vp, PRBool *_retval)
+                        JSObject *obj, jsid id, jsval *vp, PRBool *_retval)
 {
   nsGlobalWindow *win = nsGlobalWindow::FromWrapper(wrapper);
 
   JSAutoRequest ar(cx);
 
 #ifdef DEBUG_SH_FORWARDING
   {
     JSString *jsstr = ::JS_ValueToString(cx, id);
@@ -4934,38 +4929,35 @@ nsWindowSH::GetProperty(nsIXPConnectWrap
 
     JSObject *innerObj;
     if (innerWin && (innerObj = innerWin->GetGlobalJSObject())) {
 #ifdef DEBUG_SH_FORWARDING
       printf(" --- Forwarding get to inner window %p\n", (void *)innerWin);
 #endif
 
       // Forward the get to the inner object
-      if (JSVAL_IS_STRING(id)) {
-        JSString *str = JSVAL_TO_STRING(id);
-
-        *_retval = ::JS_GetUCProperty(cx, innerObj, ::JS_GetStringChars(str),
-                                      ::JS_GetStringLength(str), vp);
-      } else if (JSVAL_IS_INT(id)) {
-        *_retval = ::JS_GetElement(cx, innerObj, JSVAL_TO_INT(id), vp);
+      if (JSID_IS_STRING(id)) {
+        *_retval = ::JS_GetPropertyById(cx, innerObj, id, vp);
+      } else if (JSID_IS_INT(id)) {
+        *_retval = ::JS_GetElement(cx, innerObj, JSID_TO_INT(id), vp);
       } else {
         NS_ERROR("Write me!");
 
         return NS_ERROR_NOT_IMPLEMENTED;
       }
 
       return NS_OK;
     }
   }
 
   // The order in which things are done in this method are a bit
   // whacky, that's because this method is *extremely* performace
   // critical. Don't touch this unless you know what you're doing.
 
-  if (JSVAL_IS_INT(id)) {
+  if (JSID_IS_INT(id)) {
     // If we're accessing a numeric property we'll treat that as if
     // window.frames[n] is accessed (since window.frames === window),
     // if window.frames[n] is a child frame, wrap the frame and return
     // it without doing a security check.
 
     nsCOMPtr<nsIDOMWindow> frame = GetChildFrame(win, id);
     nsresult rv = NS_OK;
 
@@ -4991,17 +4983,17 @@ nsWindowSH::GetProperty(nsIXPConnectWrap
         rv = sXPConnect->GetXOWForObject(cx, scopeobj, JSVAL_TO_OBJECT(*vp),
                                          vp);
       }
     }
 
     return NS_FAILED(rv) ? rv : NS_SUCCESS_I_DID_SOMETHING;
   }
 
-  if (JSVAL_IS_STRING(id) && !JSVAL_IS_PRIMITIVE(*vp) &&
+  if (JSID_IS_STRING(id) && !JSVAL_IS_PRIMITIVE(*vp) &&
       ::JS_TypeOfValue(cx, *vp) != JSTYPE_FUNCTION) {
     // A named property accessed which could have been resolved to a
     // child frame in nsWindowSH::NewResolve() (*vp will tell us if
     // that's the case). If *vp is a window object (i.e. a child
     // frame), return without doing a security check.
     //
     // Calling GetWrappedNativeOfJSObject() is not all that cheap, so
     // only do that if the JSClass name is one that is likely to be a
@@ -5029,17 +5021,17 @@ nsWindowSH::GetProperty(nsIXPConnectWrap
     }
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWindowSH::SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                        JSObject *obj, jsval id, jsval *vp, PRBool *_retval)
+                        JSObject *obj, jsid id, jsval *vp, PRBool *_retval)
 {
   nsGlobalWindow *win = nsGlobalWindow::FromWrapper(wrapper);
 
 #ifdef DEBUG_SH_FORWARDING
   {
     nsDependentJSString str(::JS_ValueToString(cx, id));
 
     if (win->IsInnerWindow()) {
@@ -5064,23 +5056,20 @@ nsWindowSH::SetProperty(nsIXPConnectWrap
 
     JSObject *innerObj;
     if (innerWin && (innerObj = innerWin->GetGlobalJSObject())) {
 #ifdef DEBUG_SH_FORWARDING
       printf(" --- Forwarding set to inner window %p\n", (void *)innerWin);
 #endif
 
       // Forward the set to the inner object
-      if (JSVAL_IS_STRING(id)) {
-        JSString *str = JSVAL_TO_STRING(id);
-
-        *_retval = ::JS_SetUCProperty(cx, innerObj, ::JS_GetStringChars(str),
-                                      ::JS_GetStringLength(str), vp);
-      } else if (JSVAL_IS_INT(id)) {
-        *_retval = ::JS_SetElement(cx, innerObj, JSVAL_TO_INT(id), vp);
+      if (JSID_IS_STRING(id)) {
+        *_retval = ::JS_SetPropertyById(cx, innerObj, id, vp);
+      } else if (JSID_IS_INT(id)) {
+        *_retval = ::JS_SetElement(cx, innerObj, JSID_TO_INT(id), vp);
       } else {
         NS_ERROR("Write me!");
 
         return NS_ERROR_NOT_IMPLEMENTED;
       }
 
       return NS_OK;
     }
@@ -5109,17 +5098,17 @@ nsWindowSH::SetProperty(nsIXPConnectWrap
     return NS_FAILED(rv) ? rv : NS_SUCCESS_I_DID_SOMETHING;
   }
 
   return nsEventReceiverSH::SetProperty(wrapper, cx, obj, id, vp, _retval);
 }
 
 NS_IMETHODIMP
 nsWindowSH::AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                        JSObject *obj, jsval id, jsval *vp,
+                        JSObject *obj, jsid id, jsval *vp,
                         PRBool *_retval)
 {
   nsGlobalWindow *win = nsGlobalWindow::FromWrapper(wrapper);
 
 #ifdef DEBUG_SH_FORWARDING
   {
     nsDependentJSString str(::JS_ValueToString(cx, id));
 
@@ -5148,43 +5137,37 @@ nsWindowSH::AddProperty(nsIXPConnectWrap
       if (sResolving) {
         return NS_OK;
       }
 
 #ifdef DEBUG_SH_FORWARDING
       printf(" --- Forwarding add to inner window %p\n", (void *)innerWin);
 #endif
 
-      jsid interned_id;
-      if (!JS_ValueToId(cx, id, &interned_id)) {
-        *_retval = JS_FALSE;
-        return NS_OK;
-      }
-
       JSPropertyDescriptor desc;
-      if (!JS_GetPropertyDescriptorById(cx, obj, interned_id,
+      if (!JS_GetPropertyDescriptorById(cx, obj, id,
                                         JSRESOLVE_QUALIFIED, &desc)) {
         *_retval = JS_FALSE;
         return NS_OK;
       }
 
       // Forward the add to the inner object
-      *_retval = JS_DefinePropertyById(cx, innerObj, interned_id, *vp,
+      *_retval = JS_DefinePropertyById(cx, innerObj, id, *vp,
                                        desc.getter, desc.setter,
                                        desc.attrs | JSPROP_ENUMERATE);
       return NS_OK;
     }
   }
 
   return nsEventReceiverSH::AddProperty(wrapper, cx, obj, id, vp, _retval);
 }
 
 NS_IMETHODIMP
 nsWindowSH::DelProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                        JSObject *obj, jsval id, jsval *vp,
+                        JSObject *obj, jsid id, jsval *vp,
                         PRBool *_retval)
 {
   nsGlobalWindow *win = nsGlobalWindow::FromWrapper(wrapper);
 
 #ifdef DEBUG_SH_FORWARDING
   {
     nsDependentJSString str(::JS_ValueToString(cx, id));
 
@@ -5208,19 +5191,17 @@ nsWindowSH::DelProperty(nsIXPConnectWrap
 
     JSObject *innerObj;
     if (innerWin && (innerObj = innerWin->GetGlobalJSObject())) {
 #ifdef DEBUG_SH_FORWARDING
       printf(" --- Forwarding del to inner window %p\n", (void *)innerWin);
 #endif
 
       // Forward the del to the inner object
-      jsid interned_id;
-      *_retval = (JS_ValueToId(cx, id, &interned_id) &&
-                  JS_DeletePropertyById(cx, innerObj, interned_id));
+      *_retval = JS_DeletePropertyById(cx, innerObj, id);
 
       return NS_OK;
     }
   }
 
   // Notify any XOWs on our outer window.
 
   nsGlobalWindow *outerWin = win->GetOuterWindowInternal();
@@ -5420,71 +5401,60 @@ DefineInterfaceConstants(JSContext *cx, 
     }
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHTMLBodyElementSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext
-                                *cx, JSObject *obj, jsval id, PRUint32 flags,
+                                *cx, JSObject *obj, jsid id, PRUint32 flags,
                                 JSObject **objp, PRBool *_retval)
 {
   if (id == sOnhashchange_id) {
     // Special handling so |"onhashchange" in document.body| returns true.
-    jsid interned_id;
-
-    if (!JS_ValueToId(cx, id, &interned_id) ||
-        !JS_DefinePropertyById(cx, obj, interned_id, JSVAL_VOID,
+    if (!JS_DefinePropertyById(cx, obj, id, JSVAL_VOID,
                                nsnull, nsnull, JSPROP_ENUMERATE)) {
       *_retval = PR_FALSE;
       return NS_ERROR_FAILURE;
     }
 
     *objp = obj;
     return NS_OK;
   }
 
   return nsElementSH::NewResolve(wrapper, cx, obj, id, flags, objp, _retval);
 }
 
 NS_IMETHODIMP
 nsHTMLBodyElementSH::GetProperty(nsIXPConnectWrappedNative *wrapper,
-                                 JSContext *cx, JSObject *obj, jsval id,
+                                 JSContext *cx, JSObject *obj, jsid id,
                                  jsval *vp, PRBool *_retval)
 {
   if (id == sOnhashchange_id) {
     // Forward the request to the Window.
-    jsid interned_id;
-
-    if (!JS_ValueToId(cx, id, &interned_id) ||
-        !JS_GetPropertyById(cx, JS_GetGlobalForObject(cx, obj),
-                            interned_id, vp)) {
+    if (!JS_GetPropertyById(cx, JS_GetGlobalForObject(cx, obj), id, vp)) {
       *_retval = PR_FALSE;
       return NS_ERROR_FAILURE;
     }
 
     return NS_OK;
   }
 
   return nsElementSH::GetProperty(wrapper, cx, obj, id, vp, _retval);
 }
 
 NS_IMETHODIMP
 nsHTMLBodyElementSH::SetProperty(nsIXPConnectWrappedNative *wrapper,
                                  JSContext *cx, JSObject *obj,
-                                 jsval id, jsval *vp, PRBool *_retval)
+                                 jsid id, jsval *vp, PRBool *_retval)
 {
   if (id == sOnhashchange_id) {
     // Forward the request to the Window.
-    jsid interned_id;
-
-    if (!JS_ValueToId(cx, id, &interned_id) ||
-        !JS_SetPropertyById(cx, JS_GetGlobalForObject(cx, obj),
-                            interned_id, vp)) {
+    if (!JS_SetPropertyById(cx, JS_GetGlobalForObject(cx, obj), id, vp)) {
       *_retval = PR_FALSE;
       return NS_ERROR_FAILURE;
     }
 
     return NS_OK;
   }
 
   return nsElementSH::SetProperty(wrapper, cx, obj, id, vp, _retval);
@@ -6275,17 +6245,17 @@ ContentWindowGetter(JSContext *cx, JSObj
   return ::JS_GetProperty(cx, obj, "content", rval);
 }
 
 PRBool
 nsWindowSH::sResolving = PR_FALSE;
 
 NS_IMETHODIMP
 nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                       JSObject *obj, jsval id, PRUint32 flags,
+                       JSObject *obj, jsid id, PRUint32 flags,
                        JSObject **objp, PRBool *_retval)
 {
   nsGlobalWindow *win = nsGlobalWindow::FromWrapper(wrapper);
 
 #ifdef DEBUG_SH_FORWARDING
   {
     nsDependentJSString str(::JS_ValueToString(cx, id));
 
@@ -6341,22 +6311,19 @@ nsWindowSH::NewResolve(nsIXPConnectWrapp
     JSObject *realObj;
     wrapper->GetJSObject(&realObj);
     if (realObj == obj &&
         innerWin && (innerObj = innerWin->GetGlobalJSObject())) {
 #ifdef DEBUG_SH_FORWARDING
       printf(" --- Forwarding resolve to inner window %p\n", (void *)innerWin);
 #endif
 
-      jsid interned_id;
       JSPropertyDescriptor desc;
 
-      *_retval = (JS_ValueToId(cx, id, &interned_id) &&
-                  JS_GetPropertyDescriptorById(cx, innerObj, interned_id,
-                                               flags, &desc));
+      *_retval = JS_GetPropertyDescriptorById(cx, innerObj, id, flags, &desc);
 
       if (*_retval && desc.obj) {
 #ifdef DEBUG_SH_FORWARDING
         printf(" --- Resolve on inner window found property.\n");
 #endif
 
         // The JS engine assumes that the object that we return in objp is on
         // our prototype chain. As a result, for an assignment, it wants to
@@ -6369,47 +6336,47 @@ nsWindowSH::NewResolve(nsIXPConnectWrapp
         // we only care about fast expandos on the innerObj itself, things
         // found further up the prototype chain need to fend for themselves.
         if ((flags & JSRESOLVE_ASSIGNING) &&
             !(desc.attrs & (JSPROP_GETTER | JSPROP_SETTER)) &&
             desc.obj == innerObj) {
           PRBool oldResolving = sResolving;
           sResolving = PR_TRUE;
 
-          *_retval = JS_DefinePropertyById(cx, obj, interned_id, JSVAL_VOID,
+          *_retval = JS_DefinePropertyById(cx, obj, id, JSVAL_VOID,
                                            nsnull, nsnull,
                                            desc.attrs & JSPROP_ENUMERATE);
 
           sResolving = oldResolving;
           if (!*_retval) {
             return NS_OK;
           }
         }
 
         *objp = desc.obj;
       }
 
       return NS_OK;
     }
   }
 
-  if (!JSVAL_IS_STRING(id)) {
-    if (JSVAL_IS_INT(id) && !(flags & JSRESOLVE_ASSIGNING)) {
+  if (!JSID_IS_STRING(id)) {
+    if (JSID_IS_INT(id) && !(flags & JSRESOLVE_ASSIGNING)) {
       // If we're resolving a numeric property, treat that as if
       // window.frames[n] is resolved (since window.frames ===
       // window), if window.frames[n] is a child frame, define a
       // property for this index.
 
       nsCOMPtr<nsIDOMWindow> frame = GetChildFrame(win, id);
 
       if (frame) {
         // A numeric property accessed and the numeric property is a
         // child frame. Define a property for this index.
 
-        *_retval = ::JS_DefineElement(cx, obj, JSVAL_TO_INT(id), JSVAL_VOID,
+        *_retval = ::JS_DefineElement(cx, obj, JSID_TO_INT(id), JSVAL_VOID,
                                       nsnull, nsnull, JSPROP_SHARED);
 
         if (*_retval) {
           *objp = obj;
         }
       }
     }
 
@@ -6498,17 +6465,17 @@ nsWindowSH::NewResolve(nsIXPConnectWrapp
     return NS_OK;
   }
 
 
   // Hmm, we do an awful lot of QIs here; maybe we should add a
   // method on an interface that would let us just call into the
   // window code directly...
 
-  JSString *str = JSVAL_TO_STRING(id);
+  JSString *str = JSID_TO_STRING(id);
 
   // Don't resolve named frames on native wrappers
   if (!ObjectIsNativeWrapper(cx, obj)) {
     nsCOMPtr<nsIDocShellTreeNode> dsn(do_QueryInterface(win->GetDocShell()));
 
     PRInt32 count = 0;
 
     if (dsn) {
@@ -6547,20 +6514,17 @@ nsWindowSH::NewResolve(nsIXPConnectWrapp
                        !strcmp(JSVAL_TO_OBJECT(v)->getClass()->name,
                                "XPCCrossOriginWrapper"),
                        "Didn't wrap a window!");
         }
 #endif
 
         JSAutoRequest ar(cx);
 
-        PRBool ok = ::JS_DefineUCProperty(cx, obj, chars,
-                                          ::JS_GetStringLength(str),
-                                          v, nsnull, nsnull, 0);
-
+        PRBool ok = ::JS_DefinePropertyById(cx, obj, id, v, nsnull, nsnull, 0);
         if (!ok) {
           return NS_ERROR_FAILURE;
         }
 
         *objp = obj;
 
         return NS_OK;
       }
@@ -6604,22 +6568,21 @@ nsWindowSH::NewResolve(nsIXPConnectWrapp
       return NS_ERROR_OUT_OF_MEMORY;
     }
 
     JSObject *funObj = ::JS_GetFunctionObject(fun);
 
     nsAutoGCRoot root(&funObj, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
 
-    if (!::JS_DefineUCProperty(cx, windowObj, ::JS_GetStringChars(str),
-                               ::JS_GetStringLength(str), JSVAL_VOID,
-                               JS_DATA_TO_FUNC_PTR(JSPropertyOp, funObj),
-                               nsnull,
-                               JSPROP_ENUMERATE | JSPROP_GETTER |
-                               JSPROP_SHARED)) {
+    if (!::JS_DefinePropertyById(cx, windowObj, id, JSVAL_VOID,
+                                 JS_DATA_TO_FUNC_PTR(JSPropertyOp, funObj),
+                                 nsnull,
+                                 JSPROP_ENUMERATE | JSPROP_GETTER |
+                                 JSPROP_SHARED)) {
       return NS_ERROR_FAILURE;
     }
 
     *objp = obj;
 
     return NS_OK;
   }
 
@@ -6668,37 +6631,31 @@ nsWindowSH::NewResolve(nsIXPConnectWrapp
                        !strcmp(JSVAL_TO_OBJECT(v)->getClass()->name,
                                "XPCCrossOriginWrapper"),
                        "Didn't wrap a location object!");
     }
 #endif
 
     JSAutoRequest ar(cx);
 
-    JSBool ok = ::JS_DefineUCProperty(cx, obj, ::JS_GetStringChars(str),
-                                      ::JS_GetStringLength(str), v, nsnull,
-                                      nsnull,
-                                      JSPROP_PERMANENT |
-                                      JSPROP_ENUMERATE);
+    JSBool ok = ::JS_DefinePropertyById(cx, obj, id, v, nsnull, nsnull,
+                                        JSPROP_PERMANENT | JSPROP_ENUMERATE);
 
     if (!ok) {
       return NS_ERROR_FAILURE;
     }
 
     *objp = obj;
 
     return NS_OK;
   }
 
   if (id == sOnhashchange_id) {
     // Special handling so |"onhashchange" in window| returns true
-    jsid interned_id;
-
-    if (!JS_ValueToId(cx, id, &interned_id) ||
-        !JS_DefinePropertyById(cx, obj, interned_id, JSVAL_VOID,
+    if (!JS_DefinePropertyById(cx, obj, id, JSVAL_VOID,
                                 nsnull, nsnull, JSPROP_ENUMERATE)) {
       *_retval = PR_FALSE;
       return NS_ERROR_FAILURE;
     }
 
     *objp = obj;
     return NS_OK;
   }
@@ -6708,20 +6665,18 @@ nsWindowSH::NewResolve(nsIXPConnectWrapp
         (!(flags & JSRESOLVE_QUALIFIED) && IsWritableReplaceable(id))) {
       // A readonly "replaceable" property is being set, or a
       // readwrite "replaceable" property is being set w/o being
       // fully qualified. Define the property on obj with the value
       // undefined to override the predefined property. This is done
       // for compatibility with other browsers.
       JSAutoRequest ar(cx);
 
-      if (!::JS_DefineUCProperty(cx, obj, ::JS_GetStringChars(str),
-                                 ::JS_GetStringLength(str),
-                                 JSVAL_VOID, JS_PropertyStub, JS_PropertyStub,
-                                 JSPROP_ENUMERATE)) {
+      if (!::JS_DefinePropertyById(cx, obj, id, JSVAL_VOID, JS_PropertyStub,
+                                   JS_PropertyStub, JSPROP_ENUMERATE)) {
         return NS_ERROR_FAILURE;
       }
       *objp = obj;
 
       return NS_OK;
     }
   } else {
     if (id == sNavigator_id) {
@@ -6732,20 +6687,19 @@ nsWindowSH::NewResolve(nsIXPConnectWrapp
       jsval v;
       nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
       rv = WrapNative(cx, obj, navigator, &NS_GET_IID(nsIDOMNavigator), PR_TRUE,
                       &v, getter_AddRefs(holder));
       NS_ENSURE_SUCCESS(rv, rv);
 
       JSAutoRequest ar(cx);
 
-      if (!::JS_DefineUCProperty(cx, obj, ::JS_GetStringChars(str),
-                                 ::JS_GetStringLength(str), v, nsnull, nsnull,
-                                 JSPROP_READONLY | JSPROP_PERMANENT |
-                                 JSPROP_ENUMERATE)) {
+      if (!::JS_DefinePropertyById(cx, obj, id, v, nsnull, nsnull,
+                                   JSPROP_READONLY | JSPROP_PERMANENT |
+                                   JSPROP_ENUMERATE)) {
         return NS_ERROR_FAILURE;
       }
       *objp = obj;
 
       return NS_OK;
     }
 
     if (id == sDocument_id) {
@@ -6798,20 +6752,18 @@ nsWindowSH::NewResolve(nsIXPConnectWrapp
           scope = oldWin->GetGlobalJSObject();
         }
 
         rv = sXPConnect->GetXOWForObject(cx, scope, JSVAL_TO_OBJECT(winVal),
                                          &winVal);
         NS_ENSURE_SUCCESS(rv, rv);
       }
       PRBool ok =
-        ::JS_DefineUCProperty(cx, obj, ::JS_GetStringChars(str),
-                              ::JS_GetStringLength(str),
-                              winVal, JS_PropertyStub, JS_PropertyStub,
-                              JSPROP_READONLY | JSPROP_ENUMERATE);
+        ::JS_DefinePropertyById(cx, obj, id, winVal, JS_PropertyStub, JS_PropertyStub,
+                                JSPROP_READONLY | JSPROP_ENUMERATE);
 
       if (!ok) {
         return NS_ERROR_FAILURE;
       }
       *objp = obj;
 
       return NS_OK;
     }
@@ -6881,22 +6833,20 @@ nsWindowSH::NewResolve(nsIXPConnectWrapp
   if ((flags & JSRESOLVE_ASSIGNING) && !(flags & JSRESOLVE_WITH) &&
       win->IsInnerWindow()) {
     JSObject *realObj;
     wrapper->GetJSObject(&realObj);
 
     if (obj == realObj) {
       JSObject *proto = obj->getProto();
       if (proto) {
-        jsid interned_id;
         JSObject *pobj = NULL;
         jsval val;
 
-        if (!::JS_ValueToId(cx, id, &interned_id) ||
-            !::JS_LookupPropertyWithFlagsById(cx, proto, interned_id, flags,
+        if (!::JS_LookupPropertyWithFlagsById(cx, proto, id, flags,
                                               &pobj, &val)) {
           *_retval = JS_FALSE;
 
           return NS_OK;
         }
 
         if (pobj) {
           // A property was found on the prototype chain.
@@ -6911,23 +6861,21 @@ nsWindowSH::NewResolve(nsIXPConnectWrapp
       //
       // We don't need to worry about property attributes here as we
       // know here we're dealing with an undefined property set, so
       // we're not declaring readonly or permanent properties.
       //
       // Since we always create the undeclared property here without given a
       // chance for the interpreter to report applicable strict mode warnings,
       // we must take care to check those warnings here.
-      JSString *str = JSVAL_TO_STRING(id);
+      JSString *str = JSID_TO_STRING(id);
       if ((!(flags & JSRESOLVE_QUALIFIED) &&
            !js_CheckUndeclaredVarAssignment(cx, str)) ||
-          !::JS_DefineUCProperty(cx, obj, ::JS_GetStringChars(str),
-                                 ::JS_GetStringLength(str), JSVAL_VOID,
-                                 JS_PropertyStub, JS_PropertyStub,
-                                 JSPROP_ENUMERATE)) {
+          !::JS_DefinePropertyById(cx, obj, id, JSVAL_VOID, JS_PropertyStub,
+                                   JS_PropertyStub, JSPROP_ENUMERATE)) {
         *_retval = JS_FALSE;
 
         return NS_OK;
       }
 
       *objp = obj;
     }
   }
@@ -6966,28 +6914,28 @@ nsWindowSH::NewEnumerate(nsIXPConnectWra
       if (!iterator) {
         return NS_ERROR_OUT_OF_MEMORY;
       }
 
       *statep = OBJECT_TO_JSVAL(iterator);
       if (idp) {
         // Note: With these property iterators, we can't tell ahead of time how
         // many properties we're going to be iterating over.
-        *idp = JSVAL_ZERO;
+        *idp = INT_TO_JSID(0);
       }
       break;
     }
     case JSENUMERATE_NEXT:
     {
       JSObject *iterator = (JSObject*)JSVAL_TO_OBJECT(*statep);
       if (!JS_NextProperty(cx, iterator, idp)) {
         return NS_ERROR_UNEXPECTED;
       }
 
-      if (*idp != JSVAL_VOID) {
+      if (*idp != JSID_VOID) {
         break;
       }
 
       // Fall through.
     }
     case JSENUMERATE_DESTROY:
       // Let GC at our iterator object.
       *statep = JSVAL_NULL;
@@ -7103,17 +7051,17 @@ nsWindowSH::InnerObject(nsIXPConnectWrap
 
   return NS_OK;
 }
 
 // DOM Location helper
 
 NS_IMETHODIMP
 nsLocationSH::CheckAccess(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                          JSObject *obj, jsval id, PRUint32 mode,
+                          JSObject *obj, jsid id, PRUint32 mode,
                           jsval *vp, PRBool *_retval)
 {
   if ((mode & JSACC_TYPEMASK) == JSACC_PROTO && (mode & JSACC_WRITE)) {
     // No setting location.__proto__, ever!
 
     // Let XPConnect know that the access was not granted.
     *_retval = PR_FALSE;
 
@@ -7208,29 +7156,26 @@ nsNodeSH::IsCapabilityEnabled(const char
 {
   PRBool enabled;
   return sSecMan &&
     NS_SUCCEEDED(sSecMan->IsCapabilityEnabled(aCapability, &enabled)) &&
     enabled;
 }
 
 nsresult
-nsNodeSH::DefineVoidProp(JSContext* cx, JSObject* obj, jsval id,
+nsNodeSH::DefineVoidProp(JSContext* cx, JSObject* obj, jsid id,
                          JSObject** objp)
 {
-  NS_ASSERTION(JSVAL_IS_STRING(id), "id must be a string");
-
-  JSString* str = JSVAL_TO_STRING(id);
+  NS_ASSERTION(JSID_IS_STRING(id), "id must be a string");
 
   // We want this to be as invisible to content script as possible.  So
   // don't enumerate this, and set is as JSPROP_SHARED so it won't get
   // cached on the object.
-  JSBool ok = ::JS_DefineUCProperty(cx, obj, ::JS_GetStringChars(str),
-                                    ::JS_GetStringLength(str), JSVAL_VOID,
-                                    nsnull, nsnull, JSPROP_SHARED);
+  JSBool ok = ::JS_DefinePropertyById(cx, obj, id, JSVAL_VOID,
+                                      nsnull, nsnull, JSPROP_SHARED);
 
   if (!ok) {
     return NS_ERROR_FAILURE;
   }
 
   *objp = obj;
   return NS_OK;
 }
@@ -7371,25 +7316,25 @@ nsNodeSH::PreCreate(nsISupports *nativeO
 
   return node->IsInNativeAnonymousSubtree() ?
     NS_SUCCESS_CHROME_ACCESS_ONLY :
     (slimWrappers ? NS_SUCCESS_ALLOW_SLIM_WRAPPERS : NS_OK);
 }
 
 NS_IMETHODIMP
 nsNodeSH::AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                      JSObject *obj, jsval id, jsval *vp, PRBool *_retval)
+                      JSObject *obj, jsid id, jsval *vp, PRBool *_retval)
 {
   nsNodeSH::PreserveWrapper(GetNative(wrapper, obj));
   return nsEventReceiverSH::AddProperty(wrapper, cx, obj, id, vp, _retval);
 }
 
 NS_IMETHODIMP
 nsNodeSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                     JSObject *obj, jsval id, PRUint32 flags,
+                     JSObject *obj, jsid id, PRUint32 flags,
                      JSObject **objp, PRBool *_retval)
 {
   if ((id == sBaseURIObject_id || id == sNodePrincipal_id) &&
       IsPrivilegedScript()) {
     return DefineVoidProp(cx, obj, id, objp);
   }
 
   if (id == sOnload_id || id == sOnerror_id) {
@@ -7399,17 +7344,17 @@ nsNodeSH::NewResolve(nsIXPConnectWrapped
   }
 
   return nsEventReceiverSH::NewResolve(wrapper, cx, obj, id, flags, objp,
                                        _retval);
 }
 
 NS_IMETHODIMP
 nsNodeSH::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                      JSObject *obj, jsval id, jsval *vp, PRBool *_retval)
+                      JSObject *obj, jsid id, jsval *vp, PRBool *_retval)
 {
   if (id == sBaseURIObject_id && IsPrivilegedScript()) {
     // I wish GetBaseURI lived on nsINode
     nsCOMPtr<nsIURI> uri;
     nsCOMPtr<nsIContent> content = do_QueryWrappedNative(wrapper, obj);
     if (content) {
       uri = content->GetBaseURI();
       NS_ENSURE_TRUE(uri, NS_ERROR_OUT_OF_MEMORY);
@@ -7439,17 +7384,17 @@ nsNodeSH::GetProperty(nsIXPConnectWrappe
   }    
 
   // Note: none of our ancestors want GetProperty
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsNodeSH::SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                      JSObject *obj, jsval id, jsval *vp, PRBool *_retval)
+                      JSObject *obj, jsid id, jsval *vp, PRBool *_retval)
 {
   if ((id == sBaseURIObject_id || id == sNodePrincipal_id) &&
       IsPrivilegedScript()) {
     // We don't want privileged script that can read this property to set it,
     // but _do_ want to allow everyone else to set a value they can then read.
     //
     // XXXbz Is there a better error we could use here?
     return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
@@ -7472,17 +7417,17 @@ nsNodeSH::PreserveWrapper(nsISupports *a
   nsINode *node = static_cast<nsINode*>(aNative);
   nsContentUtils::PreserveWrapper(aNative, node);
 }
 
 // EventReceiver helper
 
 // static
 PRBool
-nsEventReceiverSH::ReallyIsEventName(jsval id, jschar aFirstChar)
+nsEventReceiverSH::ReallyIsEventName(jsid id, jschar aFirstChar)
 {
   // I wonder if this is faster than using a hash...
 
   switch (aFirstChar) {
   case 'a' :
     return id == sOnabort_id;
   case 'b' :
     return (id == sOnbeforeunload_id ||
@@ -7538,17 +7483,17 @@ nsEventReceiverSH::ReallyIsEventName(jsv
   }
 
   return PR_FALSE;
 }
 
 nsresult
 nsEventReceiverSH::RegisterCompileHandler(nsIXPConnectWrappedNative *wrapper,
                                           JSContext *cx, JSObject *obj,
-                                          jsval id, PRBool compile,
+                                          jsid id, PRBool compile,
                                           PRBool remove,
                                           PRBool *did_define)
 {
   NS_PRECONDITION(!compile || !remove,
                   "Can't both compile and remove at the same time");
   *did_define = PR_FALSE;
 
   if (!IsEventName(id)) {
@@ -7590,48 +7535,43 @@ nsEventReceiverSH::RegisterCompileHandle
                                               atom);
   }
 
   return NS_FAILED(rv) ? rv : NS_SUCCESS_I_DID_SOMETHING;
 }
 
 NS_IMETHODIMP
 nsEventReceiverSH::NewResolve(nsIXPConnectWrappedNative *wrapper,
-                              JSContext *cx, JSObject *obj, jsval id,
+                              JSContext *cx, JSObject *obj, jsid id,
                               PRUint32 flags, JSObject **objp, PRBool *_retval)
 {
-  if (!JSVAL_IS_STRING(id)) {
+  if (!JSID_IS_STRING(id)) {
     return NS_OK;
   }
 
   if (flags & JSRESOLVE_ASSIGNING) {
     if (!IsEventName(id)) {
       // Bail out.  We don't care about this assignment.
       return NS_OK;
     }
 
     // If we're assigning to an on* property, just resolve to null for
     // now; the assignment will then set the right value. Only do this
     // in the case where the property isn't already defined on the
     // object's prototype chain though.
-    JSString* str = JSVAL_TO_STRING(id);
     JSAutoRequest ar(cx);
 
     JSObject *proto = ::JS_GetPrototype(cx, obj);
     PRBool ok = PR_TRUE, hasProp = PR_FALSE;
-    if (!proto || ((ok = ::JS_HasUCProperty(cx, proto, ::JS_GetStringChars(str),
-                                            ::JS_GetStringLength(str),
-                                            &hasProp)) &&
+    if (!proto || ((ok = ::JS_HasPropertyById(cx, proto, id, &hasProp)) &&
                    !hasProp)) {
       // Make sure the flags here match those in
       // nsJSContext::BindCompiledEventHandler
-      if (!::JS_DefineUCProperty(cx, obj, ::JS_GetStringChars(str),
-                                 ::JS_GetStringLength(str), JSVAL_NULL,
-                                 nsnull, nsnull,
-                                 JSPROP_ENUMERATE | JSPROP_PERMANENT)) {
+      if (!::JS_DefinePropertyById(cx, obj, id, JSVAL_NULL, nsnull, nsnull,
+                                   JSPROP_ENUMERATE | JSPROP_PERMANENT)) {
         return NS_ERROR_FAILURE;
       }
 
       *objp = obj;
       return NS_OK;
     }
 
     return ok ? NS_OK : NS_ERROR_FAILURE;
@@ -7651,35 +7591,35 @@ nsEventReceiverSH::NewResolve(nsIXPConne
   }
 
   return nsDOMGenericSH::NewResolve(wrapper, cx, obj, id, flags, objp,
                                     _retval);
 }
 
 NS_IMETHODIMP
 nsEventReceiverSH::SetProperty(nsIXPConnectWrappedNative *wrapper,
-                               JSContext *cx, JSObject *obj, jsval id,
+                               JSContext *cx, JSObject *obj, jsid id,
                                jsval *vp, PRBool *_retval)
 {
   JSAutoRequest ar(cx);
 
   if ((::JS_TypeOfValue(cx, *vp) != JSTYPE_FUNCTION && !JSVAL_IS_NULL(*vp)) ||
-      !JSVAL_IS_STRING(id) || id == sAddEventListener_id) {
+      !JSID_IS_STRING(id) || id == sAddEventListener_id) {
     return NS_OK;
   }
 
   PRBool did_compile; // Ignored here.
 
   return RegisterCompileHandler(wrapper, cx, obj, id, PR_FALSE,
                                 JSVAL_IS_NULL(*vp), &did_compile);
 }
 
 NS_IMETHODIMP
 nsEventReceiverSH::AddProperty(nsIXPConnectWrappedNative *wrapper,
-                               JSContext *cx, JSObject *obj, jsval id,
+                               JSContext *cx, JSObject *obj, jsid id,
                                jsval *vp, PRBool *_retval)
 {
   return nsEventReceiverSH::SetProperty(wrapper, cx, obj, id, vp, _retval);
 }
 
 // EventTarget helper
 
 NS_IMETHODIMP
@@ -7693,17 +7633,17 @@ nsEventTargetSH::PreCreate(nsISupports *
 
   *parentObj = native_parent ? native_parent->GetGlobalJSObject() : globalObj;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsEventTargetSH::AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                             JSObject *obj, jsval id, jsval *vp, PRBool *_retval)
+                             JSObject *obj, jsid id, jsval *vp, PRBool *_retval)
 {
   if (id == sAddEventListener_id) {
     return NS_OK;
   }
 
   nsEventTargetSH::PreserveWrapper(GetNative(wrapper, obj));
 
   return NS_OK;
@@ -7905,17 +7845,17 @@ nsElementSH::Enumerate(nsIXPConnectWrapp
   return NS_OK;
 }
   
 
 // Generic array scriptable helper.
 
 NS_IMETHODIMP
 nsGenericArraySH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                             JSObject *obj, jsval id, PRUint32 flags,
+                             JSObject *obj, jsid id, PRUint32 flags,
                              JSObject **objp, PRBool *_retval)
 {
   if (id == sLength_id) {
     // Bail early; this isn't something we're interested in
     return NS_OK;
   }
   
   PRBool is_number = PR_FALSE;
@@ -8002,17 +7942,17 @@ nsGenericArraySH::Enumerate(nsIXPConnect
 
   return ok ? NS_OK : NS_ERROR_UNEXPECTED;
 }
 
 // Array scriptable helper
 
 NS_IMETHODIMP
 nsArraySH::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                       JSObject *obj, jsval id, jsval *vp, PRBool *_retval)
+                       JSObject *obj, jsid id, jsval *vp, PRBool *_retval)
 {
   PRBool is_number = PR_FALSE;
   PRInt32 n = GetArrayIndexFromId(cx, id, &is_number);
 
   nsresult rv = NS_OK;
 
   if (is_number) {
     if (n < 0) {
@@ -8128,20 +8068,20 @@ nsDOMTokenListSH::GetStringAt(nsISupport
   return list->Item(aIndex, aResult);
 }
 
 
 // Named Array helper
 
 NS_IMETHODIMP
 nsNamedArraySH::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                            JSObject *obj, jsval id, jsval *vp,
+                            JSObject *obj, jsid id, jsval *vp,
                             PRBool *_retval)
 {
-  if (JSVAL_IS_STRING(id) && !ObjectIsNativeWrapper(cx, obj)) {
+  if (JSID_IS_STRING(id) && !ObjectIsNativeWrapper(cx, obj)) {
     nsresult rv = NS_OK;
     nsISupports* item = GetNamedItem(GetNative(wrapper, obj),
                                      nsDependentJSString(id),
                                      &rv);
     NS_ENSURE_SUCCESS(rv, rv);
 
     if (item) {
       rv = WrapNative(cx, obj, item, PR_TRUE, vp);
@@ -8286,17 +8226,17 @@ nsContentListSH::GetNamedItem(nsISupport
 {
   nsContentList *list = nsContentList::FromSupports(aNative);
 
   return list->GetNamedItem(aName, aResult);
 }
 
 NS_IMETHODIMP
 nsDocumentSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsval id, PRUint32 flags,
+                         JSObject *obj, jsid id, PRUint32 flags,
                          JSObject **objp, PRBool *_retval)
 {
   nsresult rv;
 
   if (id == sLocation_id) {
     // Define the location property on the document object itself so
     // that we can intercept getting and setting of document.location.
 
@@ -8311,22 +8251,18 @@ nsDocumentSH::NewResolve(nsIXPConnectWra
 
     nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
     rv = WrapNative(cx, obj, location, &NS_GET_IID(nsIDOMLocation), PR_TRUE,
                     &v, getter_AddRefs(holder));
     NS_ENSURE_SUCCESS(rv, rv);
 
     JSAutoRequest ar(cx);
 
-    JSString *str = JSVAL_TO_STRING(id);
-    JSBool ok = ::JS_DefineUCProperty(cx, obj, ::JS_GetStringChars(str),
-                                      ::JS_GetStringLength(str), v, nsnull,
-                                      nsnull,
-                                      JSPROP_PERMANENT |
-                                      JSPROP_ENUMERATE);
+    JSBool ok = ::JS_DefinePropertyById(cx, obj, id, v, nsnull, nsnull,
+                                        JSPROP_PERMANENT | JSPROP_ENUMERATE);
 
     if (!ok) {
       return NS_ERROR_FAILURE;
     }
 
     *objp = obj;
 
     return NS_OK;
@@ -8336,17 +8272,17 @@ nsDocumentSH::NewResolve(nsIXPConnectWra
     return DefineVoidProp(cx, obj, id, objp);
   } 
 
   return nsNodeSH::NewResolve(wrapper, cx, obj, id, flags, objp, _retval);
 }
 
 NS_IMETHODIMP
 nsDocumentSH::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                          JSObject *obj, jsval id, jsval *vp, PRBool *_retval)
+                          JSObject *obj, jsid id, jsval *vp, PRBool *_retval)
 {
   if (id == sDocumentURIObject_id && IsPrivilegedScript()) {
     nsCOMPtr<nsIDocument> doc = do_QueryWrappedNative(wrapper);
     NS_ENSURE_TRUE(doc, NS_ERROR_UNEXPECTED);
 
     nsIURI* uri = doc->GetDocumentURI();
     NS_ENSURE_TRUE(uri, NS_ERROR_NOT_AVAILABLE);
 
@@ -8357,17 +8293,17 @@ nsDocumentSH::GetProperty(nsIXPConnectWr
     return NS_FAILED(rv) ? rv : NS_SUCCESS_I_DID_SOMETHING;
   }
 
   return nsNodeSH::GetProperty(wrapper, cx, obj, id, vp, _retval);
 }
 
 NS_IMETHODIMP
 nsDocumentSH::SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                          JSObject *obj, jsval id, jsval *vp, PRBool *_retval)
+                          JSObject *obj, jsid id, jsval *vp, PRBool *_retval)
 {
   if (id == sLocation_id) {
     nsCOMPtr<nsIDOMNSDocument> doc(do_QueryWrappedNative(wrapper));
     NS_ENSURE_TRUE(doc, NS_ERROR_UNEXPECTED);
 
     nsCOMPtr<nsIDOMLocation> location;
 
     nsresult rv = doc->GetLocation(getter_AddRefs(location));
@@ -8452,27 +8388,27 @@ nsDocumentSH::PostCreate(nsIXPConnectWra
   return NS_OK;
 }
 
 // HTMLDocument helper
 
 // static
 nsresult
 nsHTMLDocumentSH::ResolveImpl(JSContext *cx,
-                              nsIXPConnectWrappedNative *wrapper, jsval id,
+                              nsIXPConnectWrappedNative *wrapper, jsid id,
                               nsISupports **result)
 {
   nsHTMLDocument *doc =
     static_cast<nsHTMLDocument*>(static_cast<nsINode*>
                                  (wrapper->Native()));
 
   // 'id' is not always a string, it can be a number since document.1
   // should map to <input name="1">. Thus we can't use
   // JSVAL_TO_STRING() here.
-  JSString *str = JS_ValueToString(cx, id);
+  JSString *str = IdToString(cx, id);
   NS_ENSURE_TRUE(str, NS_ERROR_UNEXPECTED);
 
   return doc->ResolveName(nsDependentJSString(str), nsnull, result);
 }
 
 // static
 JSBool
 nsHTMLDocumentSH::DocumentOpen(JSContext *cx, JSObject *obj, uintN argc,
@@ -8627,17 +8563,17 @@ nsHTMLDocumentSH::GetDocumentAllNodeList
     return JS_FALSE;
   }
 
   return *nodeList != nsnull;
 }
 
 JSBool
 nsHTMLDocumentSH::DocumentAllGetProperty(JSContext *cx, JSObject *obj,
-                                         jsval id, jsval *vp)
+                                         jsid id, jsval *vp)
 {
   // document.all.item and .namedItem get their value in the
   // newResolve hook, so nothing to do for those properties here. And
   // we need to return early to prevent <div id="item"> from shadowing
   // document.all.item(), etc.
   if (id == sItem_id || id == sNamedItem_id) {
     return JS_TRUE;
   }
@@ -8652,17 +8588,17 @@ nsHTMLDocumentSH::DocumentAllGetProperty
     }
   }
 
   nsIHTMLDocument *doc = (nsIHTMLDocument *)::JS_GetPrivate(cx, obj);
   nsCOMPtr<nsIDOMHTMLDocument> domdoc(do_QueryInterface(doc));
   nsCOMPtr<nsISupports> result;
   nsresult rv = NS_OK;
 
-  if (JSVAL_IS_STRING(id)) {
+  if (JSID_IS_STRING(id)) {
     if (id == sLength_id) {
       // Map document.all.length to the length of the collection
       // document.getElementsByTagName("*"), and make sure <div
       // id="length"> doesn't shadow document.all.length.
 
       nsCOMPtr<nsIDOMNodeList> nodeList;
       if (!GetDocumentAllNodeList(cx, obj, domdoc, getter_AddRefs(nodeList))) {
         return JS_FALSE;
@@ -8688,27 +8624,27 @@ nsHTMLDocumentSH::DocumentAllGetProperty
       rv = doc->GetDocumentAllResult(str, getter_AddRefs(result));
 
       if (NS_FAILED(rv)) {
         nsDOMClassInfo::ThrowJSException(cx, rv);
 
         return JS_FALSE;
       }
     }
-  } else if (JSVAL_IS_INT(id) && JSVAL_TO_INT(id) >= 0) {
+  } else if (JSID_IS_INT(id) && JSID_TO_INT(id) >= 0) {
     // Map document.all[n] (where n is a number) to the n:th item in
     // the document.all node list.
 
     nsCOMPtr<nsIDOMNodeList> nodeList;
     if (!GetDocumentAllNodeList(cx, obj, domdoc, getter_AddRefs(nodeList))) {
       return JS_FALSE;
     }
 
     nsCOMPtr<nsIDOMNode> node;
-    nodeList->Item(JSVAL_TO_INT(id), getter_AddRefs(node));
+    nodeList->Item(JSID_TO_INT(id), getter_AddRefs(node));
 
     result = node;
   }
 
   if (result) {
     rv = WrapNative(cx, obj, result, PR_TRUE, vp);
     if (NS_FAILED(rv)) {
       nsDOMClassInfo::ThrowJSException(cx, rv);
@@ -8718,32 +8654,32 @@ nsHTMLDocumentSH::DocumentAllGetProperty
   } else {
     *vp = JSVAL_VOID;
   }
 
   return JS_TRUE;
 }
 
 JSBool
-nsHTMLDocumentSH::DocumentAllNewResolve(JSContext *cx, JSObject *obj, jsval id,
+nsHTMLDocumentSH::DocumentAllNewResolve(JSContext *cx, JSObject *obj, jsid id,
                                         uintN flags, JSObject **objp)
 {
   if (flags & JSRESOLVE_ASSIGNING) {
     // Nothing to do here if we're assigning
 
     return JS_TRUE;
   }
 
   jsval v = JSVAL_VOID;
 
   if (id == sItem_id || id == sNamedItem_id) {
     // Define the item() or namedItem() method.
 
     JSFunction *fnc =
-      ::JS_DefineFunction(cx, obj, ::JS_GetStringBytes(JSVAL_TO_STRING(id)),
+      ::JS_DefineFunction(cx, obj, ::JS_GetStringBytes(JSID_TO_STRING(id)),
                           CallToGetPropMapper, 0, JSPROP_ENUMERATE);
 
     *objp = obj;
 
     return fnc != nsnull;
   }
 
   if (id == sLength_id) {
@@ -8774,24 +8710,20 @@ nsHTMLDocumentSH::DocumentAllNewResolve(
     if (!DocumentAllGetProperty(cx, obj, id, &v)) {
       return JS_FALSE;
     }
   }
 
   JSBool ok = JS_TRUE;
 
   if (v != JSVAL_VOID) {
-    if (JSVAL_IS_STRING(id)) {
-      JSString *str = JSVAL_TO_STRING(id);
-
-      ok = ::JS_DefineUCProperty(cx, obj, ::JS_GetStringChars(str),
-                                 ::JS_GetStringLength(str), v, nsnull, nsnull,
-                                 0);
+    if (JSID_IS_STRING(id)) {
+      ok = ::JS_DefinePropertyById(cx, obj, id, v, nsnull, nsnull, 0);
     } else {
-      ok = ::JS_DefineElement(cx, obj, JSVAL_TO_INT(id), v, nsnull, nsnull, 0);
+      ok = ::JS_DefineElement(cx, obj, JSID_TO_INT(id), v, nsnull, nsnull, 0);
     }
 
     *objp = obj;
   }
 
   return ok;
 }
 
@@ -8868,17 +8800,17 @@ static inline PRUint32
 PrivateToFlags(void *priv)
 {
   JS_ASSERT(size_t(priv) <= PR_UINT32_MAX && (size_t(priv) & 1) == 0);
   return (PRUint32)(size_t(priv) >> 1);
 }
 
 JSBool
 nsHTMLDocumentSH::DocumentAllHelperGetProperty(JSContext *cx, JSObject *obj,
-                                               jsval id, jsval *vp)
+                                               jsid id, jsval *vp)
 {
   if (id != nsDOMClassInfo::sAll_id) {
     return JS_TRUE;
   }
 
   JSObject *helper = GetDocumentAllHelper(cx, obj);
 
   if (!helper) {
@@ -8929,17 +8861,17 @@ nsHTMLDocumentSH::DocumentAllHelperGetPr
     }
   }
 
   return JS_TRUE;
 }
 
 JSBool
 nsHTMLDocumentSH::DocumentAllHelperNewResolve(JSContext *cx, JSObject *obj,
-                                              jsval id, uintN flags,
+                                              jsid id, uintN flags,
                                               JSObject **objp)
 {
   if (id == nsDOMClassInfo::sAll_id) {
     // document.all is resolved for the first time. Define it.
     JSObject *helper = GetDocumentAllHelper(cx, obj);
 
     if (helper) {
       if (!::JS_DefineProperty(cx, helper, "all", JSVAL_VOID, nsnull, nsnull,
@@ -8952,33 +8884,31 @@ nsHTMLDocumentSH::DocumentAllHelperNewRe
   }
 
   return JS_TRUE;
 }
 
 
 JSBool
 nsHTMLDocumentSH::DocumentAllTagsNewResolve(JSContext *cx, JSObject *obj,
-                                            jsval id, uintN flags,
+                                            jsid id, uintN flags,
                                             JSObject **objp)
 {
-  if (JSVAL_IS_STRING(id)) {
+  if (JSID_IS_STRING(id)) {
     nsIHTMLDocument *doc = (nsIHTMLDocument *)::JS_GetPrivate(cx, obj);
 
-    JSString *str = JSVAL_TO_STRING(id);
+    JSString *str = JSID_TO_STRING(id);
 
     JSObject *proto = ::JS_GetPrototype(cx, obj);
     if (NS_UNLIKELY(!proto)) {
       return JS_TRUE;
     }
 
     JSBool found;
-    if (!::JS_HasUCProperty(cx, proto,
-                            ::JS_GetStringChars(str),
-                            ::JS_GetStringLength(str), &found)) {
+    if (!::JS_HasPropertyById(cx, proto, id, &found)) {
       return JS_FALSE;
     }
 
     if (found) {
       return JS_TRUE;
     }
 
     nsCOMPtr<nsIDOMDocument> domdoc(do_QueryInterface(doc));
@@ -8993,33 +8923,31 @@ nsHTMLDocumentSH::DocumentAllTagsNewReso
       nsresult rv = nsDOMClassInfo::WrapNative(cx, obj, tags, PR_TRUE, &v,
                                                getter_AddRefs(holder));
       if (NS_FAILED(rv)) {
         nsDOMClassInfo::ThrowJSException(cx, rv);
 
         return JS_FALSE;
       }
 
-      if (!::JS_DefineUCProperty(cx, obj, ::JS_GetStringChars(str),
-                                 ::JS_GetStringLength(str), v, nsnull, nsnull,
-                                 0)) {
+      if (!::JS_DefinePropertyById(cx, obj, id, v, nsnull, nsnull, 0)) {
         return JS_FALSE;
       }
 
       *objp = obj;
     }
   }
 
   return JS_TRUE;
 }
 
 
 NS_IMETHODIMP
 nsHTMLDocumentSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                             JSObject *obj, jsval id, PRUint32 flags,
+                             JSObject *obj, jsid id, PRUint32 flags,
                              JSObject **objp, PRBool *_retval)
 {
   // nsDocumentSH::NewResolve() does a security check that we'd kinda
   // want to do here too before doing anything else. But given that we
   // only define dynamic properties here before the call to
   // nsDocumentSH::NewResolve() we're ok, since once those properties
   // are accessed, we'll do the necessary security check.
 
@@ -9030,30 +8958,26 @@ nsHTMLDocumentSH::NewResolve(nsIXPConnec
 
     if (!ObjectIsNativeWrapper(cx, obj)) {
       nsCOMPtr<nsISupports> result;
 
       nsresult rv = ResolveImpl(cx, wrapper, id, getter_AddRefs(result));
       NS_ENSURE_SUCCESS(rv, rv);
 
       if (result) {
-        JSString *str = JS_ValueToString(cx, id);
-
         JSBool ok = *_retval =
-          ::JS_DefineUCProperty(cx, obj, ::JS_GetStringChars(str),
-                                ::JS_GetStringLength(str), JSVAL_VOID, nsnull,
-                                nsnull, 0);
+          ::JS_DefinePropertyById(cx, obj, id, JSVAL_VOID, nsnull, nsnull, 0);
         *objp = obj;
 
         return ok ? NS_OK : NS_ERROR_FAILURE;
       }
     }
 
     if (id == sOpen_id) {
-      JSString *str = JSVAL_TO_STRING(id);
+      JSString *str = JSID_TO_STRING(id);
       JSFunction *fnc =
         ::JS_DefineFunction(cx, obj, ::JS_GetStringBytes(str),
                             DocumentOpen, 0, JSPROP_ENUMERATE);
 
       *objp = obj;
 
       return fnc ? NS_OK : NS_ERROR_UNEXPECTED;
     }
@@ -9130,17 +9054,17 @@ nsHTMLDocumentSH::NewResolve(nsIXPConnec
     }
   }
 
   return nsDocumentSH::NewResolve(wrapper, cx, obj, id, flags, objp, _retval);
 }
 
 NS_IMETHODIMP
 nsHTMLDocumentSH::GetProperty(nsIXPConnectWrappedNative *wrapper,
-                              JSContext *cx, JSObject *obj, jsval id,
+                              JSContext *cx, JSObject *obj, jsid id,
                               jsval *vp, PRBool *_retval)
 {
   // For native wrappers, do not get random names on document
   if (!ObjectIsNativeWrapper(cx, obj)) {
     nsCOMPtr<nsISupports> result;
 
     JSAutoRequest ar(cx);
 
@@ -9182,58 +9106,57 @@ nsHTMLFormElementSH::FindNamedItem(nsIFo
     }
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHTMLFormElementSH::NewResolve(nsIXPConnectWrappedNative *wrapper,
-                                JSContext *cx, JSObject *obj, jsval id,
+                                JSContext *cx, JSObject *obj, jsid id,
                                 PRUint32 flags, JSObject **objp,
                                 PRBool *_retval)
 {
   // For native wrappers, do not resolve random names on form
-  if ((!(JSRESOLVE_ASSIGNING & flags)) && JSVAL_IS_STRING(id) &&
+  if ((!(JSRESOLVE_ASSIGNING & flags)) && JSID_IS_STRING(id) &&
       !ObjectIsNativeWrapper(cx, obj)) {
     nsCOMPtr<nsIForm> form(do_QueryWrappedNative(wrapper, obj));
     nsCOMPtr<nsISupports> result;
 
-    JSString *str = JSVAL_TO_STRING(id);
+    JSString *str = JSID_TO_STRING(id);
     FindNamedItem(form, str, getter_AddRefs(result));
 
     if (result) {
       JSAutoRequest ar(cx);
-      *_retval = ::JS_DefineUCProperty(cx, obj, ::JS_GetStringChars(str),
-                                       ::JS_GetStringLength(str),
-                                       JSVAL_VOID, nsnull, nsnull, 0);
+      *_retval = ::JS_DefinePropertyById(cx, obj, id, JSVAL_VOID, nsnull,
+                                         nsnull, 0);
 
       *objp = obj;
 
       return *_retval ? NS_OK : NS_ERROR_FAILURE;
     }
   }
 
   return nsElementSH::NewResolve(wrapper, cx, obj, id, flags, objp, _retval);
 }
 
 
 NS_IMETHODIMP
 nsHTMLFormElementSH::GetProperty(nsIXPConnectWrappedNative *wrapper,
-                                 JSContext *cx, JSObject *obj, jsval id,
+                                 JSContext *cx, JSObject *obj, jsid id,
                                  jsval *vp, PRBool *_retval)
 {
   nsCOMPtr<nsIForm> form(do_QueryWrappedNative(wrapper, obj));
 
-  if (JSVAL_IS_STRING(id)) {
+  if (JSID_IS_STRING(id)) {
     // For native wrappers, do not get random names on form
     if (!ObjectIsNativeWrapper(cx, obj)) {
       nsCOMPtr<nsISupports> result;
 
-      JSString *str = JSVAL_TO_STRING(id);
+      JSString *str = JSID_TO_STRING(id);
       FindNamedItem(form, str, getter_AddRefs(result));
 
       if (result) {
         // Wrap result, result can be either an element or a list of
         // elements
         nsresult rv = WrapNative(cx, obj, result, PR_TRUE, vp);
         return NS_FAILED(rv) ? rv : NS_SUCCESS_I_DID_SOMETHING;
       }
@@ -9270,17 +9193,17 @@ nsHTMLFormElementSH::NewEnumerate(nsIXPC
         return NS_ERROR_UNEXPECTED;
       }
 
       *statep = INT_TO_JSVAL(0);
 
       if (idp) {
         PRUint32 count = form->GetElementCount();
 
-        *idp = INT_TO_JSVAL(count);
+        *idp = INT_TO_JSID(count);
       }
 
       break;
     }
   case JSENUMERATE_NEXT:
     {
       nsCOMPtr<nsIForm> form(do_QueryWrappedNative(wrapper, obj));
       NS_ENSURE_TRUE(form, NS_ERROR_FAILURE);
@@ -9329,17 +9252,17 @@ nsHTMLFormElementSH::NewEnumerate(nsIXPC
   return NS_OK;
 }
 
 
 // HTMLSelectElement helper
 
 NS_IMETHODIMP
 nsHTMLSelectElementSH::GetProperty(nsIXPConnectWrappedNative *wrapper,
-                                   JSContext *cx, JSObject *obj, jsval id,
+                                   JSContext *cx, JSObject *obj, jsid id,
                                    jsval *vp, PRBool *_retval)
 {
   PRInt32 n = GetArrayIndexFromId(cx, id);
 
   nsresult rv = NS_OK;
   if (n >= 0) {
     nsCOMPtr<nsIDOMHTMLSelectElement> s = do_QueryWrappedNative(wrapper, obj);
 
@@ -9385,17 +9308,17 @@ nsHTMLSelectElementSH::SetOption(JSConte
     }
   }
 
   return aOptCollection->SetOption(aIndex, new_option);
 }
 
 NS_IMETHODIMP
 nsHTMLSelectElementSH::SetProperty(nsIXPConnectWrappedNative *wrapper,
-                                   JSContext *cx, JSObject *obj, jsval id,
+                                   JSContext *cx, JSObject *obj, jsid id,
                                    jsval *vp, PRBool *_retval)
 {
   PRInt32 n = GetArrayIndexFromId(cx, id);
 
   if (n >= 0) {
     nsCOMPtr<nsIDOMHTMLSelectElement> select =
       do_QueryWrappedNative(wrapper, obj);
     NS_ENSURE_TRUE(select, NS_ERROR_UNEXPECTED);
@@ -9649,100 +9572,84 @@ nsHTMLPluginObjElementSH::PostCreate(nsI
     new nsPluginProtoChainInstallRunner(wrapper, scriptContext);
   nsContentUtils::AddScriptRunner(runner);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHTMLPluginObjElementSH::GetProperty(nsIXPConnectWrappedNative *wrapper,
-                                      JSContext *cx, JSObject *obj, jsval id,
+                                      JSContext *cx, JSObject *obj, jsid id,
                                       jsval *vp, PRBool *_retval)
 {
   JSAutoRequest ar(cx);
 
   JSObject *pi_obj = ::JS_GetPrototype(cx, obj);
   if (NS_UNLIKELY(!pi_obj)) {
     return NS_OK;
   }
 
-  const jschar *id_chars = nsnull;
-  size_t id_length = 0;
-
   JSBool found = PR_FALSE;
 
   if (!ObjectIsNativeWrapper(cx, obj)) {
-    if (JSVAL_IS_STRING(id)) {
-      JSString *id_str = JSVAL_TO_STRING(id);
-
-      id_chars = ::JS_GetStringChars(id_str);
-      id_length = ::JS_GetStringLength(id_str);
-
-      *_retval = ::JS_HasUCProperty(cx, pi_obj, id_chars, id_length, &found);
+    if (JSID_IS_STRING(id)) {
+      *_retval = ::JS_HasPropertyById(cx, pi_obj, id, &found);
     } else {
-      *_retval = JS_HasElement(cx, pi_obj, JSVAL_TO_INT(id), &found);
+      *_retval = ::JS_HasElement(cx, pi_obj, JSID_TO_INT(id), &found);
     }
 
     if (!*_retval) {
       return NS_ERROR_UNEXPECTED;
     }
   }
 
   if (found) {
-    if (JSVAL_IS_STRING(id)) {
-      *_retval = ::JS_GetUCProperty(cx, pi_obj, id_chars, id_length, vp);
+    if (JSID_IS_STRING(id)) {
+      *_retval = ::JS_GetPropertyById(cx, pi_obj, id, vp);
     } else {
-      *_retval = ::JS_GetElement(cx, pi_obj, JSVAL_TO_INT(id), vp);
+      *_retval = ::JS_GetElement(cx, pi_obj, JSID_TO_INT(id), vp);
     }
 
     return *_retval ? NS_SUCCESS_I_DID_SOMETHING : NS_ERROR_FAILURE;
   }
 
   return nsElementSH::GetProperty(wrapper, cx, obj, id, vp, _retval);
 }
 
 NS_IMETHODIMP
 nsHTMLPluginObjElementSH::SetProperty(nsIXPConnectWrappedNative *wrapper,
-                                      JSContext *cx, JSObject *obj, jsval id,
+                                      JSContext *cx, JSObject *obj, jsid id,
                                       jsval *vp, PRBool *_retval)
 {
   JSAutoRequest ar(cx);
 
   JSObject *pi_obj = ::JS_GetPrototype(cx, obj);
   if (NS_UNLIKELY(!pi_obj)) {
     return NS_OK;
   }
 
-  const jschar *id_chars = nsnull;
-  size_t id_length = 0;
-
   JSBool found = PR_FALSE;
 
   if (!ObjectIsNativeWrapper(cx, obj)) {
-    if (JSVAL_IS_STRING(id)) {
-      JSString *id_str = JSVAL_TO_STRING(id);
-
-      id_chars = ::JS_GetStringChars(id_str);
-      id_length = ::JS_GetStringLength(id_str);
-
-      *_retval = ::JS_HasUCProperty(cx, pi_obj, id_chars, id_length, &found);
+    if (JSID_IS_STRING(id)) {
+      *_retval = ::JS_HasPropertyById(cx, pi_obj, id, &found);
     } else {
-      *_retval = JS_HasElement(cx, pi_obj, JSVAL_TO_INT(id), &found);
+      *_retval = ::JS_HasElement(cx, pi_obj, JSID_TO_INT(id), &found);
     }
 
     if (!*_retval) {
       return NS_ERROR_UNEXPECTED;
     }
   }
 
   if (found) {
-    if (JSVAL_IS_STRING(id)) {
-      *_retval = ::JS_SetUCProperty(cx, pi_obj, id_chars, id_length, vp);
+    if (JSID_IS_STRING(id)) {
+      *_retval = ::JS_SetPropertyById(cx, pi_obj, id, vp);
     } else {
-      *_retval = ::JS_SetElement(cx, pi_obj, JSVAL_TO_INT(id), vp);
+      *_retval = ::JS_SetElement(cx, pi_obj, JSID_TO_INT(id), vp);
     }
 
     return *_retval ? NS_SUCCESS_I_DID_SOMETHING : NS_ERROR_FAILURE;
   }
 
   return nsElementSH::SetProperty(wrapper, cx, obj, id, vp, _retval);
 }
 
@@ -9800,17 +9707,17 @@ nsHTMLPluginObjElementSH::GetPluginJSObj
     }
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHTMLPluginObjElementSH::NewResolve(nsIXPConnectWrappedNative *wrapper,
-                                     JSContext *cx, JSObject *obj, jsval id,
+                                     JSContext *cx, JSObject *obj, jsid id,
                                      PRUint32 flags, JSObject **objp,
                                      PRBool *_retval)
 {
   // Make sure the plugin instance is loaded and instantiated, if
   // possible.
 
   nsCOMPtr<nsIPluginInstance> pi;
   nsresult rv = GetPluginInstanceIfSafe(wrapper, obj, getter_AddRefs(pi));
@@ -9819,17 +9726,17 @@ nsHTMLPluginObjElementSH::NewResolve(nsI
   return nsElementSH::NewResolve(wrapper, cx, obj, id, flags, objp,
                                  _retval);
 }
  
 // HTMLOptionsCollection helper
 
 NS_IMETHODIMP
 nsHTMLOptionsCollectionSH::SetProperty(nsIXPConnectWrappedNative *wrapper,
-                                       JSContext *cx, JSObject *obj, jsval id,
+                                       JSContext *cx, JSObject *obj, jsid id,
                                        jsval *vp, PRBool *_retval)
 {
   PRInt32 n = GetArrayIndexFromId(cx, id);
 
   if (n < 0) {
     return NS_OK;
   }
 
@@ -9907,17 +9814,17 @@ nsMimeTypeArraySH::GetNamedItem(nsISuppo
   return array->GetNamedItem(aName, aResult);
 }
 
 
 // StringArray helper
 
 NS_IMETHODIMP
 nsStringArraySH::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                             JSObject *obj, jsval id, jsval *vp,
+                             JSObject *obj, jsid id, jsval *vp,
                              PRBool *_retval)
 {
   PRBool is_number = PR_FALSE;
   PRInt32 n = GetArrayIndexFromId(cx, id, &is_number);
 
   if (!is_number) {
     return NS_OK;
   }
@@ -9941,17 +9848,17 @@ nsStringArraySH::GetProperty(nsIXPConnec
   return NS_SUCCESS_I_DID_SOMETHING;
 }
 
 
 // History helper
 
 NS_IMETHODIMP
 nsHistorySH::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsval id, jsval *vp, PRBool *_retval)
+                         JSObject *obj, jsid id, jsval *vp, PRBool *_retval)
 {
   PRBool is_number = PR_FALSE;
   GetArrayIndexFromId(cx, id, &is_number);
 
   if (!is_number) {
     return NS_OK;
   }
 
@@ -10135,59 +10042,54 @@ nsTreeColumnsSH::GetNamedItem(nsISupport
 
 // One reason we need a newResolve hook is that in order for
 // enumeration of storage object keys to work the keys we're
 // enumerating need to exist on the storage object for the JS engine
 // to find them.
 
 NS_IMETHODIMP
 nsStorageSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                        JSObject *obj, jsval id, PRUint32 flags,
+                        JSObject *obj, jsid id, PRUint32 flags,
                         JSObject **objp, PRBool *_retval)
 {
   JSObject *realObj;
   wrapper->GetJSObject(&realObj);
 
-  // First check to see if the property is defined on our prototype,
-  // after converting id to a string if it's an integer.
-
-  JSString *jsstr = JS_ValueToString(cx, id);
-  if (!jsstr) {
-    return JS_FALSE;
-  }
+  // First check to see if the property is defined on our prototype.
 
   JSObject *proto = ::JS_GetPrototype(cx, realObj);
   JSBool hasProp;
 
   if (proto &&
-      (::JS_HasUCProperty(cx, proto, ::JS_GetStringChars(jsstr),
-                          ::JS_GetStringLength(jsstr), &hasProp) &&
+      (::JS_HasPropertyById(cx, proto, id, &hasProp) &&
        hasProp)) {
     // We found the property we're resolving on the prototype,
     // nothing left to do here then.
 
     return NS_OK;
   }
 
   // We're resolving property that doesn't exist on the prototype,
   // check if the key exists in the storage object.
 
   nsCOMPtr<nsIDOMStorageObsolete> storage(do_QueryWrappedNative(wrapper));
 
+  JSString *jsstr = IdToString(cx, id);
+  if (!jsstr)
+    return JS_FALSE;
+
   // GetItem() will return null if the caller can't access the session
   // storage item.
   nsCOMPtr<nsIDOMStorageItem> item;
   nsresult rv = storage->GetItem(nsDependentJSString(jsstr),
                                  getter_AddRefs(item));
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (item) {
-    if (!::JS_DefineUCProperty(cx, realObj, ::JS_GetStringChars(jsstr),
-                               ::JS_GetStringLength(jsstr), JSVAL_VOID, nsnull,
-                               nsnull, 0)) {
+    if (!::JS_DefinePropertyById(cx, realObj, id, JSVAL_VOID, nsnull, nsnull, 0)) {
       return NS_ERROR_FAILURE;
     }
 
     *objp = realObj;
   }
 
   return NS_OK;
 }
@@ -10198,46 +10100,46 @@ nsStorageSH::GetNamedItem(nsISupports *a
 {
   nsDOMStorage* storage = nsDOMStorage::FromSupports(aNative);
 
   return storage->GetNamedItem(aName, aResult);
 }
 
 NS_IMETHODIMP
 nsStorageSH::SetProperty(nsIXPConnectWrappedNative *wrapper,
-                         JSContext *cx, JSObject *obj, jsval id,
+                         JSContext *cx, JSObject *obj, jsid id,
                          jsval *vp, PRBool *_retval)
 {
   nsCOMPtr<nsIDOMStorageObsolete> storage(do_QueryWrappedNative(wrapper));
   NS_ENSURE_TRUE(storage, NS_ERROR_UNEXPECTED);
 
-  JSString *key = ::JS_ValueToString(cx, id);
+  JSString *key = IdToString(cx, id);
   NS_ENSURE_TRUE(key, NS_ERROR_UNEXPECTED);
 
   JSString *value = ::JS_ValueToString(cx, *vp);
   NS_ENSURE_TRUE(value, NS_ERROR_UNEXPECTED);
 
   nsresult rv = storage->SetItem(nsDependentJSString(key),
                                  nsDependentJSString(value));
   if (NS_SUCCEEDED(rv)) {
     rv = NS_SUCCESS_I_DID_SOMETHING;
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
 nsStorageSH::DelProperty(nsIXPConnectWrappedNative *wrapper,
-                         JSContext *cx, JSObject *obj, jsval id,
+                         JSContext *cx, JSObject *obj, jsid id,
                          jsval *vp, PRBool *_retval)
 {
   nsCOMPtr<nsIDOMStorageObsolete> storage(do_QueryWrappedNative(wrapper));
   NS_ENSURE_TRUE(storage, NS_ERROR_UNEXPECTED);
 
-  JSString *key = ::JS_ValueToString(cx, id);
+  JSString *key = IdToString(cx, id);
   NS_ENSURE_TRUE(key, NS_ERROR_UNEXPECTED);
 
   nsresult rv = storage->RemoveItem(nsDependentJSString(key));
   if (NS_SUCCEEDED(rv)) {
     rv = NS_SUCCESS_I_DID_SOMETHING;
   }
 
   return rv;
@@ -10259,17 +10161,17 @@ nsStorageSH::NewEnumerate(nsIXPConnectWr
 
       // XXXndeakin need to free the keys afterwards
       keys = storage->GetKeys();
       NS_ENSURE_TRUE(keys, NS_ERROR_OUT_OF_MEMORY);
 
       *statep = PRIVATE_TO_JSVAL(keys);
 
       if (idp) {
-        *idp = INT_TO_JSVAL(keys->Length());
+        *idp = INT_TO_JSID(keys->Length());
       }
       break;
     }
     case JSENUMERATE_NEXT:
       if (keys->Length() != 0) {
         nsString& key = keys->ElementAt(0);
         JSString *str =
           JS_NewUCStringCopyN(cx, reinterpret_cast<const jschar *>
@@ -10305,36 +10207,35 @@ nsStorageSH::NewEnumerate(nsIXPConnectWr
 
 // One reason we need a newResolve hook is that in order for
 // enumeration of storage object keys to work the keys we're
 // enumerating need to exist on the storage object for the JS engine
 // to find them.
 
 NS_IMETHODIMP
 nsStorage2SH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsval id, PRUint32 flags,
+                         JSObject *obj, jsid id, PRUint32 flags,
                          JSObject **objp, PRBool *_retval)
 {
   JSObject *realObj;
   wrapper->GetJSObject(&realObj);
 
   // First check to see if the property is defined on our prototype,
   // after converting id to a string if it's an integer.
 
-  JSString *jsstr = JS_ValueToString(cx, id);
+  JSString *jsstr = IdToString(cx, id);
   if (!jsstr) {
     return JS_FALSE;
   }
 
   JSObject *proto = ::JS_GetPrototype(cx, realObj);
   JSBool hasProp;
 
   if (proto &&
-      (::JS_HasUCProperty(cx, proto, ::JS_GetStringChars(jsstr),
-                          ::JS_GetStringLength(jsstr), &hasProp) &&
+      (::JS_HasPropertyById(cx, proto, id, &hasProp) &&
        hasProp)) {
     // We found the property we're resolving on the prototype,
     // nothing left to do here then.
 
     return NS_OK;
   }
 
   // We're resolving property that doesn't exist on the prototype,
@@ -10344,39 +10245,38 @@ nsStorage2SH::NewResolve(nsIXPConnectWra
 
   // GetItem() will return null if the caller can't access the session
   // storage item.
   nsAutoString data;
   nsresult rv = storage->GetItem(nsDependentJSString(jsstr), data);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (!DOMStringIsNull(data)) {
-    if (!::JS_DefineUCProperty(cx, realObj, ::JS_GetStringChars(jsstr),
-                               ::JS_GetStringLength(jsstr), JSVAL_VOID, nsnull,
-                               nsnull, 0)) {
+    if (!::JS_DefinePropertyById(cx, realObj, id, JSVAL_VOID, nsnull,
+                                 nsnull, 0)) {
       return NS_ERROR_FAILURE;
     }
 
     *objp = realObj;
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsStorage2SH::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                          JSObject *obj, jsval id, jsval *vp, PRBool *_retval)
+                          JSObject *obj, jsid id, jsval *vp, PRBool *_retval)
 {
   nsCOMPtr<nsIDOMStorage> storage(do_QueryWrappedNative(wrapper));
   NS_ENSURE_TRUE(storage, NS_ERROR_UNEXPECTED);
 
   nsAutoString val;
   nsresult rv = NS_OK;
 
-  if (JSVAL_IS_STRING(id)) {
+  if (JSID_IS_STRING(id)) {
     // For native wrappers, do not get random names on storage objects.
     if (ObjectIsNativeWrapper(cx, obj)) {
       return NS_ERROR_NOT_AVAILABLE;
     }
 
     rv = storage->GetItem(nsDependentJSString(id), val);
     NS_ENSURE_SUCCESS(rv, rv);
   } else {
@@ -10401,46 +10301,46 @@ nsStorage2SH::GetProperty(nsIXPConnectWr
       *vp = STRING_TO_JSVAL(str);
   }
 
   return NS_SUCCESS_I_DID_SOMETHING;
 }
 
 NS_IMETHODIMP
 nsStorage2SH::SetProperty(nsIXPConnectWrappedNative *wrapper,
-                          JSContext *cx, JSObject *obj, jsval id,
+                          JSContext *cx, JSObject *obj, jsid id,
                           jsval *vp, PRBool *_retval)
 {
   nsCOMPtr<nsIDOMStorage> storage(do_QueryWrappedNative(wrapper));
   NS_ENSURE_TRUE(storage, NS_ERROR_UNEXPECTED);
 
-  JSString *key = ::JS_ValueToString(cx, id);
+  JSString *key = IdToString(cx, id);
   NS_ENSURE_TRUE(key, NS_ERROR_UNEXPECTED);
 
   JSString *value = ::JS_ValueToString(cx, *vp);
   NS_ENSURE_TRUE(value, NS_ERROR_UNEXPECTED);
 
   nsresult rv = storage->SetItem(nsDependentJSString(key),
                                  nsDependentJSString(value));
   if (NS_SUCCEEDED(rv)) {
     rv = NS_SUCCESS_I_DID_SOMETHING;
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
 nsStorage2SH::DelProperty(nsIXPConnectWrappedNative *wrapper,
-                          JSContext *cx, JSObject *obj, jsval id,
+                          JSContext *cx, JSObject *obj, jsid id,
                           jsval *vp, PRBool *_retval)
 {
   nsCOMPtr<nsIDOMStorage> storage(do_QueryWrappedNative(wrapper));
   NS_ENSURE_TRUE(storage, NS_ERROR_UNEXPECTED);
 
-  JSString *key = ::JS_ValueToString(cx, id);
+  JSString *key = IdToString(cx, id);
   NS_ENSURE_TRUE(key, NS_ERROR_UNEXPECTED);
 
   nsresult rv = storage->RemoveItem(nsDependentJSString(key));
   if (NS_SUCCEEDED(rv)) {
     rv = NS_SUCCESS_I_DID_SOMETHING;
   }
 
   return rv;
@@ -10462,17 +10362,17 @@ nsStorage2SH::NewEnumerate(nsIXPConnectW
 
       // XXXndeakin need to free the keys afterwards
       keys = storage->GetKeys();
       NS_ENSURE_TRUE(keys, NS_ERROR_OUT_OF_MEMORY);
 
       *statep = PRIVATE_TO_JSVAL(keys);
 
       if (idp) {
-        *idp = INT_TO_JSVAL(keys->Length());
+        *idp = INT_TO_JSID(keys->Length());
       }
       break;
     }
     case JSENUMERATE_NEXT:
       if (keys->Length() != 0) {
         nsString& key = keys->ElementAt(0);
         JSString *str =
           JS_NewUCStringCopyN(cx, reinterpret_cast<const jschar *>
--- a/dom/base/nsDOMClassInfo.h
+++ b/dom/base/nsDOMClassInfo.h
@@ -224,20 +224,20 @@ protected:
   static nsresult RegisterClassProtos(PRInt32 aDOMClassInfoID);
   static nsresult RegisterExternalClasses();
   nsresult ResolveConstructor(JSContext *cx, JSObject *obj,
                               JSObject **objp);
 
   // Checks if id is a number and returns the number, if aIsNumber is
   // non-null it's set to true if the id is a number and false if it's
   // not a number. If id is not a number this method returns -1
-  static PRInt32 GetArrayIndexFromId(JSContext *cx, jsval id,
+  static PRInt32 GetArrayIndexFromId(JSContext *cx, jsid id,
                                      PRBool *aIsNumber = nsnull);
 
-  static inline PRBool IsReadonlyReplaceable(jsval id)
+  static inline PRBool IsReadonlyReplaceable(jsid id)
   {
     return (id == sTop_id          ||
             id == sParent_id       ||
             id == sScrollbars_id   ||
             id == sContent_id      ||
             id == sMenubar_id      ||
             id == sToolbar_id      ||
             id == sLocationbar_id  ||
@@ -248,17 +248,17 @@ protected:
             id == sScrollY_id      ||
             id == sScrollMaxX_id   ||
             id == sScrollMaxY_id   ||
             id == sLength_id       ||
             id == sFrames_id       ||
             id == sSelf_id);
   }
 
-  static inline PRBool IsWritableReplaceable(jsval id)
+  static inline PRBool IsWritableReplaceable(jsid id)
   {
     return (id == sInnerHeight_id  ||
             id == sInnerWidth_id   ||
             id == sOpener_id       ||
             id == sOuterHeight_id  ||
             id == sOuterWidth_id   ||
             id == sScreenX_id      ||
             id == sScreenY_id      ||
@@ -271,100 +271,100 @@ protected:
 
   // nsIXPCScriptable code
   static nsresult DefineStaticJSVals(JSContext *cx);
 
   static PRBool sIsInitialized;
   static PRBool sDisableDocumentAllSupport;
   static PRBool sDisableGlobalScopePollutionSupport;
 
-  static jsval sTop_id;
-  static jsval sParent_id;
-  static jsval sScrollbars_id;
-  static jsval sLocation_id;
-  static jsval sConstructor_id;
-  static jsval s_content_id;
-  static jsval sContent_id;
-  static jsval sMenubar_id;
-  static jsval sToolbar_id;
-  static jsval sLocationbar_id;
-  static jsval sPersonalbar_id;
-  static jsval sStatusbar_id;
-  static jsval sDialogArguments_id;
-  static jsval sControllers_id;
-  static jsval sLength_id;
-  static jsval sInnerHeight_id;
-  static jsval sInnerWidth_id;
-  static jsval sOuterHeight_id;
-  static jsval sOuterWidth_id;
-  static jsval sScreenX_id;
-  static jsval sScreenY_id;
-  static jsval sStatus_id;
-  static jsval sName_id;
-  static jsval sOnmousedown_id;
-  static jsval sOnmouseup_id;
-  static jsval sOnclick_id;
-  static jsval sOndblclick_id;
-  static jsval sOncontextmenu_id;
-  static jsval sOnmouseover_id;
-  static jsval sOnmouseout_id;
-  static jsval sOnkeydown_id;
-  static jsval sOnkeyup_id;
-  static jsval sOnkeypress_id;
-  static jsval sOnmousemove_id;
-  static jsval sOnfocus_id;
-  static jsval sOnblur_id;
-  static jsval sOnsubmit_id;
-  static jsval sOnreset_id;
-  static jsval sOnchange_id;
-  static jsval sOnselect_id;
-  static jsval sOnload_id;
-  static jsval sOnpopstate_id;
-  static jsval sOnbeforeunload_id;
-  static jsval sOnunload_id;
-  static jsval sOnhashchange_id;
-  static jsval sOnpageshow_id;
-  static jsval sOnpagehide_id;
-  static jsval sOnabort_id;
-  static jsval sOnerror_id;
-  static jsval sOnpaint_id;
-  static jsval sOnresize_id;
-  static jsval sOnscroll_id;
-  static jsval sOndrag_id;
-  static jsval sOndragend_id;
-  static jsval sOndragenter_id;
-  static jsval sOndragleave_id;
-  static jsval sOndragover_id;
-  static jsval sOndragstart_id;
-  static jsval sOndrop_id;
-  static jsval sScrollX_id;
-  static jsval sScrollY_id;
-  static jsval sScrollMaxX_id;
-  static jsval sScrollMaxY_id;
-  static jsval sOpen_id;
-  static jsval sItem_id;
-  static jsval sNamedItem_id;
-  static jsval sEnumerate_id;
-  static jsval sNavigator_id;
-  static jsval sDocument_id;
-  static jsval sWindow_id;
-  static jsval sFrames_id;
-  static jsval sSelf_id;
-  static jsval sOpener_id;
-  static jsval sAll_id;
-  static jsval sTags_id;
-  static jsval sAddEventListener_id;
-  static jsval sBaseURIObject_id;
-  static jsval sNodePrincipal_id;
-  static jsval sDocumentURIObject_id;
-  static jsval sOncopy_id;
-  static jsval sOncut_id;
-  static jsval sOnpaste_id;
-  static jsval sJava_id;
-  static jsval sPackages_id;
+  static jsid sTop_id;
+  static jsid sParent_id;
+  static jsid sScrollbars_id;
+  static jsid sLocation_id;
+  static jsid sConstructor_id;
+  static jsid s_content_id;
+  static jsid sContent_id;
+  static jsid sMenubar_id;
+  static jsid sToolbar_id;
+  static jsid sLocationbar_id;
+  static jsid sPersonalbar_id;
+  static jsid sStatusbar_id;
+  static jsid sDialogArguments_id;
+  static jsid sControllers_id;
+  static jsid sLength_id;
+  static jsid sInnerHeight_id;
+  static jsid sInnerWidth_id;
+  static jsid sOuterHeight_id;
+  static jsid sOuterWidth_id;
+  static jsid sScreenX_id;
+  static jsid sScreenY_id;
+  static jsid sStatus_id;
+  static jsid sName_id;
+  static jsid sOnmousedown_id;
+  static jsid sOnmouseup_id;
+  static jsid sOnclick_id;
+  static jsid sOndblclick_id;
+  static jsid sOncontextmenu_id;
+  static jsid sOnmouseover_id;
+  static jsid sOnmouseout_id;
+  static jsid sOnkeydown_id;
+  static jsid sOnkeyup_id;
+  static jsid sOnkeypress_id;
+  static jsid sOnmousemove_id;
+  static jsid sOnfocus_id;
+  static jsid sOnblur_id;
+  static jsid sOnsubmit_id;
+  static jsid sOnreset_id;
+  static jsid sOnchange_id;
+  static jsid sOnselect_id;
+  static jsid sOnload_id;
+  static jsid sOnpopstate_id;
+  static jsid sOnbeforeunload_id;
+  static jsid sOnunload_id;
+  static jsid sOnhashchange_id;
+  static jsid sOnpageshow_id;
+  static jsid sOnpagehide_id;
+  static jsid sOnabort_id;
+  static jsid sOnerror_id;
+  static jsid sOnpaint_id;
+  static jsid sOnresize_id;
+  static jsid sOnscroll_id;
+  static jsid sOndrag_id;
+  static jsid sOndragend_id;
+  static jsid sOndragenter_id;
+  static jsid sOndragleave_id;
+  static jsid sOndragover_id;
+  static jsid sOndragstart_id;
+  static jsid sOndrop_id;
+  static jsid sScrollX_id;
+  static jsid sScrollY_id;
+  static jsid sScrollMaxX_id;
+  static jsid sScrollMaxY_id;
+  static jsid sOpen_id;
+  static jsid sItem_id;
+  static jsid sNamedItem_id;
+  static jsid sEnumerate_id;
+  static jsid sNavigator_id;
+  static jsid sDocument_id;
+  static jsid sWindow_id;
+  static jsid sFrames_id;
+  static jsid sSelf_id;
+  static jsid sOpener_id;
+  static jsid sAll_id;
+  static jsid sTags_id;
+  static jsid sAddEventListener_id;
+  static jsid sBaseURIObject_id;
+  static jsid sNodePrincipal_id;
+  static jsid sDocumentURIObject_id;
+  static jsid sOncopy_id;
+  static jsid sOncut_id;
+  static jsid sOnpaste_id;
+  static jsid sJava_id;
+  static jsid sPackages_id;
 
   static JSPropertyOp sXPCNativeWrapperGetPropertyOp;
 };
 
 
 inline
 const nsQueryInterface
 do_QueryWrappedNative(nsIXPConnectWrappedNative *wrapper, JSObject *obj)
@@ -413,45 +413,45 @@ protected:
   nsEventReceiverSH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData)
   {
   }
 
   virtual ~nsEventReceiverSH()
   {
   }
 
-  static PRBool ReallyIsEventName(jsval id, jschar aFirstChar);
+  static PRBool ReallyIsEventName(jsid id, jschar aFirstChar);
 
-  static inline PRBool IsEventName(jsval id)
+  static inline PRBool IsEventName(jsid id)
   {
-    NS_ASSERTION(JSVAL_IS_STRING(id), "Don't pass non-string jsval's here!");
+    NS_ASSERTION(JSID_IS_STRING(id), "Don't pass non-string jsid's here!");
 
-    jschar *str = ::JS_GetStringChars(JSVAL_TO_STRING(id));
+    jschar *str = ::JS_GetStringChars(JSID_TO_STRING(id));
 
     if (str[0] == 'o' && str[1] == 'n') {
       return ReallyIsEventName(id, str[2]);
     }
 
     return PR_FALSE;
   }
 
   nsresult RegisterCompileHandler(nsIXPConnectWrappedNative *wrapper,
-                                  JSContext *cx, JSObject *obj, jsval id,
+                                  JSContext *cx, JSObject *obj, jsid id,
                                   PRBool compile, PRBool remove,
                                   PRBool *did_define);
 
 public:
   NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                        JSObject *obj, jsval id, PRUint32 flags,
+                        JSObject *obj, jsid id, PRUint32 flags,
                         JSObject **objp, PRBool *_retval);
   NS_IMETHOD SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsval id, jsval *vp,
+                         JSObject *obj, jsid id, jsval *vp,
                          PRBool *_retval);
   NS_IMETHOD AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsval id, jsval *vp, PRBool *_retval);
+                         JSObject *obj, jsid id, jsval *vp, PRBool *_retval);
 };
 
 // Simpler than nsEventReceiverSH
 // Makes sure that the wrapper is preserved if new properties are added.
 class nsEventTargetSH : public nsDOMGenericSH
 {
 protected:
   nsEventTargetSH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData)
@@ -460,17 +460,17 @@ protected:
 
   virtual ~nsEventTargetSH()
   {
   }
 public:
   NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
                        JSObject *globalObj, JSObject **parentObj);
   NS_IMETHOD AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsval id, jsval *vp, PRBool *_retval);
+                         JSObject *obj, jsid id, jsval *vp, PRBool *_retval);
 
   virtual void PreserveWrapper(nsISupports *aNative);
 
   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
   {
     return new nsEventTargetSH(aData);
   }
 };
@@ -515,44 +515,44 @@ public:
     if (NS_SUCCEEDED(rv)) {
       *aFlags = flags | nsIXPCScriptable::WANT_POSTCREATE;
     }
 
     return rv;
   }
 #endif
   NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsval id, jsval *vp, PRBool *_retval);
+                         JSObject *obj, jsid id, jsval *vp, PRBool *_retval);
   NS_IMETHOD SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsval id, jsval *vp, PRBool *_retval);
+                         JSObject *obj, jsid id, jsval *vp, PRBool *_retval);
   NS_IMETHOD AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsval id, jsval *vp, PRBool *_retval);
+                         JSObject *obj, jsid id, jsval *vp, PRBool *_retval);
   NS_IMETHOD DelProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsval id, jsval *vp, PRBool *_retval);
+                         JSObject *obj, jsid id, jsval *vp, PRBool *_retval);
   NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                        JSObject *obj, jsval id, PRUint32 flags,
+                        JSObject *obj, jsid id, PRUint32 flags,
                         JSObject **objp, PRBool *_retval);
   NS_IMETHOD NewEnumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
                           JSObject *obj, PRUint32 enum_op, jsval *statep,
                           jsid *idp, PRBool *_retval);
   NS_IMETHOD Finalize(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
                       JSObject *obj);
   NS_IMETHOD Equality(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
                       JSObject * obj, jsval val, PRBool *bp);
   NS_IMETHOD OuterObject(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
                          JSObject * obj, JSObject * *_retval);
   NS_IMETHOD InnerObject(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
                          JSObject * obj, JSObject * *_retval);
 
   static JSBool GlobalScopePolluterNewResolve(JSContext *cx, JSObject *obj,
-                                              jsval id, uintN flags,
+                                              jsid id, uintN flags,
                                               JSObject **objp);
   static JSBool GlobalScopePolluterGetProperty(JSContext *cx, JSObject *obj,
-                                               jsval id, jsval *vp);
-  static JSBool SecurityCheckOnSetProp(JSContext *cx, JSObject *obj, jsval id,
+                                               jsid id, jsval *vp);
+  static JSBool SecurityCheckOnSetProp(JSContext *cx, JSObject *obj, jsid id,
                                        jsval *vp);
   static void InvalidateGlobalScopePolluter(JSContext *cx, JSObject *obj);
   static nsresult InstallGlobalScopePolluter(JSContext *cx, JSObject *obj,
                                              nsIHTMLDocument *doc);
 
   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
   {
     return new nsWindowSH(aData);
@@ -570,17 +570,17 @@ protected:
   }
 
   virtual ~nsLocationSH()
   {
   }
 
 public:
   NS_IMETHOD CheckAccess(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsval id, PRUint32 mode,
+                         JSObject *obj, jsid id, PRUint32 mode,
                          jsval *vp, PRBool *_retval);
 
   NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
                        JSObject *globalObj, JSObject **parentObj);
 
   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
   {
     return new nsLocationSH(aData);
@@ -632,31 +632,31 @@ protected:
   inline PRBool IsPrivilegedScript() {
     return IsCapabilityEnabled("UniversalXPConnect");
   }
 
   // Helper to define a void property with JSPROP_SHARED; this can do all the
   // work so it's safe to just return whatever it returns.  |obj| is the object
   // we're defining on, |id| is the name of the prop.  This must be a string
   // jsval.  |objp| is the out param if we define successfully.
-  nsresult DefineVoidProp(JSContext* cx, JSObject* obj, jsval id,
+  nsresult DefineVoidProp(JSContext* cx, JSObject* obj, jsid id,
                           JSObject** objp);
 
 public:
   NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
                        JSObject *globalObj, JSObject **parentObj);
   NS_IMETHOD AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsval id, jsval *vp, PRBool *_retval);
+                         JSObject *obj, jsid id, jsval *vp, PRBool *_retval);
   NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                        JSObject *obj, jsval id, PRUint32 flags,
+                        JSObject *obj, jsid id, PRUint32 flags,
                         JSObject **objp, PRBool *_retval);
   NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsval id, jsval *vp, PRBool *_retval);
+                         JSObject *obj, jsid id, jsval *vp, PRBool *_retval);
   NS_IMETHOD SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsval id, jsval *vp, PRBool *_retval);
+                         JSObject *obj, jsid id, jsval *vp, PRBool *_retval);
   NS_IMETHOD GetFlags(PRUint32 *aFlags);
 
   virtual void PreserveWrapper(nsISupports *aNative);
 
   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
   {
     return new nsNodeSH(aData);
   }
@@ -701,17 +701,17 @@ protected:
   }
 
   virtual ~nsGenericArraySH()
   {
   }
   
 public:
   NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                        JSObject *obj, jsval id, PRUint32 flags,
+                        JSObject *obj, jsid id, PRUint32 flags,
                         JSObject **objp, PRBool *_retval);
   NS_IMETHOD Enumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
                        JSObject *obj, PRBool *_retval);
   
   virtual nsresult GetLength(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
                              JSObject *obj, PRUint32 *length);
 
   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
@@ -736,17 +736,17 @@ protected:
 
   // Subclasses need to override this, if the implementation can't fail it's
   // allowed to not set *aResult.
   virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
                                  nsresult *aResult) = 0;
 
 public:
   NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsval id, jsval *vp, PRBool *_retval);
+                         JSObject *obj, jsid id, jsval *vp, PRBool *_retval);
 
 private:
   // Not implemented, nothing should create an instance of this class.
   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData);
 };
 
 
 // NodeList scriptable helper
@@ -788,17 +788,17 @@ protected:
   }
 
   virtual nsISupports* GetNamedItem(nsISupports *aNative,
                                     const nsAString& aName,
                                     nsresult *aResult) = 0;
 
 public:
   NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsval id, jsval *vp, PRBool *_retval);
+                         JSObject *obj, jsid id, jsval *vp, PRBool *_retval);
 
 private:
   // Not implemented, nothing should create an instance of this class.
   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData);
 };
 
 
 // NamedNodeMap helper
@@ -900,22 +900,22 @@ public:
   }
 
   virtual ~nsDocumentSH()
   {
   }
 
 public:
   NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                        JSObject *obj, jsval id, PRUint32 flags,
+                        JSObject *obj, jsid id, PRUint32 flags,
                         JSObject **objp, PRBool *_retval);
   NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsval id, jsval *vp, PRBool *_retval);
+                         JSObject *obj, jsid id, jsval *vp, PRBool *_retval);
   NS_IMETHOD SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsval id, jsval *vp, PRBool *_retval);
+                         JSObject *obj, jsid id, jsval *vp, PRBool *_retval);
   NS_IMETHOD GetFlags(PRUint32* aFlags);
   NS_IMETHOD PostCreate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
                         JSObject *obj);
 
   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
   {
     return new nsDocumentSH(aData);
   }
@@ -931,46 +931,46 @@ protected:
   {
   }
 
   virtual ~nsHTMLDocumentSH()
   {
   }
 
   static nsresult ResolveImpl(JSContext *cx,
-                              nsIXPConnectWrappedNative *wrapper, jsval id,
+                              nsIXPConnectWrappedNative *wrapper, jsid id,
                               nsISupports **result);
   static JSBool DocumentOpen(JSContext *cx, JSObject *obj, uintN argc,
                              jsval *argv, jsval *rval);
   static JSBool GetDocumentAllNodeList(JSContext *cx, JSObject *obj,
                                        nsIDOMDocument *doc,
                                        nsIDOMNodeList **nodeList);
 
 public:
-  static JSBool DocumentAllGetProperty(JSContext *cx, JSObject *obj, jsval id,
+  static JSBool DocumentAllGetProperty(JSContext *cx, JSObject *obj, jsid id,
                                        jsval *vp);
-  static JSBool DocumentAllNewResolve(JSContext *cx, JSObject *obj, jsval id,
+  static JSBool DocumentAllNewResolve(JSContext *cx, JSObject *obj, jsid id,
                                       uintN flags, JSObject **objp);
   static void ReleaseDocument(JSContext *cx, JSObject *obj);
   static JSBool CallToGetPropMapper(JSContext *cx, JSObject *obj, uintN argc,
                                     jsval *argv, jsval *rval);
   static JSBool DocumentAllHelperGetProperty(JSContext *cx, JSObject *obj,
-                                             jsval id, jsval *vp);
+                                             jsid id, jsval *vp);
   static JSBool DocumentAllHelperNewResolve(JSContext *cx, JSObject *obj,
-                                            jsval id, uintN flags,
+                                            jsid id, uintN flags,
                                             JSObject **objp);
   static JSBool DocumentAllTagsNewResolve(JSContext *cx, JSObject *obj,
-                                          jsval id, uintN flags,
+                                          jsid id, uintN flags,
                                           JSObject **objp);
 
   NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                        JSObject *obj, jsval id, PRUint32 flags,
+                        JSObject *obj, jsid id, PRUint32 flags,
                         JSObject **objp, PRBool *_retval);
   NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsval id, jsval *vp, PRBool *_retval);
+                         JSObject *obj, jsid id, jsval *vp, PRBool *_retval);
 
   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
   {
     return new nsHTMLDocumentSH(aData);
   }
 };
 
 
@@ -984,25 +984,25 @@ protected:
   }
 
   virtual ~nsHTMLBodyElementSH()
   {
   }
 
 public:
   NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                        JSObject *obj, jsval id, PRUint32 flags,
+                        JSObject *obj, jsid id, PRUint32 flags,
                         JSObject **objp, PRBool *_retval);
 
   NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsval id, jsval *vp,
+                         JSObject *obj, jsid id, jsval *vp,
                          PRBool *_retval);
 
   NS_IMETHOD SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsval id, jsval *vp, PRBool *_retval);
+                         JSObject *obj, jsid id, jsval *vp, PRBool *_retval);
 
   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
   {
     return new nsHTMLBodyElementSH(aData);
   }
 };
 
 
@@ -1019,20 +1019,20 @@ protected:
   {
   }
 
   static nsresult FindNamedItem(nsIForm *aForm, JSString *str,
                                 nsISupports **aResult);
 
 public:
   NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                        JSObject *obj, jsval id, PRUint32 flags,
+                        JSObject *obj, jsid id, PRUint32 flags,
                         JSObject **objp, PRBool *_retval);
   NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsval id, jsval *vp,
+                         JSObject *obj, jsid id, jsval *vp,
                          PRBool *_retval);
 
   NS_IMETHOD NewEnumerate(nsIXPConnectWrappedNative *wrapper,
                           JSContext *cx, JSObject *obj,
                           PRUint32 enum_op, jsval *statep,
                           jsid *idp, PRBool *_retval);
 
   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
@@ -1052,20 +1052,20 @@ protected:
   }
 
   virtual ~nsHTMLSelectElementSH()
   {
   }
 
 public:
   NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsval id, jsval *vp,
+                         JSObject *obj, jsid id, jsval *vp,
                          PRBool *_retval);
   NS_IMETHOD SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsval id, jsval *vp, PRBool *_retval);
+                         JSObject *obj, jsid id, jsval *vp, PRBool *_retval);
 
   static nsresult SetOption(JSContext *cx, jsval *vp, PRUint32 aIndex,
                             nsIDOMNSHTMLOptionCollection *aOptCollection);
 
   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
   {
     return new nsHTMLSelectElementSH(aData);
   }
@@ -1092,26 +1092,26 @@ protected:
 
   static nsresult GetPluginJSObject(JSContext *cx, JSObject *obj,
                                     nsIPluginInstance *plugin_inst,
                                     JSObject **plugin_obj,
                                     JSObject **plugin_proto);
 
 public:
   NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                        JSObject *obj, jsval id, PRUint32 flags,
+                        JSObject *obj, jsid id, PRUint32 flags,
                         JSObject **objp, PRBool *_retval);
   NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
                        JSObject *globalObj, JSObject **parentObj);
   NS_IMETHOD PostCreate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
                         JSObject *obj);
   NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsval id, jsval *vp, PRBool *_retval);
+                         JSObject *obj, jsid id, jsval *vp, PRBool *_retval);
   NS_IMETHOD SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsval id, jsval *vp, PRBool *_retval);
+                         JSObject *obj, jsid id, jsval *vp, PRBool *_retval);
   NS_IMETHOD Call(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
                   JSObject *obj, PRUint32 argc, jsval *argv, jsval *vp,
                   PRBool *_retval);
 
 
   static nsresult SetupProtoChain(nsIXPConnectWrappedNative *wrapper,
                                   JSContext *cx, JSObject *obj);
 
@@ -1133,17 +1133,17 @@ protected:
   }
 
   virtual ~nsHTMLOptionsCollectionSH()
   {
   }
 
 public:
   NS_IMETHOD SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsval id, jsval *vp, PRBool *_retval);
+                         JSObject *obj, jsid id, jsval *vp, PRBool *_retval);
   
   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
   {
     return new nsHTMLOptionsCollectionSH(aData);
   }
 };
 
 
@@ -1247,17 +1247,17 @@ protected:
   {
   }
 
   virtual nsresult GetStringAt(nsISupports *aNative, PRInt32 aIndex,
                                nsAString& aResult) = 0;
 
 public:
   NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsval id, jsval *vp, PRBool *_retval);
+                         JSObject *obj, jsid id, jsval *vp, PRBool *_retval);
 };
 
 
 // History helper
 
 class nsHistorySH : public nsStringArraySH
 {
 protected:
@@ -1269,17 +1269,17 @@ protected:
   {
   }
 
   virtual nsresult GetStringAt(nsISupports *aNative, PRInt32 aIndex,
                                nsAString& aResult);
 
 public:
   NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsval id, jsval *vp, PRBool *_retval);
+                         JSObject *obj, jsid id, jsval *vp, PRBool *_retval);
 
   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
   {
     return new nsHistorySH(aData);
   }
 };
 
 // StringList scriptable helper
@@ -1542,22 +1542,22 @@ protected:
   {
   }
 
   virtual ~nsStorageSH()
   {
   }
 
   NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                        JSObject *obj, jsval id, PRUint32 flags,
+                        JSObject *obj, jsid id, PRUint32 flags,
                         JSObject **objp, PRBool *_retval);
   NS_IMETHOD SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsval id, jsval *vp, PRBool *_retval);
+                         JSObject *obj, jsid id, jsval *vp, PRBool *_retval);
   NS_IMETHOD DelProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsval id, jsval *vp, PRBool *_retval);
+                         JSObject *obj, jsid id, jsval *vp, PRBool *_retval);
   NS_IMETHOD NewEnumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
                           JSObject *obj, PRUint32 enum_op, jsval *statep,
                           jsid *idp, PRBool *_retval);
 
   virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
                                  nsresult *aResult)
   {
     return nsnull;
@@ -1582,24 +1582,24 @@ protected:
   {
   }
 
   virtual ~nsStorage2SH()
   {
   }
 
   NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                        JSObject *obj, jsval id, PRUint32 flags,
+                        JSObject *obj, jsid id, PRUint32 flags,
                         JSObject **objp, PRBool *_retval);
   NS_IMETHOD SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsval id, jsval *vp, PRBool *_retval);
+                         JSObject *obj, jsid id, jsval *vp, PRBool *_retval);
   NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsval id, jsval *vp, PRBool *_retval);
+                         JSObject *obj, jsid id, jsval *vp, PRBool *_retval);
   NS_IMETHOD DelProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
-                         JSObject *obj, jsval id, jsval *vp, PRBool *_retval);
+                         JSObject *obj, jsid id, jsval *vp, PRBool *_retval);
   NS_IMETHOD NewEnumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
                           JSObject *obj, PRUint32 enum_op, jsval *statep,
                           jsid *idp, PRBool *_retval);
 
 public:
   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
   {
     return new nsStorage2SH(aData);
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -9764,17 +9764,17 @@ NS_NewScriptGlobalObject(PRBool aIsChrom
 
 nsNavigator::nsNavigator(nsIDocShell *aDocShell)
   : mDocShell(aDocShell)
 {
 }
 
 nsNavigator::~nsNavigator()
 {
-  sPrefInternal_id = JSVAL_VOID;
+  sPrefInternal_id = JSID_VOID;
 }
 
 //*****************************************************************************
 //    nsNavigator::nsISupports
 //*****************************************************************************
 
 
 DOMCI_DATA(Navigator, nsNavigator)
@@ -10191,18 +10191,18 @@ nsNavigator::JavaEnabled(PRBool *aReturn
 
 NS_IMETHODIMP
 nsNavigator::TaintEnabled(PRBool *aReturn)
 {
   *aReturn = PR_FALSE;
   return NS_OK;
 }
 
-jsval
-nsNavigator::sPrefInternal_id = JSVAL_VOID;
+jsid
+nsNavigator::sPrefInternal_id = JSID_VOID;
 
 NS_IMETHODIMP
 nsNavigator::Preference()
 {
   // XXXjst: We could get rid of this GetCurrentNativeCallContext()
   // call if this method returned a variant...
   nsAXPCNativeCallContext *ncc = nsnull;
   nsresult rv = nsContentUtils::XPConnect()->
@@ -10230,19 +10230,19 @@ nsNavigator::Preference()
   JSContext *cx = nsnull;
 
   rv = ncc->GetJSContext(&cx);
   NS_ENSURE_SUCCESS(rv, rv);
 
   JSAutoRequest ar(cx);
 
   //--Check to see if the caller is allowed to access prefs
-  if (sPrefInternal_id == JSVAL_VOID) {
+  if (sPrefInternal_id == JSID_VOID) {
     sPrefInternal_id =
-      STRING_TO_JSVAL(::JS_InternString(cx, "preferenceinternal"));
+      INTERNED_STRING_TO_JSID(::JS_InternString(cx, "preferenceinternal"));
   }
 
   PRUint32 action;
   if (argc == 1) {
     action = nsIXPCSecurityManager::ACCESS_GET_PROPERTY;
   } else {
     action = nsIXPCSecurityManager::ACCESS_SET_PROPERTY;
   }
--- a/dom/base/nsGlobalWindow.h
+++ b/dom/base/nsGlobalWindow.h
@@ -921,17 +921,17 @@ public:
   nsresult RefreshMIMEArray();
 
 protected:
   nsRefPtr<nsMimeTypeArray> mMimeTypes;
   nsRefPtr<nsPluginArray> mPlugins;
   nsRefPtr<nsGeolocation> mGeolocation;
   nsIDocShell* mDocShell; // weak reference
 
-  static jsval       sPrefInternal_id;
+  static jsid sPrefInternal_id;
 };
 
 class nsIURI;
 
 //*****************************************************************************
 // nsLocation: Script "location" object
 //*****************************************************************************
 
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -3036,32 +3036,32 @@ nsJSContext::AddSupportsPrimitiveTojsval
 static JSPropertySpec OptionsProperties[] = {
   {"strict",    (int8)JSOPTION_STRICT,   JSPROP_ENUMERATE | JSPROP_PERMANENT},
   {"werror",    (int8)JSOPTION_WERROR,   JSPROP_ENUMERATE | JSPROP_PERMANENT},
   {"relimit",   (int8)JSOPTION_RELIMIT,  JSPROP_ENUMERATE | JSPROP_PERMANENT},
   {0}
 };
 
 static JSBool
-GetOptionsProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+GetOptionsProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
-  if (JSVAL_IS_INT(id)) {
-    uint32 optbit = (uint32) JSVAL_TO_INT(id);
+  if (JSID_IS_INT(id)) {
+    uint32 optbit = (uint32) JSID_TO_INT(id);
     if (((optbit & (optbit - 1)) == 0 && optbit <= JSOPTION_WERROR) ||
           optbit == JSOPTION_RELIMIT)
       *vp = (JS_GetOptions(cx) & optbit) ? JSVAL_TRUE : JSVAL_FALSE;
   }
   return JS_TRUE;
 }
 
 static JSBool
-SetOptionsProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+SetOptionsProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
-  if (JSVAL_IS_INT(id)) {
-    uint32 optbit = (uint32) JSVAL_TO_INT(id);
+  if (JSID_IS_INT(id)) {
+    uint32 optbit = (uint32) JSID_TO_INT(id);
 
     // Don't let options other than strict, werror, or relimit be set -- it
     // would be bad if web page script could clear
     // JSOPTION_PRIVATE_IS_NSISUPPORTS!
     if (((optbit & (optbit - 1)) == 0 && optbit <= JSOPTION_WERROR) ||
         optbit == JSOPTION_RELIMIT) {
       JSBool optval;
       JS_ValueToBoolean(cx, *vp, &optval);
--- a/dom/base/nsJSUtils.h
+++ b/dom/base/nsJSUtils.h
@@ -76,16 +76,22 @@ class nsDependentJSString : public nsDep
 {
 public:
   explicit nsDependentJSString(jsval v)
     : nsDependentString((PRUnichar *)::JS_GetStringChars(JSVAL_TO_STRING(v)),
                         ::JS_GetStringLength(JSVAL_TO_STRING(v)))
   {
   }
 
+  explicit nsDependentJSString(jsid id)
+    : nsDependentString((PRUnichar *)::JS_GetStringChars(JSID_TO_STRING(id)),
+                        ::JS_GetStringLength(JSID_TO_STRING(id)))
+  {
+  }
+
   explicit nsDependentJSString(JSString *str)
     : nsDependentString((PRUnichar *)::JS_GetStringChars(str), ::JS_GetStringLength(str))
   {
   }
 
   ~nsDependentJSString()
   {
   }
--- a/dom/src/threads/nsDOMWorker.cpp
+++ b/dom/src/threads/nsDOMWorker.cpp
@@ -111,17 +111,17 @@ public:
 
   // Chrome-only functions
   static JSBool
   NewChromeWorker(JSContext* aCx, JSObject* aObj, uintN aArgc, jsval* aArgv,
                   jsval* aRval);
 
 #ifdef BUILD_CTYPES
   static JSBool
-  CTypesLazyGetter(JSContext* aCx, JSObject* aObj, jsval aId, jsval* aVp);
+  CTypesLazyGetter(JSContext* aCx, JSObject* aObj, jsid aId, jsval* aVp);
 #endif
 
 private:
   // Internal helper for SetTimeout and SetInterval.
   static JSBool
   MakeTimeout(JSContext* aCx, JSObject* aObj, uintN aArgc, jsval* aArgv,
               jsval* aRval, PRBool aIsInterval);
 
@@ -429,40 +429,38 @@ nsDOMWorkerFunctions::MakeNewWorker(JSCo
   *aRval = v;
   return JS_TRUE;
 }
 
 #ifdef BUILD_CTYPES
 JSBool
 nsDOMWorkerFunctions::CTypesLazyGetter(JSContext* aCx,
                                        JSObject* aObj,
-                                       jsval aId,
+                                       jsid aId,
                                        jsval* aVp)
 {
 #ifdef DEBUG
   {
     NS_ASSERTION(JS_GetGlobalForObject(aCx, aObj) == aObj, "Bad object!");
-    NS_ASSERTION(JSVAL_IS_STRING(aId), "Not a string!");
-    JSString* str = JSVAL_TO_STRING(aId);
+    NS_ASSERTION(JSID_IS_STRING(aId), "Not a string!");
+    JSString* str = JSID_TO_STRING(aId);
     NS_ASSERTION(nsDependentJSString(str).EqualsLiteral("ctypes"), "Bad id!");
   }
 #endif
   nsDOMWorker* worker = static_cast<nsDOMWorker*>(JS_GetContextPrivate(aCx));
   NS_ASSERTION(worker, "This should be set by the DOM thread service!");
   NS_ASSERTION(worker->IsPrivileged(), "This shouldn't be possible!");
 
   if (worker->IsCanceled()) {
     return JS_FALSE;
   }
 
-  js::AutoIdRooter rooter(aCx);
-  return JS_ValueToId(aCx, aId, rooter.addr()) &&
-         JS_DeletePropertyById(aCx, aObj, rooter.id()) &&
+  return JS_DeletePropertyById(aCx, aObj, aId) &&
          JS_InitCTypesClass(aCx, aObj) &&
-         JS_GetPropertyById(aCx, aObj, rooter.id(), aVp);
+         JS_GetPropertyById(aCx, aObj, aId, aVp);
 }
 #endif
 
 JSFunctionSpec gDOMWorkerFunctions[] = {
   { "dump",                nsDOMWorkerFunctions::Dump,                1, 0, 0 },
   { "setTimeout",          nsDOMWorkerFunctions::SetTimeout,          1, 0, 0 },
   { "clearTimeout",        nsDOMWorkerFunctions::KillTimeout,         1, 0, 0 },
   { "setInterval",         nsDOMWorkerFunctions::SetInterval,         1, 0, 0 },
@@ -581,36 +579,36 @@ nsDOMWorkerScope::GetWrappedNative()
   NS_ASSERTION(wrappedNative, "Null wrapped native!");
   return wrappedNative.forget();
 }
 
 NS_IMETHODIMP
 nsDOMWorkerScope::AddProperty(nsIXPConnectWrappedNative* aWrapper,
                               JSContext* aCx,
                               JSObject* aObj,
-                              jsval aId,
+                              jsid aId,
                               jsval* aVp,
                               PRBool* _retval)
 {
   // We're not going to be setting any exceptions manually so set _retval to
   // true in the beginning.
   *_retval = PR_TRUE;
 
   // Bail out now if any of our prerequisites are not met. We only care about
   // someone making an 'onmessage' or 'onerror' function so aId must be a
   // string and aVp must be a function.
   JSObject* funObj;
-  if (!(JSVAL_IS_STRING(aId) &&
+  if (!(JSID_IS_STRING(aId) &&
         JSVAL_IS_OBJECT(*aVp) &&
         (funObj = JSVAL_TO_OBJECT(*aVp)) &&
         JS_ObjectIsFunction(aCx, funObj))) {
     return NS_OK;
   }
 
-  const char* name = JS_GetStringBytes(JSVAL_TO_STRING(aId));
+  const char* name = JS_GetStringBytes(JSID_TO_STRING(aId));
 
   // Figure out which listener we're setting.
   SetListenerFunc func;
   if (!strcmp(name, "onmessage")) {
     func = &nsDOMWorkerScope::SetOnmessage;
   }
   else if (!strcmp(name, "onerror")) {
     func = &nsDOMWorkerScope::SetOnerror;
--- a/dom/src/threads/nsDOMWorkerSecurityManager.cpp
+++ b/dom/src/threads/nsDOMWorkerSecurityManager.cpp
@@ -103,32 +103,32 @@ nsDOMWorkerSecurityManager::CanGetServic
 
 NS_IMETHODIMP
 nsDOMWorkerSecurityManager::CanAccess(PRUint32 aAction,
                                       nsAXPCNativeCallContext* aCallContext,
                                       JSContext* aJSContext,
                                       JSObject* aJSObject,
                                       nsISupports* aObj,
                                       nsIClassInfo* aClassInfo,
-                                      jsval aName,
+                                      jsid aName,
                                       void** aPolicy)
 {
   return NS_OK;
 }
 
 JSPrincipals*
 nsDOMWorkerSecurityManager::WorkerPrincipal()
 {
   return &gWorkerPrincipal;
 }
 
 JSBool
 nsDOMWorkerSecurityManager::JSCheckAccess(JSContext* aCx,
                                           JSObject* aObj,
-                                          jsval aId,
+                                          jsid aId,
                                           JSAccessMode aMode,
                                           jsval* aVp)
 {
   return JS_TRUE;
 }
 
 JSPrincipals*
 nsDOMWorkerSecurityManager::JSFindPrincipal(JSContext* aCx, JSObject* aObj)
--- a/dom/src/threads/nsDOMWorkerSecurityManager.h
+++ b/dom/src/threads/nsDOMWorkerSecurityManager.h
@@ -45,17 +45,17 @@
 class nsDOMWorkerSecurityManager : public nsIXPCSecurityManager
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIXPCSECURITYMANAGER
 
   static JSPrincipals* WorkerPrincipal();
 
-  static JSBool JSCheckAccess(JSContext* aCx, JSObject* aObj, jsval aId,
+  static JSBool JSCheckAccess(JSContext* aCx, JSObject* aObj, jsid aId,
                               JSAccessMode aMode, jsval* aVp);
 
   static JSPrincipals* JSFindPrincipal(JSContext* aCx, JSObject* aObj);
 
   static JSBool JSTranscodePrincipals(JSXDRState* aXdr,
                                       JSPrincipals** aJsprinp);
 };
 
--- a/extensions/pref/autoconfig/src/nsJSConfigTriggers.cpp
+++ b/extensions/pref/autoconfig/src/nsJSConfigTriggers.cpp
@@ -92,17 +92,17 @@ AutoConfigSecMan::CanGetService(JSContex
     return NS_OK;
 }
 
 NS_IMETHODIMP 
 AutoConfigSecMan::CanAccess(PRUint32 aAction, 
                             nsAXPCNativeCallContext *aCallContext, 
                             JSContext *aJSContext, JSObject *aJSObject, 
                             nsISupports *aObj, nsIClassInfo *aClassInfo, 
-                            jsval aName, void **aPolicy)
+                            jsid aName, void **aPolicy)
 {
     return NS_OK;
 }
 
 //*****************************************************************************
 
 static  JSContext *autoconfig_cx = nsnull;
 static  JSObject *autoconfig_glob;
--- a/js/jsd/jsd_val.c
+++ b/js/jsd/jsd_val.c
@@ -336,24 +336,24 @@ static JSDProperty* _newProperty(JSDCont
     if(!(jsdprop = (JSDProperty*) calloc(1, sizeof(JSDProperty))))
         return NULL;
 
     JS_INIT_CLIST(&jsdprop->links);
     jsdprop->nref = 1;
     jsdprop->flags = pd->flags | additionalFlags;
     jsdprop->slot = pd->slot;
 
-    if(!(jsdprop->name = jsd_NewValue(jsdc, ID_TO_JSVAL(pd->id))))
+    if(!(jsdprop->name = jsd_NewValue(jsdc, pd->id)))
         goto new_prop_fail;
 
     if(!(jsdprop->val = jsd_NewValue(jsdc, pd->value)))
         goto new_prop_fail;
 
     if((jsdprop->flags & JSDPD_ALIAS) &&
-       !(jsdprop->alias = jsd_NewValue(jsdc, ID_TO_JSVAL(pd->alias))))
+       !(jsdprop->alias = jsd_NewValue(jsdc, pd->alias)))
         goto new_prop_fail;
 
     return jsdprop;
 new_prop_fail:
     jsd_DropProperty(jsdc, jsdprop);
     return NULL;
 }
 
@@ -487,16 +487,17 @@ jsd_GetValueProperty(JSDContext* jsdc, J
     JSDProperty* iter = NULL;
     JSObject* obj;
     uintN  attrs = 0;
     JSBool found;
     JSPropertyDesc pd;
     const jschar * nameChars;
     size_t nameLen;
     jsval val, nameval;
+    jsid nameid;
 
     if(!jsd_IsValueObject(jsdc, jsdval))
         return NULL;
 
     /* If we already have the prop, then return it */
     while(NULL != (jsdprop = jsd_IterateProperties(jsdc, jsdval, &iter)))
     {
         JSString* propName = jsd_GetValueString(jsdc, jsdprop->name);
@@ -543,18 +544,21 @@ jsd_GetValueProperty(JSDContext* jsdc, J
     else
     {
         pd.value = val;
     }
 
     JS_EndRequest(cx);
 
     nameval = STRING_TO_JSVAL(name);
-    if (!JS_ValueToId(cx, nameval, &pd.id))
+    if (!JS_ValueToId(cx, nameval, &nameid) ||
+        !JS_IdToValue(cx, nameid, &pd.id)) {
         return NULL;
+    }
+
     pd.slot = pd.spare = 0;
     pd.alias = JSVAL_NULL;
     pd.flags |= (attrs & JSPROP_ENUMERATE) ? JSPD_ENUMERATE : 0
         | (attrs & JSPROP_READONLY)  ? JSPD_READONLY  : 0
         | (attrs & JSPROP_PERMANENT) ? JSPD_PERMANENT : 0;
 
     return _newProperty(jsdc, &pd, JSDPD_HINTED);
 }
--- a/js/src/ctypes/CTypes.cpp
+++ b/js/src/ctypes/CTypes.cpp
@@ -94,17 +94,17 @@ namespace CType {
   static JSBool NameGetter(JSContext* cx, JSObject* obj, jsid idval,
     jsval* vp);
   static JSBool SizeGetter(JSContext* cx, JSObject* obj, jsid idval,
     jsval* vp);
   static JSBool PtrGetter(JSContext* cx, JSObject* obj, jsid idval, jsval* vp);
   static JSBool CreateArray(JSContext* cx, uintN argc, jsval* vp);
   static JSBool ToString(JSContext* cx, uintN argc, jsval* vp);
   static JSBool ToSource(JSContext* cx, uintN argc, jsval* vp);
-  static JSBool HasInstance(JSContext* cx, JSObject* obj, jsval v, JSBool* bp);
+  static JSBool HasInstance(JSContext* cx, JSObject* obj, const jsval *v, JSBool* bp);
 }
 
 namespace PointerType {
   static JSBool Create(JSContext* cx, uintN argc, jsval* vp);
   static JSBool ConstructData(JSContext* cx, JSObject* obj, uintN argc,
     jsval* argv, jsval* rval);
 
   static JSBool TargetTypeGetter(JSContext* cx, JSObject* obj, jsid idval,
@@ -1312,16 +1312,72 @@ jsvalToSize(JSContext* cx, jsval val, bo
 {
   if (!jsvalToBigInteger(cx, val, allowString, result))
     return false;
 
   // Also check that the result fits in a jsdouble.
   return Convert<size_t>(jsdouble(*result)) == *result;
 }
 
+// Implicitly convert val to IntegerType, allowing jsint, jsdouble,
+// Int64, UInt64, and optionally a decimal or hexadecimal string argument.
+// (This is common code shared by jsvalToSize and the Int64/UInt64 constructors.)
+template<class IntegerType>
+static bool
+jsidToBigInteger(JSContext* cx,
+                  jsid val,
+                  bool allowString,
+                  IntegerType* result)
+{
+  JS_STATIC_ASSERT(numeric_limits<IntegerType>::is_exact);
+
+  if (JSID_IS_INT(val)) {
+    // Make sure the integer fits in the alotted precision, and has the right
+    // sign.
+    jsint i = JSID_TO_INT(val);
+    return ConvertExact(i, result);
+  }
+  if (allowString && JSID_IS_STRING(val)) {
+    // Allow conversion from base-10 or base-16 strings, provided the result
+    // fits in IntegerType. (This allows an Int64 or UInt64 object to be passed
+    // to the JS array element operator, which will automatically call
+    // toString() on the object for us.)
+    return StringToInteger(cx, JSID_TO_STRING(val), result);
+  }
+  if (JSID_IS_OBJECT(val)) {
+    // Allow conversion from an Int64 or UInt64 object directly.
+    JSObject* obj = JSID_TO_OBJECT(val);
+
+    if (UInt64::IsUInt64(cx, obj)) {
+      // Make sure the integer fits in IntegerType.
+      JSUint64 i = Int64Base::GetInt(cx, obj);
+      return ConvertExact(i, result);
+    }
+
+    if (Int64::IsInt64(cx, obj)) {
+      // Make sure the integer fits in IntegerType.
+      JSInt64 i = Int64Base::GetInt(cx, obj);
+      return ConvertExact(i, result);
+    }
+  }
+  return false;
+}
+
+// Implicitly convert val to a size value, where the size value is represented
+// by size_t but must also fit in a jsdouble.
+static bool
+jsidToSize(JSContext* cx, jsid val, bool allowString, size_t* result)
+{
+  if (!jsidToBigInteger(cx, val, allowString, result))
+    return false;
+
+  // Also check that the result fits in a jsdouble.
+  return Convert<size_t>(jsdouble(*result)) == *result;
+}
+
 // Implicitly convert a size value to a jsval, ensuring that the size_t value
 // fits in a jsdouble.
 static JSBool
 SizeTojsval(JSContext* cx, size_t size, jsval* result)
 {
   if (Convert<size_t>(jsdouble(size)) != size) {
     JS_ReportError(cx, "size overflow");
     return false;
@@ -1894,28 +1950,28 @@ ImplicitConvert(JSContext* cx,
         return false;
       }
 
       jsid id;
       size_t i = 0;
       while (1) {
         if (!JS_NextProperty(cx, iter, &id))
           return false;
-        if (JSVAL_IS_VOID(id))
+        if (JSID_IS_VOID(id))
           break;
 
         js::AutoValueRooter fieldVal(cx);
         JS_IdToValue(cx, id, Jsvalify(fieldVal.addr()));
         if (!fieldVal.value().isString()) {
           JS_ReportError(cx, "property name is not a string");
           return false;
         }
 
         const FieldInfo* field = StructType::LookupField(cx, targetType,
-          Jsvalify(fieldVal.value()));
+                                                         fieldVal.value().asString());
         if (!field)
           return false;
 
         JSString* name = fieldVal.value().asString();
         js::AutoValueRooter prop(cx);
         if (!JS_GetUCProperty(cx, obj, name->chars(), name->length(), Jsvalify(prop.addr())))
           return false;
 
@@ -3073,31 +3129,31 @@ CType::ToSource(JSContext* cx, uintN arg
   if (!result)
     return JS_FALSE;
   
   JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(result));
   return JS_TRUE;
 }
 
 JSBool
-CType::HasInstance(JSContext* cx, JSObject* obj, jsval v, JSBool* bp)
+CType::HasInstance(JSContext* cx, JSObject* obj, const jsval *v, JSBool* bp)
 {
   JS_ASSERT(CType::IsCType(cx, obj));
 
   jsval slot;
   ASSERT_OK(JS_GetReservedSlot(cx, obj, SLOT_PROTO, &slot));
   JSObject* prototype = JSVAL_TO_OBJECT(slot);
   JS_ASSERT(prototype);
   JS_ASSERT(JS_GET_CLASS(cx, prototype) == &sCDataProtoClass);
 
   *bp = JS_FALSE;
-  if (JSVAL_IS_PRIMITIVE(v))
+  if (JSVAL_IS_PRIMITIVE(*v))
     return JS_TRUE;
 
-  JSObject* proto = JSVAL_TO_OBJECT(v);
+  JSObject* proto = JSVAL_TO_OBJECT(*v);
   while ((proto = JS_GetPrototype(cx, proto))) {
     if (proto == prototype) {
       *bp = JS_TRUE;
       break;
     }
   }
   return JS_TRUE;
 }
@@ -3679,18 +3735,18 @@ ArrayType::Getter(JSContext* cx, JSObjec
   // CData, regardless of CType.)
   JSObject* typeObj = CData::GetCType(cx, obj);
   if (CType::GetTypeCode(cx, typeObj) != TYPE_array)
     return JS_TRUE;
 
   // Convert the index to a size_t and bounds-check it.
   size_t index;
   size_t length = GetLength(cx, typeObj);
-  bool ok = jsvalToSize(cx, idval, true, &index);
-  if (!ok && JSVAL_IS_STRING(idval)) {
+  bool ok = jsidToSize(cx, idval, true, &index);
+  if (!ok && JSID_IS_STRING(idval)) {
     // String either isn't a number, or doesn't fit in size_t.
     // Chances are it's a regular property lookup, so return.
     return JS_TRUE;
   }
   if (!ok || index >= length) {
     JS_ReportError(cx, "invalid index");
     return JS_FALSE;
   }
@@ -3714,18 +3770,18 @@ ArrayType::Setter(JSContext* cx, JSObjec
   // CData, regardless of CType.)
   JSObject* typeObj = CData::GetCType(cx, obj);
   if (CType::GetTypeCode(cx, typeObj) != TYPE_array)
     return JS_TRUE;
 
   // Convert the index to a size_t and bounds-check it.
   size_t index;
   size_t length = GetLength(cx, typeObj);
-  bool ok = jsvalToSize(cx, idval, true, &index);
-  if (!ok && JSVAL_IS_STRING(idval)) {
+  bool ok = jsidToSize(cx, idval, true, &index);
+  if (!ok && JSID_IS_STRING(idval)) {
     // String either isn't a number, or doesn't fit in size_t.
     // Chances are it's a regular property lookup, so return.
     return JS_TRUE;
   }
   if (!ok || index >= length) {
     JS_ReportError(cx, "invalid index");
     return JS_FALSE;
   }
@@ -3817,17 +3873,17 @@ ExtractStructField(JSContext* cx, jsval 
     JS_ReportError(cx, "struct field descriptors require a valid name and type");
     return NULL;
   }
   JSString* name = nameVal.value().asString();
 
   // make sure we have one, and only one, property
   if (!JS_NextProperty(cx, iter, &id))
     return NULL;
-  if (!JSVAL_IS_VOID(id)) {
+  if (!JSID_IS_VOID(id)) {
     JS_ReportError(cx, "struct field descriptors must contain one property");
     return NULL;
   }
 
   js::AutoValueRooter propVal(cx);
   if (!JS_GetUCProperty(cx, obj, name->chars(), name->length(), Jsvalify(propVal.addr())))
     return NULL;
 
@@ -4231,22 +4287,21 @@ StructType::GetFieldInfo(JSContext* cx, 
   jsval slot;
   ASSERT_OK(JS_GetReservedSlot(cx, obj, SLOT_FIELDINFO, &slot));
   JS_ASSERT(!JSVAL_IS_VOID(slot) && JSVAL_TO_PRIVATE(slot));
 
   return static_cast<const FieldInfoHash*>(JSVAL_TO_PRIVATE(slot));
 }
 
 const FieldInfo*
-StructType::LookupField(JSContext* cx, JSObject* obj, jsval idval)
+StructType::LookupField(JSContext* cx, JSObject* obj, JSString *name)
 {
   JS_ASSERT(CType::IsCType(cx, obj));
   JS_ASSERT(CType::GetTypeCode(cx, obj) == TYPE_struct);
 
-  JSString* name = JSVAL_TO_STRING(idval);
   FieldInfoHash::Ptr ptr = GetFieldInfo(cx, obj)->lookup(name);
   if (ptr)
     return &ptr->value;
 
   const char* bytes = JS_GetStringBytesZ(cx, name);
   if (!bytes)
     return NULL;
 
@@ -4327,17 +4382,17 @@ StructType::FieldGetter(JSContext* cx, J
   }
 
   JSObject* typeObj = CData::GetCType(cx, obj);
   if (CType::GetTypeCode(cx, typeObj) != TYPE_struct) {
     JS_ReportError(cx, "not a StructType");
     return JS_FALSE;
   }
 
-  const FieldInfo* field = LookupField(cx, typeObj, idval);
+  const FieldInfo* field = LookupField(cx, typeObj, JSID_TO_STRING(idval));
   if (!field)
     return JS_FALSE;
 
   char* data = static_cast<char*>(CData::GetData(cx, obj)) + field->mOffset;
   return ConvertToJS(cx, field->mType, obj, data, false, false, vp);
 }
 
 JSBool
@@ -4349,17 +4404,17 @@ StructType::FieldSetter(JSContext* cx, J
   }
 
   JSObject* typeObj = CData::GetCType(cx, obj);
   if (CType::GetTypeCode(cx, typeObj) != TYPE_struct) {
     JS_ReportError(cx, "not a StructType");
     return JS_FALSE;
   }
 
-  const FieldInfo* field = LookupField(cx, typeObj, idval);
+  const FieldInfo* field = LookupField(cx, typeObj, JSID_TO_STRING(idval));
   if (!field)
     return JS_FALSE;
 
   char* data = static_cast<char*>(CData::GetData(cx, obj)) + field->mOffset;
   return ImplicitConvert(cx, *vp, field->mType, data, false, NULL);
 }
 
 JSBool
@@ -4379,17 +4434,18 @@ StructType::AddressOfField(JSContext* cx
     return JS_FALSE;
   }
 
   if (argc != 1) {
     JS_ReportError(cx, "addressOfField takes one argument");
     return JS_FALSE;
   }
 
-  const FieldInfo* field = LookupField(cx, typeObj, JS_ARGV(cx, vp)[0]);
+  const FieldInfo* field = LookupField(cx, typeObj,
+                                       JSVAL_TO_STRING(JS_ARGV(cx, vp)[0]));
   if (!field)
     return JS_FALSE;
 
   JSObject* baseType = field->mType;
   JSObject* pointerType = PointerType::CreateInternal(cx, baseType);
   if (!pointerType)
     return JS_FALSE;
   js::AutoObjectRooter root(cx, pointerType);
--- a/js/src/ctypes/CTypes.h
+++ b/js/src/ctypes/CTypes.h
@@ -443,17 +443,17 @@ namespace ArrayType {
   bool GetSafeLength(JSContext* cx, JSObject* obj, size_t* result);
   ffi_type* BuildFFIType(JSContext* cx, JSObject* obj);
 }
 
 namespace StructType {
   JSBool DefineInternal(JSContext* cx, JSObject* typeObj, JSObject* fieldsObj);
 
   const FieldInfoHash* GetFieldInfo(JSContext* cx, JSObject* obj);
-  const FieldInfo* LookupField(JSContext* cx, JSObject* obj, jsval idval);
+  const FieldInfo* LookupField(JSContext* cx, JSObject* obj, JSString *name);
   JSObject* BuildFieldsArray(JSContext* cx, JSObject* obj);
   ffi_type* BuildFFIType(JSContext* cx, JSObject* obj);
 }
 
 namespace FunctionType {
   JSObject* CreateInternal(JSContext* cx, jsval abi, jsval rtype,
     jsval* argtypes, jsuint arglen);
 
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -102,16 +102,20 @@
 using namespace js;
 
 #ifdef HAVE_VA_LIST_AS_ARRAY
 #define JS_ADDRESSOF_VA_LIST(ap) ((va_list *)(ap))
 #else
 #define JS_ADDRESSOF_VA_LIST(ap) (&(ap))
 #endif
 
+#ifdef DEBUG
+JS_PUBLIC_DATA(jsid) JSID_VOID = { (size_t)JSID_VOID_TYPE };
+#endif
+
 JS_PUBLIC_API(int64)
 JS_Now()
 {
     return PRMJ_Now();
 }
 
 JS_PUBLIC_API(jsval)
 JS_GetNaNValue(JSContext *cx)
@@ -3690,27 +3694,27 @@ JS_NextProperty(JSContext *cx, JSObject 
          * If the next property mapped by scope in the property tree ancestor
          * line is not enumerable, or it's an alias, skip it and keep on trying
          * to find an enumerable property that is still in scope.
          */
         while (sprop && (!sprop->enumerable() || sprop->isAlias()))
             sprop = sprop->parent;
 
         if (!sprop) {
-            *idp = JSID_VOID();
+            *idp = JSID_VOID;
         } else {
             iterobj->setPrivate(sprop->parent);
             *idp = sprop->id;
         }
     } else {
         /* Non-native case: use the ida enumerated when iterobj was created. */
         ida = (JSIdArray *) iterobj->getPrivate();
         JS_ASSERT(i <= ida->length);
         if (i == 0) {
-            *idp = JSID_VOID();
+            *idp = JSID_VOID;
         } else {
             *idp = ida->vector[--i];
             iterobj->setSlot(JSSLOT_ITER_INDEX, Int32Tag(i));
         }
     }
     return JS_TRUE;
 }
 
@@ -4749,16 +4753,22 @@ JS_NewStringCopyZ(JSContext *cx, const c
     if (!js)
         return NULL;
     str = js_NewString(cx, js, n);
     if (!str)
         cx->free(js);
     return str;
 }
 
+JS_PUBLIC_API(JSBool)
+JS_StringHasBeenInterned(JSString *str)
+{
+    return str->isAtomized();
+}
+
 JS_PUBLIC_API(JSString *)
 JS_InternString(JSContext *cx, const char *s)
 {
     JSAtom *atom;
 
     CHECK_REQUEST(cx);
     atom = js_Atomize(cx, s, strlen(s), ATOM_INTERNED);
     if (!atom)
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -283,16 +283,29 @@ JSID_IS_STRING(jsid id)
 
 static JS_ALWAYS_INLINE JSString *
 JSID_TO_STRING(jsid id)
 {
     JS_ASSERT(JSID_IS_STRING(id));
     return (JSString *)(JSID_BITS(id));
 }
 
+JS_PUBLIC_API(JSBool)
+JS_StringHasBeenInterned(JSString *str);
+
+static JS_ALWAYS_INLINE jsid
+INTERNED_STRING_TO_JSID(JSString *str)
+{
+    jsid id;
+    JS_ASSERT(JS_StringHasBeenInterned(str));
+    JS_ASSERT(((size_t)str & JSID_TYPE_MASK) == 0);
+    JSID_BITS(id) = (size_t)str;
+    return id;
+}
+
 static JS_ALWAYS_INLINE JSBool
 JSID_IS_INT(jsid id)
 {
     return !!(JSID_BITS(id) & JSID_INT_TYPE);
 }
 
 static JS_ALWAYS_INLINE int32
 JSID_TO_INT(jsid id)
@@ -309,18 +322,18 @@ INT_FITS_IN_JSID(int32 i)
 {
     return ((jsuint)(i) - (jsuint)JSID_INT_MIN <=
             (jsuint)(JSID_INT_MAX - JSID_INT_MIN));
 }
 
 static JS_ALWAYS_INLINE jsid
 INT_TO_JSID(int32 i)
 {
+    jsid id;
     JS_ASSERT(INT_FITS_IN_JSID(i));
-    jsid id;
     JSID_BITS(id) = ((i << 1) | JSID_INT_TYPE);
     return id;
 }
 
 static JS_ALWAYS_INLINE JSBool
 JSID_IS_OBJECT(jsid id)
 {
     return (JSID_BITS(id) & JSID_TYPE_MASK) == JSID_OBJECT_TYPE;
@@ -331,19 +344,19 @@ JSID_TO_OBJECT(jsid id)
 {
     JS_ASSERT(JSID_IS_OBJECT(id));
     return (JSObject *)(JSID_BITS(id) & ~(size_t)JSID_TYPE_MASK);
 }
 
 static JS_ALWAYS_INLINE jsid
 OBJECT_TO_JSID(JSObject *obj)
 {
+    jsid id;
     JS_ASSERT(obj != NULL);
     JS_ASSERT(((size_t)obj & JSID_TYPE_MASK) == 0);
-    jsid id;
     JSID_BITS(id) = ((size_t)obj | JSID_OBJECT_TYPE);
     return id;
 }
 
 static JS_ALWAYS_INLINE JSBool
 JSID_IS_GCTHING(jsid id)
 {
     return JSID_IS_STRING(id) || JSID_IS_OBJECT(id);
@@ -384,24 +397,41 @@ JSID_DEFAULT_XML_NAMESPACE()
 static JS_ALWAYS_INLINE JSBool
 JSID_IS_VOID(jsid id)
 {
     JS_ASSERT_IF(((size_t)JSID_BITS(id) & JSID_TYPE_MASK) == JSID_VOID_TYPE,
                  JSID_BITS(id) == JSID_VOID_TYPE);
     return ((size_t)JSID_BITS(id) == JSID_VOID_TYPE);
 }
 
-static JS_ALWAYS_INLINE jsid
-JSID_VOID()
+/* TODO: explain the debug-only use of struct jsid */
+#ifdef DEBUG
+extern JS_PUBLIC_DATA(jsid) JSID_VOID;
+#else
+# define JSID_VOID  ((jsid)JSID_VOID_TYPE)
+#endif
+
+#if defined(DEBUG) && defined(__cplusplus)
+/*
+ * Internally we can use C++ to allow jsids, which are structs in debug builds,
+ * to be compared with ==.
+ */
+static JS_ALWAYS_INLINE bool
+operator==(jsid lhs, jsid rhs)
 {
-    jsid id;
-    JSID_BITS(id) = JSID_VOID_TYPE;
-    return id;
+    return JSID_BITS(lhs) == JSID_BITS(rhs);
 }
 
+static JS_ALWAYS_INLINE bool
+operator!=(jsid lhs, jsid rhs)
+{
+    return JSID_BITS(lhs) != JSID_BITS(rhs);
+}
+#endif
+
 /************************************************************************/
 
 /* Lock and unlock the GC thing held by a jsval. */
 #define JSVAL_LOCK(cx,v)        (JSVAL_IS_GCTHING(v)                          \
                                  ? JS_LockGCThing(cx, JSVAL_TO_GCTHING(v))    \
                                  : JS_TRUE)
 #define JSVAL_UNLOCK(cx,v)      (JSVAL_IS_GCTHING(v)                          \
                                  ? JS_UnlockGCThing(cx, JSVAL_TO_GCTHING(v))  \
--- a/js/src/jsarray.cpp
+++ b/js/src/jsarray.cpp
@@ -296,17 +296,17 @@ BigIndexToId(JSContext *cx, JSObject *ob
      * in any case.
      */
     if (!createAtom &&
         ((clasp = obj->getClass()) == &js_SlowArrayClass ||
          clasp == &js_ArgumentsClass ||
          clasp == &js_ObjectClass)) {
         atom = js_GetExistingStringAtom(cx, start, JS_ARRAY_END(buf) - start);
         if (!atom) {
-            *idp = JSID_VOID();
+            *idp = JSID_VOID;
             return JS_TRUE;
         }
     } else {
         atom = js_AtomizeChars(cx, start, JS_ARRAY_END(buf) - start, 0);
         if (!atom)
             return JS_FALSE;
     }
 
--- a/js/src/jsatom.h
+++ b/js/src/jsatom.h
@@ -113,28 +113,16 @@ IdToValue(jsid id)
 static JS_ALWAYS_INLINE jsval
 IdToJsval(jsid id)
 {
     return Jsvalify(IdToValue(id));
 }
 
 }
 
-#ifdef DEBUG
-/*
- * Internally we can use C++ to allow jsids, which are structs in debug builds,
- * to be compared with ==.
- */
-static JS_ALWAYS_INLINE bool
-operator==(jsid lhs, jsid rhs)
-{
-    return JSID_BITS(lhs) == JSID_BITS(rhs);
-}
-#endif
-
 #if JS_BYTES_PER_WORD == 4
 # define ATOM_HASH(atom)          ((JSHashNumber)(atom) >> 2)
 #elif JS_BYTES_PER_WORD == 8
 # define ATOM_HASH(atom)          (((JSHashNumber)(jsuword)(atom) >> 3) ^     \
                                    (JSHashNumber)((jsuword)(atom) >> 32))
 #else
 # error "Unsupported configuration"
 #endif
--- a/js/src/jsobj.h
+++ b/js/src/jsobj.h
@@ -1335,17 +1335,17 @@ js_GetWrappedObject(JSContext *cx, JSObj
 extern const char *
 js_ComputeFilename(JSContext *cx, JSStackFrame *caller,
                    JSPrincipals *principals, uintN *linenop);
 
 extern JSBool
 js_ReportGetterOnlyAssignment(JSContext *cx);
 
 extern JS_FRIEND_API(JSBool)
-js_GetterOnlyPropertyStub(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
+js_GetterOnlyPropertyStub(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
 
 #ifdef DEBUG
 namespace js {
 JS_FRIEND_API(void) DumpChars(const jschar *s, size_t n);
 JS_FRIEND_API(void) DumpString(JSString *str);
 JS_FRIEND_API(void) DumpAtom(JSAtom *atom);
 JS_FRIEND_API(void) DumpObject(JSObject *obj);
 JS_FRIEND_API(void) DumpValue(const js::Value &val);
--- a/js/src/jsops.cpp
+++ b/js/src/jsops.cpp
@@ -1328,17 +1328,17 @@ BEGIN_CASE(JSOP_INCELEM)
 BEGIN_CASE(JSOP_DECELEM)
 BEGIN_CASE(JSOP_ELEMINC)
 BEGIN_CASE(JSOP_ELEMDEC)
 
     /*
      * Delay fetching of id until we have the object to ensure the proper
      * evaluation order. See bug 372331.
      */
-    id = JSID_VOID();
+    id = JSID_VOID;
     i = -2;
     goto fetch_incop_obj;
 
 BEGIN_CASE(JSOP_INCPROP)
 BEGIN_CASE(JSOP_DECPROP)
 BEGIN_CASE(JSOP_PROPINC)
 BEGIN_CASE(JSOP_PROPDEC)
     LOAD_ATOM(0, atom);
@@ -3428,17 +3428,17 @@ BEGIN_CASE(JSOP_SETTER)
         LOAD_ATOM(0, atom);
         id = ATOM_TO_JSID(atom);
         rval = regs.sp[-1];
         i = -1;
         goto gs_pop_lval;
       }
       case JSOP_SETELEM:
         rval = regs.sp[-1];
-        id = JSID_VOID();
+        id = JSID_VOID;
         i = -2;
       gs_pop_lval:
         FETCH_OBJECT(cx, i - 1, obj);
         break;
 
       case JSOP_INITPROP:
       {
         JS_ASSERT(regs.sp - fp->base() >= 2);
@@ -3449,17 +3449,17 @@ BEGIN_CASE(JSOP_SETTER)
         id = ATOM_TO_JSID(atom);
         goto gs_get_lval;
       }
       default:
         JS_ASSERT(op2 == JSOP_INITELEM);
 
         JS_ASSERT(regs.sp - fp->base() >= 3);
         rval = regs.sp[-1];
-        id = JSID_VOID();
+        id = JSID_VOID;
         i = -2;
       gs_get_lval:
       {
         const Value &lref = regs.sp[i-1];
         JS_ASSERT(lref.isObject());
         obj = &lref.asObject();
         break;
       }
--- a/js/src/jspubtd.h
+++ b/js/src/jspubtd.h
@@ -188,19 +188,24 @@ typedef enum JSValueMask16
      * are uint16 in GCC.
      */
     JSVAL_NANBOX_PATTERN   = ((uint16)0xFFFF)
 }
 # if defined(__GNUC__)
 __attribute__((packed))
 # endif
 JSValueMask16;
+
 #else  /* defined(__cplusplus) || !defined(_MSC_VER) */
-// We need this C API for MSVC, because MSVC doesn't allow us to
-// make a 16-bit enum in C.
+
+/*
+ * We need this C API for MSVC, because MSVC doesn't allow us to
+ * make a 16-bit enum in C.
+ */
+
 typedef uint16 JSValueMask16;
 
 #define JSVAL_MASK16_NULL      ((uint16)0x0001)
 #define JSVAL_MASK16_UNDEFINED ((uint16)0x0002)
 #define JSVAL_MASK16_INT32     ((uint16)0x0004)
 #define JSVAL_MASK16_STRING    ((uint16)0x0008)
 #define JSVAL_MASK16_NONFUNOBJ ((uint16)0x0010)
 #define JSVAL_MASK16_FUNOBJ    ((uint16)0x0020)
--- a/js/src/jsscope.h
+++ b/js/src/jsscope.h
@@ -618,17 +618,17 @@ struct JSScopeProperty {
                                            if sprop->isMethod() */
         JSObject        *setterObj;     /* user-defined callable "set" object or
                                            null if sprop->hasSetterValue() */
         JSScopeProperty **prevp;        /* pointer to previous node's next, or
                                            pointer to head of freelist */
     };
 
     void insertFree(JSScopeProperty *&list) {
-        id = JSID_VOID();
+        id = JSID_VOID;
         next = list;
         prevp = &list;
         if (list)
             list->prevp = &next;
         list = this;
     }
 
     void removeFree() {
--- a/js/src/jsxml.cpp
+++ b/js/src/jsxml.cpp
@@ -2747,26 +2747,26 @@ IsFunctionQName(JSContext *cx, JSObject 
 
     atom = cx->runtime->atomState.lazy.functionNamespaceURIAtom;
     uri = GetURI(qn);
     if (uri && atom &&
         (uri == ATOM_TO_STRING(atom) ||
          js_EqualStrings(uri, ATOM_TO_STRING(atom)))) {
         return JS_ValueToId(cx, STRING_TO_JSVAL(GetLocalName(qn)), funidp);
     }
-    *funidp = JSID_VOID();
+    *funidp = JSID_VOID;
     return JS_TRUE;
 }
 
 JSBool
 js_IsFunctionQName(JSContext *cx, JSObject *obj, jsid *funidp)
 {
     if (obj->getClass() == &js_QNameClass.base)
         return IsFunctionQName(cx, obj, funidp);
-    *funidp = JSID_VOID();
+    *funidp = JSID_VOID;
     return JS_TRUE;
 }
 
 static JSObject *
 ToXMLName(JSContext *cx, jsval v, jsid *funidp)
 {
     JSAtom *atomizedName;
     JSString *name;
@@ -2814,17 +2814,17 @@ ToXMLName(JSContext *cx, jsval v, jsid *
      */
     if (js_IdIsIndex(ATOM_TO_JSID(atomizedName), &index))
         goto bad;
 
     if (*name->chars() == '@') {
         name = js_NewDependentString(cx, name, 1, name->length() - 1);
         if (!name)
             return NULL;
-        *funidp = JSID_VOID();
+        *funidp = JSID_VOID;
         return ToAttributeName(cx, STRING_TO_JSVAL(name));
     }
 
 construct:
     v = STRING_TO_JSVAL(name);
     obj = js_ConstructObject(cx, &js_QNameClass.base, NULL, NULL, 1, Valueify(&v));
     if (!obj)
         return NULL;
@@ -4277,17 +4277,17 @@ PutProperty(JSContext *cx, JSObject *obj
 
         /* 8-9. */
         if (!js_IsXMLName(cx, OBJECT_TO_JSVAL(nameobj)) &&
             !IS_STAR(GetLocalName(nameqn))) {
             goto out;
         }
 
         /* 10-11. */
-        id = JSID_VOID();
+        id = JSID_VOID;
         primitiveAssign = !vxml && !IS_STAR(GetLocalName(nameqn));
 
         /* 12. */
         k = n = xml->xml_kids.length;
         matchIndex = XML_NOT_FOUND;
         kid2 = NULL;
         while (k != 0) {
             --k;
--- a/js/src/xpconnect/idl/nsIXPCScriptable.idl
+++ b/js/src/xpconnect/idl/nsIXPCScriptable.idl
@@ -117,55 +117,55 @@ interface nsIXPCScriptable : nsISupports
 
     void   create(in nsIXPConnectWrappedNative wrapper,
                   in JSContextPtr cx, in JSObjectPtr obj);
 
     void   postCreate(in nsIXPConnectWrappedNative wrapper,
                       in JSContextPtr cx, in JSObjectPtr obj);
 
     PRBool addProperty(in nsIXPConnectWrappedNative wrapper,
-                       in JSContextPtr cx, in JSObjectPtr obj, in jsval id,
+                       in JSContextPtr cx, in JSObjectPtr obj, in jsid id,
                        in JSValPtr vp);
 
     PRBool delProperty(in nsIXPConnectWrappedNative wrapper,
-                       in JSContextPtr cx, in JSObjectPtr obj, in jsval id,
+                       in JSContextPtr cx, in JSObjectPtr obj, in jsid id,
                        in JSValPtr vp);
 
     // The returnCode should be set to NS_SUCCESS_I_DID_SOMETHING if
     // this method does something.
     PRBool getProperty(in nsIXPConnectWrappedNative wrapper,
-                       in JSContextPtr cx, in JSObjectPtr obj, in jsval id,
+                       in JSContextPtr cx, in JSObjectPtr obj, in jsid id,
                        in JSValPtr vp);
 
     // The returnCode should be set to NS_SUCCESS_I_DID_SOMETHING if
     // this method does something.
     PRBool setProperty(in nsIXPConnectWrappedNative wrapper,
-                       in JSContextPtr cx, in JSObjectPtr obj, in jsval id,
+                       in JSContextPtr cx, in JSObjectPtr obj, in jsid id,
                        in JSValPtr vp);
 
     PRBool enumerate(in nsIXPConnectWrappedNative wrapper,
                      in JSContextPtr cx, in JSObjectPtr obj);
 
     PRBool newEnumerate(in nsIXPConnectWrappedNative wrapper,
                         in JSContextPtr cx, in JSObjectPtr obj,
-                        in PRUint32 enum_op, in JSValPtr statep, out JSID idp);
+                        in PRUint32 enum_op, in JSValPtr statep, out jsid idp);
 
     PRBool newResolve(in nsIXPConnectWrappedNative wrapper,
-                      in JSContextPtr cx, in JSObjectPtr obj, in jsval id,
+                      in JSContextPtr cx, in JSObjectPtr obj, in jsid id,
                       in PRUint32 flags, out JSObjectPtr objp);
 
     PRBool convert(in nsIXPConnectWrappedNative wrapper,
                    in JSContextPtr cx, in JSObjectPtr obj,
                    in PRUint32 type, in JSValPtr vp);
 
     void   finalize(in nsIXPConnectWrappedNative wrapper,
                     in JSContextPtr cx, in JSObjectPtr obj);
 
     PRBool checkAccess(in nsIXPConnectWrappedNative wrapper,
-                       in JSContextPtr cx, in JSObjectPtr obj, in jsval id,
+                       in JSContextPtr cx, in JSObjectPtr obj, in jsid id,
                        in PRUint32 mode, in JSValPtr vp);
 
     PRBool call(in nsIXPConnectWrappedNative wrapper,
                 in JSContextPtr cx, in JSObjectPtr obj,
                 in PRUint32 argc, in JSValPtr argv, in JSValPtr vp);
 
     PRBool construct(in nsIXPConnectWrappedNative wrapper,
                      in JSContextPtr cx, in JSObjectPtr obj,
--- a/js/src/xpconnect/idl/nsIXPCSecurityManager.idl
+++ b/js/src/xpconnect/idl/nsIXPCSecurityManager.idl
@@ -103,11 +103,11 @@ interface nsIXPCSecurityManager : nsISup
     const PRUint32 ACCESS_SET_PROPERTY = 2;
 
     void CanAccess(in PRUint32 aAction,
                    in nsAXPCNativeCallContextPtr aCallContext,
                    in JSContextPtr aJSContext,
                    in JSObjectPtr aJSObject,
                    in nsISupports aObj,
                    in nsIClassInfo aClassInfo,
-                   in jsval aName,
+                   in jsid aName,
                    inout voidPtr aPolicy);
 };
--- a/js/src/xpconnect/idl/nsIXPConnect.idl
+++ b/js/src/xpconnect/idl/nsIXPConnect.idl
@@ -54,25 +54,25 @@
 %{ C++
 #include "jspubtd.h"
 #include "xptinfo.h"
 #include "nsAXPCNativeCallContext.h"
 %}
 
 /***************************************************************************/
 
-// NB: jsval is declared in nsIVariant.idl
+// NB: jsval and jsid are declared in nsIVariant.idl
 
 [ptr] native JSContextPtr(JSContext);
 [ptr] native JSClassPtr(JSClass);
 [ptr] native JSObjectPtr(JSObject);
 [ptr] native JSValPtr(jsval);
+[ptr] native JSValConstPtr(const jsval);
       native JSPropertyOp(JSPropertyOp);
       native JSEqualityOp(JSEqualityOp);
-      native JSID(jsid);
 [ptr] native voidPtrPtr(void*);
 [ptr] native nsScriptObjectTracerPtr(nsScriptObjectTracer);
 [ref] native nsCCTraversalCallbackRef(nsCycleCollectionTraversalCallback);
 [ptr] native nsAXPCNativeCallContextPtr(nsAXPCNativeCallContext);
 
 /***************************************************************************/
 
 %{ C++
@@ -175,18 +175,18 @@ interface nsIXPConnectWrappedNative : ns
     readonly attribute nsISupports      Native;
     readonly attribute JSObjectPtr      JSObjectPrototype;
 
     /**
      * These are here as an aid to nsIXPCScriptable implementors
      */
 
     readonly attribute nsIXPConnect XPConnect;
-    nsIInterfaceInfo FindInterfaceWithMember(in jsval nameID);
-    nsIInterfaceInfo FindInterfaceWithName(in jsval nameID);
+    nsIInterfaceInfo FindInterfaceWithMember(in jsid nameID);
+    nsIInterfaceInfo FindInterfaceWithName(in jsid nameID);
 
     void debugDump(in short depth);
 
     void refreshPrototype();
     /* 
      * This returns a pointer into the instance and care should be taken
      * to make sure the pointer is not kept past the life time of the
      * object it points into.
--- a/js/src/xpconnect/public/xpc_map_end.h
+++ b/js/src/xpconnect/public/xpc_map_end.h
@@ -143,62 +143,62 @@ NS_IMETHODIMP XPC_MAP_CLASSNAME::Create(
 #endif
 
 #ifndef XPC_MAP_WANT_POSTCREATE
 NS_IMETHODIMP XPC_MAP_CLASSNAME::PostCreate(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj)
     {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
 #endif
 
 #ifndef XPC_MAP_WANT_ADDPROPERTY
-NS_IMETHODIMP XPC_MAP_CLASSNAME::AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, jsval id, jsval * vp, PRBool *_retval)
+NS_IMETHODIMP XPC_MAP_CLASSNAME::AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, jsid id, jsval * vp, PRBool *_retval)
     {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
 #endif
 
 #ifndef XPC_MAP_WANT_DELPROPERTY
-NS_IMETHODIMP XPC_MAP_CLASSNAME::DelProperty(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, jsval id, jsval * vp, PRBool *_retval)
+NS_IMETHODIMP XPC_MAP_CLASSNAME::DelProperty(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, jsid id, jsval * vp, PRBool *_retval)
     {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
 #endif
 
 #ifndef XPC_MAP_WANT_GETPROPERTY
-NS_IMETHODIMP XPC_MAP_CLASSNAME::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, jsval id, jsval * vp, PRBool *_retval)
+NS_IMETHODIMP XPC_MAP_CLASSNAME::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, jsid id, jsval * vp, PRBool *_retval)
     {NS_WARNING("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
 #endif
 
 #ifndef XPC_MAP_WANT_SETPROPERTY
-NS_IMETHODIMP XPC_MAP_CLASSNAME::SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, jsval id, jsval * vp, PRBool *_retval)
+NS_IMETHODIMP XPC_MAP_CLASSNAME::SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, jsid id, jsval * vp, PRBool *_retval)
     {NS_WARNING("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
 #endif
 
 #ifndef XPC_MAP_WANT_NEWENUMERATE
 NS_IMETHODIMP XPC_MAP_CLASSNAME::NewEnumerate(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, PRUint32 enum_op, jsval * statep, jsid * idp, PRBool *_retval)
     {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
 #endif
 
 #ifndef XPC_MAP_WANT_ENUMERATE
 NS_IMETHODIMP XPC_MAP_CLASSNAME::Enumerate(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, PRBool *_retval)
     {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
 #endif
 
 #ifndef XPC_MAP_WANT_NEWRESOLVE
-NS_IMETHODIMP XPC_MAP_CLASSNAME::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, jsval id, PRUint32 flags, JSObject * *objp, PRBool *_retval)
+NS_IMETHODIMP XPC_MAP_CLASSNAME::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, jsid id, PRUint32 flags, JSObject * *objp, PRBool *_retval)
     {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
 #endif
 
 #ifndef XPC_MAP_WANT_CONVERT
 NS_IMETHODIMP XPC_MAP_CLASSNAME::Convert(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, PRUint32 type, jsval * vp, PRBool *_retval)
     {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
 #endif
 
 #ifndef XPC_MAP_WANT_FINALIZE
 NS_IMETHODIMP XPC_MAP_CLASSNAME::Finalize(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj)
     {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
 #endif
 
 #ifndef XPC_MAP_WANT_CHECKACCESS
-NS_IMETHODIMP XPC_MAP_CLASSNAME::CheckAccess(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, jsval id, PRUint32 mode, jsval * vp, PRBool *_retval)
+NS_IMETHODIMP XPC_MAP_CLASSNAME::CheckAccess(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, jsid id, PRUint32 mode, jsval * vp, PRBool *_retval)
     {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
 #endif
 
 #ifndef XPC_MAP_WANT_CALL
 NS_IMETHODIMP XPC_MAP_CLASSNAME::Call(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, PRUint32 argc, jsval * argv, jsval * vp, PRBool *_retval)
     {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
 #endif
 
--- a/js/src/xpconnect/shell/xpcshell.cpp
+++ b/js/src/xpconnect/shell/xpcshell.cpp
@@ -152,17 +152,17 @@ int gExitCode = 0;
 JSBool gQuitting = JS_FALSE;
 static JSBool reportWarnings = JS_TRUE;
 static JSBool compileOnly = JS_FALSE;
 
 JSPrincipals *gJSPrincipals = nsnull;
 nsAutoString *gWorkingDirectory = nsnull;
 
 static JSBool
-GetLocationProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+GetLocationProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
 #if (!defined(XP_WIN) && !defined(XP_UNIX)) || defined(WINCE)
     //XXX: your platform should really implement this
     return JS_FALSE;
 #else
     JSStackFrame *fp = JS_GetScriptedCaller(cx, NULL);
     JSScript *script = JS_GetFrameScript(cx, fp);
     const char *filename = JS_GetScriptFilename(cx, script);
@@ -812,25 +812,29 @@ static JSFunctionSpec glob_functions[] =
 
 JSClass global_class = {
     "global", 0,
     JS_PropertyStub,  JS_PropertyStub,  JS_PropertyStub,  JS_PropertyStub,
     JS_EnumerateStub, JS_ResolveStub,   JS_ConvertStub,   nsnull
 };
 
 static JSBool
-env_setProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+env_setProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
 /* XXX porting may be easy, but these don't seem to supply setenv by default */
 #if !defined XP_BEOS && !defined XP_OS2 && !defined SOLARIS
     JSString *idstr, *valstr;
     const char *name, *value;
     int rv;
 
-    idstr = JS_ValueToString(cx, id);
+    jsval idval;
+    if (!JS_IdToValue(cx, id, &idval))
+        return JS_FALSE;
+    
+    idstr = JS_ValueToString(cx, idval);
     valstr = JS_ValueToString(cx, *vp);
     if (!idstr || !valstr)
         return JS_FALSE;
     name = JS_GetStringBytes(idstr);
     value = JS_GetStringBytes(valstr);
 #if defined XP_WIN || defined HPUX || defined OSF1 || defined IRIX \
     || defined SCO
     {
@@ -891,26 +895,30 @@ env_enumerate(JSContext *cx, JSObject *o
             return JS_FALSE;
     }
 
     reflected = JS_TRUE;
     return JS_TRUE;
 }
 
 static JSBool
-env_resolve(JSContext *cx, JSObject *obj, jsval id, uintN flags,
+env_resolve(JSContext *cx, JSObject *obj, jsid id, uintN flags,
             JSObject **objp)
 {
     JSString *idstr, *valstr;
     const char *name, *value;
 
     if (flags & JSRESOLVE_ASSIGNING)
         return JS_TRUE;
 
-    idstr = JS_ValueToString(cx, id);
+    jsval idval;
+    if (!JS_IdToValue(cx, id, &idval))
+        return JS_FALSE;
+
+    idstr = JS_ValueToString(cx, idval);
     if (!idstr)
         return JS_FALSE;
     name = JS_GetStringBytes(idstr);
     value = getenv(name);
     if (value) {
         valstr = JS_NewStringCopyZ(cx, value);
         if (!valstr)
             return JS_FALSE;
@@ -1323,27 +1331,27 @@ FullTrustSecMan::CanGetService(JSContext
 
 #ifndef XPCONNECT_STANDALONE
 /* void CanAccess (in PRUint32 aAction, in nsIXPCNativeCallContext aCallContext, in JSContextPtr aJSContext, in JSObjectPtr aJSObject, in nsISupports aObj, in nsIClassInfo aClassInfo, in jsval aName, inout voidPtr aPolicy); */
 NS_IMETHODIMP
 FullTrustSecMan::CanAccess(PRUint32 aAction,
                            nsAXPCNativeCallContext *aCallContext,
                            JSContext * aJSContext, JSObject * aJSObject,
                            nsISupports *aObj, nsIClassInfo *aClassInfo,
-                           jsval aName, void * *aPolicy)
+                           jsid aName, void * *aPolicy)
 {
     return NS_OK;
 }
 
-/* [noscript] void checkPropertyAccess (in JSContextPtr aJSContext, in JSObjectPtr aJSObject, in string aClassName, in jsval aProperty, in PRUint32 aAction); */
+/* [noscript] void checkPropertyAccess (in JSContextPtr aJSContext, in JSObjectPtr aJSObject, in string aClassName, in jsid aProperty, in PRUint32 aAction); */
 NS_IMETHODIMP
 FullTrustSecMan::CheckPropertyAccess(JSContext * aJSContext,
                                      JSObject * aJSObject,
                                      const char *aClassName,
-                                     jsval aProperty, PRUint32 aAction)
+                                     jsid aProperty, PRUint32 aAction)
 {
     return NS_OK;
 }
 
 /* [noscript] void checkLoadURIFromScript (in JSContextPtr cx, in nsIURI uri); */
 NS_IMETHODIMP
 FullTrustSecMan::CheckLoadURIFromScript(JSContext * cx, nsIURI *uri)
 {
--- a/js/src/xpconnect/src/XPCChromeObjectWrapper.cpp
+++ b/js/src/xpconnect/src/XPCChromeObjectWrapper.cpp
@@ -205,43 +205,43 @@ CanTouchProperty(JSContext *cx, JSObject
               (JSVAL_TO_INT(allowedval) & wanted) != 0;
 
   return JS_TRUE;
 }
 
 }
 
 static JSBool
-XPC_COW_AddProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
+XPC_COW_AddProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
 
 static JSBool
-XPC_COW_DelProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
+XPC_COW_DelProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
 
 static JSBool
-XPC_COW_GetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
+XPC_COW_GetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
 
 static JSBool
-XPC_COW_SetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
+XPC_COW_SetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
 
 static JSBool
 XPC_COW_Enumerate(JSContext *cx, JSObject *obj);
 
 static JSBool
-XPC_COW_NewResolve(JSContext *cx, JSObject *obj, jsval id, uintN flags,
+XPC_COW_NewResolve(JSContext *cx, JSObject *obj, jsid id, uintN flags,
                    JSObject **objp);
 
 static JSBool
 XPC_COW_Convert(JSContext *cx, JSObject *obj, JSType type, jsval *vp);
 
 static JSBool
-XPC_COW_CheckAccess(JSContext *cx, JSObject *obj, jsval id, JSAccessMode mode,
+XPC_COW_CheckAccess(JSContext *cx, JSObject *obj, jsid id, JSAccessMode mode,
                     jsval *vp);
 
 static JSBool
-XPC_COW_Equality(JSContext *cx, JSObject *obj, jsval v, JSBool *bp);
+XPC_COW_Equality(JSContext *cx, JSObject *obj, const jsval *valp, JSBool *bp);
 
 static JSObject *
 XPC_COW_Iterator(JSContext *cx, JSObject *obj, JSBool keysonly);
 
 static JSObject *
 XPC_COW_WrappedObject(JSContext *cx, JSObject *obj);
 
 static JSBool
@@ -468,27 +468,27 @@ RewrapForContent(JSContext *cx, JSObject
     return JS_FALSE;
   }
 
   return RewrapObject(cx, JS_GetGlobalForObject(cx, scope),
                       JSVAL_TO_OBJECT(v), COW, vp);
 }
 
 static JSBool
-CheckSOW(JSContext *cx, JSObject *wrapperObj, jsval idval)
+CheckSOW(JSContext *cx, JSObject *wrapperObj, jsid id)
 {
   jsval flags;
   JS_GetReservedSlot(cx, wrapperObj, sFlagsSlot, &flags);
 
   return HAS_FLAGS(flags, FLAG_SOW)
-         ? SystemOnlyWrapper::AllowedToAct(cx, idval) : JS_TRUE;
+         ? SystemOnlyWrapper::AllowedToAct(cx, id) : JS_TRUE;
 }
 
 static JSBool
-XPC_COW_AddProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+XPC_COW_AddProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
   obj = GetWrapper(obj);
   jsval flags;
   if (!JS_GetReservedSlot(cx, obj, XPCWrapper::sFlagsSlot, &flags)) {
     return JS_FALSE;
   }
 
   if (HAS_FLAGS(flags, FLAG_RESOLVING)) {
@@ -502,74 +502,70 @@ XPC_COW_AddProperty(JSContext *cx, JSObj
 
   // Someone's adding a property to us. We need to protect ourselves from
   // getters and setters.
   JSObject *wrappedObj = GetWrappedObject(cx, obj);
   if (!wrappedObj) {
     return ThrowException(NS_ERROR_ILLEGAL_VALUE, cx);
   }
 
-  jsid interned_id;
   JSPropertyDescriptor desc;
 
-  if (!JS_ValueToId(cx, id, &interned_id) ||
-      !XPCWrapper::GetPropertyAttrs(cx, obj, interned_id, JSRESOLVE_QUALIFIED,
+  if (!XPCWrapper::GetPropertyAttrs(cx, obj, id, JSRESOLVE_QUALIFIED,
                                     JS_TRUE, &desc)) {
     return JS_FALSE;
   }
 
   NS_ASSERTION(desc.obj == obj, "The JS engine lies!");
 
   if (desc.attrs & (JSPROP_GETTER | JSPROP_SETTER)) {
     // Only chrome is allowed to add getters or setters to our object.
     // NB: We don't have to do this check again if we're already FLAG_SOW'd.
     if (!HAS_FLAGS(flags, FLAG_SOW) && !SystemOnlyWrapper::AllowedToAct(cx, id)) {
       return JS_FALSE;
     }
   }
 
   return RewrapForChrome(cx, obj, vp) &&
-         JS_DefinePropertyById(cx, wrappedObj, interned_id, *vp,
+         JS_DefinePropertyById(cx, wrappedObj, id, *vp,
                                desc.getter, desc.setter, desc.attrs);
 }
 
 static JSBool
-XPC_COW_DelProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+XPC_COW_DelProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
   if (!CheckSOW(cx, obj, id)) {
     return JS_FALSE;
   }
 
   JSObject *wrappedObj = GetWrappedObject(cx, obj);
   if (!wrappedObj) {
     return ThrowException(NS_ERROR_ILLEGAL_VALUE, cx);
   }
 
   XPCCallContext ccx(JS_CALLER, cx);
   if (!ccx.IsValid()) {
     return ThrowException(NS_ERROR_FAILURE, cx);
   }
 
   JSBool canTouch;
-  jsid interned_id;
-  if (!JS_ValueToId(cx, id, &interned_id) ||
-      !CanTouchProperty(cx, obj, interned_id, JS_TRUE, &canTouch)) {
+  if (!CanTouchProperty(cx, obj, id, JS_TRUE, &canTouch)) {
     return JS_FALSE;
   }
 
   if (!canTouch) {
     return ThrowException(NS_ERROR_XPC_SECURITY_MANAGER_VETO, cx);
   }
 
   // Deleting a property is safe.
   return XPCWrapper::DelProperty(cx, wrappedObj, id, vp);
 }
 
 static JSBool
-XPC_COW_GetOrSetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp,
+XPC_COW_GetOrSetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp,
                          JSBool isSet)
 {
   obj = GetWrapper(obj);
   if (!obj) {
     return ThrowException(NS_ERROR_ILLEGAL_VALUE, cx);
   }
 
   XPCCallContext ccx(JS_CALLER, cx);
@@ -583,110 +579,102 @@ XPC_COW_GetOrSetProperty(JSContext *cx, 
 
   AUTO_MARK_JSVAL(ccx, vp);
 
   JSObject *wrappedObj = GetWrappedObject(cx, obj);
   if (!wrappedObj) {
     return ThrowException(NS_ERROR_ILLEGAL_VALUE, cx);
   }
 
-  jsid interned_id;
-  if (!JS_ValueToId(cx, id, &interned_id)) {
-    return JS_FALSE;
-  }
-
-  if (interned_id == GetRTIdByIndex(cx, XPCJSRuntime::IDX_PROTO) ||
-      interned_id == GetRTIdByIndex(cx, XPCJSRuntime::IDX_EXPOSEDPROPS)) {
+  if (id == GetRTIdByIndex(cx, XPCJSRuntime::IDX_PROTO) ||
+      id == GetRTIdByIndex(cx, XPCJSRuntime::IDX_EXPOSEDPROPS)) {
     // No getting or setting __proto__ on my object.
     return ThrowException(NS_ERROR_INVALID_ARG, cx); // XXX better error message
   }
 
   JSBool canTouch;
-  if (!CanTouchProperty(cx, obj, interned_id, isSet, &canTouch)) {
+  if (!CanTouchProperty(cx, obj, id, isSet, &canTouch)) {
     return JS_FALSE;
   }
 
   if (!canTouch) {
     return ThrowException(NS_ERROR_XPC_SECURITY_MANAGER_VETO, cx);
   }
 
   if (isSet && !RewrapForChrome(cx, obj, vp)) {
     return JS_FALSE;
   }
 
-  JSBool ok = isSet
-              ? JS_SetPropertyById(cx, wrappedObj, interned_id, vp)
-              : JS_GetPropertyById(cx, wrappedObj, interned_id, vp);
+  JSBool ok = isSet ? JS_SetPropertyById(cx, wrappedObj, id, vp)
+                    : JS_GetPropertyById(cx, wrappedObj, id, vp);
   if (!ok) {
     return JS_FALSE;
   }
 
   return RewrapForContent(cx, obj, vp);
 }
 
 static JSBool
-XPC_COW_GetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+XPC_COW_GetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
   return XPC_COW_GetOrSetProperty(cx, obj, id, vp, JS_FALSE);
 }
 
 static JSBool
-XPC_COW_SetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+XPC_COW_SetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
   return XPC_COW_GetOrSetProperty(cx, obj, id, vp, JS_TRUE);
 }
 
 static JSBool
 XPC_COW_Enumerate(JSContext *cx, JSObject *obj)
 {
   obj = GetWrapper(obj);
   JSObject *wrappedObj = GetWrappedObject(cx, obj);
   if (!wrappedObj) {
     // Nothing to enumerate.
     return JS_TRUE;
   }
 
-  if (!CheckSOW(cx, obj, JSVAL_VOID)) {
+  if (!CheckSOW(cx, obj, JSID_VOID)) {
     return JS_FALSE;
   }
 
   XPCCallContext ccx(JS_CALLER, cx);
   if (!ccx.IsValid()) {
     return ThrowException(NS_ERROR_FAILURE, cx);
   }
 
   return XPCWrapper::Enumerate(cx, obj, wrappedObj);
 }
 
 static JSBool
-XPC_COW_NewResolve(JSContext *cx, JSObject *obj, jsval idval, uintN flags,
+XPC_COW_NewResolve(JSContext *cx, JSObject *obj, jsid id, uintN flags,
                    JSObject **objp)
 {
   obj = GetWrapper(obj);
 
-  if (!CheckSOW(cx, obj, idval)) {
+  if (!CheckSOW(cx, obj, id)) {
     return JS_FALSE;
   }
 
   JSObject *wrappedObj = GetWrappedObject(cx, obj);
   if (!wrappedObj) {
     // No wrappedObj means that this is probably the prototype.
     *objp = nsnull;
     return JS_TRUE;
   }
 
   XPCCallContext ccx(JS_CALLER, cx);
   if (!ccx.IsValid()) {
     return ThrowException(NS_ERROR_FAILURE, cx);
   }
 
-  jsid id;
   JSBool canTouch;
-  if (!JS_ValueToId(cx, idval, &id) ||
-      !CanTouchProperty(cx, obj, id, (flags & JSRESOLVE_ASSIGNING) != 0,
+  if (!CanTouchProperty(cx, obj, id, (flags & JSRESOLVE_ASSIGNING) != 0,
                         &canTouch)) {
     return JS_FALSE;
   }
 
   if (!canTouch) {
     return ThrowException(NS_ERROR_XPC_SECURITY_MANAGER_VETO, cx);
   }
 
@@ -719,55 +707,54 @@ XPC_COW_Convert(JSContext *cx, JSObject 
   if (!wrappedObj->getJSClass()->convert(cx, wrappedObj, type, vp)) {
     return JS_FALSE;
   }
 
   return RewrapForContent(cx, obj, vp);
 }
 
 static JSBool
-XPC_COW_CheckAccess(JSContext *cx, JSObject *obj, jsval prop, JSAccessMode mode,
+XPC_COW_CheckAccess(JSContext *cx, JSObject *obj, jsid id, JSAccessMode mode,
                     jsval *vp)
 {
   // Simply forward checkAccess to our wrapped object. It's already expecting
   // untrusted things to ask it about accesses.
 
   uintN junk;
-  jsid id;
-  return JS_ValueToId(cx, prop, &id) &&
-         JS_CheckAccess(cx, GetWrappedObject(cx, obj), id, mode, vp, &junk);
+  return JS_CheckAccess(cx, GetWrappedObject(cx, obj), id, mode, vp, &junk);
 }
 
 static JSBool
-XPC_COW_Equality(JSContext *cx, JSObject *obj, jsval v, JSBool *bp)
+XPC_COW_Equality(JSContext *cx, JSObject *obj, const jsval *valp, JSBool *bp)
 {
   // Convert both sides to XPCWrappedNative and see if they match.
-  if (JSVAL_IS_PRIMITIVE(v)) {
+  if (JSVAL_IS_PRIMITIVE(*valp)) {
     *bp = JS_FALSE;
     return JS_TRUE;
   }
 
-  JSObject *test = GetWrappedJSObject(cx, JSVAL_TO_OBJECT(v));
+  JSObject *test = GetWrappedJSObject(cx, JSVAL_TO_OBJECT(*valp));
 
   obj = GetWrappedObject(cx, obj);
   if (!obj) {
     return ThrowException(NS_ERROR_ILLEGAL_VALUE, cx);
   }
   XPCWrappedNative *other =
     XPCWrappedNative::GetWrappedNativeOfJSObject(cx, test);
   if (!other) {
     *bp = JS_FALSE;
     return JS_TRUE;
   }
 
   XPCWrappedNative *me = XPCWrappedNative::GetWrappedNativeOfJSObject(cx, obj);
   obj = me->GetFlatJSObject();
   test = other->GetFlatJSObject();
+  jsval testVal = OBJECT_TO_JSVAL(test);
   return ((JSExtendedClass *)obj->getJSClass())->
-    equality(cx, obj, OBJECT_TO_JSVAL(test), bp);
+    equality(cx, obj, &testVal, bp);
 }
 
 static JSObject *
 XPC_COW_Iterator(JSContext *cx, JSObject *obj, JSBool keysonly)
 {
   JSObject *wrappedObj = GetWrappedObject(cx, obj);
   if (!wrappedObj) {
     ThrowException(NS_ERROR_INVALID_ARG, cx);
--- a/js/src/xpconnect/src/XPCCrossOriginWrapper.cpp
+++ b/js/src/xpconnect/src/XPCCrossOriginWrapper.cpp
@@ -44,56 +44,56 @@
 #include "XPCWrapper.h"
 #include "nsIDOMWindow.h"
 #include "nsIDOMWindowCollection.h"
 
 // This file implements a wrapper around objects that allows them to be
 // accessed safely from across origins.
 
 static JSBool
-XPC_XOW_AddProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
+XPC_XOW_AddProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
 
 static JSBool
-XPC_XOW_DelProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
+XPC_XOW_DelProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
 
 static JSBool
-XPC_XOW_GetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
+XPC_XOW_GetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
 
 static JSBool
-XPC_XOW_SetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
+XPC_XOW_SetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
 
 static JSBool
 XPC_XOW_Enumerate(JSContext *cx, JSObject *obj);
 
 static JSBool
-XPC_XOW_NewResolve(JSContext *cx, JSObject *obj, jsval id, uintN flags,
+XPC_XOW_NewResolve(JSContext *cx, JSObject *obj, jsid id, uintN flags,
                    JSObject **objp);
 
 static JSBool
 XPC_XOW_Convert(JSContext *cx, JSObject *obj, JSType type, jsval *vp);
 
 static void
 XPC_XOW_Finalize(JSContext *cx, JSObject *obj);
 
 static JSBool
-XPC_XOW_CheckAccess(JSContext *cx, JSObject *obj, jsval id, JSAccessMode mode,
+XPC_XOW_CheckAccess(JSContext *cx, JSObject *obj, jsid id, JSAccessMode mode,
                     jsval *vp);
 
 static JSBool
 XPC_XOW_Call(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
 
 static JSBool
 XPC_XOW_Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
                   jsval *rval);
 
 static JSBool
-XPC_XOW_HasInstance(JSContext *cx, JSObject *obj, jsval v, JSBool *bp);
+XPC_XOW_HasInstance(JSContext *cx, JSObject *obj, const jsval *v, JSBool *bp);
 
 static JSBool
-XPC_XOW_Equality(JSContext *cx, JSObject *obj, jsval v, JSBool *bp);
+XPC_XOW_Equality(JSContext *cx, JSObject *obj, const jsval *v, JSBool *bp);
 
 static JSObject *
 XPC_XOW_Iterator(JSContext *cx, JSObject *obj, JSBool keysonly);
 
 static JSObject *
 XPC_XOW_WrappedObject(JSContext *cx, JSObject *obj);
 
 // The slot that we stick our scope into.
@@ -449,17 +449,17 @@ WrapObject(JSContext *cx, JSObject *pare
 
 using namespace XPCCrossOriginWrapper;
 
 static JSBool
 XPC_XOW_toString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
                  jsval *rval);
 
 static JSBool
-IsValFrame(JSObject *obj, jsval v, XPCWrappedNative *wn)
+IsValFrame(JSObject *obj, jsid id, XPCWrappedNative *wn)
 {
   // Fast path for the common case.
   if (obj->getClass()->name[0] != 'W') {
     return JS_FALSE;
   }
 
   nsCOMPtr<nsIDOMWindow> domwin(do_QueryWrappedNative(wn));
   if (!domwin) {
@@ -467,21 +467,21 @@ IsValFrame(JSObject *obj, jsval v, XPCWr
   }
 
   nsCOMPtr<nsIDOMWindowCollection> col;
   domwin->GetFrames(getter_AddRefs(col));
   if (!col) {
     return JS_FALSE;
   }
 
-  if (JSVAL_IS_INT(v)) {
-    col->Item(JSVAL_TO_INT(v), getter_AddRefs(domwin));
+  if (JSID_IS_INT(id)) {
+    col->Item(JSID_TO_INT(id), getter_AddRefs(domwin));
   } else {
     nsAutoString str(reinterpret_cast<PRUnichar *>
-                                     (JS_GetStringChars(JSVAL_TO_STRING(v))));
+                                     (JS_GetStringChars(JSID_TO_STRING(id))));
     col->NamedItem(str, getter_AddRefs(domwin));
   }
 
   return domwin != nsnull;
 }
 
 static JSBool
 WrapSameOriginProp(JSContext *cx, JSObject *outerObj, jsval *vp);
@@ -565,17 +565,17 @@ WrapSameOriginProp(JSContext *cx, JSObje
     *vp = OBJECT_TO_JSVAL(GetWrappedObject(cx, wrappedObj));
     return WrapObject(cx, outerObj->getParent(), vp);
   }
 
   return JS_TRUE;
 }
 
 static JSBool
-XPC_XOW_AddProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+XPC_XOW_AddProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
   // All AddProperty needs to do is pass on addProperty requests to
   // same-origin objects, and throw for all else.
 
   obj = GetWrapper(obj);
   jsval resolving;
   if (!JS_GetReservedSlot(cx, obj, sFlagsSlot, &resolving)) {
     return JS_FALSE;
@@ -612,17 +612,17 @@ XPC_XOW_AddProperty(JSContext *cx, JSObj
     return JS_FALSE;
   }
 
   // Same origin, pass this request along.
   return AddProperty(cx, obj, JS_TRUE, wrappedObj, id, vp);
 }
 
 static JSBool
-XPC_XOW_DelProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+XPC_XOW_DelProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
   JSObject *wrappedObj = GetWrappedObject(cx, obj);
   if (!wrappedObj) {
     return ThrowException(NS_ERROR_ILLEGAL_VALUE, cx);
   }
 
   nsresult rv = CanAccessWrapper(cx, obj, wrappedObj, nsnull);
   if (NS_FAILED(rv)) {
@@ -633,20 +633,20 @@ XPC_XOW_DelProperty(JSContext *cx, JSObj
     return JS_FALSE;
   }
 
   // Same origin, pass this request along.
   return DelProperty(cx, wrappedObj, id, vp);
 }
 
 static JSBool
-XPC_XOW_GetOrSetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp,
+XPC_XOW_GetOrSetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp,
                          JSBool isSet)
 {
-  if (id == GetRTStringByIndex(cx, XPCJSRuntime::IDX_TO_STRING)) {
+  if (id == GetRTIdByIndex(cx, XPCJSRuntime::IDX_TO_STRING)) {
     return JS_TRUE;
   }
 
   // Don't do anything if we already resolved to a wrapped function in
   // NewResolve. In practice, this means that this is a wrapped eval
   // function.
   jsval v = *vp;
   if (!JSVAL_IS_PRIMITIVE(v) &&
@@ -704,32 +704,24 @@ XPC_XOW_GetOrSetProperty(JSContext *cx, 
       }
     }
 
     return GetOrSetNativeProperty(cx, obj, wn, id, vp, isSet, JS_FALSE);
   }
 
   JSObject *proto = nsnull; // Initialize this to quiet GCC.
   JSBool checkProto =
-    (isSet && id == GetRTStringByIndex(cx, XPCJSRuntime::IDX_PROTO));
+    (isSet && id == GetRTIdByIndex(cx, XPCJSRuntime::IDX_PROTO));
   if (checkProto) {
     proto = wrappedObj->getProto();
   }
 
-  // Same origin, pass this request along as though nothing interesting
-  // happened.
-  jsid asId;
-
-  if (!JS_ValueToId(cx, id, &asId)) {
-    return JS_FALSE;
-  }
-
   JSBool ok = isSet
-              ? JS_SetPropertyById(cx, wrappedObj, asId, vp)
-              : JS_GetPropertyById(cx, wrappedObj, asId, vp);
+              ? JS_SetPropertyById(cx, wrappedObj, id, vp)
+              : JS_GetPropertyById(cx, wrappedObj, id, vp);
   if (!ok) {
     return JS_FALSE;
   }
 
   if (checkProto) {
     JSObject *newProto = wrappedObj->getProto();
 
     // If code is trying to set obj.__proto__ and we're on obj's
@@ -756,23 +748,23 @@ XPC_XOW_GetOrSetProperty(JSContext *cx, 
       return JS_FALSE;
     }
   }
 
   return WrapSameOriginProp(cx, obj, vp);
 }
 
 static JSBool
-XPC_XOW_GetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+XPC_XOW_GetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
   return XPC_XOW_GetOrSetProperty(cx, obj, id, vp, JS_FALSE);
 }
 
 static JSBool
-XPC_XOW_SetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+XPC_XOW_SetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
   return XPC_XOW_GetOrSetProperty(cx, obj, id, vp, JS_TRUE);
 }
 
 static JSBool
 XPC_XOW_Enumerate(JSContext *cx, JSObject *obj)
 {
   obj = GetWrapper(obj);
@@ -856,17 +848,17 @@ GetUXPCObject(JSContext *cx, JSObject *o
   if (!JS_SetReservedSlot(cx, obj, sUXPCObjectSlot, OBJECT_TO_JSVAL(uxpco))) {
     return nsnull;
   }
 
   return uxpco;
 }
 
 static JSBool
-XPC_XOW_NewResolve(JSContext *cx, JSObject *obj, jsval id, uintN flags,
+XPC_XOW_NewResolve(JSContext *cx, JSObject *obj, jsid id, uintN flags,
                    JSObject **objp)
 {
   obj = GetWrapper(obj);
 
   JSObject *wrappedObj = GetWrappedObject(cx, obj);
   if (!wrappedObj) {
     // No wrappedObj means that this is probably the prototype.
     *objp = nsnull;
@@ -916,17 +908,17 @@ XPC_XOW_NewResolve(JSContext *cx, JSObje
                                  flags, objp, JS_FALSE);
 
   }
 
   if (privilegeEnabled && !(obj = GetUXPCObject(cx, obj))) {
     return JS_FALSE;
   }
 
-  if (id == GetRTStringByIndex(cx, XPCJSRuntime::IDX_TO_STRING)) {
+  if (id == GetRTIdByIndex(cx, XPCJSRuntime::IDX_TO_STRING)) {
     jsval oldSlotVal;
     if (!JS_GetReservedSlot(cx, obj, sFlagsSlot, &oldSlotVal) ||
         !JS_SetReservedSlot(cx, obj, sFlagsSlot,
                             INT_TO_JSVAL(JSVAL_TO_INT(oldSlotVal) |
                                          FLAG_RESOLVING))) {
       return JS_FALSE;
     }
 
@@ -1015,26 +1007,24 @@ XPC_XOW_Finalize(JSContext *cx, JSObject
     return;
   }
 
   // Remove ourselves from the map.
   scope->GetWrapperMap()->Remove(wrappedObj);
 }
 
 static JSBool
-XPC_XOW_CheckAccess(JSContext *cx, JSObject *obj, jsval prop, JSAccessMode mode,
+XPC_XOW_CheckAccess(JSContext *cx, JSObject *obj, jsid id, JSAccessMode mode,
                     jsval *vp)
 {
   // Simply forward checkAccess to our wrapped object. It's already expecting
   // untrusted things to ask it about accesses.
 
   uintN junk;
-  jsid id;
-  return JS_ValueToId(cx, prop, &id) &&
-         JS_CheckAccess(cx, GetWrappedObject(cx, obj), id, mode, vp, &junk);
+  return JS_CheckAccess(cx, GetWrappedObject(cx, obj), id, mode, vp, &junk);
 }
 
 static JSBool
 XPC_XOW_Call(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
 {
   JSObject *wrappedObj = GetWrappedObject(cx, obj);
   if (!wrappedObj) {
     // Nothing to call.
@@ -1086,17 +1076,17 @@ XPC_XOW_Construct(JSContext *cx, JSObjec
                             rval)) {
     return JS_FALSE;
   }
 
   return RewrapIfNeeded(cx, wrappedObj, rval);
 }
 
 static JSBool
-XPC_XOW_HasInstance(JSContext *cx, JSObject *obj, jsval v, JSBool *bp)
+XPC_XOW_HasInstance(JSContext *cx, JSObject *obj, const jsval *valp, JSBool *bp)
 {
   JSObject *iface = GetWrappedObject(cx, obj);
 
   XPCCallContext ccx(JS_CALLER, cx);
   if (!ccx.IsValid()) {
     return ThrowException(NS_ERROR_FAILURE, cx);
   }
 
@@ -1112,32 +1102,35 @@ XPC_XOW_HasInstance(JSContext *cx, JSObj
   JSClass *clasp = iface->getJSClass();
 
   *bp = JS_FALSE;
   if (!clasp->hasInstance) {
     return JS_TRUE;
   }
 
   // Prematurely unwrap the left hand side.
-  if (!JSVAL_IS_PRIMITIVE(v)) {
+  jsval v = *valp;
+  if (!JSVAL_IS_PRIMITIVE(*valp)) {
     JSObject *test = JSVAL_TO_OBJECT(v);
 
     // GetWrappedObject does an instanceof check.
     test = GetWrappedObject(cx, test);
     if (test) {
       v = OBJECT_TO_JSVAL(test);
     }
   }
 
-  return clasp->hasInstance(cx, iface, v, bp);
+  return clasp->hasInstance(cx, iface, &v, bp);
 }
 
 static JSBool
-XPC_XOW_Equality(JSContext *cx, JSObject *obj, jsval v, JSBool *bp)
+XPC_XOW_Equality(JSContext *cx, JSObject *obj, const jsval *valp, JSBool *bp)
 {
+  jsval v = *valp;
+
   // Convert both sides to XPCWrappedNative and see if they match.
   if (JSVAL_IS_PRIMITIVE(v)) {
     *bp = JS_FALSE;
     return JS_TRUE;
   }
 
   JSObject *test = JSVAL_TO_OBJECT(v);
   if (test->getJSClass() == &XOWClass.base) {
@@ -1162,18 +1155,19 @@ XPC_XOW_Equality(JSContext *cx, JSObject
   if (!other) {
     *bp = JS_FALSE;
     return JS_TRUE;
   }
 
   XPCWrappedNative *me = XPCWrappedNative::GetWrappedNativeOfJSObject(cx, obj);
   obj = me->GetFlatJSObject();
   test = other->GetFlatJSObject();
+  jsval testVal = OBJECT_TO_JSVAL(test);
   return ((JSExtendedClass *)obj->getJSClass())->
-    equality(cx, obj, OBJECT_TO_JSVAL(test), bp);
+    equality(cx, obj, &testVal, bp);
 }
 
 static JSObject *
 XPC_XOW_Iterator(JSContext *cx, JSObject *obj, JSBool keysonly)
 {
   JSObject *wrappedObj = GetWrappedObject(cx, obj);
   if (!wrappedObj) {
     ThrowException(NS_ERROR_INVALID_ARG, cx);
@@ -1254,17 +1248,17 @@ XPC_XOW_toString(JSContext *cx, JSObject
   nsresult rv = CanAccessWrapper(cx, obj, wrappedObj, nsnull);
   if (rv == NS_ERROR_DOM_PROP_ACCESS_DENIED) {
     nsIScriptSecurityManager *ssm = GetSecurityManager();
     if (!ssm) {
       return ThrowException(NS_ERROR_NOT_INITIALIZED, cx);
     }
     rv = ssm->CheckPropertyAccess(cx, wrappedObj,
                                   wrappedObj->getClass()->name,
-                                  GetRTStringByIndex(cx, XPCJSRuntime::IDX_TO_STRING),
+                                  GetRTIdByIndex(cx, XPCJSRuntime::IDX_TO_STRING),
                                   nsIXPCSecurityManager::ACCESS_GET_PROPERTY);
   }
   if (NS_FAILED(rv)) {
     return JS_FALSE;
   }
 
   XPCWrappedNative *wn =
     XPCWrappedNative::GetWrappedNativeOfJSObject(cx, wrappedObj);
--- a/js/src/xpconnect/src/XPCNativeWrapper.cpp
+++ b/js/src/xpconnect/src/XPCNativeWrapper.cpp
@@ -39,60 +39,60 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include "xpcprivate.h"
 #include "XPCNativeWrapper.h"
 #include "XPCWrapper.h"
 #include "jsdbgapi.h"
 
 static JSBool
-XPC_NW_AddProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
+XPC_NW_AddProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
 
 static JSBool
-XPC_NW_DelProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
+XPC_NW_DelProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
 
 static JSBool
-XPC_NW_GetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
+XPC_NW_GetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
 
 static JSBool
-XPC_NW_SetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
+XPC_NW_SetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
 
 static JSBool
 XPC_NW_Enumerate(JSContext *cx, JSObject *obj);
 
 static JSBool
-XPC_NW_NewResolve(JSContext *cx, JSObject *obj, jsval id, uintN flags,
+XPC_NW_NewResolve(JSContext *cx, JSObject *obj, jsid id, uintN flags,
                   JSObject **objp);
 
 static JSBool
 XPC_NW_Convert(JSContext *cx, JSObject *obj, JSType type, jsval *vp);
 
 static void
 XPC_NW_Finalize(JSContext *cx, JSObject *obj);
 
 static JSBool
-XPC_NW_CheckAccess(JSContext *cx, JSObject *obj, jsval id,
+XPC_NW_CheckAccess(JSContext *cx, JSObject *obj, jsid id,
                    JSAccessMode mode, jsval *vp);
 
 static JSBool
 XPC_NW_Call(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
             jsval *rval);
 
 static JSBool
 XPC_NW_Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
                  jsval *rval);
 
 static JSBool
-XPC_NW_HasInstance(JSContext *cx, JSObject *obj, jsval v, JSBool *bp);
+XPC_NW_HasInstance(JSContext *cx, JSObject *obj, const jsval *valp, JSBool *bp);
 
 static void
 XPC_NW_Trace(JSTracer *trc, JSObject *obj);
 
 static JSBool
-XPC_NW_Equality(JSContext *cx, JSObject *obj, jsval v, JSBool *bp);
+XPC_NW_Equality(JSContext *cx, JSObject *obj, const jsval *valp, JSBool *bp);
 
 static JSObject *
 XPC_NW_Iterator(JSContext *cx, JSObject *obj, JSBool keysonly);
 
 static JSBool
 XPC_NW_FunctionWrapper(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
                        jsval *rval);
 
@@ -284,17 +284,17 @@ ThrowException(nsresult ex, JSContext *c
   XPCThrower::Throw(ex, cx);
 
   return JS_FALSE;
 }
 
 static inline
 JSBool
 EnsureLegalActivity(JSContext *cx, JSObject *obj,
-                    jsval id = JSVAL_VOID, PRUint32 accessType = 0)
+                    jsid id = JSID_VOID, PRUint32 accessType = 0)
 {
   nsIScriptSecurityManager *ssm = GetSecurityManager();
   if (!ssm) {
     // If there's no security manager, then we're not running in a browser
     // context: allow access.
     return JS_TRUE;
   }
 
@@ -331,17 +331,17 @@ EnsureLegalActivity(JSContext *cx, JSObj
       PRBool isPrivileged = PR_FALSE;
       nsresult rv =
         ssm->IsCapabilityEnabled("UniversalXPConnect", &isPrivileged);
       if (NS_SUCCEEDED(rv) && isPrivileged) {
         return JS_TRUE;
       }
 
       JSObject* flatObj;
-      if (!JSVAL_IS_VOID(id) &&
+      if (!JSID_IS_VOID(id) &&
           (accessType & (sSecMgrSetProp | sSecMgrGetProp)) &&
           (flatObj = wn->GetFlatJSObject())) {
         rv = ssm->CheckPropertyAccess(cx, flatObj,
                                       flatObj->getClass()->name,
                                       id, accessType);
         return NS_SUCCEEDED(rv);
       }
 
@@ -378,23 +378,22 @@ EnsureLegalActivity(JSContext *cx, JSObj
 #else
   return JS_TRUE;
 #endif
 
   // NB: Watch for early returns in the ifdef DEBUG code above.
 }
 
 static JSBool
-XPC_NW_AddProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+XPC_NW_AddProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
   jsid idAsId;
   JSPropertyDescriptor desc;
 
-  if (!JS_ValueToId(cx, id, &idAsId) ||
-      !JS_GetPropertyDescriptorById(cx, obj, idAsId, JSRESOLVE_QUALIFIED,
+  if (!JS_GetPropertyDescriptorById(cx, obj, idAsId, JSRESOLVE_QUALIFIED,
                                     &desc)) {
     return JS_FALSE;
   }
 
   // Do not allow scripted getters or setters on XPCNativeWrappers.
   if (desc.attrs & (JSPROP_GETTER | JSPROP_SETTER)) {
     return ThrowException(NS_ERROR_ILLEGAL_VALUE, cx);
   }
@@ -411,17 +410,17 @@ XPC_NW_AddProperty(JSContext *cx, JSObje
 
   // Note: no need to protect *vp from GC here, since it's already in the slot
   // on |obj|.
   return EnsureLegalActivity(cx, obj, id, sSecMgrSetProp) &&
          RewrapValue(cx, obj, *vp, vp);
 }
 
 static JSBool
-XPC_NW_DelProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+XPC_NW_DelProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
   return EnsureLegalActivity(cx, obj);
 }
 
 static JSBool
 XPC_NW_FunctionWrapper(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
                        jsval *rval)
 {
@@ -491,22 +490,22 @@ GetwrappedJSObject(JSContext *cx, JSObje
     *vp = v;
     return JS_TRUE;
   }
 
   return XPCSafeJSObjectWrapper::WrapObject(cx, JS_GetScopeChain(cx), v, vp);
 }
 
 static JSBool
-XPC_NW_GetOrSetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp,
+XPC_NW_GetOrSetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp,
                         JSBool aIsSet)
 {
   // We don't deal with the following properties here.
-  if (id == GetRTStringByIndex(cx, XPCJSRuntime::IDX_PROTOTYPE) ||
-      id == GetRTStringByIndex(cx, XPCJSRuntime::IDX_TO_STRING)) {
+  if (id == GetRTIdByIndex(cx, XPCJSRuntime::IDX_PROTOTYPE) ||
+      id == GetRTIdByIndex(cx, XPCJSRuntime::IDX_TO_STRING)) {
     return JS_TRUE;
   }
 
   while (!XPCNativeWrapper::IsNativeWrapper(obj)) {
     obj = obj->getProto();
     if (!obj) {
       return ThrowException(NS_ERROR_UNEXPECTED, cx);
     }
@@ -522,32 +521,32 @@ XPC_NW_GetOrSetProperty(JSContext *cx, J
 
   if (!wrappedNative) {
     return ThrowException(NS_ERROR_INVALID_ARG, cx);
   }
 
   JSObject *nativeObj = wrappedNative->GetFlatJSObject();
 
   if (!aIsSet &&
-      id == GetRTStringByIndex(cx, XPCJSRuntime::IDX_WRAPPED_JSOBJECT)) {
+      id == GetRTIdByIndex(cx, XPCJSRuntime::IDX_WRAPPED_JSOBJECT)) {
     return GetwrappedJSObject(cx, nativeObj, vp);
   }
 
   return GetOrSetNativeProperty(cx, obj, wrappedNative, id, vp, aIsSet,
                                 JS_TRUE);
 }
 
 static JSBool
-XPC_NW_GetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+XPC_NW_GetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
   return XPC_NW_GetOrSetProperty(cx, obj, id, vp, PR_FALSE);
 }
 
 static JSBool
-XPC_NW_SetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+XPC_NW_SetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
   return XPC_NW_GetOrSetProperty(cx, obj, id, vp, PR_TRUE);
 }
 
 static JSBool
 XPC_NW_Enumerate(JSContext *cx, JSObject *obj)
 {
   // We are being notified of a for-in loop or similar operation on this
@@ -565,28 +564,28 @@ XPC_NW_Enumerate(JSContext *cx, JSObject
   if (!wn) {
     return JS_TRUE;
   }
 
   return Enumerate(cx, obj, wn->GetFlatJSObject());
 }
 
 static JSBool
-XPC_NW_NewResolve(JSContext *cx, JSObject *obj, jsval id, uintN flags,
+XPC_NW_NewResolve(JSContext *cx, JSObject *obj, jsid id, uintN flags,
                   JSObject **objp)
 {
   // No need to preserve on sets of wrappedJSObject or toString, since callers
   // couldn't get at those values anyway.  Also, we always deal with
   // wrappedJSObject and toString before looking at our scriptable hooks, so no
   // need to mess with our flags yet.
-  if (id == GetRTStringByIndex(cx, XPCJSRuntime::IDX_WRAPPED_JSOBJECT)) {
+  if (id == GetRTIdByIndex(cx, XPCJSRuntime::IDX_WRAPPED_JSOBJECT)) {
     return JS_TRUE;
   }
 
-  if (id == GetRTStringByIndex(cx, XPCJSRuntime::IDX_TO_STRING)) {
+  if (id == GetRTIdByIndex(cx, XPCJSRuntime::IDX_TO_STRING)) {
     *objp = obj;
 
     // See the comment in WrapFunction for why we create this function
     // like this.
     JSFunction *fun = JS_NewFunction(cx, XPC_NW_toString, 0, 0, nsnull,
                                      "toString");
     if (!fun) {
       return JS_FALSE;
@@ -641,17 +640,17 @@ XPC_NW_Finalize(JSContext *cx, JSObject 
   {
     // scoped lock
     XPCAutoLock lock(rt->GetMapLock());
     rt->GetExplicitNativeWrapperMap()->Remove(obj);
   }
 }
 
 static JSBool
-XPC_NW_CheckAccess(JSContext *cx, JSObject *obj, jsval id,
+XPC_NW_CheckAccess(JSContext *cx, JSObject *obj, jsid id,
                    JSAccessMode mode, jsval *vp)
 {
   // Prevent setting __proto__ on an XPCNativeWrapper
   if ((mode & JSACC_WATCH) == JSACC_PROTO && (mode & JSACC_WRITE)) {
     return ThrowException(NS_ERROR_XPC_SECURITY_MANAGER_VETO, cx);
   }
 
   // Forward to the checkObjectAccess hook in the JSContext, if any.
@@ -726,17 +725,17 @@ XPC_NW_Construct(JSContext *cx, JSObject
   if (JSVAL_IS_PRIMITIVE(*rval)) {
     return ThrowException(NS_ERROR_ILLEGAL_VALUE, cx);
   }
 
   return RewrapValue(cx, obj, *rval, rval);
 }
 
 static JSBool
-XPC_NW_HasInstance(JSContext *cx, JSObject *obj, jsval v, JSBool *bp)
+XPC_NW_HasInstance(JSContext *cx, JSObject *obj, const jsval *valp, JSBool *bp)
 {
   return JS_TRUE;
 }
 
 static JSBool
 MirrorWrappedNativeParent(JSContext *cx, XPCWrappedNative *wrapper,
                           JSObject **result NS_OUTPARAM)
 {
@@ -881,26 +880,27 @@ XPC_NW_Trace(JSTracer *trc, JSObject *ob
 
   if (wrappedNative && wrappedNative->IsValid()) {
     JS_CALL_OBJECT_TRACER(trc, wrappedNative->GetFlatJSObject(),
                           "wrappedNative.flatJSObject");
   }
 }
 
 static JSBool
-XPC_NW_Equality(JSContext *cx, JSObject *obj, jsval v, JSBool *bp)
+XPC_NW_Equality(JSContext *cx, JSObject *obj, const jsval *valp, JSBool *bp)
 {
   NS_ASSERTION(XPCNativeWrapper::IsNativeWrapper(obj),
                "Uh, we should only ever be called for XPCNativeWrapper "
                "objects!");
 
   if (!EnsureLegalActivity(cx, obj)) {
     return JS_FALSE;
   }
 
+  jsval v = *valp;
   if (JSVAL_IS_PRIMITIVE(v)) {
     *bp = JS_FALSE;
 
     return JS_TRUE;
   }
 
   // Protected by EnsureLegalActivity.
   XPCWrappedNative *wrappedNative = XPCNativeWrapper::SafeGetWrappedNative(obj);
@@ -960,17 +960,17 @@ XPC_NW_toString(JSContext *cx, JSObject 
   while (!XPCNativeWrapper::IsNativeWrapper(obj)) {
     obj = obj->getProto();
     if (!obj) {
       return ThrowException(NS_ERROR_UNEXPECTED, cx);
     }
   }
 
   if (!EnsureLegalActivity(cx, obj,
-                           GetRTStringByIndex(cx, XPCJSRuntime::IDX_TO_STRING),
+                           GetRTIdByIndex(cx, XPCJSRuntime::IDX_TO_STRING),
                            sSecMgrGetProp)) {
     return JS_FALSE;
   }
 
   // Protected by EnsureLegalActivity.
   XPCWrappedNative *wrappedNative = XPCNativeWrapper::SafeGetWrappedNative(obj);
 
   if (!wrappedNative) {
--- a/js/src/xpconnect/src/XPCSafeJSObjectWrapper.cpp
+++ b/js/src/xpconnect/src/XPCSafeJSObjectWrapper.cpp
@@ -40,58 +40,58 @@
 #include "xpcprivate.h"
 #include "jsdbgapi.h"
 #include "jsscript.h" // for js_ScriptClass
 #include "XPCWrapper.h"
 #include "jsregexp.h"
 #include "nsJSPrincipals.h"
 
 static JSBool
-XPC_SJOW_AddProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
+XPC_SJOW_AddProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
 
 static JSBool
-XPC_SJOW_DelProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
+XPC_SJOW_DelProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
 
 static JSBool
-XPC_SJOW_GetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
+XPC_SJOW_GetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
 
 static JSBool
-XPC_SJOW_SetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
+XPC_SJOW_SetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
 
 static JSBool
 XPC_SJOW_Enumerate(JSContext *cx, JSObject *obj);
 
 static JSBool
-XPC_SJOW_NewResolve(JSContext *cx, JSObject *obj, jsval id, uintN flags,
+XPC_SJOW_NewResolve(JSContext *cx, JSObject *obj, jsid id, uintN flags,
                     JSObject **objp);
 
 static JSBool
 XPC_SJOW_Convert(JSContext *cx, JSObject *obj, JSType type, jsval *vp);
 
 static void
 XPC_SJOW_Finalize(JSContext *cx, JSObject *obj);
 
 static JSBool
-XPC_SJOW_CheckAccess(JSContext *cx, JSObject *obj, jsval id, JSAccessMode mode,
+XPC_SJOW_CheckAccess(JSContext *cx, JSObject *obj, jsid id, JSAccessMode mode,
                      jsval *vp);
 
 static JSBool
 XPC_SJOW_Call(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
               jsval *rval);
 
 static JSBool
 XPC_SJOW_Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
                    jsval *rval);
 
 static JSBool
 XPC_SJOW_Create(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
                 jsval *rval);
 
 static JSBool
-XPC_SJOW_Equality(JSContext *cx, JSObject *obj, jsval v, JSBool *bp);
+XPC_SJOW_Equality(JSContext *cx, JSObject *obj, const jsval *v, JSBool *bp);
 
 static JSObject *
 XPC_SJOW_Iterator(JSContext *cx, JSObject *obj, JSBool keysonly);
 
 static JSObject *
 XPC_SJOW_WrappedObject(JSContext *cx, JSObject *obj);
 
 using namespace XPCSafeJSObjectWrapper;
@@ -174,17 +174,17 @@ CanCallerAccess(JSContext *cx, JSObject 
       return ThrowException(NS_ERROR_XPC_SECURITY_MANAGER_VETO, cx);
     }
   }
 
   if (wrapperObj) {
     jsval flags;
     JS_GetReservedSlot(cx, wrapperObj, sFlagsSlot, &flags);
     if (HAS_FLAGS(flags, FLAG_SOW) &&
-        !SystemOnlyWrapper::CheckFilename(cx, JSVAL_VOID, fp)) {
+        !SystemOnlyWrapper::CheckFilename(cx, JSID_VOID, fp)) {
       return JS_FALSE;
     }
   }
 
   return PR_TRUE;
 }
 
 // Reserved slot indexes on safe wrappers.
@@ -465,22 +465,22 @@ WrapJSValue(JSContext *cx, JSObject *obj
       }
     }
   }
 
   return ok;
 }
 
 static JSBool
-XPC_SJOW_AddProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+XPC_SJOW_AddProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
   // The constructor and toString properties needs to live on the safe
   // wrapper.
-  if (id == GetRTStringByIndex(cx, XPCJSRuntime::IDX_CONSTRUCTOR) ||
-      id == GetRTStringByIndex(cx, XPCJSRuntime::IDX_TO_STRING)) {
+  if (id == GetRTIdByIndex(cx, XPCJSRuntime::IDX_CONSTRUCTOR) ||
+      id == GetRTIdByIndex(cx, XPCJSRuntime::IDX_TO_STRING)) {
     return JS_TRUE;
   }
 
   obj = FindSafeObject(obj);
   NS_ASSERTION(obj != nsnull, "FindSafeObject() returned null in class hook!");
 
   // Do nothing here if we're in the middle of resolving a property on
   // this safe wrapper.
@@ -510,17 +510,17 @@ XPC_SJOW_AddProperty(JSContext *cx, JSOb
       return JS_FALSE;
     }
   }
 
   return XPCWrapper::AddProperty(cx, obj, JS_FALSE, unsafeObj, id, vp);
 }
 
 static JSBool
-XPC_SJOW_DelProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+XPC_SJOW_DelProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
   JSObject *unsafeObj = GetUnsafeObject(cx, obj);
   if (!unsafeObj) {
     return ThrowException(NS_ERROR_UNEXPECTED, cx);
   }
 
   // Check that the caller can access the unsafe object.
   if (!CanCallerAccess(cx, obj, unsafeObj)) {
@@ -574,21 +574,21 @@ private:
   JSContext *cx;
   JSRegExpStatics statics;
   js::AutoStringRooter tvr;
   uint32 options;
   JSStackFrame *fp;
 };
 
 static JSBool
-XPC_SJOW_GetOrSetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp,
+XPC_SJOW_GetOrSetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp,
                           JSBool aIsSet)
 {
   // We resolve toString to a function in our resolve hook.
-  if (id == GetRTStringByIndex(cx, XPCJSRuntime::IDX_TO_STRING)) {
+  if (id == GetRTIdByIndex(cx, XPCJSRuntime::IDX_TO_STRING)) {
     return JS_TRUE;
   }
 
   obj = FindSafeObject(obj);
   NS_ASSERTION(obj != nsnull, "FindSafeObject() returned null in class hook!");
 
   JSObject *unsafeObj = GetUnsafeObject(cx, obj);
   if (!unsafeObj) {
@@ -602,47 +602,42 @@ XPC_SJOW_GetOrSetProperty(JSContext *cx,
   }
 
   {
     SafeCallGuard guard(cx, FindObjectPrincipals(cx, obj, unsafeObj));
     if (!guard.ready()) {
       return JS_FALSE;
     }
 
-    jsid interned_id;
-    if (!JS_ValueToId(cx, id, &interned_id)) {
-      return JS_FALSE;
-    }
-
     if (aIsSet &&
         !JSVAL_IS_PRIMITIVE(*vp) &&
         !RewrapObject(cx, JS_GetGlobalForObject(cx, unsafeObj),
                       JSVAL_TO_OBJECT(*vp), UNKNOWN, vp)) {
       return JS_FALSE;
     }
 
     JSBool ok = aIsSet
-                ? JS_SetPropertyById(cx, unsafeObj, interned_id, vp)
-                : JS_GetPropertyById(cx, unsafeObj, interned_id, vp);
+                ? JS_SetPropertyById(cx, unsafeObj, id, vp)
+                : JS_GetPropertyById(cx, unsafeObj, id, vp);
     if (!ok) {
       return JS_FALSE;
     }
   }
 
   return WrapJSValue(cx, obj, *vp, vp);
 }
 
 static JSBool
-XPC_SJOW_GetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+XPC_SJOW_GetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
   return XPC_SJOW_GetOrSetProperty(cx, obj, id, vp, PR_FALSE);
 }
 
 static JSBool
-XPC_SJOW_SetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+XPC_SJOW_SetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
   return XPC_SJOW_GetOrSetProperty(cx, obj, id, vp, PR_TRUE);
 }
 
 static JSBool
 XPC_SJOW_Enumerate(JSContext *cx, JSObject *obj)
 {
   obj = FindSafeObject(obj);
@@ -670,17 +665,17 @@ XPC_SJOW_Enumerate(JSContext *cx, JSObje
   // we don't need to do a security check since JS_Enumerate() will
   // look up unsafeObj.__iterator__ and if we don't have permission to
   // access that, it'll throw and we'll be safe.
 
   return XPCWrapper::Enumerate(cx, obj, unsafeObj);
 }
 
 static JSBool
-XPC_SJOW_NewResolve(JSContext *cx, JSObject *obj, jsval id, uintN flags,
+XPC_SJOW_NewResolve(JSContext *cx, JSObject *obj, jsid id, uintN flags,
                     JSObject **objp)
 {
   obj = FindSafeObject(obj);
   NS_ASSERTION(obj != nsnull, "FindSafeObject() returned null in class hook!");
 
   JSObject *unsafeObj = GetUnsafeObject(cx, obj);
   if (!unsafeObj) {
     // No unsafe object, nothing to resolve here.
@@ -690,17 +685,17 @@ XPC_SJOW_NewResolve(JSContext *cx, JSObj
 
   // Check that the caller can access the unsafe object.
   if (!CanCallerAccess(cx, obj, unsafeObj)) {
     // CanCallerAccess() already threw for us.
     return JS_FALSE;
   }
 
   // Resolve toString specially.
-  if (id == GetRTStringByIndex(cx, XPCJSRuntime::IDX_TO_STRING)) {
+  if (id == GetRTIdByIndex(cx, XPCJSRuntime::IDX_TO_STRING)) {
     *objp = obj;
     return JS_DefineFunction(cx, obj, "toString",
                              XPC_SJOW_toString, 0, 0) != nsnull;
   }
 
   return XPCWrapper::NewResolve(cx, obj, JS_FALSE, unsafeObj, id, flags,
                                 objp);
 }
@@ -720,17 +715,17 @@ XPC_SJOW_Finalize(JSContext *cx, JSObjec
   if (::JS_GetReservedSlot(cx, obj, sPrincipalSlot, &v) && !JSVAL_IS_VOID(v)) {
     nsIPrincipal *principal = (nsIPrincipal *)JSVAL_TO_PRIVATE(v);
 
     NS_RELEASE(principal);
   }
 }
 
 static JSBool
-XPC_SJOW_CheckAccess(JSContext *cx, JSObject *obj, jsval id,
+XPC_SJOW_CheckAccess(JSContext *cx, JSObject *obj, jsid id,
                      JSAccessMode mode, jsval *vp)
 {
   // Prevent setting __proto__ on an XPCSafeJSObjectWrapper
   if ((mode & JSACC_WATCH) == JSACC_PROTO && (mode & JSACC_WRITE)) {
     return ThrowException(NS_ERROR_XPC_SECURITY_MANAGER_VETO, cx);
   }
 
   // Forward to the checkObjectAccess hook in the runtime, if any.
@@ -922,24 +917,24 @@ XPC_SJOW_Create(JSContext *cx, JSObject 
       return JS_FALSE;
     }
   }
 
   return WrapJSValue(cx, callee, *rval, rval);
 }
 
 static JSBool
-XPC_SJOW_Equality(JSContext *cx, JSObject *obj, jsval v, JSBool *bp)
+XPC_SJOW_Equality(JSContext *cx, JSObject *obj, const jsval *valp, JSBool *bp)
 {
-  if (JSVAL_IS_PRIMITIVE(v)) {
+  if (JSVAL_IS_PRIMITIVE(*valp)) {
     *bp = JS_FALSE;
   } else {
     JSObject *unsafeObj = GetUnsafeObject(cx, obj);
 
-    JSObject *other = JSVAL_TO_OBJECT(v);
+    JSObject *other = JSVAL_TO_OBJECT(*valp);
     JSObject *otherUnsafe = GetUnsafeObject(cx, other);
 
     // An object is equal to a SJOW if:
     //   - The other object is the same SJOW.
     //   - The other object is the object that this SJOW is wrapping.
     //   - The other object is a SJOW wrapping the same object as this one.
     // or
     //   - Both objects somehow wrap the same native object.
--- a/js/src/xpconnect/src/XPCSystemOnlyWrapper.cpp
+++ b/js/src/xpconnect/src/XPCSystemOnlyWrapper.cpp
@@ -43,46 +43,46 @@
 #include "jscntxt.h"  // For js::AutoValueRooter.
 #include "XPCNativeWrapper.h"
 #include "XPCWrapper.h"
 
 // This file implements a wrapper around trusted objects that allows them to
 // be safely injected into untrusted code.
 
 static JSBool
-XPC_SOW_AddProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
+XPC_SOW_AddProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
 
 static JSBool
-XPC_SOW_DelProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
+XPC_SOW_DelProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
 
 static JSBool
-XPC_SOW_GetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
+XPC_SOW_GetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
 
 static JSBool
-XPC_SOW_SetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
+XPC_SOW_SetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
 
 static JSBool
 XPC_SOW_Enumerate(JSContext *cx, JSObject *obj);
 
 static JSBool
-XPC_SOW_NewResolve(JSContext *cx, JSObject *obj, jsval id, uintN flags,
+XPC_SOW_NewResolve(JSContext *cx, JSObject *obj, jsid id, uintN flags,
                    JSObject **objp);
 
 static JSBool
 XPC_SOW_Convert(JSContext *cx, JSObject *obj, JSType type, jsval *vp);
 
 static JSBool
-XPC_SOW_CheckAccess(JSContext *cx, JSObject *obj, jsval id, JSAccessMode mode,
+XPC_SOW_CheckAccess(JSContext *cx, JSObject *obj, jsid id, JSAccessMode mode,
                     jsval *vp);
 
 static JSBool
-XPC_SOW_HasInstance(JSContext *cx, JSObject *obj, jsval v, JSBool *bp);
+XPC_SOW_HasInstance(JSContext *cx, JSObject *obj, const jsval *valp, JSBool *bp);
 
 static JSBool
-XPC_SOW_Equality(JSContext *cx, JSObject *obj, jsval v, JSBool *bp);
+XPC_SOW_Equality(JSContext *cx, JSObject *obj, const jsval *valp, JSBool *bp);
 
 static JSObject *
 XPC_SOW_Iterator(JSContext *cx, JSObject *obj, JSBool keysonly);
 
 static JSObject *
 XPC_SOW_WrappedObject(JSContext *cx, JSObject *obj);
 
 using namespace XPCWrapper;
@@ -166,17 +166,17 @@ MakeSOW(JSContext *cx, JSObject *obj)
   return JS_GetReservedSlot(cx, obj, sFlagsSlot, &flags) &&
          JS_SetReservedSlot(cx, obj, sFlagsSlot,
                             INT_TO_JSVAL(JSVAL_TO_INT(flags) | FLAG_SOW));
 }
 
 
 // If you change this code, change also nsContentUtils::CanAccessNativeAnon()!
 JSBool
-AllowedToAct(JSContext *cx, jsval idval)
+AllowedToAct(JSContext *cx, jsid id)
 {
   // TODO bug 508928: Refactor this with the XOW security checking code.
   nsIScriptSecurityManager *ssm = GetSecurityManager();
   if (!ssm) {
     return JS_TRUE;
   }
 
   JSStackFrame *fp;
@@ -216,46 +216,47 @@ AllowedToAct(JSContext *cx, jsval idval)
   }
 
   // Before we throw, check for UniversalXPConnect.
   nsresult rv = ssm->IsCapabilityEnabled("UniversalXPConnect", &privileged);
   if (NS_SUCCEEDED(rv) && privileged) {
     return JS_TRUE;
   }
 
-  if (JSVAL_IS_VOID(idval)) {
+  if (JSID_IS_VOID(id)) {
     ThrowException(NS_ERROR_XPC_SECURITY_MANAGER_VETO, cx);
   } else {
     // TODO Localize me?
-    JSString *str = JS_ValueToString(cx, idval);
-    if (str) {
+    jsval idval;
+    JSString *str;
+    if (JS_IdToValue(cx, id, &idval) && (str = JS_ValueToString(cx, idval))) {
       JS_ReportError(cx, "Permission denied to access property '%hs' from a non-chrome context",
                      JS_GetStringChars(str));
     }
   }
 
   return JS_FALSE;
 }
 
 JSBool
-CheckFilename(JSContext *cx, jsval idval, JSStackFrame *fp)
+CheckFilename(JSContext *cx, jsid id, JSStackFrame *fp)
 {
   const char *filename;
   if (fp &&
       (filename = fp->script->filename) &&
       !strncmp(filename, prefix, NS_ARRAY_LENGTH(prefix) - 1)) {
     return JS_TRUE;
   }
 
-  if (JSVAL_IS_VOID(idval)) {
+  if (JSID_IS_VOID(id)) {
     ThrowException(NS_ERROR_XPC_SECURITY_MANAGER_VETO, cx);
   } else {
-    // TODO Localize me?
-    JSString *str = JS_ValueToString(cx, idval);
-    if (str) {
+    jsval idval;
+    JSString *str;
+    if (JS_IdToValue(cx, id, &idval) && (str = JS_ValueToString(cx, idval))) {
       JS_ReportError(cx, "Permission denied to access property '%hs' from a non-chrome context",
                      JS_GetStringChars(str));
     }
   }
 
   return JS_FALSE;
 }
 
@@ -302,17 +303,17 @@ GetWrappedObject(JSContext *cx, JSObject
 {
   return UnwrapGeneric(cx, &SOWClass, wrapper);
 }
 
 static JSBool
 XPC_SOW_FunctionWrapper(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
                         jsval *rval)
 {
-  if (!AllowedToAct(cx, JSVAL_VOID)) {
+  if (!AllowedToAct(cx, JSID_VOID)) {
     return JS_FALSE;
   }
 
   JSObject *wrappedObj;
 
   // Allow 'this' to be either a SOW, in which case we unwrap it or something
   // that isn't a SOW.  We disallow invalid SOWs that have no wrapped object.
   // We do this so that it's possible to use this function with .call on
@@ -423,17 +424,17 @@ XPC_SOW_RewrapValue(JSContext *cx, JSObj
     }
     v = *vp = OBJECT_TO_JSVAL(obj);
   }
 
   return WrapObject(cx, wrapperObj->getParent(), v, vp);
 }
 
 static JSBool
-XPC_SOW_AddProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+XPC_SOW_AddProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
   NS_ASSERTION(obj->getJSClass() == &SOWClass.base, "Wrong object");
 
   jsval resolving;
   if (!JS_GetReservedSlot(cx, obj, sFlagsSlot, &resolving)) {
     return JS_FALSE;
   }
 
@@ -450,32 +451,32 @@ XPC_SOW_AddProperty(JSContext *cx, JSObj
   if (!wrappedObj) {
     return JS_TRUE;
   }
 
   return AddProperty(cx, obj, JS_TRUE, wrappedObj, id, vp);
 }
 
 static JSBool
-XPC_SOW_DelProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+XPC_SOW_DelProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
   JSObject *wrappedObj = GetWrappedObject(cx, obj);
   if (!wrappedObj) {
     return ThrowException(NS_ERROR_ILLEGAL_VALUE, cx);
   }
 
   if (!AllowedToAct(cx, id)) {
     return JS_FALSE;
   }
 
   return DelProperty(cx, wrappedObj, id, vp);
 }
 
 static JSBool
-XPC_SOW_GetOrSetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp,
+XPC_SOW_GetOrSetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp,
                          JSBool isSet)
 {
   obj = GetWrapper(obj);
   if (!obj) {
     return ThrowException(NS_ERROR_ILLEGAL_VALUE, cx);
   }
 
   if (!AllowedToAct(cx, id)) {
@@ -484,67 +485,62 @@ XPC_SOW_GetOrSetProperty(JSContext *cx, 
 
   js::AutoArrayRooter tvr(cx, 1, vp);
 
   JSObject *wrappedObj = GetWrappedObject(cx, obj);
   if (!wrappedObj) {
     return ThrowException(NS_ERROR_ILLEGAL_VALUE, cx);
   }
 
-  if (isSet && id == GetRTStringByIndex(cx, XPCJSRuntime::IDX_PROTO)) {
+  if (isSet && id == GetRTIdByIndex(cx, XPCJSRuntime::IDX_PROTO)) {
     // No setting __proto__ on my object.
     return ThrowException(NS_ERROR_INVALID_ARG, cx); // XXX better error message
   }
 
-  jsid interned_id;
-  if (!JS_ValueToId(cx, id, &interned_id)) {
-    return JS_FALSE;
-  }
-
   JSBool ok = isSet
-              ? JS_SetPropertyById(cx, wrappedObj, interned_id, vp)
-              : JS_GetPropertyById(cx, wrappedObj, interned_id, vp);
+              ? JS_SetPropertyById(cx, wrappedObj, id, vp)
+              : JS_GetPropertyById(cx, wrappedObj, id, vp);
   if (!ok) {
     return JS_FALSE;
   }
 
   return XPC_SOW_RewrapValue(cx, obj, vp);
 }
 
 static JSBool
-XPC_SOW_GetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+XPC_SOW_GetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
   return XPC_SOW_GetOrSetProperty(cx, obj, id, vp, JS_FALSE);
 }
 
 static JSBool
-XPC_SOW_SetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+XPC_SOW_SetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
   return XPC_SOW_GetOrSetProperty(cx, obj, id, vp, JS_TRUE);
 }
 
 static JSBool
 XPC_SOW_Enumerate(JSContext *cx, JSObject *obj)
 {
   obj = GetWrapper(obj);
   JSObject *wrappedObj = GetWrappedObject(cx, obj);
   if (!wrappedObj) {
     // Nothing to enumerate.
     return JS_TRUE;
   }
 
-  if (!AllowedToAct(cx, JSVAL_VOID)) {
+  if (!AllowedToAct(cx, JSID_VOID)) {
     return JS_FALSE;
   }
 
   return Enumerate(cx, obj, wrappedObj);
 }
 
 static JSBool
-XPC_SOW_NewResolve(JSContext *cx, JSObject *obj, jsval id, uintN flags,
+XPC_SOW_NewResolve(JSContext *cx, JSObject *obj, jsid id, uintN flags,
                    JSObject **objp)
 {
   obj = GetWrapper(obj);
 
   JSObject *wrappedObj = GetWrappedObject(cx, obj);
   if (!wrappedObj) {
     // No wrappedObj means that this is probably the prototype.
     *objp = nsnull;
@@ -556,17 +552,17 @@ XPC_SOW_NewResolve(JSContext *cx, JSObje
   }
 
   return NewResolve(cx, obj, JS_FALSE, wrappedObj, id, flags, objp);
 }
 
 static JSBool
 XPC_SOW_Convert(JSContext *cx, JSObject *obj, JSType type, jsval *vp)
 {
-  if (!AllowedToAct(cx, JSVAL_VOID)) {
+  if (!AllowedToAct(cx, JSID_VOID)) {
     return JS_FALSE;
   }
 
   // Don't do any work to convert to object.
   if (type == JSTYPE_OBJECT) {
     *vp = OBJECT_TO_JSVAL(obj);
     return JS_TRUE;
   }
@@ -577,38 +573,36 @@ XPC_SOW_Convert(JSContext *cx, JSObject 
     // XXX Can this happen?
     return JS_TRUE;
   }
 
   return wrappedObj->getJSClass()->convert(cx, wrappedObj, type, vp);
 }
 
 static JSBool
-XPC_SOW_CheckAccess(JSContext *cx, JSObject *obj, jsval prop, JSAccessMode mode,
+XPC_SOW_CheckAccess(JSContext *cx, JSObject *obj, jsid id, JSAccessMode mode,
                     jsval *vp)
 {
   // Simply forward checkAccess to our wrapped object. It's already expecting
   // untrusted things to ask it about accesses.
 
   JSObject *wrappedObj = GetWrappedObject(cx, obj);
   if (!wrappedObj) {
     *vp = JSVAL_VOID;
     return JS_TRUE;
   }
 
   uintN junk;
-  jsid id;
-  return JS_ValueToId(cx, prop, &id) &&
-         JS_CheckAccess(cx, wrappedObj, id, mode, vp, &junk);
+  return JS_CheckAccess(cx, wrappedObj, id, mode, vp, &junk);
 }
 
 static JSBool
-XPC_SOW_HasInstance(JSContext *cx, JSObject *obj, jsval v, JSBool *bp)
+XPC_SOW_HasInstance(JSContext *cx, JSObject *obj, const jsval *valp, JSBool *bp)
 {
-  if (!AllowedToAct(cx, JSVAL_VOID)) {
+  if (!AllowedToAct(cx, JSID_VOID)) {
     return JS_FALSE;
   }
 
   JSObject *iface = GetWrappedObject(cx, obj);
   if (!iface) {
     *bp = JS_FALSE;
     return JS_TRUE;
   }
@@ -618,33 +612,35 @@ XPC_SOW_HasInstance(JSContext *cx, JSObj
   *bp = JS_FALSE;
   if (!clasp->hasInstance) {
     return JS_TRUE;
   }
 
   // Prematurely unwrap the left hand side. This isn't necessary, but could be
   // faster than waiting until XPCWrappedNative::GetWrappedNativeOfJSObject to
   // do it.
+  jsval v = *valp;
   if (!JSVAL_IS_PRIMITIVE(v)) {
     JSObject *test = JSVAL_TO_OBJECT(v);
 
     // GetWrappedObject does a class check.
     test = GetWrappedObject(cx, test);
     if (test) {
       v = OBJECT_TO_JSVAL(test);
     }
   }
 
-  return clasp->hasInstance(cx, iface, v, bp);
+  return clasp->hasInstance(cx, iface, &v, bp);
 }
 
 static JSBool
-XPC_SOW_Equality(JSContext *cx, JSObject *obj, jsval v, JSBool *bp)
+XPC_SOW_Equality(JSContext *cx, JSObject *obj, const jsval *valp, JSBool *bp)
 {
   // Delegate to our wrapped object.
+  jsval v = *valp;
   if (JSVAL_IS_PRIMITIVE(v)) {
     *bp = JS_FALSE;
     return JS_TRUE;
   }
 
   if (obj == JSVAL_TO_OBJECT(v)) {
     *bp = JS_TRUE;
     return JS_TRUE;
@@ -658,26 +654,28 @@ XPC_SOW_Equality(JSContext *cx, JSObject
   }
 
   if (lhs) {
     // Delegate to our wrapped object if we can.
     JSClass *clasp = lhs->getJSClass();
     if (clasp->flags & JSCLASS_IS_EXTENDED) {
       JSExtendedClass *xclasp = (JSExtendedClass *) clasp;
       // NB: JSExtendedClass.equality is a required field.
-      return xclasp->equality(cx, lhs, OBJECT_TO_JSVAL(rhs), bp);
+      jsval rhsVal = OBJECT_TO_JSVAL(rhs);
+      return xclasp->equality(cx, lhs, &rhsVal, bp);
     }
   }
 
   // We know rhs is non-null.
   JSClass *clasp = rhs->getJSClass();
   if (clasp->flags & JSCLASS_IS_EXTENDED) {
     JSExtendedClass *xclasp = (JSExtendedClass *) clasp;
     // NB: JSExtendedClass.equality is a required field.
-    return xclasp->equality(cx, rhs, OBJECT_TO_JSVAL(lhs), bp);
+    jsval lhsVal = OBJECT_TO_JSVAL(lhs);
+    return xclasp->equality(cx, rhs, &lhsVal, bp);
   }
 
   *bp = JS_FALSE;
   return JS_TRUE;
 }
 
 static JSObject *
 XPC_SOW_Iterator(JSContext *cx, JSObject *obj, JSBool keysonly)
--- a/js/src/xpconnect/src/XPCWrapper.cpp
+++ b/js/src/xpconnect/src/XPCWrapper.cpp
@@ -422,52 +422,47 @@ CreateSimpleIterator(JSContext *cx, JSOb
     }
   } while ((propertyContainer = propertyContainer->getProto()));
 
   return FinishCreatingIterator(cx, iterObj, keysonly);
 }
 
 JSBool
 AddProperty(JSContext *cx, JSObject *wrapperObj, JSBool wantGetterSetter,
-            JSObject *innerObj, jsval id, jsval *vp)
+            JSObject *innerObj, jsid id, jsval *vp)
 {
-  jsid interned_id;
-  if (!::JS_ValueToId(cx, id, &interned_id)) {
-    return JS_FALSE;
-  }
-
   JSPropertyDescriptor desc;
-  if (!GetPropertyAttrs(cx, wrapperObj, interned_id, JSRESOLVE_QUALIFIED,
+  if (!GetPropertyAttrs(cx, wrapperObj, id, JSRESOLVE_QUALIFIED,
                         wantGetterSetter, &desc)) {
     return JS_FALSE;
   }
 
   NS_ASSERTION(desc.obj == wrapperObj,
                "What weird wrapper are we using?");
 
-  return JS_DefinePropertyById(cx, innerObj, interned_id, *vp,
+  return JS_DefinePropertyById(cx, innerObj, id, *vp,
                                desc.getter, desc.setter, desc.attrs);
 }
 
 JSBool
-DelProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+DelProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
-  if (JSVAL_IS_STRING(id)) {
-    JSString *str = JSVAL_TO_STRING(id);
+  if (JSID_IS_STRING(id)) {
+    JSString *str = JSID_TO_STRING(id);
     jschar *chars = ::JS_GetStringChars(str);
     size_t length = ::JS_GetStringLength(str);
 
     return ::JS_DeleteUCProperty2(cx, obj, chars, length, vp);
   }
 
-  if (!JSVAL_IS_INT(id)) {
+  if (!JSID_IS_INT(id)) {
     return DoThrowException(NS_ERROR_NOT_IMPLEMENTED, cx);
   }
 
-  return ::JS_DeleteElement2(cx, obj, JSVAL_TO_INT(id), vp);
+  return ::JS_DeleteElement2(cx, obj, JSID_TO_INT(id), vp);
 }
 
 JSBool
 Enumerate(JSContext *cx, JSObject *wrapperObj, JSObject *innerObj)
 {
   // We are being notified of a for-in loop or similar operation on
   // this wrapper. Forward to the correct high-level object hook,
   // OBJ_ENUMERATE on the unsafe object, called via the JS_Enumerate API.
@@ -509,25 +504,20 @@ Enumerate(JSContext *cx, JSObject *wrapp
 
   JS_DestroyIdArray(cx, ida);
 
   return ok;
 }
 
 JSBool
 NewResolve(JSContext *cx, JSObject *wrapperObj, JSBool wantDetails,
-           JSObject *innerObj, jsval id, uintN flags, JSObject **objp)
+           JSObject *innerObj, jsid id, uintN flags, JSObject **objp)
 {
-  jsid interned_id;
-  if (!::JS_ValueToId(cx, id, &interned_id)) {
-    return JS_FALSE;
-  }
-
   JSPropertyDescriptor desc;
-  if (!GetPropertyAttrs(cx, innerObj, interned_id, flags, wantDetails, &desc)) {
+  if (!GetPropertyAttrs(cx, innerObj, id, flags, wantDetails, &desc)) {
     return JS_FALSE;
   }
 
   if (!desc.obj) {
     // Nothing to define.
     return JS_TRUE;
   }
 
@@ -536,41 +526,41 @@ NewResolve(JSContext *cx, JSObject *wrap
   jsval oldFlags;
   if (!::JS_GetReservedSlot(cx, wrapperObj, sFlagsSlot, &oldFlags) ||
       !::JS_SetReservedSlot(cx, wrapperObj, sFlagsSlot,
                             INT_TO_JSVAL(JSVAL_TO_INT(oldFlags) |
                                          FLAG_RESOLVING))) {
     return JS_FALSE;
   }
 
-  JSBool ok = JS_DefinePropertyById(cx, wrapperObj, interned_id, desc.value,
+  JSBool ok = JS_DefinePropertyById(cx, wrapperObj, id, desc.value,
                                     desc.getter, desc.setter, desc.attrs);
 
   JS_SetReservedSlot(cx, wrapperObj, sFlagsSlot, oldFlags);
 
   if (ok) {
     *objp = wrapperObj;
   }
 
   return ok;
 }
 
 JSBool
 ResolveNativeProperty(JSContext *cx, JSObject *wrapperObj,
                       JSObject *innerObj, XPCWrappedNative *wn,
-                      jsval id, uintN flags, JSObject **objp,
+                      jsid id, uintN flags, JSObject **objp,
                       JSBool isNativeWrapper)
 {
   // This will do verification and the method lookup for us.
   XPCCallContext ccx(JS_CALLER, cx, innerObj, nsnull, id);
 
   // For "constructor" we don't want to call into the resolve hooks on the
   // wrapped native, since that would give the wrong constructor.
   if (NATIVE_HAS_FLAG(wn, WantNewResolve) &&
-      id != GetRTStringByIndex(cx, XPCJSRuntime::IDX_CONSTRUCTOR)) {
+      id != GetRTIdByIndex(cx, XPCJSRuntime::IDX_CONSTRUCTOR)) {
 
     // Mark ourselves as resolving so our AddProperty hook can do the
     // right thing here.
     jsval oldFlags;
     if (!::JS_GetReservedSlot(cx, wrapperObj, sFlagsSlot, &oldFlags) ||
         !::JS_SetReservedSlot(cx, wrapperObj, sFlagsSlot,
                               INT_TO_JSVAL(JSVAL_TO_INT(oldFlags) |
                                            FLAG_RESOLVING))) {
@@ -623,17 +613,17 @@ ResolveNativeProperty(JSContext *cx, JSO
       // Mozilla) so throw.
       // I suspect that we'd need to redo the security check on the new object
       // (if it has a different class than the original object) and then call
       // ResolveNativeProperty with *that* as the inner object.
       return DoThrowException(NS_ERROR_NOT_IMPLEMENTED, cx);
     }
   }
 
-  if (!JSVAL_IS_STRING(id)) {
+  if (!JSID_IS_STRING(id)) {
     // A non-string id is being resolved. Won't be found here, return
     // early.
 
     MaybePreserveWrapper(cx, wn, flags);
 
     return JS_TRUE;
   }
 
@@ -660,17 +650,17 @@ ResolveNativeProperty(JSContext *cx, JSO
   if (!member) {
     // No member, nothing to resolve.
 
     MaybePreserveWrapper(cx, wn, flags);
 
     return JS_TRUE;
   }
 
-  JSString *str = JSVAL_TO_STRING(id);
+  JSString *str = JSID_TO_STRING(id);
   if (!str) {
     return DoThrowException(NS_ERROR_UNEXPECTED, cx);
   }
 
   // Get (and perhaps lazily create) the member's value (commonly a
   // cloneable function).
   jsval v;
   uintN attrs = JSPROP_ENUMERATE;
@@ -734,36 +724,34 @@ ResolveNativeProperty(JSContext *cx, JSO
   if (!isNativeWrapper &&
       (!::JS_GetReservedSlot(cx, wrapperObj, sFlagsSlot, &oldFlags) ||
        !::JS_SetReservedSlot(cx, wrapperObj, sFlagsSlot,
                              INT_TO_JSVAL(JSVAL_TO_INT(oldFlags) |
                                           FLAG_RESOLVING)))) {
     return JS_FALSE;
   }
 
-  if (!::JS_DefineUCProperty(cx, wrapperObj, ::JS_GetStringChars(str),
-                            ::JS_GetStringLength(str), v, getter, setter,
-                            attrs)) {
+  if (!::JS_DefinePropertyById(cx, wrapperObj, id, v, getter, setter, attrs)) {
     return JS_FALSE;
   }
 
   if (!isNativeWrapper &&
       !::JS_SetReservedSlot(cx, wrapperObj, sFlagsSlot, oldFlags)) {
     return JS_FALSE;
   }
 
   *objp = wrapperObj;
 
   return JS_TRUE;
 }
 
 JSBool
 GetOrSetNativeProperty(JSContext *cx, JSObject *obj,
                        XPCWrappedNative *wrappedNative,
-                       jsval id, jsval *vp, JSBool aIsSet,
+                       jsid id, jsval *vp, JSBool aIsSet,
                        JSBool isNativeWrapper)
 {
   // This will do verification and the method lookup for us.
   JSObject *nativeObj = wrappedNative->GetFlatJSObject();
   XPCCallContext ccx(JS_CALLER, cx, nativeObj, nsnull, id);
 
   if (aIsSet ? NATIVE_HAS_FLAG(wrappedNative, WantSetProperty) :
                NATIVE_HAS_FLAG(wrappedNative, WantGetProperty)) {
@@ -801,17 +789,17 @@ GetOrSetNativeProperty(JSContext *cx, JS
                aIsSet ? "Set" : "Got", propName.get());
       }
 #endif
 
       return RewrapIfDeepWrapper(cx, obj, v, vp, isNativeWrapper);
     }
   }
 
-  if (!JSVAL_IS_STRING(id)) {
+  if (!JSID_IS_STRING(id)) {
     // Not going to be found here
     return JS_TRUE;
   }
 
   // Verify that our jsobject really is a wrapped native.
   XPCWrappedNative* wrapper = ccx.GetWrapper();
   if (wrapper != wrappedNative || !wrapper->IsValid()) {
     NS_ASSERTION(wrapper == wrappedNative, "Uh, how did this happen!");
@@ -913,24 +901,20 @@ NativeToString(JSContext *cx, XPCWrapped
                uintN argc, jsval *argv, jsval *rval,
                JSBool isNativeWrapper)
 {
   // Check whether toString was overridden in any object along
   // the wrapped native's object's prototype chain.
   XPCJSRuntime *rt = nsXPConnect::GetRuntimeInstance();
 
   jsid id = rt->GetStringID(XPCJSRuntime::IDX_TO_STRING);
-  jsval idAsVal;
-  if (!::JS_IdToValue(cx, id, &idAsVal)) {
-    return JS_FALSE;
-  }
 
   // Someone is trying to call toString on our wrapped object.
   JSObject *wn_obj = wrappedNative->GetFlatJSObject();
-  XPCCallContext ccx(JS_CALLER, cx, wn_obj, nsnull, idAsVal);
+  XPCCallContext ccx(JS_CALLER, cx, wn_obj, nsnull, id);
   if (!ccx.IsValid()) {
     // Shouldn't really happen.
     return DoThrowException(NS_ERROR_FAILURE, cx);
   }
 
   XPCNativeInterface *iface = ccx.GetInterface();
   XPCNativeMember *member = ccx.GetMember();
   JSString* str = nsnull;
--- a/js/src/xpconnect/src/XPCWrapper.h
+++ b/js/src/xpconnect/src/XPCWrapper.h
@@ -147,20 +147,20 @@ namespace SystemOnlyWrapper {
 JSBool
 WrapObject(JSContext *cx, JSObject *parent, jsval v, jsval *vp);
 
 JSBool
 MakeSOW(JSContext *cx, JSObject *obj);
 
 // Used by UnwrapSOW below.
 JSBool
-AllowedToAct(JSContext *cx, jsval idval);
+AllowedToAct(JSContext *cx, jsid id);
 
 JSBool
-CheckFilename(JSContext *cx, jsval idval, JSStackFrame *fp);
+CheckFilename(JSContext *cx, jsid id, JSStackFrame *fp);
 
 }
 
 namespace ChromeObjectWrapper    { extern JSExtendedClass COWClass; }
 namespace XPCSafeJSObjectWrapper { extern JSExtendedClass SJOWClass; }
 namespace SystemOnlyWrapper      { extern JSExtendedClass SOWClass; }
 namespace XPCCrossOriginWrapper  { extern JSExtendedClass XOWClass; }
 
@@ -336,17 +336,17 @@ UnwrapGeneric(JSContext *cx, const JSExt
 inline JSObject *
 UnwrapSOW(JSContext *cx, JSObject *wrapper)
 {
   wrapper = UnwrapGeneric(cx, &SystemOnlyWrapper::SOWClass, wrapper);
   if (!wrapper) {
     return nsnull;
   }
 
-  if (!SystemOnlyWrapper::AllowedToAct(cx, JSVAL_VOID)) {
+  if (!SystemOnlyWrapper::AllowedToAct(cx, JSID_VOID)) {
     JS_ClearPendingException(cx);
     wrapper = nsnull;
   }
 
   return wrapper;
 }
 
 /**
@@ -451,23 +451,23 @@ CreateSimpleIterator(JSContext *cx, JSOb
                      JSObject *propertyContainer);
 
 /**
  * Called for the common part of adding a property to obj.
  */
 JSBool
 AddProperty(JSContext *cx, JSObject *wrapperObj,
             JSBool wantGetterSetter, JSObject *innerObj,
-            jsval id, jsval *vp);
+            jsid id, jsval *vp);
 
 /**
  * Called for the common part of deleting a property from obj.
  */
 JSBool
-DelProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
+DelProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
 
 /**
  * Called to enumerate the properties of |innerObj| onto |wrapperObj|.
  */
 JSBool
 Enumerate(JSContext *cx, JSObject *wrapperObj, JSObject *innerObj);
 
 /**
@@ -476,38 +476,38 @@ Enumerate(JSContext *cx, JSObject *wrapp
  * and is therefore unsuitable for cross-origin resolution.
  *
  * If |caller| is not NONE, then we will call the proper WrapObject
  * hook for any getters or setters about to be lifted onto
  * |wrapperObj|.
  */
 JSBool
 NewResolve(JSContext *cx, JSObject *wrapperObj, JSBool preserveVal,
-           JSObject *innerObj, jsval id, uintN flags, JSObject **objp);
+           JSObject *innerObj, jsid id, uintN flags, JSObject **objp);
 
 /**
  * Resolve a native property named id from innerObj onto wrapperObj. The
  * native wrapper will be preserved if necessary. Note that if we resolve
  * an attribute here, we don't deal with the value until later.
  */
 JSBool
 ResolveNativeProperty(JSContext *cx, JSObject *wrapperObj,
                       JSObject *innerObj, XPCWrappedNative *wn,
-                      jsval id, uintN flags, JSObject **objp,
+                      jsid id, uintN flags, JSObject **objp,
                       JSBool isNativeWrapper);
 
 /**
  * Gets a native property from obj. This goes directly through XPConnect, it
  * does not look at Javascript-defined getters or setters. This ensures that
  * the caller gets a real answer.
  */
 JSBool
 GetOrSetNativeProperty(JSContext *cx, JSObject *obj,
                        XPCWrappedNative *wrappedNative,
-                       jsval id, jsval *vp, JSBool aIsSet,
+                       jsid id, jsval *vp, JSBool aIsSet,
                        JSBool isNativeWrapper);
 
 /**
  * Gets a string representation of wrappedNative, going through IDL.
  */
 JSBool
 NativeToString(JSContext *cx, XPCWrappedNative *wrappedNative,
                uintN argc, jsval *argv, jsval *rval,
--- a/js/src/xpconnect/src/nsXPConnect.cpp
+++ b/js/src/xpconnect/src/nsXPConnect.cpp
@@ -1116,17 +1116,17 @@ NS_IMETHODIMP nsXPConnect::InitClassesFo
     if(!scope)
         return UnexpectedFailure(NS_ERROR_FAILURE);
 
     scope->RemoveWrappedNativeProtos();
     return NS_OK;
 }
 
 static JSBool
-TempGlobalResolve(JSContext *aJSContext, JSObject *obj, jsval id)
+TempGlobalResolve(JSContext *aJSContext, JSObject *obj, jsid id)
 {
     JSBool resolved;
     return JS_ResolveStandardClass(aJSContext, obj, id, &resolved);
 }
 
 static JSClass xpcTempGlobalClass = {
     "xpcTempGlobalClass", JSCLASS_GLOBAL_FLAGS,
     JS_PropertyStub,  JS_PropertyStub,  JS_PropertyStub,  JS_PropertyStub,
--- a/js/src/xpconnect/src/qsgen.py
+++ b/js/src/xpconnect/src/qsgen.py
@@ -727,17 +727,17 @@ def writeQuickStub(f, customMethodCalls,
     isAttr = (member.kind == 'attribute')
     isMethod = (member.kind == 'method')
     assert isAttr or isMethod
     isGetter = isAttr and not isSetter
 
     signature = "static JSBool\n"
     if isAttr:
         # JSPropertyOp signature.
-        signature += "%s(JSContext *cx, JSObject *obj, jsval id,%s jsval *vp)\n"
+        signature += "%s(JSContext *cx, JSObject *obj, jsid id,%s jsval *vp)\n"
     else:
         # JSFastNative.
         signature += "%s(JSContext *cx, uintN argc,%s jsval *vp)\n"
 
     customMethodCall = customMethodCalls.get(stubName, None)
 
     if customMethodCall is None:
         customMethodCall = customMethodCalls.get(member.iface.name + '_', None)
--- a/js/src/xpconnect/src/xpccallcontext.cpp
+++ b/js/src/xpconnect/src/xpccallcontext.cpp
@@ -38,23 +38,23 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 /* Call context. */
 
 #include "xpcprivate.h"
 
 XPCCallContext::XPCCallContext(XPCContext::LangType callerLanguage,
-                               JSContext* cx    /* = nsnull  */,
-                               JSObject* obj    /* = nsnull  */,
-                               JSObject* funobj /* = nsnull  */,
-                               jsval name       /* = 0       */,
-                               uintN argc       /* = NO_ARGS */,
-                               jsval *argv      /* = nsnull  */,
-                               jsval *rval      /* = nsnull  */)
+                               JSContext* cx    /* = nsnull    */,
+                               JSObject* obj    /* = nsnull    */,
+                               JSObject* funobj /* = nsnull    */,
+                               jsid name        /* = JSID_VOID */,
+                               uintN argc       /* = NO_ARGS   */,
+                               jsval *argv      /* = nsnull    */,
+                               jsval *rval      /* = nsnull    */)
     :   mState(INIT_FAILED),
         mXPC(nsXPConnect::GetXPConnect()),
         mThreadData(nsnull),
         mXPCContext(nsnull),
         mJSContext(cx),
         mContextPopRequired(JS_FALSE),
         mDestroyJSContextInDestructor(JS_FALSE),
         mCallerLanguage(callerLanguage),
@@ -79,27 +79,27 @@ XPCCallContext::XPCCallContext(XPCContex
         mContextPopRequired(JS_FALSE),
         mDestroyJSContextInDestructor(JS_FALSE),
         mCallerLanguage(callerLanguage),
         mCurrentJSObject(currentJSObject),
         mWrapper(wrapper),
         mTearOff(tearOff),
         mCallee(nsnull)
 {
-    Init(callerLanguage, callBeginRequest, obj, nsnull, JS_FALSE, 0, NO_ARGS,
+    Init(callerLanguage, callBeginRequest, obj, nsnull, JS_FALSE, JSID_VOID, NO_ARGS,
          nsnull, nsnull);
 }
 
 void
 XPCCallContext::Init(XPCContext::LangType callerLanguage,
                      JSBool callBeginRequest,
                      JSObject* obj,
                      JSObject* funobj,
                      JSBool getWrappedNative,
-                     jsval name,
+                     jsid name,
                      uintN argc,
                      jsval *argv,
                      jsval *rval)
 {
     // Mark our internal string wrappers as not used. Make sure we do
     // this before any early returns, as the destructor will assert
     // based on this.
     StringWrapperEntry *se =
@@ -215,27 +215,27 @@ XPCCallContext::Init(XPCContext::LangTyp
             return;
 
         NS_ASSERTION(IS_SLIM_WRAPPER(mCurrentJSObject),
                      "What kind of wrapper is this?");
 
         mFlattenedJSObject = mCurrentJSObject;
     }
 
-    if(name)
+    if(!JSID_IS_VOID(name))
         SetName(name);
 
     if(argc != NO_ARGS)
         SetArgsAndResultPtr(argc, argv, rval);
 
     CHECK_STATE(HAVE_OBJECT);
 }
 
 void
-XPCCallContext::SetName(jsval name)
+XPCCallContext::SetName(jsid name)
 {
     CHECK_STATE(HAVE_OBJECT);
 
     mName = name;
 
 #ifdef XPC_IDISPATCH_SUPPORT
     mIDispatchMember = nsnull;
 #endif
--- a/js/src/xpconnect/src/xpccomponents.cpp
+++ b/js/src/xpconnect/src/xpccomponents.cpp
@@ -270,17 +270,17 @@ nsXPCComponents_Interfaces::NewEnumerate
 
             {
                 *statep = JSVAL_NULL;
                 return NS_ERROR_UNEXPECTED;
             }
 
             *statep = PRIVATE_TO_JSVAL(e);
             if(idp)
-                *idp = JSVAL_ZERO; // indicate that we don't know the count
+                *idp = INT_TO_JSID(0); // indicate that we don't know the count
             return NS_OK;
         }
         case JSENUMERATE_NEXT:
         {
             nsCOMPtr<nsISupports> isup;
 
             e = (nsIEnumerator*) JSVAL_TO_PRIVATE(*statep);
 
@@ -325,24 +325,24 @@ nsXPCComponents_Interfaces::NewEnumerate
             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
 nsXPCComponents_Interfaces::NewResolve(nsIXPConnectWrappedNative *wrapper,
                                        JSContext * cx, JSObject * obj,
-                                       jsval id, PRUint32 flags,
+                                       jsid id, PRUint32 flags,
                                        JSObject * *objp, PRBool *_retval)
 {
     const char* name = nsnull;
 
     if(mManager &&
-       JSVAL_IS_STRING(id) &&
-       nsnull != (name = JS_GetStringBytes(JSVAL_TO_STRING(id))) &&
+       JSID_IS_STRING(id) &&
+       nsnull != (name = JS_GetStringBytes(JSID_TO_STRING(id))) &&
        name[0] != '{') // we only allow interfaces by name here
     {
         nsCOMPtr<nsIInterfaceInfo> info;
         mManager->GetInfoForName(name, getter_AddRefs(info));
         if(!info)
             return NS_OK;
 
         nsCOMPtr<nsIJSIID> nsid =
@@ -358,21 +358,18 @@ nsXPCComponents_Interfaces::NewResolve(n
                 if(NS_SUCCEEDED(xpc->WrapNative(cx, obj,
                                                 static_cast<nsIJSIID*>(nsid),
                                                 NS_GET_IID(nsIJSIID),
                                                 getter_AddRefs(holder))))
                 {
                     JSObject* idobj;
                     if(holder && NS_SUCCEEDED(holder->GetJSObject(&idobj)))
                     {
-                        jsid idid;
-
                         *objp = obj;
-                        *_retval = JS_ValueToId(cx, id, &idid) &&
-                                   JS_DefinePropertyById(cx, obj, idid,
+                        *_retval = JS_DefinePropertyById(cx, obj, id,
                                                          OBJECT_TO_JSVAL(idobj),
                                                          nsnull, nsnull,
                                                          JSPROP_ENUMERATE |
                                                          JSPROP_READONLY |
                                                          JSPROP_PERMANENT);
                     }
                 }
             }
@@ -599,17 +596,17 @@ nsXPCComponents_InterfacesByID::NewEnume
 
             {
                 *statep = JSVAL_NULL;
                 return NS_ERROR_UNEXPECTED;
             }
 
             *statep = PRIVATE_TO_JSVAL(e);
             if(idp)
-                *idp = JSVAL_ZERO; // indicate that we don't know the count
+                *idp = INT_TO_JSID(0); // indicate that we don't know the count
             return NS_OK;
         }
         case JSENUMERATE_NEXT:
         {
             nsCOMPtr<nsISupports> isup;
 
             e = (nsIEnumerator*) JSVAL_TO_PRIVATE(*statep);
 
@@ -659,25 +656,25 @@ nsXPCComponents_InterfacesByID::NewEnume
             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
 nsXPCComponents_InterfacesByID::NewResolve(nsIXPConnectWrappedNative *wrapper,
                                            JSContext * cx, JSObject * obj,
-                                           jsval id, PRUint32 flags,
+                                           jsid id, PRUint32 flags,
                                            JSObject * *objp, PRBool *_retval)
 {
     const jschar* name = nsnull;
 
     if(mManager &&
-       JSVAL_IS_STRING(id) &&
-       38 == JS_GetStringLength(JSVAL_TO_STRING(id)) &&
-       nsnull != (name = JS_GetStringChars(JSVAL_TO_STRING(id))))
+       JSID_IS_STRING(id) &&
+       38 == JS_GetStringLength(JSID_TO_STRING(id)) &&
+       nsnull != (name = JS_GetStringChars(JSID_TO_STRING(id))))
     {
         nsID iid;
         if (!iid.Parse(NS_ConvertUTF16toUTF8(reinterpret_cast<const PRUnichar*>
                                                              (name)).get()))
             return NS_OK;
 
         nsCOMPtr<nsIInterfaceInfo> info;
         mManager->GetInfoForIID(&iid, getter_AddRefs(info));
@@ -698,21 +695,19 @@ nsXPCComponents_InterfacesByID::NewResol
             if(NS_SUCCEEDED(xpc->WrapNative(cx, obj,
                                             static_cast<nsIJSIID*>(nsid),
                                             NS_GET_IID(nsIJSIID),
                                             getter_AddRefs(holder))))
             {
                 JSObject* idobj;
                 if(holder && NS_SUCCEEDED(holder->GetJSObject(&idobj)))
                 {
-                    jsid idid;
-
                     *objp = obj;
-                    *_retval = JS_ValueToId(cx, id, &idid) &&
-                        JS_DefinePropertyById(cx, obj, idid,
+                    *_retval =
+                        JS_DefinePropertyById(cx, obj, id,
                                               OBJECT_TO_JSVAL(idobj),
                                               nsnull, nsnull,
                                               JSPROP_ENUMERATE |
                                               JSPROP_READONLY |
                                               JSPROP_PERMANENT);
                 }
             }
         }
@@ -921,17 +916,17 @@ nsXPCComponents_Classes::NewEnumerate(ns
                NS_FAILED(compMgr->EnumerateContractIDs(&e)) || !e )
             {
                 *statep = JSVAL_NULL;
                 return NS_ERROR_UNEXPECTED;
             }
 
             *statep = PRIVATE_TO_JSVAL(e);
             if(idp)
-                *idp = JSVAL_ZERO; // indicate that we don't know the count
+                *idp = INT_TO_JSID(0); // indicate that we don't know the count
             return NS_OK;
         }
         case JSENUMERATE_NEXT:
         {
             nsCOMPtr<nsISupports> isup;
             PRBool hasMore;
             e = (nsISimpleEnumerator*) JSVAL_TO_PRIVATE(*statep);
 
@@ -964,24 +959,24 @@ nsXPCComponents_Classes::NewEnumerate(ns
             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
 nsXPCComponents_Classes::NewResolve(nsIXPConnectWrappedNative *wrapper,
                                     JSContext * cx, JSObject * obj,
-                                    jsval id, PRUint32 flags,
+                                    jsid id, PRUint32 flags,
                                     JSObject * *objp, PRBool *_retval)
 
 {
     const char* name = nsnull;
 
-    if(JSVAL_IS_STRING(id) &&
-       nsnull != (name = JS_GetStringBytes(JSVAL_TO_STRING(id))) &&
+    if(JSID_IS_STRING(id) &&
+       nsnull != (name = JS_GetStringBytes(JSID_TO_STRING(id))) &&
        name[0] != '{') // we only allow contractids here
     {
         nsCOMPtr<nsIJSCID> nsid =
             dont_AddRef(static_cast<nsIJSCID*>(nsJSCID::NewID(name)));
         if(nsid)
         {
             nsCOMPtr<nsIXPConnect> xpc;
             wrapper->GetXPConnect(getter_AddRefs(xpc));
@@ -991,21 +986,18 @@ nsXPCComponents_Classes::NewResolve(nsIX
                 if(NS_SUCCEEDED(xpc->WrapNative(cx, obj,
                                                 static_cast<nsIJSCID*>(nsid),
                                                 NS_GET_IID(nsIJSCID),
                                                 getter_AddRefs(holder))))
                 {
                     JSObject* idobj;
                     if(holder && NS_SUCCEEDED(holder->GetJSObject(&idobj)))
                     {
-                        jsid idid;
-
                         *objp = obj;
-                        *_retval = JS_ValueToId(cx, id, &idid) &&
-                                   JS_DefinePropertyById(cx, obj, idid,
+                        *_retval = JS_DefinePropertyById(cx, obj, id,
                                                          OBJECT_TO_JSVAL(idobj),
                                                          nsnull, nsnull,
                                                          JSPROP_ENUMERATE |
                                                          JSPROP_READONLY |
                                                          JSPROP_PERMANENT);
                     }
                 }
             }
@@ -1174,17 +1166,17 @@ nsXPCComponents_ClassesByID::NewEnumerat
                NS_FAILED(compMgr->EnumerateCIDs(&e)) || !e )
             {
                 *statep = JSVAL_NULL;
                 return NS_ERROR_UNEXPECTED;
             }
 
             *statep = PRIVATE_TO_JSVAL(e);
             if(idp)
-                *idp = JSVAL_ZERO; // indicate that we don't know the count
+                *idp = INT_TO_JSID(0); // indicate that we don't know the count
             return NS_OK;
         }
         case JSENUMERATE_NEXT:
         {
             nsCOMPtr<nsISupports> isup;
             PRBool hasMore;
             e = (nsISimpleEnumerator*) JSVAL_TO_PRIVATE(*statep);
 
@@ -1235,23 +1227,23 @@ IsRegisteredCLSID(const char* str)
 
     return registered;
 }
 
 /* PRBool newResolve (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in jsval id, in PRUint32 flags, out JSObjectPtr objp); */
 NS_IMETHODIMP
 nsXPCComponents_ClassesByID::NewResolve(nsIXPConnectWrappedNative *wrapper,
                                         JSContext * cx, JSObject * obj,
-                                        jsval id, PRUint32 flags,
+                                        jsid id, PRUint32 flags,
                                         JSObject * *objp, PRBool *_retval)
 {
     const char* name = nsnull;
 
-    if(JSVAL_IS_STRING(id) &&
-       nsnull != (name = JS_GetStringBytes(JSVAL_TO_STRING(id))) &&
+    if(JSID_IS_STRING(id) &&
+       nsnull != (name = JS_GetStringBytes(JSID_TO_STRING(id))) &&
        name[0] == '{' &&
        IsRegisteredCLSID(name)) // we only allow canonical CLSIDs here
     {
         nsCOMPtr<nsIJSCID> nsid =
             dont_AddRef(static_cast<nsIJSCID*>(nsJSCID::NewID(name)));
         if(nsid)
         {
             nsCOMPtr<nsIXPConnect> xpc;
@@ -1262,21 +1254,18 @@ nsXPCComponents_ClassesByID::NewResolve(
                 if(NS_SUCCEEDED(xpc->WrapNative(cx, obj,
                                                 static_cast<nsIJSCID*>(nsid),
                                                 NS_GET_IID(nsIJSCID),
                                                 getter_AddRefs(holder))))
                 {
                     JSObject* idobj;
                     if(holder && NS_SUCCEEDED(holder->GetJSObject(&idobj)))
                     {
-                        jsid idid;
-
                         *objp = obj;
-                        *_retval = JS_ValueToId(cx, id, &idid) &&
-                                   JS_DefinePropertyById(cx, obj, idid,
+                        *_retval = JS_DefinePropertyById(cx, obj, id,
                                                          OBJECT_TO_JSVAL(idobj),
                                                          nsnull, nsnull,
                                                          JSPROP_ENUMERATE |
                                                          JSPROP_READONLY |
                                                          JSPROP_PERMANENT);
                     }
                 }
             }
@@ -1438,17 +1427,17 @@ nsXPCComponents_Results::NewEnumerate(ns
 {
     void** iter;
 
     switch(enum_op)
     {
         case JSENUMERATE_INIT:
         {
             if(idp)
-                *idp = INT_TO_JSVAL(nsXPCException::GetNSResultCount());
+                *idp = INT_TO_JSID(nsXPCException::GetNSResultCount());
 
             void** space = (void**) new char[sizeof(void*)];
             *space = nsnull;
             *statep = PRIVATE_TO_JSVAL(space);
             return NS_OK;
         }
         case JSENUMERATE_NEXT:
         {
@@ -1472,38 +1461,36 @@ nsXPCComponents_Results::NewEnumerate(ns
     }
 }
 
 
 /* PRBool newResolve (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in jsval id, in PRUint32 flags, out JSObjectPtr objp); */
 NS_IMETHODIMP
 nsXPCComponents_Results::NewResolve(nsIXPConnectWrappedNative *wrapper,
                                     JSContext * cx, JSObject * obj,
-                                    jsval id, PRUint32 flags,
+                                    jsid id, PRUint32 flags,
                                     JSObject * *objp, PRBool *_retval)
 {
     const char* name = nsnull;
 
-    if(JSVAL_IS_STRING(id) &&
-       nsnull != (name = JS_GetStringBytes(JSVAL_TO_STRING(id))))
+    if(JSID_IS_STRING(id) &&
+       nsnull != (name = JS_GetStringBytes(JSID_TO_STRING(id))))
     {
         const char* rv_name;
         void* iter = nsnull;
         nsresult rv;
         while(nsXPCException::IterateNSResults(&rv, &rv_name, nsnull, &iter))
         {
             if(!strcmp(name, rv_name))
             {
-                jsid idid;
                 jsval val;
 
                 *objp = obj;
                 if(!JS_NewNumberValue(cx, (jsdouble)rv, &val) ||
-                   !JS_ValueToId(cx, id, &idid) ||
-                   !JS_DefinePropertyById(cx, obj, idid, val,
+                   !JS_DefinePropertyById(cx, obj, id, val,
                                           nsnull, nsnull,
                                           JSPROP_ENUMERATE |
                                           JSPROP_READONLY |
                                           JSPROP_PERMANENT))
                 {
                     return NS_ERROR_UNEXPECTED;
                 }
             }
@@ -2829,17 +2816,17 @@ nsXPCComponents_Utils::LookupMethod()
         return NS_ERROR_XPC_BAD_CONVERT_JS;
 
     // this will do verification and the method lookup for us
     // Note that if |obj| is an XPCNativeWrapper this will all still work.
     // We'll hand back the same method that we'd hand back for the underlying
     // XPCWrappedNative.  This means no deep wrapping, unfortunately, but we
     // can't keep track of both the underlying function and the
     // XPCNativeWrapper at once in a single parent slot...
-    XPCCallContext inner_cc(JS_CALLER, cx, obj, nsnull, argv[1]);
+    XPCCallContext inner_cc(JS_CALLER, cx, obj, nsnull, name_id);
 
     // was our jsobject really a wrapped native at all?
     XPCWrappedNative* wrapper = inner_cc.GetWrapper();
     if(!wrapper || !wrapper->IsValid())
         return NS_ERROR_XPC_BAD_CONVERT_JS;
 
     // did we find a method/attribute by that name?
     XPCNativeMember* member = inner_cc.GetMember();
@@ -3088,29 +3075,24 @@ SandboxImport(JSContext *cx, JSObject *o
 
 static JSBool
 sandbox_enumerate(JSContext *cx, JSObject *obj)
 {
     return JS_EnumerateStandardClasses(cx, obj);
 }
 
 static JSBool
-sandbox_getProto(JSContext *cx, JSObject *obj, jsval idval, jsval *vp)
+sandbox_getProto(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
-    jsid id;
-    if (!JS_ValueToId(cx, idval, &id)) {
-        return JS_FALSE;
-    }
-
     uintN attrs;
     return JS_CheckAccess(cx, obj, id, JSACC_PROTO, vp, &attrs);
 }
 
 static JSBool
-sandbox_setProto(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+sandbox_setProto(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
     if (!JSVAL_IS_OBJECT(*vp)) {
         return JS_TRUE;
     }
 
     JSObject *pobj = JSVAL_TO_OBJECT(*vp);
     if (pobj) {
         if (pobj->getJSClass() == &XPCCrossOriginWrapper::XOWClass.base &&
@@ -3119,31 +3101,26 @@ sandbox_setProto(JSContext *cx, JSObject
             return JS_FALSE;
         }
     }
 
     return JS_SetPrototype(cx, obj, JSVAL_TO_OBJECT(*vp));
 }
 
 static JSBool
-sandbox_resolve(JSContext *cx, JSObject *obj, jsval idval)
+sandbox_resolve(JSContext *cx, JSObject *obj, jsid id)
 {
     JSBool resolved;
-    if (!JS_ResolveStandardClass(cx, obj, idval, &resolved)) {
+    if (!JS_ResolveStandardClass(cx, obj, id, &resolved)) {
         return JS_FALSE;
     }
     if (resolved) {
         return JS_TRUE;
     }
 
-    jsid id;
-    if (!JS_ValueToId(cx, idval, &id)) {
-        return JS_FALSE;
-    }
-
     if (id == GetRTIdByIndex(cx, XPCJSRuntime::IDX_PROTO)) {
         return JS_DefinePropertyById(cx, obj, id, JSVAL_VOID, sandbox_getProto,
                                      sandbox_setProto, JSPROP_SHARED);
     }
 
     return JS_TRUE;
 }
 
@@ -4071,93 +4048,93 @@ nsXPCComponents::GetManager(nsIComponent
 #define                             XPC_MAP_WANT_SETPROPERTY
 #define XPC_MAP_FLAGS               nsIXPCScriptable::ALLOW_PROP_MODS_DURING_RESOLVE
 #include "xpc_map_end.h" /* This will #undef the above */
 
 /* PRBool newResolve (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in jsval id, in PRUint32 flags, out JSObjectPtr objp); */
 NS_IMETHODIMP
 nsXPCComponents::NewResolve(nsIXPConnectWrappedNative *wrapper,
                             JSContext * cx, JSObject * obj,
-                            jsval id, PRUint32 flags,
+                            jsid id, PRUint32 flags,
                             JSObject * *objp, PRBool *_retval)
 {
     XPCJSRuntime* rt = nsXPConnect::GetRuntimeInstance();
     if(!rt)
         return NS_ERROR_FAILURE;
 
     jsid idid;
     uintN attrs = 0;
 
-    if(id == rt->GetStringJSVal(XPCJSRuntime::IDX_LAST_RESULT))
+    if(id == rt->GetStringID(XPCJSRuntime::IDX_LAST_RESULT))
     {
         idid = rt->GetStringID(XPCJSRuntime::IDX_LAST_RESULT);
         attrs = JSPROP_READONLY;
     }
-    else if(id == rt->GetStringJSVal(XPCJSRuntime::IDX_RETURN_CODE))
+    else if(id == rt->GetStringID(XPCJSRuntime::IDX_RETURN_CODE))
         idid = rt->GetStringID(XPCJSRuntime::IDX_RETURN_CODE);
     else
         return NS_OK;
 
     *objp = obj;
     *_retval = JS_DefinePropertyById(cx, obj, idid, JSVAL_VOID, nsnull, nsnull,
                                      JSPROP_ENUMERATE | JSPROP_PERMANENT |
                                      attrs);
     return NS_OK;
 }
 
 /* PRBool getProperty (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in jsval id, in JSValPtr vp); */
 NS_IMETHODIMP
 nsXPCComponents::GetProperty(nsIXPConnectWrappedNative *wrapper,
                              JSContext * cx, JSObject * obj,
-                             jsval id, jsval * vp, PRBool *_retval)
+                             jsid id, jsval * vp, PRBool *_retval)
 {
     XPCContext* xpcc = XPCContext::GetXPCContext(cx);
     if(!xpcc)
         return NS_ERROR_FAILURE;
 
     PRBool doResult = JS_FALSE;
     nsresult res;
     XPCJSRuntime* rt = xpcc->GetRuntime();
-    if(id == rt->GetStringJSVal(XPCJSRuntime::IDX_LAST_RESULT))
+    if(id == rt->GetStringID(XPCJSRuntime::IDX_LAST_RESULT))
     {
         res = xpcc->GetLastResult();
         doResult = JS_TRUE;
     }
-    else if(id == rt->GetStringJSVal(XPCJSRuntime::IDX_RETURN_CODE))
+    else if(id == rt->GetStringID(XPCJSRuntime::IDX_RETURN_CODE))
     {
         res = xpcc->GetPendingResult();
         doResult = JS_TRUE;
     }
 
     nsresult rv = NS_OK;
     if(doResult)
     {
         if(!JS_NewNumberValue(cx, (jsdouble) res, vp))
             return NS_ERROR_OUT_OF_MEMORY;
         rv = NS_SUCCESS_I_DID_SOMETHING;
     }
 
     return rv;
 }
 
-/* PRBool setProperty (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in jsval id, in JSValPtr vp); */
+/* PRBool setProperty (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in jsid id, in JSValPtr vp); */
 NS_IMETHODIMP
 nsXPCComponents::SetProperty(nsIXPConnectWrappedNative *wrapper,
-                             JSContext * cx, JSObject * obj, jsval id,
+                             JSContext * cx, JSObject * obj, jsid id,
                              jsval * vp, PRBool *_retval)
 {
     XPCContext* xpcc = XPCContext::GetXPCContext(cx);
     if(!xpcc)
         return NS_ERROR_FAILURE;
 
     XPCJSRuntime* rt = xpcc->GetRuntime();
     if(!rt)
         return NS_ERROR_FAILURE;
 
-    if(id == rt->GetStringJSVal(XPCJSRuntime::IDX_RETURN_CODE))
+    if(id == rt->GetStringID(XPCJSRuntime::IDX_RETURN_CODE))
     {
         nsresult rv;
         if(JS_ValueToECMAUint32(cx, *vp, (uint32*)&rv))
         {
             xpcc->SetPendingResult(rv);
             xpcc->SetLastResult(rv);
             return NS_SUCCESS_I_DID_SOMETHING;
         }
--- a/js/src/xpconnect/src/xpcinlines.h
+++ b/js/src/xpconnect/src/xpcinlines.h
@@ -252,17 +252,17 @@ XPCCallContext::HasInterfaceAndMember() 
 {
     return mState >= HAVE_NAME && mInterface && (mMember
 #ifdef XPC_IDISPATCH_SUPPORT
         || mIDispatchMember
 #endif
         );
 }
 
-inline jsval
+inline jsid
 XPCCallContext::GetName() const
 {
     CHECK_STATE(HAVE_NAME);
     return mName;
 }
 
 inline JSBool
 XPCCallContext::GetStaticMemberIsLocal() const
@@ -302,25 +302,25 @@ XPCCallContext::GetReturnValueWasSet() c
 inline void
 XPCCallContext::SetRetVal(jsval val)
 {
     CHECK_STATE(HAVE_ARGS);
     if(mRetVal)
         *mRetVal = val;
 }
 
-inline jsval
+inline jsid
 XPCCallContext::GetResolveName() const
 {
     CHECK_STATE(HAVE_CONTEXT);
     return mThreadData->GetResolveName();
 }
 
-inline jsval
-XPCCallContext::SetResolveName(jsval name)
+inline jsid
+XPCCallContext::SetResolveName(jsid name)
 {
     CHECK_STATE(HAVE_CONTEXT);
     return mThreadData->SetResolveName(name);
 }
 
 inline XPCWrappedNative*
 XPCCallContext::GetResolvingWrapper() const
 {
@@ -391,17 +391,17 @@ XPCNativeInterface::GetIID() const
 inline const char*
 XPCNativeInterface::GetNameString() const
 {
     const char* name;
     return NS_SUCCEEDED(mInfo->GetNameShared(&name)) ? name : nsnull;
 }
 
 inline XPCNativeMember*
-XPCNativeInterface::FindMember(jsval name) const
+XPCNativeInterface::FindMember(jsid name) const
 {
     const XPCNativeMember* member = mMembers;
     for(int i = (int) mMemberCount; i > 0; i--, member++)
         if(member->GetName() == name)
             return const_cast<XPCNativeMember*>(member);
     return nsnull;
 }
 
@@ -419,17 +419,17 @@ XPCNativeInterface::DealWithDyingGCThing
     XPCNativeMember* member = mMembers;
     for(int i = (int) mMemberCount; i > 0; i--, member++)
         member->DealWithDyingGCThings(cx, rt);
 }
 
 /***************************************************************************/
 
 inline JSBool
-XPCNativeSet::FindMember(jsval name, XPCNativeMember** pMember,
+XPCNativeSet::FindMember(jsid name, XPCNativeMember** pMember,
                          PRUint16* pInterfaceIndex) const
 {
     XPCNativeInterface* const * iface;
     int count = (int) mInterfaceCount;
     int i;
 
     // look for interface names first
 
@@ -457,28 +457,28 @@ XPCNativeSet::FindMember(jsval name, XPC
                 *pInterfaceIndex = (PRUint16) i;
             return JS_TRUE;
         }
     }
     return JS_FALSE;
 }
 
 inline JSBool
-XPCNativeSet::FindMember(jsval name, XPCNativeMember** pMember,
+XPCNativeSet::FindMember(jsid name, XPCNativeMember** pMember,
                          XPCNativeInterface** pInterface) const
 {
     PRUint16 index;
     if(!FindMember(name, pMember, &index))
         return JS_FALSE;
     *pInterface = mInterfaces[index];
     return JS_TRUE;
 }
 
 inline JSBool
-XPCNativeSet::FindMember(jsval name,
+XPCNativeSet::FindMember(jsid name,
                          XPCNativeMember** pMember,
                          XPCNativeInterface** pInterface,
                          XPCNativeSet* protoSet,
                          JSBool* pIsLocal) const
 {
     XPCNativeMember* Member;
     XPCNativeInterface* Interface;
     XPCNativeMember* protoMember;
@@ -496,17 +496,17 @@ XPCNativeSet::FindMember(jsval name,
          !protoSet->MatchesSetUpToInterface(this, Interface) &&
           (!protoSet->FindMember(name, &protoMember, (PRUint16*)nsnull) ||
            protoMember != Member));
 
     return JS_TRUE;
 }
 
 inline XPCNativeInterface*
-XPCNativeSet::FindNamedInterface(jsval name) const
+XPCNativeSet::FindNamedInterface(jsid name) const
 {
     XPCNativeInterface* const * pp = mInterfaces;
 
     for(int i = (int) mInterfaceCount; i > 0; i--, pp++)
     {
         XPCNativeInterface* iface = *pp;
 
         if(name == iface->GetName())
@@ -712,23 +712,21 @@ XPCWrappedNative::SweepTearOffs()
             }
         }
     }
 }
 
 /***************************************************************************/
 
 inline JSBool
-xpc_ForcePropertyResolve(JSContext* cx, JSObject* obj, jsval idval)
+xpc_ForcePropertyResolve(JSContext* cx, JSObject* obj, jsid id)
 {
     jsval prop;
-    jsid id;
 
-    if(!JS_ValueToId(cx, idval, &id) ||
-       !JS_LookupPropertyById(cx, obj, id, &prop))
+    if(!JS_LookupPropertyById(cx, obj, id, &prop))
         return JS_FALSE;
     return JS_TRUE;
 }
 
 inline JSObject*
 xpc_NewSystemInheritingJSObject(JSContext *cx, JSClass *clasp, JSObject *proto,
                                 JSObject *parent)
 {
@@ -771,17 +769,17 @@ GetRTIdByIndex(JSContext *cx, uintN inde
 {
   XPCJSRuntime *rt = nsXPConnect::GetRuntimeInstance();
   return rt->GetStringID(index);
 }
 
 inline jsval
 GetRTStringByIndex(JSContext *cx, uintN index)
 {
-  return ID_TO_JSVAL(GetRTIdByIndex(cx, index));
+  return STRING_TO_JSVAL(JSID_TO_STRING(GetRTIdByIndex(cx, index)));
 }
 
 inline
 JSBool ThrowBadParam(nsresult rv, uintN paramNum, XPCCallContext& ccx)
 {
     XPCThrower::ThrowBadParam(rv, paramNum, ccx);
     return JS_FALSE;
 }
--- a/js/src/xpconnect/src/xpcjsid.cpp
+++ b/js/src/xpconnect/src/xpcjsid.cpp
@@ -469,17 +469,17 @@ nsJSIID::NewID(nsIInterfaceInfo* aInfo)
     return idObj;
 }
 
 
 /* PRBool resolve (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in jsval id); */
 NS_IMETHODIMP
 nsJSIID::NewResolve(nsIXPConnectWrappedNative *wrapper,
                     JSContext * cx, JSObject * obj,
-                    jsval id, PRUint32 flags,
+                    jsid id, PRUint32 flags,
                     JSObject * *objp, PRBool *_retval)
 {
     XPCCallContext ccx(JS_CALLER, cx);
 
     AutoMarkingNativeInterfacePtr iface(ccx);
 
     const nsIID* iid;
     mInfo->GetIIDShared(&iid);
@@ -491,22 +491,18 @@ nsJSIID::NewResolve(nsIXPConnectWrappedN
 
     XPCNativeMember* member = iface->FindMember(id);
     if(member && member->IsConstant())
     {
         jsval val;
         if(!member->GetConstantValue(ccx, iface, &val))
             return NS_ERROR_OUT_OF_MEMORY;
 
-        jsid idid;
-        if(!JS_ValueToId(cx, id, &idid))
-            return NS_ERROR_OUT_OF_MEMORY;
-
         *objp = obj;
-        *_retval = JS_DefinePropertyById(cx, obj, idid, val, nsnull, nsnull,
+        *_retval = JS_DefinePropertyById(cx, obj, id, val, nsnull, nsnull,
                                          JSPROP_ENUMERATE | JSPROP_READONLY |
                                          JSPROP_PERMANENT);
     }
 
     return NS_OK;
 }
 
 /* PRBool enumerate (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj); */
@@ -915,17 +911,17 @@ nsJSCID::Construct(nsIXPConnectWrappedNa
                    PRBool *_retval)
 {
     XPCJSRuntime* rt = nsXPConnect::GetRuntimeInstance();
     if(!rt)
         return NS_ERROR_FAILURE;
 
     // 'push' a call context and call on it
     XPCCallContext ccx(JS_CALLER, cx, obj, nsnull,
-                       rt->GetStringJSVal(XPCJSRuntime::IDX_CREATE_INSTANCE),
+                       rt->GetStringID(XPCJSRuntime::IDX_CREATE_INSTANCE),
                        argc, argv, vp);
 
     *_retval = XPCWrappedNative::CallMethod(ccx);
     return NS_OK;
 }
 
 /* PRBool hasInstance (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in jsval val, out PRBool bp); */
 NS_IMETHODIMP
--- a/js/src/xpconnect/src/xpcjsruntime.cpp
+++ b/js/src/xpconnect/src/xpcjsruntime.cpp
@@ -1069,17 +1069,17 @@ XPCJSRuntime::XPCJSRuntime(nsXPConnect* 
         JS_NewDHashTable(JS_DHashGetStubOps(), nsnull,
                          sizeof(JSDHashEntryStub), 128);
 #endif
     NS_TIME_FUNCTION;
 
     DOM_InitInterfaces();
 
     // these jsids filled in later when we have a JSContext to work with.
-    mStrIDs[0] = 0;
+    mStrIDs[0] = JSID_VOID;
 
     mJSRuntime = JS_NewRuntime(32L * 1024L * 1024L); // pref ?
     if(mJSRuntime)
     {
         // Unconstrain the runtime's threshold on nominal heap size, to avoid
         // triggering GC too often if operating continuously near an arbitrary
         // finite threshold (0xffffffff is infinity for uint32 parameters).
         // This leaves the maximum-JS_malloc-bytes threshold still in effect
@@ -1141,26 +1141,26 @@ XPCJSRuntime::newXPCJSRuntime(nsXPConnec
 
 JSBool
 XPCJSRuntime::OnJSContextNew(JSContext *cx)
 {
     NS_TIME_FUNCTION;
 
     // if it is our first context then we need to generate our string ids
     JSBool ok = JS_TRUE;
-    if(!mStrIDs[0])
+    if(JSID_IS_VOID(mStrIDs[0]))
     {
         JS_SetGCParameterForThread(cx, JSGC_MAX_CODE_CACHE_BYTES, 16 * 1024 * 1024);
         JSAutoRequest ar(cx);
         for(uintN i = 0; i < IDX_TOTAL_COUNT; i++)
         {
             JSString* str = JS_InternString(cx, mStrings[i]);
             if(!str || !JS_ValueToId(cx, STRING_TO_JSVAL(str), &mStrIDs[i]))
             {
-                mStrIDs[0] = 0;
+                mStrIDs[0] = JSID_VOID;
                 ok = JS_FALSE;
                 break;
             }
             mStrJSVals[i] = STRING_TO_JSVAL(str);
         }
     }
     if (!ok)
         return JS_FALSE;
--- a/js/src/xpconnect/src/xpcprivate.h
+++ b/js/src/xpconnect/src/xpcprivate.h
@@ -945,17 +945,17 @@ public:
     NS_IMETHOD GetLanguage(PRUint16 *aResult);
 
     enum {NO_ARGS = (uintN) -1};
 
     XPCCallContext(XPCContext::LangType callerLanguage,
                    JSContext* cx    = nsnull,
                    JSObject* obj    = nsnull,
                    JSObject* funobj = nsnull,
-                   jsval id         = 0,
+                   jsid id          = JSID_VOID,
                    uintN argc       = NO_ARGS,
                    jsval *argv      = nsnull,
                    jsval *rval      = nsnull);
 
     virtual ~XPCCallContext();
 
     inline JSBool                       IsValid() const ;
 
@@ -983,41 +983,41 @@ public:
 
     inline XPCNativeScriptableInfo*     GetScriptableInfo() const ;
     inline JSBool                       CanGetSet() const ;
     inline XPCNativeSet*                GetSet() const ;
     inline JSBool                       CanGetInterface() const ;
     inline XPCNativeInterface*          GetInterface() const ;
     inline XPCNativeMember*             GetMember() const ;
     inline JSBool                       HasInterfaceAndMember() const ;
-    inline jsval                        GetName() const ;
+    inline jsid                         GetName() const ;
     inline JSBool                       GetStaticMemberIsLocal() const ;
     inline uintN                        GetArgc() const ;
     inline jsval*                       GetArgv() const ;
     inline jsval*                       GetRetVal() const ;
     inline JSBool                       GetReturnValueWasSet() const ;
 
     inline PRUint16                     GetMethodIndex() const ;
     inline void                         SetMethodIndex(PRUint16 index) ;
 
     inline JSBool   GetDestroyJSContextInDestructor() const;
     inline void     SetDestroyJSContextInDestructor(JSBool b);
 
-    inline jsval GetResolveName() const;
-    inline jsval SetResolveName(jsval name);
+    inline jsid GetResolveName() const;
+    inline jsid SetResolveName(jsid name);
 
     inline XPCWrappedNative* GetResolvingWrapper() const;
     inline XPCWrappedNative* SetResolvingWrapper(XPCWrappedNative* w);
 
     inline void SetRetVal(jsval val);
 
     inline JSObject* GetCallee() const;
     inline void SetCallee(JSObject* callee);
 
-    void SetName(jsval name);
+    void SetName(jsid name);
     void SetArgsAndResultPtr(uintN argc, jsval *argv, jsval *rval);
     void SetCallInfo(XPCNativeInterface* iface, XPCNativeMember* member,
                      JSBool isSetter);
 
     nsresult  CanCallNow();
 
     void SystemIsBeingShutDown();
 
@@ -1050,17 +1050,17 @@ private:
                    XPCWrappedNative* wn,
                    XPCWrappedNativeTearOff* tearoff);
 
     void Init(XPCContext::LangType callerLanguage,
               JSBool callBeginRequest,
               JSObject* obj,
               JSObject* funobj,
               JSBool getWrappedNative,
-              jsval name,
+              jsid name,
               uintN argc,
               jsval *argv,
               jsval *rval);
 
 private:
     // posible values for mState
     enum State {
         INIT_FAILED,
@@ -1105,17 +1105,17 @@ private:
     XPCWrappedNativeTearOff*        mTearOff;
 
     XPCNativeScriptableInfo*        mScriptableInfo;
 
     XPCNativeSet*                   mSet;
     XPCNativeInterface*             mInterface;
     XPCNativeMember*                mMember;
 
-    jsval                           mName;
+    jsid                            mName;
     JSBool                          mStaticMemberIsLocal;
 
     uintN                           mArgc;
     jsval*                          mArgv;
     jsval*                          mRetVal;
 
     JSBool                          mReturnValueWasSet;
 #ifdef XPC_IDISPATCH_SUPPORT
@@ -1279,17 +1279,17 @@ extern JSExtendedClass XPC_WN_NoHelper_J
 extern JSClass XPC_WN_NoMods_WithCall_Proto_JSClass;
 extern JSClass XPC_WN_NoMods_NoCall_Proto_JSClass;
 extern JSClass XPC_WN_ModsAllowed_WithCall_Proto_JSClass;
 extern JSClass XPC_WN_ModsAllowed_NoCall_Proto_JSClass;
 extern JSClass XPC_WN_Tearoff_JSClass;
 extern JSClass XPC_WN_NoHelper_Proto_JSClass;
 
 extern JSBool
-XPC_WN_Equality(JSContext *cx, JSObject *obj, jsval v, JSBool *bp);
+XPC_WN_Equality(JSContext *cx, JSObject *obj, const jsval *v, JSBool *bp);
 
 extern JSObjectOps *
 XPC_WN_Proto_GetObjectOps(JSContext *cx, JSClass *clazz);
 
 extern JSBool
 XPC_WN_CallMethod(JSContext *cx, JSObject *obj,
                   uintN argc, jsval *argv, jsval *vp);
 
@@ -1552,17 +1552,17 @@ JSObject* xpc_CloneJSFunction(XPCCallCon
 class XPCNativeMember
 {
 public:
     static JSBool GetCallInfo(XPCCallContext& ccx,
                               JSObject* funobj,
                               XPCNativeInterface** pInterface,
                               XPCNativeMember**    pMember);
 
-    jsval   GetName() const {return mName;}
+    jsid   GetName() const {return mName;}
 
     PRUint16 GetIndex() const {return mIndex;}
 
     JSBool GetConstantValue(XPCCallContext& ccx, XPCNativeInterface* iface,
                             jsval* pval)
         {NS_ASSERTION(IsConstant(),
                       "Only call this if you're sure this is a constant!");
          if(!IsResolved() && !Resolve(ccx, iface)) return JS_FALSE;
@@ -1582,17 +1582,17 @@ public:
 
     JSBool IsWritableAttribute() const
         {return 0 != (mFlags & SETTER_TOO);}
 
     JSBool IsReadOnlyAttribute() const
         {return IsAttribute() && !IsWritableAttribute();}
 
 
-    void SetName(jsval a) {mName = a;}
+    void SetName(jsid a) {mName = a;}
 
     void SetMethod(PRUint16 index)
         {mVal = JSVAL_NULL; mFlags = METHOD; mIndex = index;}
 
     void SetConstant(PRUint16 index)
         {mVal = JSVAL_NULL; mFlags = CONSTANT; mIndex = index;}
 
     void SetReadOnlyAttribute(PRUint16 index)
@@ -1619,17 +1619,17 @@ private:
         METHOD      = 0x02,
         CONSTANT    = 0x04,
         GETTER      = 0x08,
         SETTER_TOO  = 0x10
     };
 
 private:
     // our only data...
-    jsval    mName;
+    jsid     mName;
     jsval    mVal;
     PRUint16 mIndex;
     PRUint16 mFlags;
 };
 
 /***************************************************************************/
 // XPCNativeInterface represents a single idl declared interface. This is
 // primarily the set of XPCNativeMembers.
@@ -1643,21 +1643,21 @@ public:
                                             const nsIID* iid);
     static XPCNativeInterface* GetNewOrUsed(XPCCallContext& ccx,
                                             nsIInterfaceInfo* info);
     static XPCNativeInterface* GetNewOrUsed(XPCCallContext& ccx,
                                             const char* name);
     static XPCNativeInterface* GetISupports(XPCCallContext& ccx);
 
     inline nsIInterfaceInfo* GetInterfaceInfo() const {return mInfo.get();}
-    inline jsval             GetName()          const {return mName;}
+    inline jsid              GetName()          const {return mName;}
 
     inline const nsIID* GetIID() const;
     inline const char*  GetNameString() const;
-    inline XPCNativeMember* FindMember(jsval name) const;
+    inline XPCNativeMember* FindMember(jsid name) const;
 
     inline JSBool HasAncestor(const nsIID* iid) const;
 
     const char* GetMemberName(XPCCallContext& ccx,
                               const XPCNativeMember* member) const;
 
     PRUint16 GetMemberCount() const
         {NS_ASSERTION(!IsMarked(), "bad"); return mMemberCount;}
@@ -1681,29 +1681,29 @@ public:
 
     static void DestroyInstance(XPCNativeInterface* inst);
 
 protected:
     static XPCNativeInterface* NewInstance(XPCCallContext& ccx,
                                            nsIInterfaceInfo* aInfo);
 
     XPCNativeInterface();   // not implemented
-    XPCNativeInterface(nsIInterfaceInfo* aInfo, jsval aName)
+    XPCNativeInterface(nsIInterfaceInfo* aInfo, jsid aName)
         : mInfo(aInfo), mName(aName), mMemberCount(0)
                           {MOZ_COUNT_CTOR(XPCNativeInterface);}
     ~XPCNativeInterface() {MOZ_COUNT_DTOR(XPCNativeInterface);}
 
     void* operator new(size_t, void* p) CPP_THROW_NEW {return p;}
 
     XPCNativeInterface(const XPCNativeInterface& r); // not implemented
     XPCNativeInterface& operator= (const XPCNativeInterface& r); // not implemented
 
 private:
     nsCOMPtr<nsIInterfaceInfo> mInfo;
-    jsval                      mName;
+    jsid                       mName;
     PRUint16          mMemberCount;
     XPCNativeMember   mMembers[1]; // always last - object sized for array
 };
 
 /***************************************************************************/
 // XPCNativeSetKey is used to key a XPCNativeSet in a NativeSetMap.
 
 class XPCNativeSetKey
@@ -1764,35 +1764,35 @@ public:
                                       nsIClassInfo* classInfo);
     static XPCNativeSet* GetNewOrUsed(XPCCallContext& ccx,
                                       XPCNativeSet* otherSet,
                                       XPCNativeInterface* newInterface,
                                       PRUint16 position);
 
     static void ClearCacheEntryForClassInfo(nsIClassInfo* classInfo);
 
-    inline JSBool FindMember(jsval name, XPCNativeMember** pMember,
+    inline JSBool FindMember(jsid name, XPCNativeMember** pMember,
                              PRUint16* pInterfaceIndex) const;
 
-    inline JSBool FindMember(jsval name, XPCNativeMember** pMember,
+    inline JSBool FindMember(jsid name, XPCNativeMember** pMember,
                              XPCNativeInterface** pInterface) const;
 
-    inline JSBool FindMember(jsval name,
+    inline JSBool FindMember(jsid name,
                              XPCNativeMember** pMember,
                              XPCNativeInterface** pInterface,
                              XPCNativeSet* protoSet,
                              JSBool* pIsLocal) const;
 
     inline JSBool HasInterface(XPCNativeInterface* aInterface) const;
     inline JSBool HasInterfaceWithAncestor(XPCNativeInterface* aInterface) const;
     inline JSBool HasInterfaceWithAncestor(const nsIID* iid) const;
 
     inline XPCNativeInterface* FindInterfaceWithIID(const nsIID& iid) const;
 
-    inline XPCNativeInterface* FindNamedInterface(jsval name) const;
+    inline XPCNativeInterface* FindNamedInterface(jsid name) const;
 
     PRUint16 GetMemberCount() const {return mMemberCount;}
     PRUint16 GetInterfaceCount() const
         {NS_ASSERTION(!IsMarked(), "bad"); return mInterfaceCount;}
     XPCNativeInterface** GetInterfaceArray() {return mInterfaces;}
 
     XPCNativeInterface* GetInterfaceAt(PRUint16 i)
         {NS_ASSERTION(i < mInterfaceCount, "bad index"); return mInterfaces[i];}
@@ -2538,22 +2538,22 @@ public:
     // This will try to find a member that is of the form "camelCased"
     // but was accessed from JS using "CamelCased". This is here to catch
     // mistakes caused by the confusion magnet that JS methods are by
     // convention 'foo' while C++ members are by convention 'Foo'.
     static void
     HandlePossibleNameCaseError(XPCCallContext& ccx,
                                 XPCNativeSet* set,
                                 XPCNativeInterface* iface,
-                                jsval name);
+                                jsid name);
     static void
     HandlePossibleNameCaseError(JSContext* cx,
                                 XPCNativeSet* set,
                                 XPCNativeInterface* iface,
-                                jsval name);
+                                jsid name);
 
 #define  HANDLE_POSSIBLE_NAME_CASE_ERROR(context, set, iface, name) \
     XPCWrappedNative::HandlePossibleNameCaseError(context, set, iface, name)
 #else
 #define  HANDLE_POSSIBLE_NAME_CASE_ERROR(context, set, iface, name) ((void)0)
 #endif
 
     enum CallMode {CALL_METHOD, CALL_GETTER, CALL_SETTER};
@@ -3509,19 +3509,19 @@ public:
     }
 
     XPCJSContextStack* GetJSContextStack() {return mJSContextStack;}
 
     XPCCallContext*  GetCallContext() const {return mCallContext;}
     XPCCallContext*  SetCallContext(XPCCallContext* ccx)
         {XPCCallContext* old = mCallContext; mCallContext = ccx; return old;}
 
-    jsval GetResolveName() const {return mResolveName;}
-    jsval SetResolveName(jsval name)
-        {jsval old = mResolveName; mResolveName = name; return old;}
+    jsid GetResolveName() const {return mResolveName;}
+    jsid SetResolveName(jsid name)
+        {jsid old = mResolveName; mResolveName = name; return old;}
 
     XPCWrappedNative* GetResolvingWrapper() const {return mResolvingWrapper;}
     XPCWrappedNative* SetResolvingWrapper(XPCWrappedNative* w)
         {XPCWrappedNative* old = mResolvingWrapper;
          mResolvingWrapper = w; return old;}
 
     void Cleanup();
     void ReleaseNatives();
@@ -3556,17 +3556,17 @@ public:
 private:
     XPCPerThreadData();
     static XPCPerThreadData* GetDataImpl(JSContext *cx);
 
 private:
     XPCJSContextStack*   mJSContextStack;
     XPCPerThreadData*    mNextThread;
     XPCCallContext*      mCallContext;
-    jsval                mResolveName;
+    jsid                 mResolveName;
     XPCWrappedNative*    mResolvingWrapper;
 
     nsIExceptionManager* mExceptionManager;
     nsIException*        mException;
     JSBool               mExceptionManagerNotAvailable;
     AutoMarkingPtr*      mAutoRoots;
 
 #ifdef XPC_CHECK_WRAPPER_THREADSAFETY
@@ -4002,36 +4002,36 @@ private:
     AutoScriptEvaluate(const AutoScriptEvaluate &);
     AutoScriptEvaluate & operator =(const AutoScriptEvaluate &);
 };
 
 /***************************************************************************/
 class NS_STACK_CLASS AutoResolveName
 {
 public:
-    AutoResolveName(XPCCallContext& ccx, jsval name
+    AutoResolveName(XPCCallContext& ccx, jsid name
                     MOZILLA_GUARD_OBJECT_NOTIFIER_PARAM)
         : mTLS(ccx.GetThreadData()),
           mOld(mTLS->SetResolveName(name)),
           mCheck(name) {
         MOZILLA_GUARD_OBJECT_NOTIFIER_INIT;
     }
     ~AutoResolveName()
         {
 #ifdef DEBUG
-            jsval old = 
+            jsid old = 
 #endif
             mTLS->SetResolveName(mOld);
             NS_ASSERTION(old == mCheck, "Bad Nesting!");
         }
 
 private:
     XPCPerThreadData* mTLS;
-    jsval mOld;
-    jsval mCheck;
+    jsid mOld;
+    jsid mCheck;
     MOZILLA_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
 /***************************************************************************/
 class XPCMarkableJSVal
 {
 public:
     XPCMarkableJSVal(jsval val) : mVal(val), mValPtr(&mVal) {}
@@ -4366,17 +4366,17 @@ xpc_EvalInSandbox(JSContext *cx, JSObjec
                   const char *filename, PRInt32 lineNo,
                   JSVersion jsVersion, PRBool returnStringOnly, jsval *rval);
 #endif /* !XPCONNECT_STANDALONE */
 
 /***************************************************************************/
 // Inlined utilities.
 
 inline JSBool
-xpc_ForcePropertyResolve(JSContext* cx, JSObject* obj, jsval idval);
+xpc_ForcePropertyResolve(JSContext* cx, JSObject* obj, jsid id);
 
 inline jsid
 GetRTIdByIndex(JSContext *cx, uintN index);
 
 inline jsval
 GetRTStringByIndex(JSContext *cx, uintN index);
 
 // Wrapper for JS_NewObject to mark the new object as system when parent is
--- a/js/src/xpconnect/src/xpcquickstubs.cpp
+++ b/js/src/xpconnect/src/xpcquickstubs.cpp
@@ -114,16 +114,28 @@ LookupInterfaceOrAncestor(PRUint32 table
             if(entry)
                 break;
             info.swap(parent);
         }
     }
     return entry;
 }
 
+static inline jsid
+JSValHoldingJSIdToJSId(jsval v)
+{
+    if (JSVAL_IS_STRING(v))
+        return INTERNED_STRING_TO_JSID(JSVAL_TO_STRING(v));
+    if (JSVAL_IS_INT(v))
+        return INT_TO_JSID(JSVAL_TO_INT(v));
+    if (JSVAL_IS_VOID(v))
+        return JSID_VOID;
+    return OBJECT_TO_JSID(JSVAL_TO_OBJECT(v));
+}
+
 static JSBool
 PropertyOpForwarder(JSContext *cx, uintN argc, jsval *vp)
 {
     // Layout:
     //   this = our this
     //   property op to call = callee reserved slot 0
     //   name of the property = callee reserved slot 1
 
@@ -136,17 +148,18 @@ PropertyOpForwarder(JSContext *cx, uintN
     JSObject *ptrobj = JSVAL_TO_OBJECT(v);
     JSPropertyOp *popp = static_cast<JSPropertyOp *>(JS_GetPrivate(cx, ptrobj));
 
     if(!JS_GetReservedSlot(cx, callee, 1, &v))
         return JS_FALSE;
 
     jsval argval = (argc > 0) ? JS_ARGV(cx, vp)[0] : JSVAL_VOID;
     JS_SET_RVAL(cx, vp, argval);
-    return (*popp)(cx, obj, v, vp);
+    jsid id = JSValHoldingJSIdToJSId(argval);
+    return (*popp)(cx, obj, id, vp);
 }
 
 static void
 PointerFinalize(JSContext *cx, JSObject *obj)
 {
     JSPropertyOp *popp = static_cast<JSPropertyOp *>(JS_GetPrivate(cx, obj));
     delete popp;
 }
@@ -485,17 +498,17 @@ xpc_qsThrow(JSContext *cx, nsresult rv)
  * We could instead have each quick stub pass its name to the error-handling
  * functions, as that name is statically known.  But that would be redundant;
  * the information is handy at runtime anyway.  Also, this code often produces
  * a more specific error message, e.g. "[nsIDOMHTMLDocument.appendChild]"
  * rather than "[nsIDOMNode.appendChild]".
  */
 static void
 GetMemberInfo(JSObject *obj,
-              jsval memberId,
+              jsid memberId,
               const char **ifaceName,
               const char **memberName)
 {
     // Get the interface name.  From DefinePropertyIfFound (in
     // xpcwrappednativejsops.cpp) and XPCThrower::Verbosify.
     //
     // We could instead make the quick stub could pass in its interface name,
     // but this code often produces a more specific error message, e.g.
@@ -522,32 +535,32 @@ GetMemberInfo(JSObject *obj,
             XPCNativeMember *member;
             XPCNativeInterface *iface;
 
             if(set->FindMember(memberId, &member, &iface))
                 *ifaceName = iface->GetNameString();
         }
     }
 
-    *memberName = (JSVAL_IS_STRING(memberId)
-                   ? JS_GetStringBytes(JSVAL_TO_STRING(memberId))
+    *memberName = (JSID_IS_STRING(memberId)
+                   ? JS_GetStringBytes(JSID_TO_STRING(memberId))
                    : "unknown");
 }
 
 static void
 GetMethodInfo(JSContext *cx,
               jsval *vp,
               const char **ifaceName,
               const char **memberName)
 {
     JSObject *funobj = JSVAL_TO_OBJECT(JS_CALLEE(cx, vp));
     NS_ASSERTION(JS_ObjectIsFunction(cx, funobj),
                  "JSFastNative callee should be Function object");
     JSString *str = JS_GetFunctionId((JSFunction *) JS_GetPrivate(cx, funobj));
-    jsval methodId = str ? STRING_TO_JSVAL(str) : JSVAL_NULL;
+    jsid methodId = str ? INTERNED_STRING_TO_JSID(str) : JSID_VOID;
 
     GetMemberInfo(JSVAL_TO_OBJECT(vp[1]), methodId, ifaceName, memberName);
 }
 
 static JSBool
 ThrowCallFailed(JSContext *cx, nsresult rv,
                 const char *ifaceName, const char *memberName)
 {
@@ -591,17 +604,17 @@ ThrowCallFailed(JSContext *cx, nsresult 
     if(sz)
         JS_smprintf_free(sz);
 
     return JS_FALSE;
 }
 
 JSBool
 xpc_qsThrowGetterSetterFailed(JSContext *cx, nsresult rv, JSObject *obj,
-                              jsval memberId)
+                              jsid memberId)
 {
     const char *ifaceName, *memberName;
     GetMemberInfo(obj, memberId, &ifaceName, &memberName);
     return ThrowCallFailed(cx, rv, ifaceName, memberName);
 }
 
 JSBool
 xpc_qsThrowMethodFailed(JSContext *cx, nsresult rv, jsval *vp)
@@ -664,17 +677,17 @@ void
 xpc_qsThrowBadArgWithDetails(JSContext *cx, nsresult rv, uintN paramnum,
                              const char *ifaceName, const char *memberName)
 {
     ThrowBadArg(cx, rv, ifaceName, memberName, paramnum);
 }
 
 void
 xpc_qsThrowBadSetterValue(JSContext *cx, nsresult rv,
-                          JSObject *obj, jsval propId)
+                          JSObject *obj, jsid propId)
 {
     const char *ifaceName, *memberName;
     GetMemberInfo(obj, propId, &ifaceName, &memberName);
     ThrowBadArg(cx, rv, ifaceName, memberName, 0);
 }
 
 xpc_qsDOMString::xpc_qsDOMString(JSContext *cx, jsval v, jsval *pval,
                                  StringificationBehavior nullBehavior,
--- a/js/src/xpconnect/src/xpcquickstubs.h
+++ b/js/src/xpconnect/src/xpcquickstubs.h
@@ -95,17 +95,17 @@ xpc_qsThrow(JSContext *cx, nsresult rv);
  * and xpc_qsThrowBadArg.
  *
  * This is one reason the UnwrapThis functions below have an out parameter that
  * receives the wrapper JSObject.  (The other reason is to help the caller keep
  * that JSObject GC-reachable.)
  */
 JSBool
 xpc_qsThrowGetterSetterFailed(JSContext *cx, nsresult rv,
-                              JSObject *obj, jsval memberId);
+                              JSObject *obj, jsid memberId);
 
 /**
  * Fail after an XPCOM method returned rv.
  *
  * See NOTE at xpc_qsThrowGetterSetterFailed.
  */
 JSBool
 xpc_qsThrowMethodFailed(JSContext *cx, nsresult rv, jsval *vp);
@@ -135,17 +135,17 @@ xpc_qsThrowBadArgWithDetails(JSContext *
 
 /**
  * Fail after converting a setter argument fails.
  *
  * See NOTE at xpc_qsThrowGetterSetterFailed.
  */
 void
 xpc_qsThrowBadSetterValue(JSContext *cx, nsresult rv, JSObject *obj,
-                          jsval propId);
+                          jsid propId);
 
 
 /* Functions for converting values between COM and JS. */
 
 inline JSBool
 xpc_qsInt32ToJsval(JSContext *cx, PRInt32 i, jsval *rv)
 {
     *rv = INT_TO_JSVAL(i);
--- a/js/src/xpconnect/src/xpcruntimesvc.cpp
+++ b/js/src/xpconnect/src/xpcruntimesvc.cpp
@@ -64,17 +64,17 @@ NS_IMPL_THREADSAFE_RELEASE(BackstagePass
                             nsIXPCScriptable::DONT_ENUM_QUERY_INTERFACE    | \
                             nsIXPCScriptable::DONT_REFLECT_INTERFACE_NAMES
 #include "xpc_map_end.h" /* This will #undef the above */
 
 /* PRBool newResolve (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in jsval id, in PRUint32 flags, out JSObjectPtr objp); */
 NS_IMETHODIMP
 BackstagePass::NewResolve(nsIXPConnectWrappedNative *wrapper,
                           JSContext * cx, JSObject * obj,
-                          jsval id, PRUint32 flags, 
+                          jsid id, PRUint32 flags, 
                           JSObject * *objp, PRBool *_retval)
 {
     JSBool resolved;
 
     *_retval = JS_ResolveStandardClass(cx, obj, id, &resolved);
     if(*_retval && resolved)
         *objp = obj;
     return NS_OK;
--- a/js/src/xpconnect/src/xpcthreadcontext.cpp
+++ b/js/src/xpconnect/src/xpcthreadcontext.cpp
@@ -184,17 +184,17 @@ XPCJSContextStack::DEBUG_StackHasJSConte
     for(PRUint32 i = 0; i < mStack.Length(); i++)
         if(aJSContext == mStack[i].cx)
             return JS_TRUE;
     return JS_FALSE;
 }
 #endif
 
 static JSBool
-SafeGlobalResolve(JSContext *cx, JSObject *obj, jsval id)
+SafeGlobalResolve(JSContext *cx, JSObject *obj, jsid id)
 {
     JSBool resolved;
     return JS_ResolveStandardClass(cx, obj, id, &resolved);
 }
 
 static void
 SafeFinalize(JSContext* cx, JSObject* obj)
 {
@@ -326,17 +326,17 @@ PRLock*           XPCPerThreadData::gLoc
 XPCPerThreadData* XPCPerThreadData::gThreads        = nsnull;
 XPCPerThreadData *XPCPerThreadData::sMainThreadData = nsnull;
 void *            XPCPerThreadData::sMainJSThread   = nsnull;
 
 XPCPerThreadData::XPCPerThreadData()
     :   mJSContextStack(new XPCJSContextStack()),
         mNextThread(nsnull),
         mCallContext(nsnull),
-        mResolveName(0),
+        mResolveName(JSID_VOID),
         mResolvingWrapper(nsnull),
         mExceptionManager(nsnull),
         mException(nsnull),
         mExceptionManagerNotAvailable(JS_FALSE),
         mAutoRoots(nsnull)
 #ifdef XPC_CHECK_WRAPPER_THREADSAFETY
       , mWrappedNativeThreadsafetyReportDepth(0)
 #endif
--- a/js/src/xpconnect/src/xpcwrappednative.cpp
+++ b/js/src/xpconnect/src/xpcwrappednative.cpp
@@ -3038,34 +3038,34 @@ NS_IMETHODIMP XPCWrappedNative::GetXPCon
         *aXPConnect = temp;
     }
     else
         *aXPConnect = nsnull;
     return NS_OK;
 }
 
 /* XPCNativeInterface FindInterfaceWithMember (in jsval name); */
-NS_IMETHODIMP XPCWrappedNative::FindInterfaceWithMember(jsval name, nsIInterfaceInfo * *_retval)
+NS_IMETHODIMP XPCWrappedNative::FindInterfaceWithMember(jsid name, nsIInterfaceInfo * *_retval)
 {
     XPCNativeInterface* iface;
     XPCNativeMember*  member;
 
     if(GetSet()->FindMember(name, &member, &iface) && iface)
     {
         nsIInterfaceInfo* temp = iface->GetInterfaceInfo();
         NS_IF_ADDREF(temp);
         *_retval = temp;
     }
     else
         *_retval = nsnull;
     return NS_OK;
 }
 
 /* XPCNativeInterface FindInterfaceWithName (in jsval name); */
-NS_IMETHODIMP XPCWrappedNative::FindInterfaceWithName(jsval name, nsIInterfaceInfo * *_retval)
+NS_IMETHODIMP XPCWrappedNative::FindInterfaceWithName(jsid name, nsIInterfaceInfo * *_retval)
 {
     XPCNativeInterface* iface = GetSet()->FindNamedInterface(name);
     if(iface)
     {
         nsIInterfaceInfo* temp = iface->GetInterfaceInfo();
         NS_IF_ADDREF(temp);
         *_retval = temp;
     }
@@ -3251,54 +3251,57 @@ XPCWrappedNative::ToString(XPCCallContex
 /***************************************************************************/
 
 #ifdef XPC_DETECT_LEADING_UPPERCASE_ACCESS_ERRORS
 // static
 void
 XPCWrappedNative::HandlePossibleNameCaseError(JSContext* cx,
                                               XPCNativeSet* set,
                                               XPCNativeInterface* iface,
-                                              jsval name)
+                                              jsid name)
 {
     XPCCallContext ccx(JS_CALLER, cx);
     HandlePossibleNameCaseError(ccx, set, iface, name);
 }
 
 // static
 void
 XPCWrappedNative::HandlePossibleNameCaseError(XPCCallContext& ccx,
                                               XPCNativeSet* set,
                                               XPCNativeInterface* iface,
-                                              jsval name)
+                                              jsid name)
 {
     if(!ccx.IsValid())
         return;
 
     JSString* oldJSStr;
     JSString* newJSStr;
     PRUnichar* oldStr;
     PRUnichar* newStr;
     XPCNativeMember* member;
     XPCNativeInterface* localIface;
 
     /* PRUnichar->char->PRUnichar hack is to avoid pulling in i18n code. */
-    if(JSVAL_IS_STRING(name) &&
-       nsnull != (oldJSStr = JSVAL_TO_STRING(name)) &&
+    if(JSID_IS_STRING(name) &&
+       nsnull != (oldJSStr = JSID_TO_STRING(name)) &&
        nsnull != (oldStr = (PRUnichar*) JS_GetStringChars(oldJSStr)) &&
        oldStr[0] != 0 &&
        oldStr[0] >> 8 == 0 &&
        nsCRT::IsUpper((char)oldStr[0]) &&
        nsnull != (newStr = nsCRT::strdup(oldStr)))
     {
         newStr[0] = (PRUnichar) nsCRT::ToLower((char)newStr[0]);
-        newJSStr = JS_NewUCStringCopyZ(ccx, (const jschar*)newStr);
+        newJSStr = JS_InternUCString(ccx, (const jschar*)newStr);
         nsCRT::free(newStr);
-        if(newJSStr && (set ?
-             set->FindMember(STRING_TO_JSVAL(newJSStr), &member, &localIface) :
-                        NS_PTR_TO_INT32(iface->FindMember(STRING_TO_JSVAL(newJSStr)))))
+        if (!newJSStr)
+            return;
+
+        jsid id = INTERNED_STRING_TO_JSID(newJSStr);
+        if(set ? set->FindMember(id, &member, &localIface)
+               : NS_PTR_TO_INT32(iface->FindMember(id)))
         {
             // found it!
             const char* ifaceName = set ?
                     localIface->GetNameString() :
                     iface->GetNameString();
             const char* goodName = JS_GetStringBytes(newJSStr);
             const char* badName = JS_GetStringBytes(oldJSStr);
             char* locationStr = nsnull;
--- a/js/src/xpconnect/src/xpcwrappednativeinfo.cpp
+++ b/js/src/xpconnect/src/xpcwrappednativeinfo.cpp
@@ -363,18 +363,18 @@ XPCNativeInterface::NewInstance(XPCCallC
     int i;
     JSBool failed = JS_FALSE;
     PRUint16 constCount;
     PRUint16 methodCount;
     PRUint16 totalCount;
     PRUint16 realTotalCount = 0;
     XPCNativeMember* cur;
     JSString*  str;
-    jsval name;
-    jsval interfaceName;
+    jsid name;
+    jsid interfaceName;
 
     // XXX Investigate lazy init? This is a problem given the
     // 'placement new' scheme - we need to at least know how big to make
     // the object. We might do a scan of methods to determine needed size,
     // then make our object, but avoid init'ing *any* members until asked?
     // Find out how often we create these objects w/o really looking at
     // (or using) the members.
 
@@ -428,17 +428,17 @@ XPCNativeInterface::NewInstance(XPCCallC
 
         str = JS_InternString(ccx, info->GetName());
         if(!str)
         {
             NS_ERROR("bad method name");
             failed = JS_TRUE;
             break;
         }
-        name = STRING_TO_JSVAL(str);
+        name = INTERNED_STRING_TO_JSID(str);
 
         if(info->IsSetter())
         {
             NS_ASSERTION(realTotalCount,"bad setter");
             // Note: ASSUMES Getter/Setter pairs are next to each other
             // This is a rule of the typelib spec.
             cur = &members[realTotalCount-1];
             NS_ASSERTION(cur->GetName() == name,"bad setter");
@@ -472,17 +472,17 @@ XPCNativeInterface::NewInstance(XPCCallC
 
             str = JS_InternString(ccx, constant->GetName());
             if(!str)
             {
                 NS_ERROR("bad constant name");
                 failed = JS_TRUE;
                 break;
             }
-            name = STRING_TO_JSVAL(str);
+            name = INTERNED_STRING_TO_JSID(str);
 
             // XXX need better way to find dups
             //NS_ASSERTION(!LookupMemberByID(name),"duplicate method/constant name");
 
             cur = &members[realTotalCount++];
             cur->SetName(name);
             cur->SetConstant(i);
         }
@@ -491,17 +491,17 @@ XPCNativeInterface::NewInstance(XPCCallC
     if(!failed)
     {
         const char* bytes;
         if(NS_FAILED(aInfo->GetNameShared(&bytes)) || !bytes ||
            nsnull == (str = JS_InternString(ccx, bytes)))
         {
             failed = JS_TRUE;
         }
-        interfaceName = STRING_TO_JSVAL(str);
+        interfaceName = INTERNED_STRING_TO_JSID(str);
     }
 
     if(!failed)
     {
         // Use placement new to create an object with the right amount of space
         // to hold the members array
         int size = sizeof(XPCNativeInterface);
         if(realTotalCount > 1)
@@ -533,17 +533,17 @@ XPCNativeInterface::DestroyInstance(XPCN
     inst->~XPCNativeInterface();
     delete [] (char*) inst;
 }
 
 const char*
 XPCNativeInterface::GetMemberName(XPCCallContext& ccx,
                                   const XPCNativeMember* member) const
 {
-    return JS_GetStringBytes(JSVAL_TO_STRING(member->GetName()));
+    return JS_GetStringBytes(JSID_TO_STRING(member->GetName()));
 }
 
 void
 XPCNativeInterface::DebugDump(PRInt16 depth)
 {
 #ifdef DEBUG
     depth--;
     XPC_LOG_ALWAYS(("XPCNativeInterface @ %x", this));
--- a/js/src/xpconnect/src/xpcwrappednativejsops.cpp
+++ b/js/src/xpconnect/src/xpcwrappednativejsops.cpp
@@ -68,37 +68,16 @@ static JSBool Throw(uintN errNum, JSCont
 #define THROW_AND_RETURN_IF_BAD_WRAPPER(cx, wrapper)                         \
     PR_BEGIN_MACRO                                                           \
     if(!wrapper)                                                             \
         return Throw(NS_ERROR_XPC_BAD_OP_ON_WN_PROTO, cx);                   \
     if(!wrapper->IsValid())                                                  \
         return Throw(NS_ERROR_XPC_HAS_BEEN_SHUTDOWN, cx);                    \
     PR_END_MACRO
 
-// We rely on the engine only giving us jsval ids that are actually the
-// self-same jsvals that are in the atom table (that is, if the id represents
-// a string). So, we assert by converting the jsval to an id and then back
-// to a jsval and comparing pointers. If the engine ever breaks this promise
-// then we will scream.
-#ifdef DEBUG
-#define CHECK_IDVAL(cx, idval)                                               \
-    PR_BEGIN_MACRO                                                           \
-    if(JSVAL_IS_STRING(idval))                                               \
-    {                                                                        \
-        jsid d_id;                                                           \
-        jsval d_val;                                                         \
-        NS_ASSERTION(JS_ValueToId(cx, idval, &d_id), "JS_ValueToId failed!");\
-        NS_ASSERTION(JS_IdToValue(cx, d_id, &d_val), "JS_IdToValue failed!");\
-        NS_ASSERTION(d_val == idval, "id differs from id in atom table!");   \
-    }                                                                        \
-    PR_END_MACRO
-#else
-#define CHECK_IDVAL(cx, idval) ((void)0)
-#endif
-
 /***************************************************************************/
 
 static JSBool
 ToStringGuts(XPCCallContext& ccx)
 {
     char* sz;
     XPCWrappedNative* wrapper = ccx.GetWrapper();
 
@@ -157,17 +136,17 @@ XPC_WN_Shared_ToString(JSContext *cx, JS
         }
 
         *vp = STRING_TO_JSVAL(str);
 
         return JS_TRUE;
     }
     
     XPCCallContext ccx(JS_CALLER, cx, obj);
-    ccx.SetName(ccx.GetRuntime()->GetStringJSVal(XPCJSRuntime::IDX_TO_STRING));
+    ccx.SetName(ccx.GetRuntime()->GetStringID(XPCJSRuntime::IDX_TO_STRING));
     ccx.SetArgsAndResultPtr(argc, argv, vp);
     return ToStringGuts(ccx);
 }
 
 static JSBool
 XPC_WN_Shared_ToSource(JSContext *cx, JSObject *obj,
                        uintN argc, jsval *argv, jsval *vp)
 {
@@ -252,26 +231,26 @@ XPC_WN_DoubleWrappedGetter(JSContext *cx
     if(sm)
     {
         AutoMarkingNativeInterfacePtr iface(ccx);
         iface = XPCNativeInterface::
                     GetNewOrUsed(ccx, &NS_GET_IID(nsIXPCWrappedJSObjectGetter));
 
         if(iface)
         {
-            jsval idval = ccx.GetRuntime()->
-                        GetStringJSVal(XPCJSRuntime::IDX_WRAPPED_JSOBJECT);
+            jsid id = ccx.GetRuntime()->
+                        GetStringID(XPCJSRuntime::IDX_WRAPPED_JSOBJECT);
 
             ccx.SetCallInfo(iface, iface->GetMemberAt(1), JS_FALSE);
             if(NS_FAILED(sm->
                     CanAccess(nsIXPCSecurityManager::ACCESS_GET_PROPERTY,
                               &ccx, ccx,
                               ccx.GetFlattenedJSObject(),
                               wrapper->GetIdentityObject(),
-                              wrapper->GetClassInfo(), idval,
+                              wrapper->GetClassInfo(), id,
                               wrapper->GetSecurityInfoAddr())))
             {
                 // The SecurityManager should have set an exception.
                 return JS_FALSE;
             }
         }
     }
     *vp = OBJECT_TO_JSVAL(realObject);
@@ -285,58 +264,57 @@ XPC_WN_DoubleWrappedGetter(JSContext *cx
 /*
  * NOTE:
  * We *never* set the tearoff names (e.g. nsIFoo) as JS_ENUMERATE.
  * We *never* set toString or toSource as JS_ENUMERATE.
  */
 
 static JSBool
 DefinePropertyIfFound(XPCCallContext& ccx,
-                      JSObject *obj, jsval idval,
+                      JSObject *obj, jsid id,
                       XPCNativeSet* set,
                       XPCNativeInterface* iface,
                       XPCNativeMember* member,
                       XPCWrappedNativeScope* scope,
                       JSBool reflectToStringAndToSource,
                       XPCWrappedNative* wrapperToReflectInterfaceNames,
                       XPCWrappedNative* wrapperToReflectDoubleWrap,
                       XPCNativeScriptableInfo* scriptableInfo,
                       uintN propFlags,
                       JSBool* resolved)
 {
     XPCJSRuntime* rt = ccx.GetRuntime();
     JSBool found;
     const char* name;
-    jsid id;
 
     if(set)
     {
         if(iface)
             found = JS_TRUE;
         else
-            found = set->FindMember(idval, &member, &iface);
+            found = set->FindMember(id, &member, &iface);
     }
     else
-        found = (nsnull != (member = iface->FindMember(idval)));
+        found = (nsnull != (member = iface->FindMember(id)));
 
     if(!found)
     {
-        HANDLE_POSSIBLE_NAME_CASE_ERROR(ccx, set, iface, idval);
+        HANDLE_POSSIBLE_NAME_CASE_ERROR(ccx, set, iface, id);
 
         if(reflectToStringAndToSource)
         {
             JSNative call;
 
-            if(idval == rt->GetStringJSVal(XPCJSRuntime::IDX_TO_STRING))
+            if(id == rt->GetStringID(XPCJSRuntime::IDX_TO_STRING))
             {
                 call = XPC_WN_Shared_ToString;
                 name = rt->GetStringName(XPCJSRuntime::IDX_TO_STRING);
                 id   = rt->GetStringID(XPCJSRuntime::IDX_TO_STRING);
             }
-            else if(idval == rt->GetStringJSVal(XPCJSRuntime::IDX_TO_SOURCE))
+            else if(id == rt->GetStringID(XPCJSRuntime::IDX_TO_SOURCE))
             {
                 call = XPC_WN_Shared_ToSource;
                 name = rt->GetStringName(XPCJSRuntime::IDX_TO_SOURCE);
                 id   = rt->GetStringID(XPCJSRuntime::IDX_TO_SOURCE);
             }
 
             else
                 call = nsnull;
@@ -345,17 +323,17 @@ DefinePropertyIfFound(XPCCallContext& cc
             {
                 JSFunction* fun = JS_NewFunction(ccx, call, 0, 0, obj, name);
                 if(!fun)
                 {
                     JS_ReportOutOfMemory(ccx);
                     return JS_FALSE;
                 }
 
-                AutoResolveName arn(ccx, idval);
+                AutoResolveName arn(ccx, id);
                 if(resolved)
                     *resolved = JS_TRUE;
                 return JS_DefinePropertyById(ccx, obj, id,
                                              OBJECT_TO_JSVAL(JS_GetFunctionObject(fun)),
                                              nsnull, nsnull,
                                              propFlags & ~JSPROP_ENUMERATE);
             }
         }
@@ -365,37 +343,36 @@ DefinePropertyIfFound(XPCCallContext& cc
         // interface and add a tearoff as necessary.
 
         if(wrapperToReflectInterfaceNames)
         {
             AutoMarkingNativeInterfacePtr iface2(ccx);
             XPCWrappedNativeTearOff* to;
             JSObject* jso;
 
-            if(JSVAL_IS_STRING(idval) &&
-               nsnull != (name = JS_GetStringBytes(JSVAL_TO_STRING(idval))) &&
+            if(JSID_IS_STRING(id) &&
+               nsnull != (name = JS_GetStringBytes(JSID_TO_STRING(id))) &&
                (iface2 = XPCNativeInterface::GetNewOrUsed(ccx, name), iface2) &&
                nsnull != (to = wrapperToReflectInterfaceNames->
                                     FindTearOff(ccx, iface2, JS_TRUE)) &&
                nsnull != (jso = to->GetJSObject()))
 
             {
-                AutoResolveName arn(ccx, idval);
+                AutoResolveName arn(ccx, id);
                 if(resolved)
                     *resolved = JS_TRUE;
-                return JS_ValueToId(ccx, idval, &id) &&
-                       JS_DefinePropertyById(ccx, obj, id, OBJECT_TO_JSVAL(jso),
+                return JS_DefinePropertyById(ccx, obj, id, OBJECT_TO_JSVAL(jso),
                                              nsnull, nsnull,
                                              propFlags & ~JSPROP_ENUMERATE);
             }
         }
 
         // This *might* be a double wrapped JSObject
         if(wrapperToReflectDoubleWrap &&
-           idval == rt->GetStringJSVal(XPCJSRuntime::IDX_WRAPPED_JSOBJECT) &&
+           id == rt->GetStringID(XPCJSRuntime::IDX_WRAPPED_JSOBJECT) &&
            GetDoubleWrappedJSObject(ccx, wrapperToReflectDoubleWrap))
         {
             // We build and add a getter function.
             // A security check is done on a per-get basis.
 
             JSFunction* fun;
 
             id = rt->GetStringID(XPCJSRuntime::IDX_WRAPPED_JSOBJECT);
@@ -409,30 +386,30 @@ DefinePropertyIfFound(XPCCallContext& cc
 
             JSObject* funobj = JS_GetFunctionObject(fun);
             if(!funobj)
                 return JS_FALSE;
 
             propFlags |= JSPROP_GETTER;
             propFlags &= ~JSPROP_ENUMERATE;
 
-            AutoResolveName arn(ccx, idval);
+            AutoResolveName arn(ccx, id);
             if(resolved)
                 *resolved = JS_TRUE;
             return JS_DefinePropertyById(ccx, obj, id, JSVAL_VOID,
                                          JS_DATA_TO_FUNC_PTR(JSPropertyOp,
                                                              funobj),
                                          nsnull, propFlags);
         }
 
 #ifdef XPC_IDISPATCH_SUPPORT
         // Check to see if there's an IDispatch tearoff     
         if(wrapperToReflectInterfaceNames &&
             XPCIDispatchExtension::DefineProperty(ccx, obj, 
-                idval, wrapperToReflectInterfaceNames, propFlags, resolved))
+                id, wrapperToReflectInterfaceNames, propFlags, resolved))
             return JS_TRUE;
 #endif
         
         if(resolved)
             *resolved = JS_FALSE;
         return JS_TRUE;
     }
 
@@ -444,46 +421,44 @@ DefinePropertyIfFound(XPCCallContext& cc
               wrapperToReflectInterfaceNames->FindTearOff(ccx, iface, JS_TRUE);
 
             if(!to)
                 return JS_FALSE;
             JSObject* jso = to->GetJSObject();
             if(!jso)
                 return JS_FALSE;
 
-            AutoResolveName arn(ccx, idval);
+            AutoResolveName arn(ccx, id);
             if(resolved)
                 *resolved = JS_TRUE;
-            return JS_ValueToId(ccx, idval, &id) &&
-                   JS_DefinePropertyById(ccx, obj, id, OBJECT_TO_JSVAL(jso),
+            return JS_DefinePropertyById(ccx, obj, id, OBJECT_TO_JSVAL(jso),
                                          nsnull, nsnull,
                                          propFlags & ~JSPROP_ENUMERATE);
         }
         if(resolved)
             *resolved = JS_FALSE;
         return JS_TRUE;
     }
 
     if(member->IsConstant())
     {
         jsval val;
-        AutoResolveName arn(ccx, idval);
+        AutoResolveName arn(ccx, id);
         if(resolved)
             *resolved = JS_TRUE;
         return member->GetConstantValue(ccx, iface, &val) &&
-               JS_ValueToId(ccx, idval, &id) &&
                JS_DefinePropertyById(ccx, obj, id, val, nsnull, nsnull,
                                      propFlags);
     }
 
-    if(idval == rt->GetStringJSVal(XPCJSRuntime::IDX_TO_STRING) ||
-       idval == rt->GetStringJSVal(XPCJSRuntime::IDX_TO_SOURCE) ||
+    if(id == rt->GetStringID(XPCJSRuntime::IDX_TO_STRING) ||
+       id == rt->GetStringID(XPCJSRuntime::IDX_TO_SOURCE) ||
        (scriptableInfo &&
         scriptableInfo->GetFlags().DontEnumQueryInterface() &&
-        idval == rt->GetStringJSVal(XPCJSRuntime::IDX_QUERY_INTERFACE)))
+        id == rt->GetStringID(XPCJSRuntime::IDX_QUERY_INTERFACE)))
         propFlags &= ~JSPROP_ENUMERATE;
 
     jsval funval;
     if(!member->NewFunctionObject(ccx, iface, obj, &funval))
         return JS_FALSE;
 
     // protect funobj until it is actually attached
     AUTO_MARK_JSVAL(ccx, funval);
@@ -493,21 +468,20 @@ DefinePropertyIfFound(XPCCallContext& cc
         static int cloneCount = 0;
         if(!(++cloneCount%10))
             printf("<><><> %d cloned functions created\n", cloneCount);
     }
 #endif
 
     if(member->IsMethod())
     {
-        AutoResolveName arn(ccx, idval);
+        AutoResolveName arn(ccx, id);
         if(resolved)
             *resolved = JS_TRUE;
-        return JS_ValueToId(ccx, idval, &id) &&
-               JS_DefinePropertyById(ccx, obj, id, funval, nsnull, nsnull,
+        return JS_DefinePropertyById(ccx, obj, id, funval, nsnull, nsnull,
                                      propFlags);
     }
 
     // else...
 
     NS_ASSERTION(member->IsAttribute(), "way broken!");
 
     propFlags |= JSPROP_GETTER | JSPROP_SHARED;
@@ -520,48 +494,44 @@ DefinePropertyIfFound(XPCCallContext& cc
         propFlags &= ~JSPROP_READONLY;
         setter = getter;
     }
     else
     {
         setter = js_GetterOnlyPropertyStub;
     }
 
-    AutoResolveName arn(ccx, idval);
+    AutoResolveName arn(ccx, id);
     if(resolved)
         *resolved = JS_TRUE;
 
-    return JS_ValueToId(ccx, idval, &id) &&
-           JS_DefinePropertyById(ccx, obj, id, JSVAL_VOID, getter, setter,
+    return JS_DefinePropertyById(ccx, obj, id, JSVAL_VOID, getter, setter,
                                  propFlags);
 }
 
 /***************************************************************************/
 /***************************************************************************/
 
 static JSBool
-XPC_WN_OnlyIWrite_PropertyStub(JSContext *cx, JSObject *obj, jsval idval, jsval *vp)
+XPC_WN_OnlyIWrite_PropertyStub(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
-    CHECK_IDVAL(cx, idval);
-
-    XPCCallContext ccx(JS_CALLER, cx, obj, nsnull, idval);
+    XPCCallContext ccx(JS_CALLER, cx, obj, nsnull, id);
     XPCWrappedNative* wrapper = ccx.GetWrapper();
     THROW_AND_RETURN_IF_BAD_WRAPPER(cx, wrapper);
 
     // Allow only XPConnect to add the property
-    if(ccx.GetResolveName() == idval)
+    if(ccx.GetResolveName() == id)
         return JS_TRUE;
 
     return Throw(NS_ERROR_XPC_CANT_MODIFY_PROP_ON_WN, cx);
 }
 
 static JSBool
-XPC_WN_CannotModifyPropertyStub(JSContext *cx, JSObject *obj, jsval idval, jsval *vp)
+XPC_WN_CannotModifyPropertyStub(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
-    CHECK_IDVAL(cx, idval);
     return Throw(NS_ERROR_XPC_CANT_MODIFY_PROP_ON_WN, cx);
 }
 
 static JSBool
 XPC_WN_Shared_Convert(JSContext *cx, JSObject *obj, JSType type, jsval *vp)
 {
     if(type == JSTYPE_OBJECT)
     {
@@ -594,17 +564,17 @@ XPC_WN_Shared_Convert(JSContext *cx, JSO
             *vp = JS_GetNaNValue(cx);
             return JS_TRUE;
         case JSTYPE_BOOLEAN:
             *vp = JSVAL_TRUE;
             return JS_TRUE;
         case JSTYPE_VOID:
         case JSTYPE_STRING:
         {
-            ccx.SetName(ccx.GetRuntime()->GetStringJSVal(XPCJSRuntime::IDX_TO_STRING));
+            ccx.SetName(ccx.GetRuntime()->GetStringID(XPCJSRuntime::IDX_TO_STRING));
             ccx.SetArgsAndResultPtr(0, nsnull, vp);
 
             XPCNativeMember* member = ccx.GetMember();
             if(member && member->IsMethod())
             {
                 if(!XPCWrappedNative::CallMethod(ccx))
                     return JS_FALSE;
 
@@ -658,17 +628,17 @@ XPC_WN_Shared_Enumerate(JSContext *cx, J
             XPCIDispatchExtension::Enumerate(ccx, obj, wrapper);
             continue;
         }
 #endif
         PRUint16 member_count = iface->GetMemberCount();
         for(PRUint16 k = 0; k < member_count; k++)
         {
             XPCNativeMember* member = iface->GetMemberAt(k);
-            jsval name = member->GetName();
+            jsid name = member->GetName();
 
             // Skip if this member is going to come from the proto.
             PRUint16 index;
             if(protoSet &&
                protoSet->FindMember(name, nsnull, &index) && index == i)
                 continue;
             if(!xpc_ForcePropertyResolve(cx, obj, name))
                 return JS_FALSE;
@@ -775,34 +745,32 @@ XPC_WN_Shared_Trace(JSTracer *trc, JSObj
     }
     else if(obj2)
     {
         GetSlimWrapperProto(obj2)->TraceJS(trc);
     }
 }
 
 static JSBool
-XPC_WN_NoHelper_Resolve(JSContext *cx, JSObject *obj, jsval idval)
+XPC_WN_NoHelper_Resolve(JSContext *cx, JSObject *obj, jsid id)
 {
-    CHECK_IDVAL(cx, idval);
-
     MORPH_SLIM_WRAPPER(cx, obj);
-    XPCCallContext ccx(JS_CALLER, cx, obj, nsnull, idval);
+    XPCCallContext ccx(JS_CALLER, cx, obj, nsnull, id);
     XPCWrappedNative* wrapper = ccx.GetWrapper();
     THROW_AND_RETURN_IF_BAD_WRAPPER(cx, wrapper);
 
     XPCNativeSet* set = ccx.GetSet();
     if(!set)
         return JS_TRUE;
 
     // Don't resolve properties that are on our prototype.
     if(ccx.GetInterface() && !ccx.GetStaticMemberIsLocal())
         return JS_TRUE;
 
-    return DefinePropertyIfFound(ccx, obj, idval,
+    return DefinePropertyIfFound(ccx, obj, id,
                                  set, nsnull, nsnull, wrapper->GetScope(),
                                  JS_TRUE, wrapper, wrapper, nsnull,
                                  JSPROP_ENUMERATE |
                                  JSPROP_READONLY |
                                  JSPROP_PERMANENT, nsnull);
 }
 
 nsISupports *
@@ -824,18 +792,19 @@ XPC_GetIdentityObject(JSContext *cx, JSO
 
         return nsnull;
     }
 
     return wrapper->GetIdentityObject();
 }
 
 JSBool
-XPC_WN_Equality(JSContext *cx, JSObject *obj, jsval v, JSBool *bp)
+XPC_WN_Equality(JSContext *cx, JSObject *obj, const jsval *valp, JSBool *bp)
 {
+    jsval v = *valp;
     *bp = JS_FALSE;
 
     JSObject *obj2;
     XPCWrappedNative *wrapper =
         XPCWrappedNative::GetWrappedNativeOfJSObject(cx, obj, nsnull, &obj2);
     if(obj2)
     {
         *bp = !JSVAL_IS_PRIMITIVE(v) && (JSVAL_TO_OBJECT(v) == obj2);
@@ -988,20 +957,18 @@ JSExtendedClass XPC_WN_NoHelper_JSClass 
     XPC_WN_InnerObject,
     nsnull,nsnull,nsnull,nsnull,nsnull
 };
 
 
 /***************************************************************************/
 
 static JSBool
-XPC_WN_MaybeResolvingPropertyStub(JSContext *cx, JSObject *obj, jsval idval, jsval *vp)
+XPC_WN_MaybeResolvingPropertyStub(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
-    CHECK_IDVAL(cx, idval);
-
     MORPH_SLIM_WRAPPER(cx, obj);
     XPCCallContext ccx(JS_CALLER, cx, obj);
     XPCWrappedNative* wrapper = ccx.GetWrapper();
     THROW_AND_RETURN_IF_BAD_WRAPPER(cx, wrapper);
 
     if(ccx.GetResolvingWrapper() == wrapper)
         return JS_TRUE;
     return Throw(NS_ERROR_XPC_CANT_MODIFY_PROP_ON_WN, cx);
@@ -1033,63 +1000,62 @@ XPC_WN_MaybeResolvingPropertyStub(JSCont
     nsresult rv = si->
 
 #define POST_HELPER_STUB                                                     \
     if(NS_FAILED(rv))                                                        \
         return Throw(rv, cx);                                                \
     return retval;
 
 static JSBool
-XPC_WN_Helper_AddProperty(JSContext *cx, JSObject *obj, jsval idval, jsval *vp)
+XPC_WN_Helper_AddProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
     PRE_HELPER_STUB
-    AddProperty(wrapper, cx, obj, idval, vp, &retval);
+    AddProperty(wrapper, cx, obj, id, vp, &retval);
     POST_HELPER_STUB
 }
 
 static JSBool
-XPC_WN_Helper_DelProperty(JSContext *cx, JSObject *obj, jsval idval, jsval *vp)
+XPC_WN_Helper_DelProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
     PRE_HELPER_STUB
-    DelProperty(wrapper, cx, obj, idval, vp, &retval);
+    DelProperty(wrapper, cx, obj, id, vp, &retval);
     POST_HELPER_STUB
 }
 
 static JSBool
-XPC_WN_Helper_GetProperty(JSContext *cx, JSObject *obj, jsval idval, jsval *vp)
+XPC_WN_Helper_GetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
     PRE_HELPER_STUB
-    GetProperty(wrapper, cx, obj, idval, vp, &retval);
+    GetProperty(wrapper, cx, obj, id, vp, &retval);
     POST_HELPER_STUB
 }
 
 static JSBool
-XPC_WN_Helper_SetProperty(JSContext *cx, JSObject *obj, jsval idval, jsval *vp)
+XPC_WN_Helper_SetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
     PRE_HELPER_STUB
-    SetProperty(wrapper, cx, obj, idval, vp, &retval);
+    SetProperty(wrapper, cx, obj, id, vp, &retval);
     POST_HELPER_STUB
 }
 
 static JSBool
 XPC_WN_Helper_Convert(JSContext *cx, JSObject *obj, JSType type, jsval *vp)
 {
     SLIM_LOG_WILL_MORPH(cx, obj);
     PRE_HELPER_STUB_NO_SLIM
     Convert(wrapper, cx, obj, type, vp, &retval);
     POST_HELPER_STUB
 }
 
 static JSBool
-XPC_WN_Helper_CheckAccess(JSContext *cx, JSObject *obj, jsval idval,
+XPC_WN_Helper_CheckAccess(JSContext *cx, JSObject *obj, jsid id,
                           JSAccessMode mode, jsval *vp)
 {
-    CHECK_IDVAL(cx, idval);
     PRE_HELPER_STUB
-    CheckAccess(wrapper, cx, obj, idval, mode, vp, &retval);
+    CheckAccess(wrapper, cx, obj, id, mode, vp, &retval);
     POST_HELPER_STUB
 }
 
 static JSBool
 XPC_WN_Helper_Call(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
                    jsval *rval)
 {
     // this is a hack to get the obj of the actual object not the object
@@ -1114,21 +1080,21 @@ XPC_WN_Helper_Construct(JSContext *cx, J
 
     SLIM_LOG_WILL_MORPH(cx, obj);
     PRE_HELPER_STUB_NO_SLIM
     Construct(wrapper, cx, obj, argc, argv, rval, &retval);
     POST_HELPER_STUB
 }
 
 static JSBool
-XPC_WN_Helper_HasInstance(JSContext *cx, JSObject *obj, jsval v, JSBool *bp)
+XPC_WN_Helper_HasInstance(JSContext *cx, JSObject *obj, const jsval *valp, JSBool *bp)
 {
     SLIM_LOG_WILL_MORPH(cx, obj);
     PRE_HELPER_STUB_NO_SLIM
-    HasInstance(wrapper, cx, obj, v, bp, &retval);
+    HasInstance(wrapper, cx, obj, *valp, bp, &retval);
     POST_HELPER_STUB
 }
 
 static void
 XPC_WN_Helper_Finalize(JSContext *cx, JSObject *obj)
 {
     nsISupports* p = static_cast<nsISupports*>(xpc_GetJSPrivate(obj));
     if(IS_SLIM_WRAPPER(obj))
@@ -1167,70 +1133,68 @@ XPC_WN_Helper_Trace(JSTracer *trc, JSObj
     }
     else if(obj2)
     {
         GetSlimWrapperProto(obj2)->TraceJS(trc);
     }
 }
 
 static JSBool
-XPC_WN_Helper_NewResolve(JSContext *cx, JSObject *obj, jsval idval, uintN flags,
+XPC_WN_Helper_NewResolve(JSContext *cx, JSObject *obj, jsid id, uintN flags,
                          JSObject **objp)
 {
-    CHECK_IDVAL(cx, idval);
-
     nsresult rv = NS_OK;
     JSBool retval = JS_TRUE;
     JSObject* obj2FromScriptable = nsnull;
     if(IS_SLIM_WRAPPER(obj))
     {
         XPCNativeScriptableInfo *si =
             GetSlimWrapperProto(obj)->GetScriptableInfo();
         if(!si->GetFlags().WantNewResolve())
             return retval;
 
         NS_ASSERTION(si->GetFlags().AllowPropModsToPrototype() &&
                      !si->GetFlags().AllowPropModsDuringResolve(),
                      "We don't support these flags for slim wrappers!");
 
-        rv = si->GetCallback()->NewResolve(nsnull, cx, obj, idval, flags,
+        rv = si->GetCallback()->NewResolve(nsnull, cx, obj, id, flags,
                                            &obj2FromScriptable, &retval);
         if(NS_FAILED(rv))
             return Throw(rv, cx);
 
         if(obj2FromScriptable)
             *objp = obj2FromScriptable;
 
         return retval;
     }
 
     XPCCallContext ccx(JS_CALLER, cx, obj);
     XPCWrappedNative* wrapper = ccx.GetWrapper();
     THROW_AND_RETURN_IF_BAD_WRAPPER(cx, wrapper);
 
-    jsval old = ccx.SetResolveName(idval);
+    jsid old = ccx.SetResolveName(id);
 
     XPCNativeScriptableInfo* si = wrapper->GetScriptableInfo();
     if(si && si->GetFlags().WantNewResolve())
     {
         XPCWrappedNative* oldResolvingWrapper;
         JSBool allowPropMods = si->GetFlags().AllowPropModsDuringResolve();
 
         if(allowPropMods)
             oldResolvingWrapper = ccx.SetResolvingWrapper(wrapper);
 
-        rv = si->GetCallback()->NewResolve(wrapper, cx, obj, idval, flags,
+        rv = si->GetCallback()->NewResolve(wrapper, cx, obj, id, flags,
                                              &obj2FromScriptable, &retval);
 
         if(allowPropMods)
             (void)ccx.SetResolvingWrapper(oldResolvingWrapper);
     }
 
     old = ccx.SetResolveName(old);
-    NS_ASSERTION(old == idval, "bad nest");
+    NS_ASSERTION(old == id, "bad nest");
 
     if(NS_FAILED(rv))
     {
         return Throw(rv, cx);
     }
 
     if(obj2FromScriptable)
     {
@@ -1243,34 +1207,34 @@ XPC_WN_Helper_NewResolve(JSContext *cx, 
 
         XPCNativeSet* set = wrapper->GetSet();
         XPCNativeSet* protoSet = wrapper->HasProto() ?
                                     wrapper->GetProto()->GetSet() : nsnull;
         XPCNativeMember* member;
         XPCNativeInterface* iface;
         JSBool IsLocal;
 
-        if(set->FindMember(idval, &member, &iface, protoSet, &IsLocal) &&
+        if(set->FindMember(id, &member, &iface, protoSet, &IsLocal) &&
            IsLocal)
         {
             XPCWrappedNative* oldResolvingWrapper;
 
             XPCNativeScriptableFlags siFlags(0);
             if(si)
                 siFlags = si->GetFlags();
 
             uintN enumFlag =
                 siFlags.DontEnumStaticProps() ? 0 : JSPROP_ENUMERATE;
 
             XPCWrappedNative* wrapperForInterfaceNames =
                 siFlags.DontReflectInterfaceNames() ? nsnull : wrapper;
 
             JSBool resolved;
             oldResolvingWrapper = ccx.SetResolvingWrapper(wrapper);
-            retval = DefinePropertyIfFound(ccx, obj, idval,
+            retval = DefinePropertyIfFound(ccx, obj, id,
                                            set, iface, member,
                                            wrapper->GetScope(),
                                            JS_FALSE,
                                            wrapperForInterfaceNames,
                                            nsnull, si,
                                            enumFlag, &resolved);
             (void)ccx.SetResolvingWrapper(oldResolvingWrapper);
             if(retval && resolved)
@@ -1771,17 +1735,17 @@ XPC_WN_CallMethod(JSContext *cx, JSObjec
         JSFunction *fun = GET_FUNCTION_PRIVATE(cx, funobj);
         funname = JS_GetFunctionName(fun);
     }
     SLIM_LOG_WILL_MORPH_FOR_PROP(cx, obj, funname);
 #endif
     if(IS_SLIM_WRAPPER(obj) && !MorphSlimWrapper(cx, obj))
         return Throw(NS_ERROR_XPC_BAD_OP_ON_WN_PROTO, cx);
 
-    XPCCallContext ccx(JS_CALLER, cx, obj, funobj, 0, argc, argv, vp);
+    XPCCallContext ccx(JS_CALLER, cx, obj, funobj, JSID_VOID, argc, argv, vp);
     XPCWrappedNative* wrapper = ccx.GetWrapper();
     THROW_AND_RETURN_IF_BAD_WRAPPER(cx, wrapper);
 
     XPCNativeInterface* iface;
     XPCNativeMember*    member;
 
     if(!XPCNativeMember::GetCallInfo(ccx, funobj, &iface, &member))
         return Throw(NS_ERROR_XPC_CANT_GET_METHOD_INFO, cx);
@@ -1904,20 +1868,18 @@ XPC_WN_Shared_Proto_Trace(JSTracer *trc,
         (XPCWrappedNativeProto*) xpc_GetJSPrivate(obj);
     if(p)
         TraceScopeJSObjects(trc, p->GetScope());
 }
 
 /*****************************************************/
 
 static JSBool
-XPC_WN_ModsAllowed_Proto_Resolve(JSContext *cx, JSObject *obj, jsval idval)
+XPC_WN_ModsAllowed_Proto_Resolve(JSContext *cx, JSObject *obj, jsid id)
 {
-    CHECK_IDVAL(cx, idval);
-
     NS_ASSERTION(
         JS_InstanceOf(cx, obj, &XPC_WN_ModsAllowed_WithCall_Proto_JSClass,
                       nsnull) ||
         JS_InstanceOf(cx, obj, &XPC_WN_ModsAllowed_NoCall_Proto_JSClass,
                       nsnull),
                  "bad proto");
 
     XPCWrappedNativeProto* self =
@@ -1928,17 +1890,17 @@ XPC_WN_ModsAllowed_Proto_Resolve(JSConte
     XPCCallContext ccx(JS_CALLER, cx);
     if(!ccx.IsValid())
         return JS_FALSE;
 
     XPCNativeScriptableInfo* si = self->GetScriptableInfo();
     uintN enumFlag = (si && si->GetFlags().DontEnumStaticProps()) ?
                                                 0 : JSPROP_ENUMERATE;
 
-    return DefinePropertyIfFound(ccx, obj, idval,
+    return DefinePropertyIfFound(ccx, obj, id,
                                  self->GetSet(), nsnull, nsnull,
                                  self->GetScope(),
                                  JS_TRUE, nsnull, nsnull, si,
                                  enumFlag, nsnull);
 }
 
 // Give our proto classes object ops that match the respective
 // wrappers so that the JS engine can share scope (maps) among
@@ -2017,46 +1979,42 @@ JSClass XPC_WN_ModsAllowed_NoCall_Proto_
     nsnull,                         // hasInstance;
     JS_CLASS_TRACE(XPC_WN_Shared_Proto_Trace), // mark/trace;
     nsnull                          // spare;
 };
 
 /***************************************************************************/
 
 static JSBool
-XPC_WN_OnlyIWrite_Proto_PropertyStub(JSContext *cx, JSObject *obj, jsval idval, jsval *vp)
+XPC_WN_OnlyIWrite_Proto_PropertyStub(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
 {
-    CHECK_IDVAL(cx, idval);
-
     NS_ASSERTION(
         JS_InstanceOf(cx, obj, &XPC_WN_NoMods_WithCall_Proto_JSClass, nsnull) ||
         JS_InstanceOf(cx, obj, &XPC_WN_NoMods_NoCall_Proto_JSClass, nsnull),
                  "bad proto");
 
     XPCWrappedNativeProto* self =
         (XPCWrappedNativeProto*) xpc_GetJSPrivate(obj);
     if(!self)
         return JS_FALSE;
 
     XPCCallContext ccx(JS_CALLER, cx);
     if(!ccx.IsValid())
         return JS_FALSE;
 
     // Allow XPConnect to add the property only
-    if(ccx.GetResolveName() == idval)
+    if(ccx.GetResolveName() == id)
         return JS_TRUE;
 
     return Throw(NS_ERROR_XPC_BAD_OP_ON_WN_PROTO, cx);
 }
 
 static JSBool
-XPC_WN_NoMods_Proto_Resolve(JSContext *cx, JSObject *obj, jsval idval)
+XPC_WN_NoMods_Proto_Resolve(JSContext *cx, JSObject *obj, jsid id)
 {
-    CHECK_IDVAL(cx, idval);
-
     NS_ASSERTION(
         JS_InstanceOf(cx, obj, &XPC_WN_NoMods_WithCall_Proto_JSClass, nsnull) ||
         JS_InstanceOf(cx, obj, &XPC_WN_NoMods_NoCall_Proto_JSClass, nsnull),
                  "bad proto");
 
     XPCWrappedNativeProto* self =
         (XPCWrappedNativeProto*) xpc_GetJSPrivate(obj);
     if(!self)
@@ -2065,17 +2023,17 @@ XPC_WN_NoMods_Proto_Resolve(JSContext *c
     XPCCallContext ccx(JS_CALLER, cx);
     if(!ccx.IsValid())
         return JS_FALSE;
 
     XPCNativeScriptableInfo* si = self->GetScriptableInfo();
     uintN enumFlag = (si && si->GetFlags().DontEnumStaticProps()) ?
                                                 0 : JSPROP_ENUMERATE;
 
-    return DefinePropertyIfFound(ccx, obj, idval,
+    return DefinePropertyIfFound(ccx, obj, id,
                                  self->GetSet(), nsnull, nsnull,
                                  self->GetScope(),
                                  JS_TRUE, nsnull, nsnull, si,
                                  JSPROP_READONLY |
                                  JSPROP_PERMANENT |
                                  enumFlag, nsnull);
 }
 
@@ -2151,32 +2109,30 @@ XPC_WN_TearOff_Enumerate(JSContext *cx, 
         if(!xpc_ForcePropertyResolve(cx, obj, iface->GetMemberAt(k)->GetName()))
             return JS_FALSE;
     }
 
     return JS_TRUE;
 }
 
 static JSBool
-XPC_WN_TearOff_Resolve(JSContext *cx, JSObject *obj, jsval idval)
+XPC_WN_TearOff_Resolve(JSContext *cx, JSObject *obj, jsid id)
 {
-    CHECK_IDVAL(cx, idval);
-
     MORPH_SLIM_WRAPPER(cx, obj);
     XPCCallContext ccx(JS_CALLER, cx, obj);
     XPCWrappedNative* wrapper = ccx.GetWrapper();
     THROW_AND_RETURN_IF_BAD_WRAPPER(cx, wrapper);
 
     XPCWrappedNativeTearOff* to = ccx.GetTearOff();
     XPCNativeInterface* iface;
 
     if(!to || nsnull == (iface = to->GetInterface()))
         return Throw(NS_ERROR_XPC_BAD_OP_ON_WN_PROTO, cx);
 
-    return DefinePropertyIfFound(ccx, obj, idval, nsnull, iface, nsnull,
+    return DefinePropertyIfFound(ccx, obj, id, nsnull, iface, nsnull,
                                  wrapper->GetScope(),
                                  JS_TRUE, nsnull, nsnull, nsnull,
                                  JSPROP_READONLY |
                                  JSPROP_PERMANENT |
                                  JSPROP_ENUMERATE, nsnull);
 }
 
 static void
--- a/js/src/xpconnect/tests/TestXPC.cpp
+++ b/js/src/xpconnect/tests/TestXPC.cpp
@@ -278,19 +278,19 @@ MySecMan::CanGetService(JSContext * aJSC
                     "security exception")));
             return NS_ERROR_FAILURE;
         default:
             NS_ERROR("bad case");
             return NS_OK;
     }
 }
 
-/* void CanAccess (in PRUint32 aAction, in nsIXPCNativeCallContext aCallContext, in JSContextPtr aJSContext, in JSObjectPtr aJSObject, in nsISupports aObj, in nsIClassInfo aClassInfo, in jsval aName, inout voidPtr aPolicy); */
+/* void CanAccess (in PRUint32 aAction, in nsIXPCNativeCallContext aCallContext, in JSContextPtr aJSContext, in JSObjectPtr aJSObject, in nsISupports aObj, in nsIClassInfo aClassInfo, in jsid aName, inout voidPtr aPolicy); */
 NS_IMETHODIMP 
-MySecMan::CanAccess(PRUint32 aAction, nsAXPCNativeCallContext *aCallContext, JSContext * aJSContext, JSObject * aJSObject, nsISupports *aObj, nsIClassInfo *aClassInfo, jsval aName, void * *aPolicy)
+MySecMan::CanAccess(PRUint32 aAction, nsAXPCNativeCallContext *aCallContext, JSContext * aJSContext, JSObject * aJSObject, nsISupports *aObj, nsIClassInfo *aClassInfo, jsid aName, void * *aPolicy)
 {
     switch(mMode)
     {
         case OK_ALL:
             return NS_OK;
         case VETO_ALL:
             JS_SetPendingException(aJSContext,