Bug 791322 - Move Rooted to js:: namespace; r=billm
authorTerrence Cole <terrence@mozilla.com>
Mon, 24 Sep 2012 18:08:22 -0700
changeset 108164 b9721197c2211052051b7d38f0a0c9840330b629
parent 108163 15cc8994c2be885c4adf3307bbdaef6e3f3b4b8f
child 108165 403ebae0552f5323e5578746bfd23a3d327e58fa
push id23539
push userryanvm@gmail.com
push dateWed, 26 Sep 2012 22:55:55 +0000
treeherdermozilla-central@ec079fd92224 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbillm
bugs791322
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 791322 - Move Rooted to js:: namespace; r=billm These should not be part of the public API.
content/base/src/nsFrameMessageManager.cpp
content/xbl/src/nsXBLBinding.cpp
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMWindowUtils.cpp
dom/base/nsJSEnvironment.cpp
dom/bindings/Codegen.py
dom/indexedDB/KeyPath.cpp
dom/src/json/nsJSON.cpp
dom/workers/ScriptLoader.cpp
dom/workers/WorkerPrivate.cpp
extensions/pref/autoconfig/src/nsJSConfigTriggers.cpp
js/ipc/ObjectWrapperParent.cpp
js/src/frontend/TokenStream.h
js/src/gc/Root.h
js/src/ion/CompilerRoot.h
js/src/ion/IonAllocPolicy.h
js/src/jsapi-tests/selfTest.cpp
js/src/jsapi-tests/testAddPropertyPropcache.cpp
js/src/jsapi-tests/testArrayBuffer.cpp
js/src/jsapi-tests/testBindCallable.cpp
js/src/jsapi-tests/testBug604087.cpp
js/src/jsapi-tests/testCallNonGenericMethodOnProxy.cpp
js/src/jsapi-tests/testClassGetter.cpp
js/src/jsapi-tests/testCloneScript.cpp
js/src/jsapi-tests/testConservativeGC.cpp
js/src/jsapi-tests/testCustomIterator.cpp
js/src/jsapi-tests/testDebugger.cpp
js/src/jsapi-tests/testDeepFreeze.cpp
js/src/jsapi-tests/testDefineGetterSetterNonEnumerable.cpp
js/src/jsapi-tests/testDefineProperty.cpp
js/src/jsapi-tests/testErrorCopying.cpp
js/src/jsapi-tests/testFunctionProperties.cpp
js/src/jsapi-tests/testGCOutOfMemory.cpp
js/src/jsapi-tests/testGetPropertyDefault.cpp
js/src/jsapi-tests/testIntString.cpp
js/src/jsapi-tests/testJSEvaluateScript.cpp
js/src/jsapi-tests/testLookup.cpp
js/src/jsapi-tests/testNewObject.cpp
js/src/jsapi-tests/testOps.cpp
js/src/jsapi-tests/testOriginPrincipals.cpp
js/src/jsapi-tests/testParseJSON.cpp
js/src/jsapi-tests/testProfileStrings.cpp
js/src/jsapi-tests/testRegExp.cpp
js/src/jsapi-tests/testScriptObject.cpp
js/src/jsapi-tests/testSetProperty.cpp
js/src/jsapi-tests/testTrap.cpp
js/src/jsapi-tests/testValueABI.cpp
js/src/jsapi-tests/testVersion.cpp
js/src/jsapi-tests/testXDR.cpp
js/src/jsapi-tests/tests.cpp
js/src/jsapi-tests/tests.h
js/src/jsapi.h
js/src/jsclass.h
js/src/jsgc.cpp
js/src/jsinfer.h
js/src/jsinferinlines.h
js/src/jsprvtd.h
js/src/jspubtd.h
js/src/jsscope.h
js/src/shell/jsheaptools.cpp
js/src/vm/ObjectImpl.h
js/src/vm/String-inl.h
js/xpconnect/loader/mozJSComponentLoader.cpp
js/xpconnect/loader/mozJSSubScriptLoader.cpp
js/xpconnect/src/XPCComponents.cpp
js/xpconnect/src/XPCQuickStubs.h
js/xpconnect/src/XPCRuntimeService.cpp
--- a/content/base/src/nsFrameMessageManager.cpp
+++ b/content/base/src/nsFrameMessageManager.cpp
@@ -900,17 +900,17 @@ nsFrameScriptExecutor::TryCacheLoadAndCo
       JSObject* global = nullptr;
       mGlobal->GetJSObject(&global);
       if (global) {
         JSAutoCompartment ac(mCx, global);
         JS::CompileOptions options(mCx);
         options.setNoScriptRval(true)
                .setFileAndLine(url.get(), 1)
                .setPrincipals(nsJSPrincipals::get(mPrincipal));
-        JS::RootedObject empty(mCx, NULL);
+        js::RootedObject empty(mCx, NULL);
         JSScript* script = JS::Compile(mCx, empty, options,
                                        dataString.get(), dataString.Length());
 
         if (script) {
           nsAutoCString scheme;
           uri->GetScheme(scheme);
           // We don't cache data: scripts!
           if (!scheme.EqualsLiteral("data")) {
--- a/content/xbl/src/nsXBLBinding.cpp
+++ b/content/xbl/src/nsXBLBinding.cpp
@@ -166,17 +166,17 @@ InstallXBLField(JSContext* cx,
   // because in this method we've entered |this|'s compartment (see in
   // Field[GS]etter where we attempt a cross-compartment call), we must enter
   // the callee's compartment to access its reserved slots.
   nsXBLPrototypeBinding* protoBinding;
   nsDependentJSString fieldName;
   {
     JSAutoCompartment ac(cx, callee);
 
-    JS::Rooted<JSObject*> xblProto(cx);
+    js::Rooted<JSObject*> xblProto(cx);
     xblProto = &js::GetFunctionNativeReserved(callee, XBLPROTO_SLOT).toObject();
 
     JS::Value name = js::GetFunctionNativeReserved(callee, FIELD_SLOT);
     JSFlatString* fieldStr = JS_ASSERT_STRING_IS_FLAT(name.toString());
     fieldName.init(fieldStr);
 
     MOZ_ALWAYS_TRUE(JS_ValueToId(cx, name, idp));
 
@@ -212,31 +212,31 @@ InstallXBLField(JSContext* cx,
 }
 
 bool
 FieldGetterImpl(JSContext *cx, JS::CallArgs args)
 {
   const JS::Value &thisv = args.thisv();
   MOZ_ASSERT(ValueHasISupportsPrivate(thisv));
 
-  JS::Rooted<JSObject*> thisObj(cx, &thisv.toObject());
+  js::Rooted<JSObject*> thisObj(cx, &thisv.toObject());
 
   bool installed = false;
-  JS::Rooted<JSObject*> callee(cx, &args.calleev().toObject());
-  JS::Rooted<jsid> id(cx);
+  js::Rooted<JSObject*> callee(cx, &args.calleev().toObject());
+  js::Rooted<jsid> id(cx);
   if (!InstallXBLField(cx, callee, thisObj, id.address(), &installed)) {
     return false;
   }
 
   if (!installed) {
     args.rval().setUndefined();
     return true;
   }
 
-  JS::Rooted<JS::Value> v(cx);
+  js::Rooted<JS::Value> v(cx);
   if (!JS_GetPropertyById(cx, thisObj, id, v.address())) {
     return false;
   }
   args.rval().set(v);
   return true;
 }
 
 static JSBool
@@ -248,26 +248,26 @@ FieldGetter(JSContext *cx, unsigned argc
 }
 
 bool
 FieldSetterImpl(JSContext *cx, JS::CallArgs args)
 {
   const JS::Value &thisv = args.thisv();
   MOZ_ASSERT(ValueHasISupportsPrivate(thisv));
 
-  JS::Rooted<JSObject*> thisObj(cx, &thisv.toObject());
+  js::Rooted<JSObject*> thisObj(cx, &thisv.toObject());
 
   bool installed = false;
-  JS::Rooted<JSObject*> callee(cx, &args.calleev().toObject());
-  JS::Rooted<jsid> id(cx);
+  js::Rooted<JSObject*> callee(cx, &args.calleev().toObject());
+  js::Rooted<jsid> id(cx);
   if (!InstallXBLField(cx, callee, thisObj, id.address(), &installed)) {
     return false;
   }
 
-  JS::Rooted<JS::Value> v(cx,
+  js::Rooted<JS::Value> v(cx,
                           args.length() > 0 ? args[0] : JS::UndefinedValue());
   return JS_SetPropertyById(cx, thisObj, id, v.address());
 }
 
 static JSBool
 FieldSetter(JSContext *cx, unsigned argc, JS::Value *vp)
 {
   JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@@ -295,30 +295,30 @@ XBLResolve(JSContext *cx, JSHandleObject
   nsDependentJSString fieldName(id);
   nsXBLProtoImplField* field = protoBinding->FindField(fieldName);
   if (!field || field->IsEmpty()) {
     return true;
   }
 
   // We have a field: now install a getter/setter pair which will resolve the
   // field onto the actual object, when invoked.
-  JS::Rooted<JSObject*> global(cx, JS_GetGlobalForObject(cx, obj));
+  js::Rooted<JSObject*> global(cx, JS_GetGlobalForObject(cx, obj));
 
-  JS::Rooted<JSObject*> get(cx);
+  js::Rooted<JSObject*> get(cx);
   get = ::JS_GetFunctionObject(js::NewFunctionByIdWithReserved(cx, FieldGetter,
                                                                0, 0, global,
                                                                id));
   if (!get) {
     return false;
   }
   js::SetFunctionNativeReserved(get, XBLPROTO_SLOT, JS::ObjectValue(*obj));
   js::SetFunctionNativeReserved(get, FIELD_SLOT,
                                 JS::StringValue(JSID_TO_STRING(id)));
 
-  JS::Rooted<JSObject*> set(cx);
+  js::Rooted<JSObject*> set(cx);
   set = ::JS_GetFunctionObject(js::NewFunctionByIdWithReserved(cx, FieldSetter,
                                                                1, 0, global,
                                                                id));
   if (!set) {
     return false;
   }
   js::SetFunctionNativeReserved(set, XBLPROTO_SLOT, JS::ObjectValue(*obj));
   js::SetFunctionNativeReserved(set, FIELD_SLOT,
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -7106,33 +7106,33 @@ LocationSetter(JSContext *cx, JSHandleOb
 
   return JS_TRUE;
 }
 
 static JSBool
 LocationSetterUnwrapper(JSContext *cx, JSHandleObject obj_, JSHandleId id, JSBool strict,
                         JSMutableHandleValue vp)
 {
-  JS::RootedObject obj(cx, obj_);
+  js::RootedObject obj(cx, obj_);
 
   JSObject *wrapped = XPCWrapper::UnsafeUnwrapSecurityWrapper(obj);
   if (wrapped) {
     obj = wrapped;
   }
 
   return LocationSetter<nsIDOMWindow>(cx, obj, id, strict, vp);
 }
 
 NS_IMETHODIMP
 nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
                        JSObject *obj_, jsid id_, uint32_t flags,
                        JSObject **objp, bool *_retval)
 {
-  JS::RootedObject obj(cx, obj_);
-  JS::RootedId id(cx, id_);
+  js::RootedObject obj(cx, obj_);
+  js::RootedId id(cx, id_);
 
   nsGlobalWindow *win = nsGlobalWindow::FromWrapper(wrapper);
 
   if (!JSID_IS_STRING(id)) {
     if (JSID_IS_INT(id) && JSID_TO_INT(id) >= 0 && !(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
@@ -7344,17 +7344,17 @@ nsWindowSH::NewResolve(nsIXPConnectWrapp
   // It is not worth calling GlobalResolve() if we are resolving
   // for assignment, since only read-write properties get dealt
   // with there.
   if (!(flags & JSRESOLVE_ASSIGNING)) {
     JSAutoRequest ar(cx);
 
     // Resolve special classes.
     for (uint32_t i = 0; i < ArrayLength(sOtherResolveFuncs); i++) {
-      JS::RootedObject tmp(cx, *objp);
+      js::RootedObject tmp(cx, *objp);
       if (!sOtherResolveFuncs[i](cx, obj, id, flags, &tmp)) {
         return NS_ERROR_FAILURE;
       }
       *objp = tmp;
       if (*objp) {
         return NS_OK;
       }
     }
@@ -9072,17 +9072,17 @@ nsHTMLDocumentSH::DocumentAllNewResolve(
                                         unsigned flags, JSMutableHandleObject objp)
 {
   if (flags & JSRESOLVE_ASSIGNING) {
     // Nothing to do here if we're assigning
 
     return JS_TRUE;
   }
 
-  JS::RootedValue v(cx);
+  js::RootedValue v(cx);
 
   if (sItem_id == id || sNamedItem_id == id) {
     // Define the item() or namedItem() method.
 
     JSFunction *fnc = ::JS_DefineFunctionById(cx, obj, id, CallToGetPropMapper,
                                               0, JSPROP_ENUMERATE);
     objp.set(obj);
 
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -1962,17 +1962,17 @@ nsDOMWindowUtils::GetParent(const JS::Va
     return NS_ERROR_DOM_SECURITY_ERR;
   }
 
   // First argument must be an object.
   if (JSVAL_IS_PRIMITIVE(aObject)) {
     return NS_ERROR_XPC_BAD_CONVERT_JS;
   }
 
-  JS::Rooted<JSObject*> parent(aCx, JS_GetParent(JSVAL_TO_OBJECT(aObject)));
+  js::Rooted<JSObject*> parent(aCx, JS_GetParent(JSVAL_TO_OBJECT(aObject)));
   *aParent = OBJECT_TO_JSVAL(parent);
 
   // Outerize if necessary.
   if (parent) {
     if (JSObjectOp outerize = js::GetObjectClass(parent)->ext.outerObject) {
       *aParent = OBJECT_TO_JSVAL(outerize(aCx, parent));
     }
   }
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -1302,17 +1302,17 @@ nsJSContext::EvaluateStringWithValue(con
     JSAutoCompartment ac(mContext, aScopeObject);
 
     ++mExecuteDepth;
 
     JS::CompileOptions options(mContext);
     options.setFileAndLine(aURL, aLineNo)
            .setVersion(JSVersion(aVersion))
            .setPrincipals(nsJSPrincipals::get(principal));
-    JS::RootedObject rootedScope(mContext, aScopeObject);
+    js::RootedObject rootedScope(mContext, aScopeObject);
     ok = JS::Evaluate(mContext, rootedScope, options, PromiseFlatString(aScript).get(),
                       aScript.Length(), &val);
 
     --mExecuteDepth;
 
     if (!ok) {
       // Tell XPConnect about any pending exceptions. This is needed
       // to avoid dropping JS exceptions in case we got here through
@@ -1490,17 +1490,17 @@ nsJSContext::EvaluateString(const nsAStr
 
   // SecurityManager said "ok", but don't compile if aVersion is unknown.
   // Since the caller is responsible for parsing the version strings, we just
   // check it isn't JSVERSION_UNKNOWN.
   if (ok && JSVersion(aVersion) != JSVERSION_UNKNOWN) {
     XPCAutoRequest ar(mContext);
     JSAutoCompartment ac(mContext, aScopeObject);
 
-    JS::RootedObject rootedScope(mContext, aScopeObject);
+    js::RootedObject rootedScope(mContext, aScopeObject);
     JS::CompileOptions options(mContext);
     options.setFileAndLine(aURL, aLineNo)
            .setPrincipals(nsJSPrincipals::get(principal))
            .setOriginPrincipals(nsJSPrincipals::get(aOriginPrincipal))
            .setVersion(JSVersion(aVersion));
     ok = JS::Evaluate(mContext, rootedScope, options,
                       PromiseFlatString(aScript).get(),
                       aScript.Length(), vp);
@@ -1580,17 +1580,17 @@ nsJSContext::CompileScript(const PRUnich
   JS::CompileOptions options(mContext);
   JS::CompileOptions::SourcePolicy sp = aSaveSource ?
     JS::CompileOptions::SAVE_SOURCE :
     JS::CompileOptions::LAZY_SOURCE;
   options.setPrincipals(nsJSPrincipals::get(aPrincipal))
          .setFileAndLine(aURL, aLineNo)
          .setVersion(JSVersion(aVersion))
          .setSourcePolicy(sp);
-  JS::RootedObject rootedScope(mContext, scopeObject);
+  js::RootedObject rootedScope(mContext, scopeObject);
   JSScript* script = JS::Compile(mContext,
                                  rootedScope,
                                  options,
                                  static_cast<const jschar*>(aText),
                                  aTextLength);
   if (!script) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
@@ -1758,17 +1758,17 @@ nsJSContext::CompileEventHandler(nsIAtom
 
   // Event handlers are always shared, and must be bound before use.
   // Therefore we don't bother compiling with principals.
   XPCAutoRequest ar(mContext);
 
   JS::CompileOptions options(mContext);
   options.setVersion(JSVersion(aVersion))
          .setFileAndLine(aURL, aLineNo);
-  JS::RootedObject empty(mContext, NULL);
+  js::RootedObject empty(mContext, NULL);
   JSFunction* fun = JS::CompileFunction(mContext, empty, options, nsAtomCString(aName).get(),
                                         aArgCount, aArgNames,
                                         PromiseFlatString(aBody).get(), aBody.Length());
 
   if (!fun) {
     ReportPendingException();
     return NS_ERROR_ILLEGAL_VALUE;
   }
@@ -1811,17 +1811,17 @@ nsJSContext::CompileFunction(JSObject* a
     nsCOMPtr<nsIScriptObjectPrincipal> globalData = do_QueryInterface(global);
     if (globalData) {
       principal = globalData->GetPrincipal();
       if (!principal)
         return NS_ERROR_FAILURE;
     }
   }
 
-  JS::RootedObject target(mContext, aShared ? NULL : aTarget);
+  js::RootedObject target(mContext, aShared ? NULL : aTarget);
 
   XPCAutoRequest ar(mContext);
 
   JS::CompileOptions options(mContext);
   options.setPrincipals(nsJSPrincipals::get(principal))
          .setVersion(JSVersion(aVersion))
          .setFileAndLine(aURL, aLineNo);
   JSFunction* fun = JS::CompileFunction(mContext, target,
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -3448,17 +3448,17 @@ class CGAbstractBindingMethod(CGAbstract
             str(CastableObjectUnwrapper(
                         FakeCastableDescriptor(self.descriptor),
                         "obj", "self", self.unwrapFailureCode))))
         return CGList([ self.getThis(), unwrapThis,
                         self.generate_code() ], "\n").define()
 
     def getThis(self):
         return CGIndenter(
-            CGGeneric("JS::RootedObject obj(cx, JS_THIS_OBJECT(cx, vp));\n"
+            CGGeneric("js::RootedObject obj(cx, JS_THIS_OBJECT(cx, vp));\n"
                       "if (!obj) {\n"
                       "  return false;\n"
                       "}\n"
                       "\n"
                       "%s* self;" % self.descriptor.nativeType))
 
     def generate_code(self):
         assert(False) # Override me
--- a/dom/indexedDB/KeyPath.cpp
+++ b/dom/indexedDB/KeyPath.cpp
@@ -343,17 +343,17 @@ KeyPath::ExtractKeyAsJSVal(JSContext* aC
   NS_ASSERTION(IsValid(), "This doesn't make sense!");
 
   if (IsString()) {
     return GetJSValFromKeyPathString(aCx, aValue, mStrings[0], aOutVal,
                                      DoNotCreateProperties, nullptr, nullptr);
   }
  
   const uint32_t len = mStrings.Length();
-  JS::RootedObject arrayObj(aCx, JS_NewArrayObject(aCx, len, nullptr));
+  js::RootedObject arrayObj(aCx, JS_NewArrayObject(aCx, len, nullptr));
   if (!arrayObj) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   JS::Value value;
   for (uint32_t i = 0; i < len; ++i) {
     nsresult rv = GetJSValFromKeyPathString(aCx, aValue, mStrings[i], &value,
                                             DoNotCreateProperties, nullptr,
--- a/dom/src/json/nsJSON.cpp
+++ b/dom/src/json/nsJSON.cpp
@@ -495,17 +495,17 @@ nsJSON::LegacyDecodeFromStream(nsIInputS
   return DecodeInternal(cx, aStream, aContentLength, true, aRetval, LEGACY);
 }
 
 NS_IMETHODIMP
 nsJSON::LegacyDecodeToJSVal(const nsAString &str, JSContext *cx, jsval *result)
 {
   JSAutoRequest ar(cx);
 
-  JS::RootedValue reviver(cx, JS::NullValue()), value(cx);
+  js::RootedValue reviver(cx, JS::NullValue()), value(cx);
 
   if (!js::ParseJSONWithReviver(cx, static_cast<const jschar*>(PromiseFlatString(str).get()),
                                 str.Length(), reviver,
                                 &value, LEGACY)) {
     return NS_ERROR_UNEXPECTED;
   }
 
   *result = value;
@@ -565,17 +565,17 @@ nsJSONListener::OnStopRequest(nsIRequest
 
   // This can happen with short UTF-8 messages (<4 bytes)
   if (!mSniffBuffer.IsEmpty()) {
     // Just consume mSniffBuffer
     rv = ProcessBytes(nullptr, 0);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
-  JS::RootedValue reviver(mCx, JS::NullValue()), value(mCx);
+  js::RootedValue reviver(mCx, JS::NullValue()), value(mCx);
 
   const jschar* chars = reinterpret_cast<const jschar*>(mBufferedChars.Elements());
   JSBool ok = js::ParseJSONWithReviver(mCx, chars,
                                        (uint32) mBufferedChars.Length(),
                                        reviver, &value,
                                        mDecodingMode);
 
   *mRootVal = value;
--- a/dom/workers/ScriptLoader.cpp
+++ b/dom/workers/ScriptLoader.cpp
@@ -580,17 +580,17 @@ ScriptExecutorRunnable::WorkerRun(JSCont
     NS_ASSERTION(!loadInfo.mChannel, "Should no longer have a channel!");
     NS_ASSERTION(loadInfo.mExecutionScheduled, "Should be scheduled!");
 
     if (!loadInfo.mExecutionResult) {
       return true;
     }
   }
 
-  JS::RootedObject global(aCx, JS_GetGlobalObject(aCx));
+  js::RootedObject global(aCx, JS_GetGlobalObject(aCx));
   NS_ASSERTION(global, "Must have a global by now!");
 
   JSPrincipals* principal = GetWorkerPrincipal();
   NS_ASSERTION(principal, "This should never be null!");
 
   for (uint32_t index = mFirstIndex; index <= mLastIndex; index++) {
     ScriptLoadInfo& loadInfo = loadInfos.ElementAt(index);
 
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -3810,17 +3810,17 @@ WorkerPrivate::RunExpiredTimeouts(JSCont
   }
 
   NS_ASSERTION(mTimer, "Must have a timer!");
   NS_ASSERTION(!mTimeouts.IsEmpty(), "Should have some work to do!");
 
   bool retval = true;
 
   AutoPtrComparator<TimeoutInfo> comparator = GetAutoPtrComparator(mTimeouts);
-  JS::RootedObject global(aCx, JS_GetGlobalObject(aCx));
+  js::RootedObject global(aCx, JS_GetGlobalObject(aCx));
   JSPrincipals* principal = GetWorkerPrincipal();
 
   // We want to make sure to run *something*, even if the timer fired a little
   // early. Fudge the value of now to at least include the first timeout.
   const TimeStamp now = NS_MAX(TimeStamp::Now(), mTimeouts[0]->mTargetTime);
 
   nsAutoTArray<TimeoutInfo*, 10> expiredTimeouts;
   for (uint32_t index = 0; index < mTimeouts.Length(); index++) {
--- a/extensions/pref/autoconfig/src/nsJSConfigTriggers.cpp
+++ b/extensions/pref/autoconfig/src/nsJSConfigTriggers.cpp
@@ -196,17 +196,17 @@ nsresult EvaluateAdminConfigScript(const
     }
 
     JS_BeginRequest(autoconfig_cx);
     nsCOMPtr<nsIPrincipal> principal;
     nsContentUtils::GetSecurityManager()->GetSystemPrincipal(getter_AddRefs(principal));
     JS::CompileOptions options(autoconfig_cx);
     options.setPrincipals(nsJSPrincipals::get(principal))
            .setFileAndLine(filename, 1);
-    JS::RootedObject glob(autoconfig_cx, autoconfig_glob);
+    js::RootedObject glob(autoconfig_cx, autoconfig_glob);
     ok = JS::Evaluate(autoconfig_cx, glob, options, js_buffer, length, nullptr);
     JS_EndRequest(autoconfig_cx);
 
     JS_MaybeGC(autoconfig_cx);
 
     JSContext *cx;
     cxstack->Pop(&cx);
     NS_ASSERTION(cx == autoconfig_cx, "AutoConfig JS contexts didn't match");
--- a/js/ipc/ObjectWrapperParent.cpp
+++ b/js/ipc/ObjectWrapperParent.cpp
@@ -311,17 +311,17 @@ JSObject_from_PObjectWrapperParent(JSCon
 }
 
 /*static*/ bool
 ObjectWrapperParent::
 jsval_from_PObjectWrapperParent(JSContext* cx,
                                 const PObjectWrapperParent* from,
                                 jsval* to)
 {
-    JS::RootedObject obj(cx);
+    js::RootedObject obj(cx);
     if (!JSObject_from_PObjectWrapperParent(cx, from, &obj))
         return false;
     *to = OBJECT_TO_JSVAL(obj);
     return true;
 }
     
 static bool
 jsid_from_int(JSContext* cx, int from, jsid* to)
@@ -568,17 +568,17 @@ ObjectWrapperParent::CPOW_NewResolve(JSC
         !self->CallNewResolve(in_id, flags,
                               aco.StatusPtr(), &out_pobj) ||
         !aco.Ok() ||
         !JSObject_from_PObjectWrapperParent(cx, out_pobj, objp))
         return JS_FALSE;
 
     if (objp) {
         AutoResolveFlag arf(objp);
-        JS::RootedObject obj2(cx, objp);
+        js::RootedObject obj2(cx, objp);
         JS_DefinePropertyById(cx, obj2, id, JSVAL_VOID, NULL, NULL,
                               JSPROP_ENUMERATE);
     }
     return JS_TRUE;
 }
 
 /*static*/ JSBool
 ObjectWrapperParent::CPOW_Convert(JSContext *cx, JSHandleObject obj, JSType type,
--- a/js/src/frontend/TokenStream.h
+++ b/js/src/frontend/TokenStream.h
@@ -840,27 +840,27 @@ class TokenStream
         while (--n >= 0)
             getChar();
     }
 
     void updateLineInfoForEOL();
     void updateFlagsForEOL();
 
     Token               tokens[ntokens];/* circular token buffer */
-    JS::SkipRoot        tokensRoot;     /* prevent overwriting of token buffer */
+    js::SkipRoot        tokensRoot;     /* prevent overwriting of token buffer */
     unsigned            cursor;         /* index of last parsed token */
     unsigned            lookahead;      /* count of lookahead tokens */
     unsigned            lineno;         /* current line number */
     unsigned            flags;          /* flags -- see above */
     const jschar        *linebase;      /* start of current line;  points into userbuf */
     const jschar        *prevLinebase;  /* start of previous line;  NULL if on the first line */
-    JS::SkipRoot        linebaseRoot;
-    JS::SkipRoot        prevLinebaseRoot;
+    js::SkipRoot        linebaseRoot;
+    js::SkipRoot        prevLinebaseRoot;
     TokenBuf            userbuf;        /* user input buffer */
-    JS::SkipRoot        userbufRoot;
+    js::SkipRoot        userbufRoot;
     const char          *filename;      /* input filename or null */
     jschar              *sourceMap;     /* source map's filename or null */
     void                *listenerTSData;/* listener data for this TokenStream */
     CharBuffer          tokenbuf;       /* current token string buffer */
     int8_t              oneCharTokens[128];  /* table of one-char tokens */
     bool                maybeEOL[256];       /* probabilistic EOL lookup table */
     bool                maybeStrSpecial[256];/* speeds up string scanning */
     JSVersion           version;        /* (i.e. to identify keywords) */
--- a/js/src/gc/Root.h
+++ b/js/src/gc/Root.h
@@ -12,24 +12,16 @@
 
 #include "mozilla/TypeTraits.h"
 #include "mozilla/GuardObjects.h"
 
 #include "js/TemplateLib.h"
 
 #include "jspubtd.h"
 
-namespace js {
-namespace gc {
-struct Cell;
-} /* namespace gc */
-} /* namespace js */
-
-namespace JS {
-
 /*
  * Moving GC Stack Rooting
  *
  * A moving GC may change the physical location of GC allocated things, even
  * when they are rooted, updating all pointers to the thing to refer to its new
  * location. The GC must therefore know about all live pointers to a thing,
  * not just one of them, in order to behave correctly.
  *
@@ -63,50 +55,60 @@ namespace JS {
  *   generally use handles for those arguments and avoid any explicit rooting.
  *   This has two benefits. First, when several such functions call each other
  *   then redundant rooting of multiple copies of the GC thing can be avoided.
  *   Second, if the caller does not pass a rooted value a compile error will be
  *   generated, which is quicker and easier to fix than when relying on a
  *   separate rooting analysis.
  */
 
-template <typename T> class MutableHandle;
+namespace js {
+
 template <typename T> class Rooted;
 
 template <typename T>
 struct RootMethods { };
 
+template <typename T>
+class HandleBase {};
+
+template <typename T>
+class MutableHandleBase {};
+
+} /* namespace js */
+
+namespace JS {
+
+template <typename T> class MutableHandle;
+
 /*
  * Handle provides an implicit constructor for NullPtr so that, given:
  *   foo(Handle<JSObject*> h);
  * callers can simply write:
  *   foo(NullPtr());
  * which avoids creating a Rooted<JSObject*> just to pass NULL.
  */
 struct NullPtr
 {
     static void * const constNullValue;
 };
 
 template <typename T>
 class MutableHandle;
 
-template <typename T>
-class HandleBase {};
-
 /*
  * Reference to a T that has been rooted elsewhere. This is most useful
  * as a parameter type, which guarantees that the T lvalue is properly
  * rooted. See "Move GC Stack Rooting" above.
  *
  * If you want to add additional methods to Handle for a specific
  * specialization, define a HandleBase<T> specialization containing them.
  */
 template <typename T>
-class Handle : public HandleBase<T>
+class Handle : public js::HandleBase<T>
 {
   public:
     /* Creates a handle from a handle of a type convertible to T. */
     template <typename S>
     Handle(Handle<S> handle,
            typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type dummy = 0)
     {
         ptr = reinterpret_cast<const T *>(handle.address());
@@ -137,17 +139,17 @@ class Handle : public HandleBase<T>
     }
 
     /*
      * Construct a handle from an explicitly rooted location. This is the
      * normal way to create a handle, and normally happens implicitly.
      */
     template <typename S>
     inline
-    Handle(Rooted<S> &root,
+    Handle(js::Rooted<S> &root,
            typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type dummy = 0);
 
     /* Construct a read only handle from a mutable handle. */
     template <typename S>
     inline
     Handle(MutableHandle<S> &root,
            typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type dummy = 0);
 
@@ -168,46 +170,43 @@ class Handle : public HandleBase<T>
 
 typedef Handle<JSObject*>    HandleObject;
 typedef Handle<JSFunction*>  HandleFunction;
 typedef Handle<JSScript*>    HandleScript;
 typedef Handle<JSString*>    HandleString;
 typedef Handle<jsid>         HandleId;
 typedef Handle<Value>        HandleValue;
 
-template <typename T>
-class MutableHandleBase {};
-
 /*
  * Similar to a handle, but the underlying storage can be changed. This is
  * useful for outparams.
  *
  * If you want to add additional methods to MutableHandle for a specific
  * specialization, define a MutableHandleBase<T> specialization containing
  * them.
  */
 template <typename T>
-class MutableHandle : public MutableHandleBase<T>
+class MutableHandle : public js::MutableHandleBase<T>
 {
   public:
     template <typename S>
     MutableHandle(MutableHandle<S> handle,
                   typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type dummy = 0)
     {
         this->ptr = reinterpret_cast<const T *>(handle.address());
     }
 
     template <typename S>
     inline
-    MutableHandle(Rooted<S> *root,
+    MutableHandle(js::Rooted<S> *root,
                   typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type dummy = 0);
 
     void set(T v)
     {
-        JS_ASSERT(!RootMethods<T>::poisoned(v));
+        JS_ASSERT(!js::RootMethods<T>::poisoned(v));
         *ptr = v;
     }
 
     /*
      * This may be called only if the location of the T is guaranteed
      * to be marked (for some reason other than being a Rooted),
      * e.g., if it is guaranteed to be reachable from an implicit root.
      *
@@ -247,16 +246,20 @@ typedef MutableHandle<Value>       Mutab
  */
 typedef JSObject *                  RawObject;
 typedef JSFunction *                RawFunction;
 typedef JSScript *                  RawScript;
 typedef JSString *                  RawString;
 typedef jsid                        RawId;
 typedef Value                       RawValue;
 
+} /* namespace JS */
+
+namespace js {
+
 /*
  * InternalHandle is a handle to an internal pointer into a gcthing. Use
  * InternalHandle when you have a pointer to a direct field of a gcthing, or
  * when you need a parameter type for something that *may* be a pointer to a
  * direct field of a gcthing.
  */
 class InternalHandleBase
 {
@@ -274,17 +277,17 @@ class InternalHandle<T*> : public Intern
     size_t offset;
 
   public:
     /*
      * Create an InternalHandle using a Handle to the gcthing containing the
      * field in question, and a pointer to the field.
      */
     template<typename H>
-    InternalHandle(const Handle<H> &handle, T *field)
+    InternalHandle(const JS::Handle<H> &handle, T *field)
       : holder((void**)handle.address()), offset(uintptr_t(field) - uintptr_t(handle.get()))
     {
     }
 
     /*
      * Create an InternalHandle to a field within a Rooted<>.
      */
     template<typename R>
@@ -314,18 +317,16 @@ class InternalHandle<T*> : public Intern
      */
     InternalHandle(T *field)
       : holder(reinterpret_cast<void * const *>(&zeroPointer)),
         offset(uintptr_t(field))
     {
     }
 };
 
-extern mozilla::ThreadLocal<JSRuntime *> TlsRuntime;
-
 /*
  * By default, pointers should use the inheritance hierarchy to find their
  * ThingRootKind. Some pointer types are explicitly set in jspubtd.h so that
  * Rooted<T> may be used without the class definition being available.
  */
 template <typename T>
 struct RootKind<T *> { static ThingRootKind rootKind() { return T::rootKind(); } };
 
@@ -449,40 +450,16 @@ class Rooted : public RootedBase<T>
     Rooted<T> **stack, *prev;
 #endif
     T ptr;
     MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 
     Rooted(const Rooted &) MOZ_DELETE;
 };
 
-template<typename T> template <typename S>
-inline
-Handle<T>::Handle(Rooted<S> &root,
-                  typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type dummy)
-{
-    ptr = reinterpret_cast<const T *>(root.address());
-}
-
-template<typename T> template <typename S>
-inline
-Handle<T>::Handle(MutableHandle<S> &root,
-                  typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type dummy)
-{
-    ptr = reinterpret_cast<const T *>(root.address());
-}
-
-template<typename T> template <typename S>
-inline
-MutableHandle<T>::MutableHandle(Rooted<S> *root,
-                                typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type dummy)
-{
-    ptr = root->address();
-}
-
 typedef Rooted<JSObject*>    RootedObject;
 typedef Rooted<JSFunction*>  RootedFunction;
 typedef Rooted<JSScript*>    RootedScript;
 typedef Rooted<JSString*>    RootedString;
 typedef Rooted<jsid>         RootedId;
 typedef Rooted<Value>        RootedValue;
 
 /*
@@ -540,16 +517,44 @@ class SkipRoot
         JS_GUARD_OBJECT_NOTIFIER_INIT;
     }
 
 #endif /* DEBUG && JSGC_ROOT_ANALYSIS */
 
     JS_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
+} /* namespace js */
+
+namespace JS {
+
+template<typename T> template <typename S>
+inline
+Handle<T>::Handle(js::Rooted<S> &root,
+                  typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type dummy)
+{
+    ptr = reinterpret_cast<const T *>(root.address());
+}
+
+template<typename T> template <typename S>
+inline
+Handle<T>::Handle(MutableHandle<S> &root,
+                  typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type dummy)
+{
+    ptr = reinterpret_cast<const T *>(root.address());
+}
+
+template<typename T> template <typename S>
+inline
+MutableHandle<T>::MutableHandle(js::Rooted<S> *root,
+                                typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type dummy)
+{
+    ptr = root->address();
+}
+
 JS_FRIEND_API(void) EnterAssertNoGCScope();
 JS_FRIEND_API(void) LeaveAssertNoGCScope();
 JS_FRIEND_API(bool) InNoGCScope();
 
 /*
  * The scoped guard object AutoAssertNoGC forces the GC to assert if a GC is
  * attempted while the guard object is live.  If you have a GC-unsafe operation
  * to perform, use this guard object to protect your operation.
@@ -575,32 +580,40 @@ public:
 
 #if defined(DEBUG) && defined(JS_GC_ZEAL) && defined(JSGC_ROOT_ANALYSIS) && !defined(JS_THREADSAFE)
 extern void
 CheckStackRoots(JSContext *cx);
 #endif
 
 JS_FRIEND_API(bool) NeedRelaxedRootChecks();
 
+} /* namespace JS */
+
+namespace js {
+
 /*
  * Hook for dynamic root analysis. Checks the native stack and poisons
  * references to GC things which have not been rooted.
  */
 inline void MaybeCheckStackRoots(JSContext *cx, bool relax = true)
 {
 #ifdef DEBUG
     JS_ASSERT(!InNoGCScope());
 # if defined(JS_GC_ZEAL) && defined(JSGC_ROOT_ANALYSIS) && !defined(JS_THREADSAFE)
     if (relax && NeedRelaxedRootChecks())
         return;
     CheckStackRoots(cx);
 # endif
 #endif
 }
 
+namespace gc {
+struct Cell;
+} /* namespace gc */
+
 /* Base class for automatic read-only object rooting during compilation. */
 class CompilerRootNode
 {
   protected:
     CompilerRootNode(js::gc::Cell *ptr)
       : next(NULL), ptr(ptr)
     { }
 
@@ -609,13 +622,13 @@ class CompilerRootNode
 
   public:
     CompilerRootNode *next;
 
   protected:
     js::gc::Cell *ptr;
 };
 
-}  /* namespace JS */
+}  /* namespace js */
 
 #endif  /* __cplusplus */
 
 #endif  /* jsgc_root_h___ */
--- a/js/src/ion/CompilerRoot.h
+++ b/js/src/ion/CompilerRoot.h
@@ -30,17 +30,17 @@ class CompilerRoot : public CompilerRoot
     {
         if (ptr)
             setRoot(ptr);
     }
 
   public:
     // Sets the pointer and inserts into root list. The pointer becomes read-only.
     void setRoot(T root) {
-        JS::CompilerRootNode *&rootList = GetIonContext()->temp->rootList();
+        CompilerRootNode *&rootList = GetIonContext()->temp->rootList();
 
         JS_ASSERT(!ptr);
         ptr = root;
         next = rootList;
         rootList = this;
     }
 
   public:
--- a/js/src/ion/IonAllocPolicy.h
+++ b/js/src/ion/IonAllocPolicy.h
@@ -18,17 +18,17 @@ namespace js {
 namespace ion {
 
 class TempAllocator
 {
     LifoAlloc *lifoAlloc_;
     void *mark_;
 
     // Linked list of GCThings rooted by this allocator.
-    JS::CompilerRootNode *rootList_;
+    CompilerRootNode *rootList_;
 
   public:
     TempAllocator(LifoAlloc *lifoAlloc)
       : lifoAlloc_(lifoAlloc),
         mark_(lifoAlloc->mark()),
         rootList_(NULL)
     { }
 
@@ -52,17 +52,17 @@ class TempAllocator
         return p;
     }
 
     LifoAlloc *lifoAlloc()
     {
         return lifoAlloc_;
     }
 
-    JS::CompilerRootNode *&rootList()
+    CompilerRootNode *&rootList()
     {
         return rootList_;
     }
 
     bool ensureBallast() {
         // Most infallible Ion allocations are small, so we use a ballast of
         // ~16K for now.
         return lifoAlloc_->ensureUnusedApproximate(16 * 1024);
--- a/js/src/jsapi-tests/selfTest.cpp
+++ b/js/src/jsapi-tests/selfTest.cpp
@@ -5,17 +5,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 
 #include "tests.h"
 
 BEGIN_TEST(selfTest_NaNsAreSame)
 {
-    JS::RootedValue v1(cx), v2(cx);
+    js::RootedValue v1(cx), v2(cx);
     EVAL("0/0", v1.address());  // NaN
     CHECK_SAME(v1, v1);
 
     EVAL("Math.sin('no')", v2.address());  // also NaN
     CHECK_SAME(v1, v2);
     return true;
 }
 END_TEST(selfTest_NaNsAreSame)
--- a/js/src/jsapi-tests/testAddPropertyPropcache.cpp
+++ b/js/src/jsapi-tests/testAddPropertyPropcache.cpp
@@ -29,35 +29,35 @@ JSClass addPropertyClass = {
     JS_StrictPropertyStub,   /* setProperty */
     JS_EnumerateStub,
     JS_ResolveStub,
     JS_ConvertStub
 };
 
 BEGIN_TEST(testAddPropertyHook)
 {
-    JS::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL));
+    js::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL));
     CHECK(obj);
-    JS::RootedValue proto(cx, OBJECT_TO_JSVAL(obj));
+    js::RootedValue proto(cx, OBJECT_TO_JSVAL(obj));
     JS_InitClass(cx, global, obj, &addPropertyClass, NULL, 0, NULL, NULL, NULL,
                  NULL);
 
     obj = JS_NewArrayObject(cx, 0, NULL);
     CHECK(obj);
-    JS::RootedValue arr(cx, OBJECT_TO_JSVAL(obj));
+    js::RootedValue arr(cx, OBJECT_TO_JSVAL(obj));
 
     CHECK(JS_DefineProperty(cx, global, "arr", arr,
                             JS_PropertyStub, JS_StrictPropertyStub,
                             JSPROP_ENUMERATE));
 
     for (int i = 0; i < expectedCount; ++i) {
         obj = JS_NewObject(cx, &addPropertyClass, NULL, NULL);
         CHECK(obj);
-        JS::RootedValue vobj(cx, OBJECT_TO_JSVAL(obj));
-        JS::RootedObject arrObj(cx, JSVAL_TO_OBJECT(arr));
+        js::RootedValue vobj(cx, OBJECT_TO_JSVAL(obj));
+        js::RootedObject arrObj(cx, JSVAL_TO_OBJECT(arr));
         CHECK(JS_DefineElement(cx, arrObj, i, vobj,
                                JS_PropertyStub, JS_StrictPropertyStub,
                                JSPROP_ENUMERATE));
     }
 
     // Now add a prop to each of the objects, but make sure to do
     // so at the same bytecode location so we can hit the propcache.
     EXEC("'use strict';                                     \n"
--- a/js/src/jsapi-tests/testArrayBuffer.cpp
+++ b/js/src/jsapi-tests/testArrayBuffer.cpp
@@ -6,18 +6,18 @@
 #include "jsfriendapi.h"
 
 #define NUM_TEST_BUFFERS 2
 #define MAGIC_VALUE_1 3
 #define MAGIC_VALUE_2 17
 
 BEGIN_TEST(testArrayBuffer_bug720949_steal)
 {
-    JS::RootedObject buf_len1(cx), buf_len200(cx);
-    JS::RootedObject tarray_len1(cx), tarray_len200(cx);
+    js::RootedObject buf_len1(cx), buf_len200(cx);
+    js::RootedObject tarray_len1(cx), tarray_len200(cx);
 
     uint32_t sizes[NUM_TEST_BUFFERS] = { sizeof(uint32_t), 200 * sizeof(uint32_t) };
     JS::HandleObject testBuf[NUM_TEST_BUFFERS] = { buf_len1, buf_len200 };
     JS::HandleObject testArray[NUM_TEST_BUFFERS] = { tarray_len1, tarray_len200 };
 
     // Single-element ArrayBuffer (uses fixed slots for storage)
     CHECK(buf_len1 = JS_NewArrayBuffer(cx, sizes[0]));
     CHECK(tarray_len1 = JS_NewInt32ArrayWithBuffer(cx, testBuf[0], 0, -1));
@@ -66,21 +66,21 @@ BEGIN_TEST(testArrayBuffer_bug720949_ste
         CHECK(JS_GetProperty(cx, view, "length", &v));
         CHECK_SAME(v, INT_TO_JSVAL(0));
         CHECK_EQUAL(JS_GetArrayBufferByteLength(obj, cx), 0);
         v = JSVAL_VOID;
         JS_GetElement(cx, obj, 0, &v);
         CHECK_SAME(v, JSVAL_VOID);
 
         // Transfer to a new ArrayBuffer
-        JS::RootedObject dst(cx, JS_NewArrayBufferWithContents(cx, contents));
+        js::RootedObject dst(cx, JS_NewArrayBufferWithContents(cx, contents));
         CHECK(JS_IsArrayBufferObject(dst, cx));
         data = JS_GetArrayBufferData(obj, cx);
 
-        JS::RootedObject dstview(cx, JS_NewInt32ArrayWithBuffer(cx, dst, 0, -1));
+        js::RootedObject dstview(cx, JS_NewInt32ArrayWithBuffer(cx, dst, 0, -1));
         CHECK(dstview != NULL);
 
         CHECK_EQUAL(JS_GetArrayBufferByteLength(dst, cx), size);
         data = JS_GetArrayBufferData(dst, cx);
         CHECK(data != NULL);
         CHECK_EQUAL(*reinterpret_cast<uint32_t*>(data), MAGIC_VALUE_2);
         CHECK(JS_GetElement(cx, dstview, 0, &v));
         CHECK_SAME(v, INT_TO_JSVAL(MAGIC_VALUE_2));
@@ -94,27 +94,27 @@ static void GC(JSContext *cx)
 {
     JS_GC(JS_GetRuntime(cx));
     JS_GC(JS_GetRuntime(cx)); // Trigger another to wait for background finalization to end
 }
 
 // Varying number of views of a buffer, to test the neutering weak pointers
 BEGIN_TEST(testArrayBuffer_bug720949_viewList)
 {
-    JS::RootedObject buffer(cx);
+    js::RootedObject buffer(cx);
 
     // No views
     buffer = JS_NewArrayBuffer(cx, 2000);
     buffer = NULL;
     GC(cx);
 
     // One view.
     {
         buffer = JS_NewArrayBuffer(cx, 2000);
-        JS::RootedObject view(cx, JS_NewUint8ArrayWithBuffer(cx, buffer, 0, -1));
+        js::RootedObject view(cx, JS_NewUint8ArrayWithBuffer(cx, buffer, 0, -1));
         void *contents;
         CHECK(JS_StealArrayBufferContents(cx, buffer, &contents));
         CHECK(contents != NULL);
         JS_free(cx, contents);
         GC(cx);
         CHECK(isNeutered(view));
         CHECK(isNeutered(buffer));
         view = NULL;
@@ -122,18 +122,18 @@ BEGIN_TEST(testArrayBuffer_bug720949_vie
         buffer = NULL;
         GC(cx);
     }
 
     // Two views
     {
         buffer = JS_NewArrayBuffer(cx, 2000);
 
-        JS::RootedObject view1(cx, JS_NewUint8ArrayWithBuffer(cx, buffer, 0, -1));
-        JS::RootedObject view2(cx, JS_NewUint8ArrayWithBuffer(cx, buffer, 1, 200));
+        js::RootedObject view1(cx, JS_NewUint8ArrayWithBuffer(cx, buffer, 0, -1));
+        js::RootedObject view2(cx, JS_NewUint8ArrayWithBuffer(cx, buffer, 1, 200));
 
         // Remove, re-add a view
         view2 = NULL;
         GC(cx);
         view2 = JS_NewUint8ArrayWithBuffer(cx, buffer, 1, 200);
 
         // Neuter
         void *contents;
--- a/js/src/jsapi-tests/testBindCallable.cpp
+++ b/js/src/jsapi-tests/testBindCallable.cpp
@@ -9,18 +9,18 @@ BEGIN_TEST(test_BindCallable)
   jsval v;
   EVAL("({ somename : 1717 })", &v);
   CHECK(v.isObject());
 
   jsval func;
   EVAL("(function() { return this.somename; })", &func);
   CHECK(func.isObject());
 
-  JS::RootedObject funcObj(cx, JSVAL_TO_OBJECT(func));
-  JS::RootedObject vObj(cx, JSVAL_TO_OBJECT(v));
+  js::RootedObject funcObj(cx, JSVAL_TO_OBJECT(func));
+  js::RootedObject vObj(cx, JSVAL_TO_OBJECT(v));
   JSObject* newCallable = JS_BindCallable(cx, funcObj, vObj);
   CHECK(newCallable);
 
   jsval retval;
   bool called = JS_CallFunctionValue(cx, NULL, OBJECT_TO_JSVAL(newCallable),
                                      0, NULL, &retval);
   CHECK(called);
 
--- a/js/src/jsapi-tests/testBug604087.cpp
+++ b/js/src/jsapi-tests/testBug604087.cpp
@@ -27,70 +27,70 @@ struct OuterWrapper : js::DirectWrapper
 
 OuterWrapper
 OuterWrapper::singleton;
 
 static JSObject *
 wrap(JSContext *cx, JS::HandleObject toWrap, JS::HandleObject target)
 {
     JSAutoCompartment ac(cx, target);
-    JS::RootedObject wrapper(cx, toWrap);
+    js::RootedObject wrapper(cx, toWrap);
     if (!JS_WrapObject(cx, wrapper.address()))
         return NULL;
     return wrapper;
 }
 
 static JSObject *
 SameCompartmentWrap(JSContext *cx, JSObject *objArg)
 {
-    JS::RootedObject obj(cx, objArg);
+    js::RootedObject obj(cx, objArg);
     JS_GC(JS_GetRuntime(cx));
     return obj;
 }
 
 static JSObject *
 PreWrap(JSContext *cx, JSObject *scopeArg, JSObject *objArg, unsigned flags)
 {
-    JS::RootedObject scope(cx, scopeArg);
-    JS::RootedObject obj(cx, objArg);
+    js::RootedObject scope(cx, scopeArg);
+    js::RootedObject obj(cx, objArg);
     JS_GC(JS_GetRuntime(cx));
     return obj;
 }
 
 static JSObject *
 Wrap(JSContext *cx, JSObject *objArg, JSObject *protoArg, JSObject *parentArg, unsigned flags)
 {
-    JS::RootedObject obj(cx, objArg);
-    JS::RootedObject proto(cx, protoArg);
-    JS::RootedObject parent(cx, parentArg);
+    js::RootedObject obj(cx, objArg);
+    js::RootedObject proto(cx, protoArg);
+    js::RootedObject parent(cx, parentArg);
     return js::Wrapper::New(cx, obj, proto, parent, &js::CrossCompartmentWrapper::singleton);
 }
 
 BEGIN_TEST(testBug604087)
 {
-    JS::RootedObject outerObj(cx, js::Wrapper::New(cx, global, global->getProto(), global,
+    js::RootedObject outerObj(cx, js::Wrapper::New(cx, global, global->getProto(), global,
                                                &OuterWrapper::singleton));
-    JS::RootedObject compartment2(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
-    JS::RootedObject compartment3(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
-    JS::RootedObject compartment4(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
+    js::RootedObject compartment2(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
+    js::RootedObject compartment3(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
+    js::RootedObject compartment4(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
 
-    JS::RootedObject c2wrapper(cx, wrap(cx, outerObj, compartment2));
+    js::RootedObject c2wrapper(cx, wrap(cx, outerObj, compartment2));
     CHECK(c2wrapper);
     js::SetProxyExtra(c2wrapper, 0, js::Int32Value(2));
 
-    JS::RootedObject c3wrapper(cx, wrap(cx, outerObj, compartment3));
+    js::RootedObject c3wrapper(cx, wrap(cx, outerObj, compartment3));
     CHECK(c3wrapper);
     js::SetProxyExtra(c3wrapper, 0, js::Int32Value(3));
 
-    JS::RootedObject c4wrapper(cx, wrap(cx, outerObj, compartment4));
+    js::RootedObject c4wrapper(cx, wrap(cx, outerObj, compartment4));
     CHECK(c4wrapper);
     js::SetProxyExtra(c4wrapper, 0, js::Int32Value(4));
     compartment4 = c4wrapper = NULL;
 
-    JS::RootedObject next(cx);
+    js::RootedObject next(cx);
     {
         JSAutoCompartment ac(cx, compartment2);
         next = js::Wrapper::New(cx, compartment2, compartment2->getProto(), compartment2,
                                 &OuterWrapper::singleton);
         CHECK(next);
     }
 
     JS_SetWrapObjectCallbacks(JS_GetRuntime(cx), Wrap, SameCompartmentWrap, PreWrap);
--- a/js/src/jsapi-tests/testCallNonGenericMethodOnProxy.cpp
+++ b/js/src/jsapi-tests/testCallNonGenericMethodOnProxy.cpp
@@ -39,49 +39,49 @@ CustomMethod(JSContext *cx, unsigned arg
 {
   CallArgs args = CallArgsFromVp(argc, vp);
   return CallNonGenericMethod(cx, IsCustomClass, CustomMethodImpl, args);
 }
 
 BEGIN_TEST(test_CallNonGenericMethodOnProxy)
 {
   // Create the first global object and compartment
-  JS::RootedObject globalA(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
+  js::RootedObject globalA(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
   CHECK(globalA);
 
-  JS::RootedObject customA(cx, JS_NewObject(cx, &CustomClass, NULL, NULL));
+  js::RootedObject customA(cx, JS_NewObject(cx, &CustomClass, NULL, NULL));
   CHECK(customA);
   JS_SetReservedSlot(customA, CUSTOM_SLOT, Int32Value(17));
 
   JSFunction *customMethodA = JS_NewFunction(cx, CustomMethod, 0, 0, customA, "customMethodA");
   CHECK(customMethodA);
 
   jsval rval;
   CHECK(JS_CallFunction(cx, customA, customMethodA, 0, NULL, &rval));
   CHECK_SAME(rval, Int32Value(17));
 
   // Now create the second global object and compartment...
   {
-    JS::RootedObject globalB(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
+    js::RootedObject globalB(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
     CHECK(globalB);
 
     // ...and enter it.
     JSAutoCompartment enter(cx, globalB);
-    JS::RootedObject customB(cx, JS_NewObject(cx, &CustomClass, NULL, NULL));
+    js::RootedObject customB(cx, JS_NewObject(cx, &CustomClass, NULL, NULL));
     CHECK(customB);
     JS_SetReservedSlot(customB, CUSTOM_SLOT, Int32Value(42));
 
     JSFunction *customMethodB = JS_NewFunction(cx, CustomMethod, 0, 0, customB, "customMethodB");
     CHECK(customMethodB);
 
     jsval rval;
     CHECK(JS_CallFunction(cx, customB, customMethodB, 0, NULL, &rval));
     CHECK_SAME(rval, Int32Value(42));
 
-    JS::RootedObject wrappedCustomA(cx, customA);
+    js::RootedObject wrappedCustomA(cx, customA);
     CHECK(JS_WrapObject(cx, wrappedCustomA.address()));
 
     jsval rval2;
     CHECK(JS_CallFunction(cx, wrappedCustomA, customMethodB, 0, NULL, &rval2));
     CHECK_SAME(rval, Int32Value(42));
   }
 
   return true;
--- a/js/src/jsapi-tests/testClassGetter.cpp
+++ b/js/src/jsapi-tests/testClassGetter.cpp
@@ -58,16 +58,16 @@ static JSFunctionSpec ptestFunctions[] =
 BEGIN_TEST(testClassGetter_isCalled)
 {
     CHECK(JS_InitClass(cx, global, NULL, &ptestClass, PTest, 0,
                        NULL, ptestFunctions, NULL, NULL));
 
     EXEC("function check() { var o = new PTest(); o.test_fn(); o.test_value1; o.test_value2; o.test_value1; }");
 
     for (int i = 1; i < 9; i++) {
-        JS::RootedValue rval(cx);
+        js::RootedValue rval(cx);
         CHECK(JS_CallFunctionName(cx, global, "check", 0, NULL, rval.address()));
         CHECK_SAME(INT_TO_JSVAL(called_test_fn), INT_TO_JSVAL(i));
         CHECK_SAME(INT_TO_JSVAL(called_test_prop_get), INT_TO_JSVAL(4 * i));
     }
     return true;
 }
 END_TEST(testClassGetter_isCalled)
--- a/js/src/jsapi-tests/testCloneScript.cpp
+++ b/js/src/jsapi-tests/testCloneScript.cpp
@@ -8,32 +8,32 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 
 #include "tests.h"
 #include "jsdbgapi.h"
 
 BEGIN_TEST(test_cloneScript)
 {
-    JS::RootedObject A(cx, createGlobal());
-    JS::RootedObject B(cx, createGlobal());
+    js::RootedObject A(cx, createGlobal());
+    js::RootedObject B(cx, createGlobal());
 
     CHECK(A);
     CHECK(B);
 
     const char *source =
         "var i = 0;\n"
         "var sum = 0;\n"
         "while (i < 10) {\n"
         "    sum += i;\n"
         "    ++i;\n"
         "}\n"
         "(sum);\n";
 
-    JS::RootedObject obj(cx);
+    js::RootedObject obj(cx);
 
     // compile for A
     {
         JSAutoCompartment a(cx, A);
         JSFunction *fun;
         CHECK(fun = JS_CompileFunction(cx, A, "f", 0, NULL, source, strlen(source), __FILE__, 1));
         CHECK(obj = JS_GetFunctionObject(fun));
     }
@@ -85,26 +85,26 @@ BEGIN_TEST(test_cloneScriptWithPrincipal
 {
     JS_InitDestroyPrincipalsCallback(rt, DestroyPrincipals);
 
     JSPrincipals *principalsA = new Principals();
     AutoDropPrincipals dropA(rt, principalsA);
     JSPrincipals *principalsB = new Principals();
     AutoDropPrincipals dropB(rt, principalsB);
 
-    JS::RootedObject A(cx, createGlobal(principalsA));
-    JS::RootedObject B(cx, createGlobal(principalsB));
+    js::RootedObject A(cx, createGlobal(principalsA));
+    js::RootedObject B(cx, createGlobal(principalsB));
 
     CHECK(A);
     CHECK(B);
 
     const char *argnames[] = { "arg" };
     const char *source = "return function() { return arg; }";
 
-    JS::RootedObject obj(cx);
+    js::RootedObject obj(cx);
 
     // Compile in A
     {
         JSAutoCompartment a(cx, A);
         JSFunction *fun;
         CHECK(fun = JS_CompileFunctionForPrincipals(cx, A, principalsA, "f",
                                                     mozilla::ArrayLength(argnames), argnames,
                                                     source, strlen(source), __FILE__, 1));
@@ -114,17 +114,17 @@ BEGIN_TEST(test_cloneScriptWithPrincipal
 
         CHECK(JS_GetScriptPrincipals(script) == principalsA);
         CHECK(obj = JS_GetFunctionObject(fun));
     }
 
     // Clone into B
     {
         JSAutoCompartment b(cx, B);
-        JS::RootedObject cloned(cx);
+        js::RootedObject cloned(cx);
         CHECK(cloned = JS_CloneFunctionObject(cx, obj, B));
 
         JSFunction *fun;
         CHECK(fun = JS_ValueToFunction(cx, JS::ObjectValue(*cloned)));
 
         JSScript *script;
         CHECK(script = JS_GetFunctionScript(cx, fun));
 
--- a/js/src/jsapi-tests/testConservativeGC.cpp
+++ b/js/src/jsapi-tests/testConservativeGC.cpp
@@ -6,38 +6,38 @@
 #include "jsobj.h"
 #include "vm/String.h"
 
 #include "jsobjinlines.h"
 
 BEGIN_TEST(testConservativeGC)
 {
 #ifndef JSGC_USE_EXACT_ROOTING
-    JS::RootedValue v2(cx);
+    js::RootedValue v2(cx);
     EVAL("({foo: 'bar'});", v2.address());
     CHECK(v2.isObject());
     char objCopy[sizeof(JSObject)];
     js_memcpy(&objCopy, JSVAL_TO_OBJECT(v2), sizeof(JSObject));
 
-    JS::RootedValue v3(cx);
+    js::RootedValue v3(cx);
     EVAL("String(Math.PI);", v3.address());
     CHECK(JSVAL_IS_STRING(v3));
     char strCopy[sizeof(JSString)];
     js_memcpy(&strCopy, JSVAL_TO_STRING(v3), sizeof(JSString));
 
     jsval tmp;
     EVAL("({foo2: 'bar2'});", &tmp);
     CHECK(tmp.isObject());
-    JS::RootedObject obj2(cx, JSVAL_TO_OBJECT(tmp));
+    js::RootedObject obj2(cx, JSVAL_TO_OBJECT(tmp));
     char obj2Copy[sizeof(JSObject)];
     js_memcpy(&obj2Copy, obj2, sizeof(JSObject));
 
     EVAL("String(Math.sqrt(3));", &tmp);
     CHECK(JSVAL_IS_STRING(tmp));
-    JS::RootedString str2(cx, JSVAL_TO_STRING(tmp));
+    js::RootedString str2(cx, JSVAL_TO_STRING(tmp));
     char str2Copy[sizeof(JSString)];
     js_memcpy(&str2Copy, str2, sizeof(JSString));
 
     tmp = JSVAL_NULL;
 
     JS_GC(rt);
 
     EVAL("var a = [];\n"
--- a/js/src/jsapi-tests/testCustomIterator.cpp
+++ b/js/src/jsapi-tests/testCustomIterator.cpp
@@ -15,17 +15,17 @@ IterNext(JSContext *cx, unsigned argc, j
         return JS_ThrowStopIteration(cx);
     JS_SET_RVAL(cx, vp, INT_TO_JSVAL(count));
     return true;
 }
 
 static JSObject *
 IterHook(JSContext *cx, JS::HandleObject obj, JSBool keysonly)
 {
-    JS::RootedObject iterObj(cx, JS_NewObject(cx, NULL, NULL, NULL));
+    js::RootedObject iterObj(cx, JS_NewObject(cx, NULL, NULL, NULL));
     if (!iterObj)
         return NULL;
     if (!JS_DefineFunction(cx, iterObj, "next", IterNext, 0, 0))
         return NULL;
     return iterObj;
 }
 
 js::Class HasCustomIterClass = {
--- a/js/src/jsapi-tests/testDebugger.cpp
+++ b/js/src/jsapi-tests/testDebugger.cpp
@@ -112,17 +112,17 @@ END_TEST(testDebugger_getThisStrict)
 bool called = false;
 
 static JSTrapStatus
 ThrowHook(JSContext *cx, JSScript *, jsbytecode *, jsval *rval, void *closure)
 {
     JS_ASSERT(!closure);
     called = true;
 
-    JS::RootedObject global(cx, JS_GetGlobalForScopeChain(cx));
+    js::RootedObject global(cx, JS_GetGlobalForScopeChain(cx));
 
     char text[] = "new Error()";
     jsval _;
     JS_EvaluateScript(cx, global, text, strlen(text), "", 0, &_);
 
     return JSTRAP_CONTINUE;
 }
 
@@ -145,26 +145,26 @@ BEGIN_TEST(testDebugger_throwHook)
     JS_SetOptions(cx, oldopts);
     return true;
 }
 END_TEST(testDebugger_throwHook)
 
 BEGIN_TEST(testDebugger_debuggerObjectVsDebugMode)
 {
     CHECK(JS_DefineDebuggerObject(cx, global));
-    JS::RootedObject debuggee(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
+    js::RootedObject debuggee(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
     CHECK(debuggee);
 
     {
         JSAutoCompartment ae(cx, debuggee);
         CHECK(JS_SetDebugMode(cx, true));
         CHECK(JS_InitStandardClasses(cx, debuggee));
     }
 
-    JS::RootedObject debuggeeWrapper(cx, debuggee);
+    js::RootedObject debuggeeWrapper(cx, debuggee);
     CHECK(JS_WrapObject(cx, debuggeeWrapper.address()));
     jsval v = OBJECT_TO_JSVAL(debuggeeWrapper);
     CHECK(JS_SetProperty(cx, global, "debuggee", &v));
 
     EVAL("var dbg = new Debugger(debuggee);\n"
          "var hits = 0;\n"
          "dbg.onDebuggerStatement = function () { hits++; };\n"
          "debuggee.eval('debugger;');\n"
@@ -185,24 +185,24 @@ BEGIN_TEST(testDebugger_debuggerObjectVs
     return true;
 }
 END_TEST(testDebugger_debuggerObjectVsDebugMode)
 
 BEGIN_TEST(testDebugger_newScriptHook)
 {
     // Test that top-level indirect eval fires the newScript hook.
     CHECK(JS_DefineDebuggerObject(cx, global));
-    JS::RootedObject g(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
+    js::RootedObject g(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL));
     CHECK(g);
     {
         JSAutoCompartment ae(cx, g);
         CHECK(JS_InitStandardClasses(cx, g));
     }
 
-    JS::RootedObject gWrapper(cx, g);
+    js::RootedObject gWrapper(cx, g);
     CHECK(JS_WrapObject(cx, gWrapper.address()));
     jsval v = OBJECT_TO_JSVAL(gWrapper);
     CHECK(JS_SetProperty(cx, global, "g", &v));
 
     EXEC("var dbg = Debugger(g);\n"
          "var hits = 0;\n"
          "dbg.onNewScript = function (s) {\n"
          "    hits += Number(s instanceof Debugger.Script);\n"
--- a/js/src/jsapi-tests/testDeepFreeze.cpp
+++ b/js/src/jsapi-tests/testDeepFreeze.cpp
@@ -7,34 +7,34 @@
 
 
 #include "tests.h"
 
 BEGIN_TEST(testDeepFreeze_bug535703)
 {
     jsval v;
     EVAL("var x = {}; x;", &v);
-    JS::RootedObject obj(cx, JSVAL_TO_OBJECT(v));
+    js::RootedObject obj(cx, JSVAL_TO_OBJECT(v));
     CHECK(JS_DeepFreezeObject(cx, obj));  // don't crash
     EVAL("Object.isFrozen(x)", &v);
     CHECK_SAME(v, JSVAL_TRUE);
     return true;
 }
 END_TEST(testDeepFreeze_bug535703)
 
 BEGIN_TEST(testDeepFreeze_deep)
 {
     jsval a, o;
     EXEC("var a = {}, o = a;\n"
          "for (var i = 0; i < 5000; i++)\n"
          "    a = {x: a, y: a};\n");
     EVAL("a", &a);
     EVAL("o", &o);
 
-    JS::RootedObject aobj(cx, JSVAL_TO_OBJECT(a));
+    js::RootedObject aobj(cx, JSVAL_TO_OBJECT(a));
     CHECK(JS_DeepFreezeObject(cx, aobj));
 
     jsval b;
     EVAL("Object.isFrozen(a)", &b);
     CHECK_SAME(b, JSVAL_TRUE);
     EVAL("Object.isFrozen(o)", &b);
     CHECK_SAME(b, JSVAL_TRUE);
     return true;
@@ -43,17 +43,17 @@ END_TEST(testDeepFreeze_deep)
 
 BEGIN_TEST(testDeepFreeze_loop)
 {
     jsval x, y;
     EXEC("var x = [], y = {x: x}; y.y = y; x.push(x, y);");
     EVAL("x", &x);
     EVAL("y", &y);
 
-    JS::RootedObject xobj(cx, JSVAL_TO_OBJECT(x));
+    js::RootedObject xobj(cx, JSVAL_TO_OBJECT(x));
     CHECK(JS_DeepFreezeObject(cx, xobj));
 
     jsval b;
     EVAL("Object.isFrozen(x)", &b);
     CHECK_SAME(b, JSVAL_TRUE);
     EVAL("Object.isFrozen(y)", &b);
     CHECK_SAME(b, JSVAL_TRUE);
     return true;
--- a/js/src/jsapi-tests/testDefineGetterSetterNonEnumerable.cpp
+++ b/js/src/jsapi-tests/testDefineGetterSetterNonEnumerable.cpp
@@ -13,32 +13,32 @@ native(JSContext *cx, unsigned argc, jsv
 {
     return JS_TRUE;
 }
 
 static const char PROPERTY_NAME[] = "foo";
 
 BEGIN_TEST(testDefineGetterSetterNonEnumerable)
 {
-    JS::RootedValue vobj(cx);
-    JS::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL));
+    js::RootedValue vobj(cx);
+    js::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL));
     CHECK(obj);
     vobj = OBJECT_TO_JSVAL(obj);
 
     JSFunction *funGet = JS_NewFunction(cx, native, 0, 0, NULL, "get");
     CHECK(funGet);
-    JS::RootedObject funGetObj(cx, JS_GetFunctionObject(funGet));
-    JS::RootedValue vget(cx, OBJECT_TO_JSVAL(funGetObj));
+    js::RootedObject funGetObj(cx, JS_GetFunctionObject(funGet));
+    js::RootedValue vget(cx, OBJECT_TO_JSVAL(funGetObj));
 
     JSFunction *funSet = JS_NewFunction(cx, native, 1, 0, NULL, "set");
     CHECK(funSet);
-    JS::RootedObject funSetObj(cx, JS_GetFunctionObject(funSet));
-    JS::RootedValue vset(cx, OBJECT_TO_JSVAL(funSetObj));
+    js::RootedObject funSetObj(cx, JS_GetFunctionObject(funSet));
+    js::RootedValue vset(cx, OBJECT_TO_JSVAL(funSetObj));
 
-    JS::RootedObject vObject(cx, JSVAL_TO_OBJECT(vobj));
+    js::RootedObject vObject(cx, JSVAL_TO_OBJECT(vobj));
     CHECK(JS_DefineProperty(cx, vObject, PROPERTY_NAME,
                             JSVAL_VOID,
                             JS_DATA_TO_FUNC_PTR(JSPropertyOp, (JSObject*) funGetObj),
                             JS_DATA_TO_FUNC_PTR(JSStrictPropertyOp, (JSObject*) funSetObj),
                             JSPROP_GETTER | JSPROP_SETTER | JSPROP_ENUMERATE));
 
     CHECK(JS_DefineProperty(cx, vObject, PROPERTY_NAME,
                             JSVAL_VOID,
--- a/js/src/jsapi-tests/testDefineProperty.cpp
+++ b/js/src/jsapi-tests/testDefineProperty.cpp
@@ -5,20 +5,20 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 
 #include "tests.h"
 
 BEGIN_TEST(testDefineProperty_bug564344)
 {
-    JS::RootedValue x(cx);
+    js::RootedValue x(cx);
     EVAL("function f() {}\n"
          "var x = {p: f};\n"
          "x.p();  // brand x's scope\n"
          "x;", x.address());
 
-    JS::RootedObject obj(cx, JSVAL_TO_OBJECT(x));
+    js::RootedObject obj(cx, JSVAL_TO_OBJECT(x));
     for (int i = 0; i < 2; i++)
         CHECK(JS_DefineProperty(cx, obj, "q", JSVAL_VOID, NULL, NULL, JSPROP_SHARED));
     return true;
 }
 END_TEST(testDefineProperty_bug564344)
--- a/js/src/jsapi-tests/testErrorCopying.cpp
+++ b/js/src/jsapi-tests/testErrorCopying.cpp
@@ -21,15 +21,15 @@ my_ErrorReporter(JSContext *cx, const ch
 }
 
 BEGIN_TEST(testErrorCopying_columnCopied)
 {
         //0         1         2
         //0123456789012345678901234567
     EXEC("function check() { Object; foo; }");
 
-    JS::RootedValue rval(cx);
+    js::RootedValue rval(cx);
     JS_SetErrorReporter(cx, my_ErrorReporter);
     CHECK(!JS_CallFunctionName(cx, global, "check", 0, NULL, rval.address()));
     CHECK(column == 27);
     return true;
 }
 END_TEST(testErrorCopying_columnCopied)
--- a/js/src/jsapi-tests/testFunctionProperties.cpp
+++ b/js/src/jsapi-tests/testFunctionProperties.cpp
@@ -5,22 +5,22 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 
 #include "tests.h"
 
 BEGIN_TEST(testFunctionProperties)
 {
-    JS::RootedValue x(cx);
+    js::RootedValue x(cx);
     EVAL("(function f() {})", x.address());
 
-    JS::RootedObject obj(cx, JSVAL_TO_OBJECT(x));
+    js::RootedObject obj(cx, JSVAL_TO_OBJECT(x));
 
-    JS::RootedValue y(cx);
+    js::RootedValue y(cx);
     CHECK(JS_GetProperty(cx, obj, "arguments", y.address()));
     CHECK_SAME(y, JSVAL_NULL);
 
     CHECK(JS_GetProperty(cx, obj, "caller", y.address()));
     CHECK_SAME(y, JSVAL_NULL);
 
     return true;
 }
--- a/js/src/jsapi-tests/testGCOutOfMemory.cpp
+++ b/js/src/jsapi-tests/testGCOutOfMemory.cpp
@@ -16,17 +16,17 @@ ErrorCounter(JSContext *cx, const char *
 {
     ++errorCount;
 }
 
 BEGIN_TEST(testGCOutOfMemory)
 {
     JS_SetErrorReporter(cx, ErrorCounter);
 
-    JS::RootedValue root(cx);
+    js::RootedValue root(cx);
 
     static const char source[] =
         "var max = 0; (function() {"
         "    var array = [];"
         "    for (; ; ++max)"
         "        array.push({});"
         "    array = []; array.push(0);"
         "})();";
--- a/js/src/jsapi-tests/testGetPropertyDefault.cpp
+++ b/js/src/jsapi-tests/testGetPropertyDefault.cpp
@@ -21,17 +21,17 @@ stringToId(JSContext *cx, const char *s,
     return JS_ValueToId(cx, STRING_TO_JSVAL(str), idp);
 }
 
 BEGIN_TEST(testGetPropertyDefault_bug594060)
 {
     {
         // Check JS_GetPropertyDefault
 
-        JS::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL));
+        js::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL));
         CHECK(obj);
 
         jsval v0 = JSVAL_TRUE;
         CHECK(JS_SetProperty(cx, obj, "here", &v0));
 
         jsval v1;
         CHECK(JS_GetPropertyDefault(cx, obj, "here", JSVAL_FALSE, &v1));
         CHECK(JSVAL_IS_TRUE(v1));
@@ -39,17 +39,17 @@ BEGIN_TEST(testGetPropertyDefault_bug594
         jsval v2;
         CHECK(JS_GetPropertyDefault(cx, obj, "nothere", JSVAL_FALSE, &v2));
         CHECK(JSVAL_IS_FALSE(v2));
     }
 
     {
         // Check JS_GetPropertyByIdDefault
 
-        JS::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL));
+        js::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL));
         CHECK(obj);
 
         jsid hereid;
         CHECK(stringToId(cx, "here", &hereid));
 
         jsid nothereid;
         CHECK(stringToId(cx, "nothere", &nothereid));
 
--- a/js/src/jsapi-tests/testIntString.cpp
+++ b/js/src/jsapi-tests/testIntString.cpp
@@ -6,17 +6,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 
 #include "tests.h"
 #include "vm/String.h"
 
 BEGIN_TEST(testIntString_bug515273)
 {
-    JS::RootedValue v(cx);
+    js::RootedValue v(cx);
 
     EVAL("'1';", v.address());
     JSString *str = JSVAL_TO_STRING(v);
     CHECK(JS_StringHasBeenInterned(cx, str));
     CHECK(JS_FlatStringEqualsAscii(JS_ASSERT_STRING_IS_FLAT(str), "1"));
 
     EVAL("'42';", v.address());
     str = JSVAL_TO_STRING(v);
--- a/js/src/jsapi-tests/testJSEvaluateScript.cpp
+++ b/js/src/jsapi-tests/testJSEvaluateScript.cpp
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=8 sw=4 et tw=99:
  */
 
 #include "tests.h"
 
 BEGIN_TEST(testJSEvaluateScript)
 {
-    JS::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, global));
+    js::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, global));
     CHECK(obj);
 
     uint32_t options = JS_GetOptions(cx);
     CHECK(options & JSOPTION_VAROBJFIX);
 
     static const char src[] = "var x = 5;";
 
     JS::Value retval;
--- a/js/src/jsapi-tests/testLookup.cpp
+++ b/js/src/jsapi-tests/testLookup.cpp
@@ -9,45 +9,45 @@
 #include "tests.h"
 #include "jsfun.h"  // for js::IsInternalFunctionObject
 
 #include "jsobjinlines.h"
 
 BEGIN_TEST(testLookup_bug522590)
 {
     // Define a function that makes method-bearing objects.
-    JS::RootedValue x(cx);
+    js::RootedValue x(cx);
     EXEC("function mkobj() { return {f: function () {return 2;}} }");
 
     // Calling mkobj() multiple times must create multiple functions in ES5.
     EVAL("mkobj().f !== mkobj().f", x.address());
     CHECK_SAME(x, JSVAL_TRUE);
 
     // Now make x.f a method.
     EVAL("mkobj()", x.address());
-    JS::RootedObject xobj(cx, JSVAL_TO_OBJECT(x));
+    js::RootedObject xobj(cx, JSVAL_TO_OBJECT(x));
 
     // This lookup must not return an internal function object.
-    JS::RootedValue r(cx);
+    js::RootedValue r(cx);
     CHECK(JS_LookupProperty(cx, xobj, "f", r.address()));
     CHECK(r.isObject());
     JSObject *funobj = &r.toObject();
     CHECK(funobj->isFunction());
     CHECK(!js::IsInternalFunctionObject(funobj));
 
     return true;
 }
 END_TEST(testLookup_bug522590)
 
 JSBool
 document_resolve(JSContext *cx, JSHandleObject obj, JSHandleId id, unsigned flags,
                  JSMutableHandleObject objp)
 {
     // If id is "all", and we're not detecting, resolve document.all=true.
-    JS::RootedValue v(cx);
+    js::RootedValue v(cx);
     if (!JS_IdToValue(cx, id, v.address()))
         return false;
     if (JSVAL_IS_STRING(v)) {
         JSString *str = JSVAL_TO_STRING(v);
         JSFlatString *flatStr = JS_FlattenString(cx, str);
         if (!flatStr)
             return false;
         if (JS_FlatStringEqualsAscii(flatStr, "all") && !(flags & JSRESOLVE_DETECTING)) {
@@ -63,19 +63,19 @@ document_resolve(JSContext *cx, JSHandle
 static JSClass document_class = {
     "document", JSCLASS_NEW_RESOLVE,
     JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
     JS_EnumerateStub, (JSResolveOp) document_resolve, JS_ConvertStub
 };
 
 BEGIN_TEST(testLookup_bug570195)
 {
-    JS::RootedObject obj(cx, JS_NewObject(cx, &document_class, NULL, NULL));
+    js::RootedObject obj(cx, JS_NewObject(cx, &document_class, NULL, NULL));
     CHECK(obj);
     CHECK(JS_DefineProperty(cx, global, "document", OBJECT_TO_JSVAL(obj), NULL, NULL, 0));
-    JS::RootedValue v(cx);
+    js::RootedValue v(cx);
     EVAL("document.all ? true : false", v.address());
     CHECK_SAME(v, JSVAL_FALSE);
     EVAL("document.hasOwnProperty('all')", v.address());
     CHECK_SAME(v, JSVAL_FALSE);
     return true;
 }
 END_TEST(testLookup_bug570195)
--- a/js/src/jsapi-tests/testNewObject.cpp
+++ b/js/src/jsapi-tests/testNewObject.cpp
@@ -12,17 +12,17 @@
 
 const size_t N = 1000;
 static jsval argv[N];
 
 static JSBool
 constructHook(JSContext *cx, unsigned argc, jsval *vp)
 {
     // Check that arguments were passed properly from JS_New.
-    JS::RootedObject callee(cx, JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)));
+    js::RootedObject callee(cx, JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)));
 
     JSObject *obj = JS_NewObjectForConstructor(cx, js::Jsvalify(&js::ObjectClass), vp);
     if (!obj) {
         JS_ReportError(cx, "test failed, could not construct object");
         return false;
     }
     if (strcmp(JS_GetClass(obj)->name, "Object") != 0) {
         JS_ReportError(cx, "test failed, wrong class for 'this'");
@@ -52,24 +52,24 @@ constructHook(JSContext *cx, unsigned ar
 
 BEGIN_TEST(testNewObject_1)
 {
     // Root the global argv test array. Only the first 2 entries really need to
     // be rooted, since we're only putting integers in the rest.
     CHECK(JS_AddNamedValueRoot(cx, &argv[0], "argv0"));
     CHECK(JS_AddNamedValueRoot(cx, &argv[1], "argv1"));
 
-    JS::RootedValue v(cx);
+    js::RootedValue v(cx);
     EVAL("Array", v.address());
-    JS::RootedObject Array(cx, JSVAL_TO_OBJECT(v));
+    js::RootedObject Array(cx, JSVAL_TO_OBJECT(v));
 
     // With no arguments.
-    JS::RootedObject obj(cx, JS_New(cx, Array, 0, NULL));
+    js::RootedObject obj(cx, JS_New(cx, Array, 0, NULL));
     CHECK(obj);
-    JS::RootedValue rt(cx, OBJECT_TO_JSVAL(obj));
+    js::RootedValue rt(cx, OBJECT_TO_JSVAL(obj));
     CHECK(JS_IsArrayObject(cx, obj));
     uint32_t len;
     CHECK(JS_GetArrayLength(cx, obj, &len));
     CHECK_EQUAL(len, 0);
 
     // With one argument.
     argv[0] = INT_TO_JSVAL(4);
     obj = JS_New(cx, Array, 1, argv);
@@ -94,19 +94,19 @@ BEGIN_TEST(testNewObject_1)
     // With JSClass.construct.
     static JSClass cls = {
         "testNewObject_1",
         0,
         JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
         JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL,
         NULL, NULL, NULL, constructHook
     };
-    JS::RootedObject ctor(cx, JS_NewObject(cx, &cls, NULL, NULL));
+    js::RootedObject ctor(cx, JS_NewObject(cx, &cls, NULL, NULL));
     CHECK(ctor);
-    JS::RootedValue rt2(cx, OBJECT_TO_JSVAL(ctor));
+    js::RootedValue rt2(cx, OBJECT_TO_JSVAL(ctor));
     obj = JS_New(cx, ctor, 3, argv);
     CHECK(obj);
     CHECK(JS_GetElement(cx, ctor, 0, v.address()));
     CHECK_SAME(v, JSVAL_ZERO);
 
     JS_RemoveValueRoot(cx, &argv[0]);
     JS_RemoveValueRoot(cx, &argv[1]);
 
--- a/js/src/jsapi-tests/testOps.cpp
+++ b/js/src/jsapi-tests/testOps.cpp
@@ -50,16 +50,16 @@ static JSFunctionSpec s_functions[] =
 
 BEGIN_TEST(testOps_bug559006)
 {
     CHECK(JS_DefineFunctions(cx, global, s_functions));
 
     EXEC("function main() { while(1) return 0 + createMyObject(); }");
 
     for (int i = 0; i < 9; i++) {
-        JS::RootedValue rval(cx);
+        js::RootedValue rval(cx);
         CHECK(JS_CallFunctionName(cx, global, "main", 0, NULL, rval.address()));
         CHECK_SAME(rval, INT_TO_JSVAL(123));
     }
     return true;
 }
 END_TEST(testOps_bug559006)
 
--- a/js/src/jsapi-tests/testOriginPrincipals.cpp
+++ b/js/src/jsapi-tests/testOriginPrincipals.cpp
@@ -56,17 +56,17 @@ bool
 eval(const char *asciiChars, JSPrincipals *principals, JSPrincipals *originPrincipals, jsval *rval)
 {
     size_t len = strlen(asciiChars);
     jschar *chars = new jschar[len+1];
     for (size_t i = 0; i < len; ++i)
         chars[i] = asciiChars[i];
     chars[len] = 0;
 
-    JS::RootedObject global(cx, JS_NewGlobalObject(cx, getGlobalClass(), principals));
+    js::RootedObject global(cx, JS_NewGlobalObject(cx, getGlobalClass(), principals));
     CHECK(global);
     JSAutoCompartment ac(cx, global);
     CHECK(JS_InitStandardClasses(cx, global));
     bool ok = JS_EvaluateUCScriptForPrincipalsVersionOrigin(cx, global,
                                                             principals,
                                                             originPrincipals,
                                                             chars, len, "", 0, rval,
                                                             JSVERSION_DEFAULT);
--- a/js/src/jsapi-tests/testParseJSON.cpp
+++ b/js/src/jsapi-tests/testParseJSON.cpp
@@ -52,17 +52,17 @@ BEGIN_TEST(testParseJSON_success)
     CHECK(TryParse(cx, "0", INT_TO_JSVAL(0)));
     CHECK(TryParse(cx, "1", INT_TO_JSVAL(1)));
     CHECK(TryParse(cx, "-1", INT_TO_JSVAL(-1)));
     CHECK(TryParse(cx, "1", DOUBLE_TO_JSVAL(1)));
     CHECK(TryParse(cx, "1.75", DOUBLE_TO_JSVAL(1.75)));
     CHECK(TryParse(cx, "9e9", DOUBLE_TO_JSVAL(9e9)));
     CHECK(TryParse(cx, "9e99999", DOUBLE_TO_JSVAL(std::numeric_limits<double>::infinity())));
 
-    JS::Rooted<JSFlatString*> str(cx);
+    js::Rooted<JSFlatString*> str(cx);
 
     const jschar emptystr[] = { '\0' };
     str = js_NewStringCopyN(cx, emptystr, 0);
     CHECK(str);
     CHECK(TryParse(cx, "\"\"", STRING_TO_JSVAL(str)));
 
     const jschar nullstr[] = { '\0' };
     str = NewString(cx, nullstr);
@@ -78,18 +78,18 @@ BEGIN_TEST(testParseJSON_success)
     const jschar newlinestr[] = { '\n', };
     str = NewString(cx, newlinestr);
     CHECK(str);
     CHECK(TryParse(cx, "\"\\n\"", STRING_TO_JSVAL(str)));
     CHECK(TryParse(cx, "\"\\u000A\"", STRING_TO_JSVAL(str)));
 
 
     // Arrays
-    JS::RootedValue v(cx), v2(cx);
-    JS::RootedObject obj(cx);
+    js::RootedValue v(cx), v2(cx);
+    js::RootedObject obj(cx);
 
     CHECK(Parse(cx, "[]", v.address()));
     CHECK(!JSVAL_IS_PRIMITIVE(v));
     obj = JSVAL_TO_OBJECT(v);
     CHECK(JS_IsArrayObject(cx, obj));
     CHECK(JS_GetProperty(cx, obj, "length", v2.address()));
     CHECK_SAME(v2, JSVAL_ZERO);
 
@@ -127,17 +127,17 @@ Parse(JSContext *cx, const char (&input)
     CHECK(JS_ParseJSON(cx, str.chars(), str.length(), vp));
     return true;
 }
 
 template<size_t N> inline bool
 TryParse(JSContext *cx, const char (&input)[N], const jsval &expectedArg)
 {
     AutoInflatedString str(cx);
-    JS::RootedValue expected(cx, expectedArg);
+    js::RootedValue expected(cx, expectedArg);
     jsval v;
     str = input;
     CHECK(JS_ParseJSON(cx, str.chars(), str.length(), &v));
     CHECK_SAME(v, expected);
     return true;
 }
 END_TEST(testParseJSON_success)
 
@@ -210,32 +210,32 @@ Censor(JSContext *cx, unsigned argc, jsv
     return true;
 }
 
 BEGIN_TEST(testParseJSON_reviver)
 {
     JSFunction *fun = JS_NewFunction(cx, Censor, 0, 0, global, "censor");
     CHECK(fun);
 
-    JS::RootedValue filter(cx, OBJECT_TO_JSVAL(JS_GetFunctionObject(fun)));
+    js::RootedValue filter(cx, OBJECT_TO_JSVAL(JS_GetFunctionObject(fun)));
 
     CHECK(TryParse(cx, "true", filter));
     CHECK(TryParse(cx, "false", filter));
     CHECK(TryParse(cx, "null", filter));
     CHECK(TryParse(cx, "1", filter));
     CHECK(TryParse(cx, "1.75", filter));
     CHECK(TryParse(cx, "[]", filter));
     CHECK(TryParse(cx, "[1]", filter));
     CHECK(TryParse(cx, "{}", filter));
     return true;
 }
 
 template<size_t N> inline bool
 TryParse(JSContext *cx, const char (&input)[N], JS::HandleValue filter)
 {
     AutoInflatedString str(cx);
-    JS::RootedValue v(cx);
+    js::RootedValue v(cx);
     str = input;
     CHECK(JS_ParseJSONWithReviver(cx, str.chars(), str.length(), filter, v.address()));
     CHECK_SAME(v, JSVAL_NULL);
     return true;
 }
 END_TEST(testParseJSON_reviver)
--- a/js/src/jsapi-tests/testProfileStrings.cpp
+++ b/js/src/jsapi-tests/testProfileStrings.cpp
@@ -37,17 +37,17 @@ test_fn(JSContext *cx, unsigned argc, js
     max_stack = psize;
     return JS_TRUE;
 }
 
 static JSBool
 test_fn2(JSContext *cx, unsigned argc, jsval *vp)
 {
     jsval r;
-    JS::RootedObject global(cx, JS_GetGlobalObject(cx));
+    js::RootedObject global(cx, JS_GetGlobalObject(cx));
     return JS_CallFunctionName(cx, global, "d", 0, NULL, &r);
 }
 
 static JSBool
 enable(JSContext *cx, unsigned argc, jsval *vp)
 {
     js::EnableRuntimeProfilingStack(cx->runtime, true);
     return JS_TRUE;
@@ -77,17 +77,17 @@ static JSFunctionSpec ptestFunctions[] =
     JS_FS("disable", disable, 0, 0),
     JS_FS_END
 };
 
 static JSObject*
 initialize(JSContext *cx)
 {
     js::SetRuntimeProfilingStack(cx->runtime, pstack, &psize, 10);
-    JS::RootedObject global(cx, JS_GetGlobalObject(cx));
+    js::RootedObject global(cx, JS_GetGlobalObject(cx));
     return JS_InitClass(cx, global, NULL, &ptestClass, Prof, 0,
                         NULL, ptestFunctions, NULL, NULL);
 }
 
 BEGIN_TEST(testProfileStrings_isCalledWithInterpreter)
 {
     CHECK(initialize(cx));
 
@@ -98,42 +98,42 @@ BEGIN_TEST(testProfileStrings_isCalledWi
     EXEC("function c() { d(); }");
     EXEC("function b() { c(); }");
     EXEC("function a() { b(); }");
     EXEC("function check() { var p = new Prof(); p.test_fn(); a(); }");
     EXEC("function check2() { var p = new Prof(); p.test_fn2(); }");
 
     reset(cx);
     {
-        JS::RootedValue rval(cx);
+        js::RootedValue rval(cx);
         /* Make sure the stack resets and we have an entry for each stack */
         CHECK(JS_CallFunctionName(cx, global, "check", 0, NULL, rval.address()));
         CHECK(psize == 0);
         CHECK(max_stack >= 8);
         CHECK(cx->runtime->spsProfiler.stringsCount() == 8);
         /* Make sure the stack resets and we added no new entries */
         max_stack = 0;
         CHECK(JS_CallFunctionName(cx, global, "check", 0, NULL, rval.address()));
         CHECK(psize == 0);
         CHECK(max_stack >= 8);
         CHECK(cx->runtime->spsProfiler.stringsCount() == 8);
     }
     reset(cx);
     {
-        JS::RootedValue rval(cx);
+        js::RootedValue rval(cx);
         CHECK(JS_CallFunctionName(cx, global, "check2", 0, NULL, rval.address()));
         CHECK(cx->runtime->spsProfiler.stringsCount() == 5);
         CHECK(max_stack >= 6);
         CHECK(psize == 0);
     }
     js::EnableRuntimeProfilingStack(cx->runtime, false);
     js::SetRuntimeProfilingStack(cx->runtime, pstack, &psize, 3);
     reset(cx);
     {
-        JS::RootedValue rval(cx);
+        js::RootedValue rval(cx);
         pstack[3].setLabel((char*) 1234);
         CHECK(JS_CallFunctionName(cx, global, "check", 0, NULL, rval.address()));
         CHECK((size_t) pstack[3].label() == 1234);
         CHECK(max_stack >= 8);
         CHECK(psize == 0);
     }
     return true;
 }
@@ -152,17 +152,17 @@ BEGIN_TEST(testProfileStrings_isCalledWi
     EXEC("function c() { d(); }");
     EXEC("function b() { c(); }");
     EXEC("function a() { b(); }");
     EXEC("function check() { var p = new Prof(); p.test_fn(); a(); }");
     EXEC("function check2() { var p = new Prof(); p.test_fn2(); }");
 
     reset(cx);
     {
-        JS::RootedValue rval(cx);
+        js::RootedValue rval(cx);
         /* Make sure the stack resets and we have an entry for each stack */
         CHECK(JS_CallFunctionName(cx, global, "check", 0, NULL, rval.address()));
         CHECK(psize == 0);
         CHECK(max_stack >= 8);
 
         /* Make sure the stack resets and we added no new entries */
         uint32_t cnt = cx->runtime->spsProfiler.stringsCount();
         max_stack = 0;
@@ -172,17 +172,17 @@ BEGIN_TEST(testProfileStrings_isCalledWi
         CHECK(max_stack >= 8);
     }
 
     js::EnableRuntimeProfilingStack(cx->runtime, false);
     js::SetRuntimeProfilingStack(cx->runtime, pstack, &psize, 3);
     reset(cx);
     {
         /* Limit the size of the stack and make sure we don't overflow */
-        JS::RootedValue rval(cx);
+        js::RootedValue rval(cx);
         pstack[3].setLabel((char*) 1234);
         CHECK(JS_CallFunctionName(cx, global, "check", 0, NULL, rval.address()));
         CHECK(psize == 0);
         CHECK(max_stack >= 8);
         CHECK((size_t) pstack[3].label() == 1234);
     }
     return true;
 }
@@ -192,17 +192,17 @@ BEGIN_TEST(testProfileStrings_isCalledWh
 {
     CHECK(initialize(cx));
     JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_METHODJIT | JSOPTION_METHODJIT_ALWAYS);
 
     EXEC("function check2() { throw 'a'; }");
 
     reset(cx);
     {
-        JS::RootedValue rval(cx);
+        js::RootedValue rval(cx);
         /* Make sure the stack resets and we have an entry for each stack */
         JS_CallFunctionName(cx, global, "check2", 0, NULL, rval.address());
         CHECK(psize == 0);
         CHECK(cx->runtime->spsProfiler.stringsCount() == 1);
     }
     return true;
 }
 END_TEST(testProfileStrings_isCalledWhenError)
@@ -213,50 +213,50 @@ BEGIN_TEST(testProfileStrings_worksWhenE
     JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_METHODJIT | JSOPTION_METHODJIT_ALWAYS);
 
     EXEC("function b(p) { p.test_fn(); }");
     EXEC("function a() { var p = new Prof(); p.enable(); b(p); }");
     reset(cx);
     js::EnableRuntimeProfilingStack(cx->runtime, false);
     {
         /* enable it in the middle of JS and make sure things check out */
-        JS::RootedValue rval(cx);
+        js::RootedValue rval(cx);
         JS_CallFunctionName(cx, global, "a", 0, NULL, rval.address());
         CHECK(psize == 0);
         CHECK(max_stack >= 1);
         CHECK(cx->runtime->spsProfiler.stringsCount() == 1);
     }
 
     EXEC("function d(p) { p.disable(); }");
     EXEC("function c() { var p = new Prof(); d(p); }");
     reset(cx);
     {
         /* now disable in the middle of js */
-        JS::RootedValue rval(cx);
+        js::RootedValue rval(cx);
         JS_CallFunctionName(cx, global, "c", 0, NULL, rval.address());
         CHECK(psize == 0);
     }
 
     EXEC("function e() { var p = new Prof(); d(p); p.enable(); b(p); }");
     reset(cx);
     {
         /* now disable in the middle of js, but re-enable before final exit */
-        JS::RootedValue rval(cx);
+        js::RootedValue rval(cx);
         JS_CallFunctionName(cx, global, "e", 0, NULL, rval.address());
         CHECK(psize == 0);
         CHECK(max_stack >= 3);
     }
 
     EXEC("function h() { }");
     EXEC("function g(p) { p.disable(); for (var i = 0; i < 100; i++) i++; }");
     EXEC("function f() { g(new Prof()); }");
     reset(cx);
     cx->runtime->spsProfiler.enableSlowAssertions(false);
     {
-        JS::RootedValue rval(cx);
+        js::RootedValue rval(cx);
         /* disable, and make sure that if we try to re-enter the JIT the pop
          * will still happen */
         JS_CallFunctionName(cx, global, "f", 0, NULL, rval.address());
         CHECK(psize == 0);
     }
     return true;
 }
 END_TEST(testProfileStrings_worksWhenEnabledOnTheFly)
--- a/js/src/jsapi-tests/testRegExp.cpp
+++ b/js/src/jsapi-tests/testRegExp.cpp
@@ -1,34 +1,34 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "tests.h"
 
 BEGIN_TEST(testObjectIsRegExp)
 {
-    JS::RootedValue val(cx);
+    js::RootedValue val(cx);
 
     EVAL("new Object", val.address());
-    JS::RootedObject obj(cx, JSVAL_TO_OBJECT(val));
+    js::RootedObject obj(cx, JSVAL_TO_OBJECT(val));
     CHECK(!JS_ObjectIsRegExp(cx, obj));
 
     EVAL("/foopy/", val.address());
     obj = JSVAL_TO_OBJECT(val);
     CHECK(JS_ObjectIsRegExp(cx, obj));
 
     return true;
 }
 END_TEST(testObjectIsRegExp)
 
 BEGIN_TEST(testGetRegExpFlags)
 {
-    JS::RootedValue val(cx);
-    JS::RootedObject obj(cx);
+    js::RootedValue val(cx);
+    js::RootedObject obj(cx);
 
     EVAL("/foopy/", val.address());
     obj = JSVAL_TO_OBJECT(val);
     CHECK_EQUAL(JS_GetRegExpFlags(cx, obj), 0);
 
     EVAL("/foopy/g", val.address());
     obj = JSVAL_TO_OBJECT(val);
     CHECK_EQUAL(JS_GetRegExpFlags(cx, obj), JSREG_GLOB);
@@ -38,18 +38,18 @@ BEGIN_TEST(testGetRegExpFlags)
     CHECK_EQUAL(JS_GetRegExpFlags(cx, obj), (JSREG_FOLD | JSREG_GLOB));
 
     return true;
 }
 END_TEST(testGetRegExpFlags)
 
 BEGIN_TEST(testGetRegExpSource)
 {
-    JS::RootedValue val(cx);
-    JS::RootedObject obj(cx);
+    js::RootedValue val(cx);
+    js::RootedObject obj(cx);
 
     EVAL("/foopy/", val.address());
     obj = JSVAL_TO_OBJECT(val);
     JSString *source = JS_GetRegExpSource(cx, obj);
     CHECK(JS_FlatStringEqualsAscii(JS_ASSERT_STRING_IS_FLAT(source), "foopy"));
 
     return true;
 }
--- a/js/src/jsapi-tests/testScriptObject.cpp
+++ b/js/src/jsapi-tests/testScriptObject.cpp
@@ -16,17 +16,17 @@ struct ScriptObjectFixture : public JSAP
     ScriptObjectFixture()
     {
         for (int i = 0; i < code_size; i++)
             uc_code[i] = code[i];
     }
 
     bool tryScript(JS::HandleObject global, JSScript *scriptArg)
     {
-        JS::RootedScript script(cx, scriptArg);
+        js::RootedScript script(cx, scriptArg);
         CHECK(script);
 
         JS_GC(rt);
 
         /* After a garbage collection, the script should still work. */
         jsval result;
         CHECK(JS_ExecuteScript(cx, global, script, &result));
 
--- a/js/src/jsapi-tests/testSetProperty.cpp
+++ b/js/src/jsapi-tests/testSetProperty.cpp
@@ -12,19 +12,19 @@ static JSBool
 nativeGet(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandleValue vp)
 {
     vp.set(INT_TO_JSVAL(17));
     return JS_TRUE;
 }
 
 BEGIN_TEST(testSetProperty_NativeGetterStubSetter)
 {
-    JS::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL));
+    js::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL));
     CHECK(obj);
-    JS::RootedValue vobj(cx, OBJECT_TO_JSVAL(obj));
+    js::RootedValue vobj(cx, OBJECT_TO_JSVAL(obj));
 
     CHECK(JS_DefineProperty(cx, global, "globalProp", vobj,
                             JS_PropertyStub, JS_StrictPropertyStub,
                             JSPROP_ENUMERATE));
 
     CHECK(JS_DefineProperty(cx, obj, "prop", JSVAL_VOID,
                             nativeGet, JS_StrictPropertyStub,
                             JSPROP_SHARED));
--- a/js/src/jsapi-tests/testTrap.cpp
+++ b/js/src/jsapi-tests/testTrap.cpp
@@ -29,33 +29,33 @@ BEGIN_TEST(testTrap_gc)
 "while (i < 10) {\n"
 "    sum += i;\n"
 "    ++i;\n"
 "}\n"
 "({ result: sum });\n"
         ;
 
     // compile
-    JS::RootedScript script(cx, JS_CompileScript(cx, global, source, strlen(source), __FILE__, 1));
+    js::RootedScript script(cx, JS_CompileScript(cx, global, source, strlen(source), __FILE__, 1));
     CHECK(script);
 
     // execute
-    JS::RootedValue v2(cx);
+    js::RootedValue v2(cx);
     CHECK(JS_ExecuteScript(cx, global, script, v2.address()));
     CHECK(v2.isObject());
     CHECK_EQUAL(emptyTrapCallCount, 0);
 
     // Enable debug mode
     CHECK(JS_SetDebugMode(cx, JS_TRUE));
 
     static const char trapClosureText[] = "some trap closure";
 
     // scope JSScript  usage to make sure that it is not used after
     // JS_ExecuteScript. This way we avoid using Anchor.
-    JS::RootedString trapClosure(cx);
+    js::RootedString trapClosure(cx);
     {
         jsbytecode *line2 = JS_LineNumberToPC(cx, script, 1);
         CHECK(line2);
 
         jsbytecode *line6 = JS_LineNumberToPC(cx, script, 5);
         CHECK(line2);
 
         trapClosure = JS_NewStringCopyZ(cx, trapClosureText);
--- a/js/src/jsapi-tests/testValueABI.cpp
+++ b/js/src/jsapi-tests/testValueABI.cpp
@@ -24,17 +24,17 @@ C_GetEmptyStringValue(JSContext *cx);
 
 extern size_t
 C_jsvalAlignmentTest();
 
 }
 
 BEGIN_TEST(testValueABI_retparam)
 {
-    JS::RootedObject obj(cx, JS_GetGlobalObject(cx));
+    js::RootedObject obj(cx, JS_GetGlobalObject(cx));
     jsval v = OBJECT_TO_JSVAL(obj);
     obj = NULL;
     CHECK(C_ValueToObject(cx, v, obj.address()));
     JSBool equal;
     CHECK(JS_StrictlyEqual(cx, v, OBJECT_TO_JSVAL(obj), &equal));
     CHECK(equal);
 
     v = C_GetEmptyStringValue(cx);
--- a/js/src/jsapi-tests/testVersion.cpp
+++ b/js/src/jsapi-tests/testVersion.cpp
@@ -34,30 +34,30 @@ struct VersionFixture : public JSAPITest
     JSVersion captured;
 
     virtual bool init() {
         if (!JSAPITest::init())
             return false;
         JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_ALLOW_XML);
         callbackData = this;
         captured = JSVERSION_UNKNOWN;
-        JS::RootedObject global(cx, JS_GetGlobalObject(cx));
+        js::RootedObject global(cx, JS_GetGlobalObject(cx));
         return JS_DefineFunction(cx, global, "checkVersionHasMoarXML", CheckVersionHasMoarXML, 0, 0) &&
                JS_DefineFunction(cx, global, "disableMoarXMLOption", DisableMoarXMLOption, 0, 0) &&
                JS_DefineFunction(cx, global, "callSetVersion17", CallSetVersion17, 0, 0) &&
                JS_DefineFunction(cx, global, "checkNewScriptNoXML", CheckNewScriptNoXML, 0, 0) &&
                JS_DefineFunction(cx, global, "overrideVersion15", OverrideVersion15, 0, 0) &&
                JS_DefineFunction(cx, global, "captureVersion", CaptureVersion, 0, 0) &&
                JS_DefineFunction(cx, global, "checkOverride", CheckOverride, 1, 0) &&
                JS_DefineFunction(cx, global, "evalScriptVersion16",
                                  EvalScriptVersion16, 0, 0);
     }
 
     JSScript *fakeScript(const char *contents, size_t length) {
-        JS::RootedObject global(cx, JS_GetGlobalObject(cx));
+        js::RootedObject global(cx, JS_GetGlobalObject(cx));
         return JS_CompileScript(cx, global, contents, length, "<test>", 1);
     }
 
     bool hasMoarXML(unsigned version) {
         return VersionHasMoarXML(JSVersion(version));
     }
 
     bool hasMoarXML(JSScript *script) {
@@ -95,17 +95,17 @@ struct VersionFixture : public JSAPITest
         CHECK(JS_GetVersion(cx) != version);
         JS_SetVersion(cx, version);
         return true;
     }
 
     bool evalVersion(const jschar *chars, size_t len, JSVersion version) {
         CHECK(JS_GetVersion(cx) != version);
         jsval rval;
-        JS::RootedObject global(cx, JS_GetGlobalObject(cx));
+        js::RootedObject global(cx, JS_GetGlobalObject(cx));
         CHECK(JS_EvaluateUCScriptForPrincipalsVersion(
                 cx, global, NULL, chars, len, "<test>", 0, &rval, version));
         return true;
     }
 
     bool toggleMoarXML(bool shouldEnable) {
         CHECK_EQUAL(hasMoarXML(), !shouldEnable);
         JS_ToggleOptions(cx, JSOPTION_MOAR_XML);
--- a/js/src/jsapi-tests/testXDR.cpp
+++ b/js/src/jsapi-tests/testXDR.cpp
@@ -129,17 +129,17 @@ enum TestCase {
 };
 
 JSScript *createScriptViaXDR(JSPrincipals *prin, JSPrincipals *orig, int testCase)
 {
     const char src[] =
         "function f() { return 1; }\n"
         "f;\n";
 
-    JS::RootedObject global(cx, JS_GetGlobalObject(cx));
+    js::RootedObject global(cx, JS_GetGlobalObject(cx));
     JSScript *script = CompileScriptForPrincipalsVersionOrigin(cx, global, prin, orig,
                                                                src, strlen(src), "test", 1,
                                                                JSVERSION_DEFAULT);
     if (!script)
         return NULL;
 
     if (testCase == TEST_SCRIPT || testCase == TEST_SERIALIZED_FUNCTION) {
         script = FreezeThaw(cx, script);
@@ -148,17 +148,17 @@ JSScript *createScriptViaXDR(JSPrincipal
         if (testCase == TEST_SCRIPT)
             return script;
     }
 
     JS::Value v;
     JSBool ok = JS_ExecuteScript(cx, global, script, &v);
     if (!ok || !v.isObject())
         return NULL;
-    JS::RootedObject funobj(cx, &v.toObject());
+    js::RootedObject funobj(cx, &v.toObject());
     if (testCase == TEST_FUNCTION) {
         funobj = FreezeThaw(cx, funobj);
         if (!funobj)
             return NULL;
     }
     return GetScript(cx, funobj);
 }
 
@@ -180,17 +180,17 @@ BEGIN_TEST(testXDR_atline)
     CHECK(script = FreezeThaw(cx, script));
     CHECK(!strcmp("bar", JS_GetScriptFilename(cx, script)));
 
     JS::Value v;
     JSBool ok = JS_ExecuteScript(cx, global, script, &v);
     CHECK(ok);
     CHECK(v.isObject());
 
-    JS::RootedObject funobj(cx, &v.toObject());
+    js::RootedObject funobj(cx, &v.toObject());
     script = JS_GetFunctionScript(cx, JS_GetObjectFunction(funobj));
     CHECK(!strcmp("foo", JS_GetScriptFilename(cx, script)));
 
     return true;
 }
 
 END_TEST(testXDR_atline)
 
@@ -207,25 +207,25 @@ BEGIN_TEST(testXDR_bug506491)
     // compile
     JSScript *script = JS_CompileScript(cx, global, s, strlen(s), __FILE__, __LINE__);
     CHECK(script);
 
     script = FreezeThaw(cx, script);
     CHECK(script);
 
     // execute
-    JS::RootedValue v2(cx);
+    js::RootedValue v2(cx);
     CHECK(JS_ExecuteScript(cx, global, script, v2.address()));
 
     // try to break the Block object that is the parent of f
     JS_GC(rt);
 
     // confirm
     EVAL("f() === 'ok';\n", v2.address());
-    JS::RootedValue trueval(cx, JSVAL_TRUE);
+    js::RootedValue trueval(cx, JSVAL_TRUE);
     CHECK_SAME(v2, trueval);
     return true;
 }
 END_TEST(testXDR_bug506491)
 
 BEGIN_TEST(testXDR_bug516827)
 {
     // compile an empty script
--- a/js/src/jsapi-tests/tests.cpp
+++ b/js/src/jsapi-tests/tests.cpp
@@ -19,26 +19,26 @@ bool JSAPITest::init()
         return false;
     cx = createContext();
     if (!cx)
         return false;
 #ifdef JS_GC_ZEAL
     JS_SetGCZeal(cx, 0, 0);
 #endif
     JS_BeginRequest(cx);
-    JS::RootedObject global(cx, createGlobal());
+    js::RootedObject global(cx, createGlobal());
     if (!global)
         return false;
     oldCompartment = JS_EnterCompartment(cx, global);
     return oldCompartment != NULL;
 }
 
 bool JSAPITest::exec(const char *bytes, const char *filename, int lineno)
 {
-    JS::RootedValue v(cx);
+    js::RootedValue v(cx);
     JS::HandleObject global = JS::HandleObject::fromMarkedLocation(&this->global);
     return JS_EvaluateScript(cx, global, bytes, strlen(bytes), filename, lineno, v.address()) ||
         fail(bytes, filename, lineno);
 }
 
 bool JSAPITest::evaluate(const char *bytes, const char *filename, int lineno, jsval *vp)
 {
     JS::HandleObject global = JS::HandleObject::fromMarkedLocation(&this->global);
--- a/js/src/jsapi-tests/tests.h
+++ b/js/src/jsapi-tests/tests.h
@@ -198,17 +198,17 @@ class JSAPITest
 #define CHECK(expr) \
     do { \
         if (!(expr)) \
             return fail("CHECK failed: " #expr, __FILE__, __LINE__); \
     } while (false)
 
     bool fail(JSAPITestString msg = JSAPITestString(), const char *filename = "-", int lineno = 0) {
         if (JS_IsExceptionPending(cx)) {
-            JS::RootedValue v(cx);
+            js::RootedValue v(cx);
             JS_GetPendingException(cx, v.address());
             JS_ClearPendingException(cx);
             JSString *s = JS_ValueToString(cx, v);
             if (s) {
                 JSAutoByteString bytes(cx, s);
                 if (!!bytes)
                     msg += bytes.ptr();
             }
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -812,45 +812,49 @@ PrivateUint32Value(uint32_t ui)
 }
 
 JS_ALWAYS_INLINE bool
 SameType(const Value &lhs, const Value &rhs)
 {
     return JSVAL_SAME_TYPE_IMPL(lhs.data, rhs.data);
 }
 
+} /* namespace JS */
+
 /************************************************************************/
 
-template <> struct RootMethods<const Value>
+namespace js {
+
+template <> struct RootMethods<const JS::Value>
 {
-    static Value initial() { return UndefinedValue(); }
+    static JS::Value initial() { return UndefinedValue(); }
     static ThingRootKind kind() { return THING_ROOT_VALUE; }
-    static bool poisoned(const Value &v) { return IsPoisonedValue(v); }
+    static bool poisoned(const JS::Value &v) { return IsPoisonedValue(v); }
 };
 
-template <> struct RootMethods<Value>
+template <> struct RootMethods<JS::Value>
 {
-    static Value initial() { return UndefinedValue(); }
+    static JS::Value initial() { return UndefinedValue(); }
     static ThingRootKind kind() { return THING_ROOT_VALUE; }
-    static bool poisoned(const Value &v) { return IsPoisonedValue(v); }
+    static bool poisoned(const JS::Value &v) { return IsPoisonedValue(v); }
 };
 
 template <class Outer> class MutableValueOperations;
 
 /*
  * A class designed for CRTP use in implementing the non-mutating parts of the
  * Value interface in Value-like classes.  Outer must be a class inheriting
  * ValueOperations<Outer> with a visible extract() method returning the
  * const Value* abstracted by Outer.
  */
 template <class Outer>
 class ValueOperations
 {
     friend class MutableValueOperations<Outer>;
-    const Value * value() const { return static_cast<const Outer*>(this)->extract(); }
+    const JS::Value * value() const { return static_cast<const Outer*>(this)->extract(); }
 
   public:
     bool isUndefined() const { return value()->isUndefined(); }
     bool isNull() const { return value()->isNull(); }
     bool isBoolean() const { return value()->isBoolean(); }
     bool isTrue() const { return value()->isTrue(); }
     bool isFalse() const { return value()->isFalse(); }
     bool isNumber() const { return value()->isNumber(); }
@@ -885,17 +889,17 @@ class ValueOperations
  * A class designed for CRTP use in implementing the mutating parts of the
  * Value interface in Value-like classes.  Outer must be a class inheriting
  * MutableValueOperations<Outer> with visible extractMutable() and extract()
  * methods returning the const Value* and Value* abstracted by Outer.
  */
 template <class Outer>
 class MutableValueOperations : public ValueOperations<Outer>
 {
-    Value * value() { return static_cast<Outer*>(this)->extractMutable(); }
+    JS::Value * value() { return static_cast<Outer*>(this)->extractMutable(); }
 
   public:
     void setNull() { value()->setNull(); }
     void setUndefined() { value()->setUndefined(); }
     void setInt32(int32_t i) { value()->setInt32(i); }
     void setDouble(double d) { value()->setDouble(d); }
     void setString(JSString *str) { value()->setString(str); }
     void setString(const JS::Anchor<JSString *> &str) { value()->setString(str); }
@@ -907,62 +911,66 @@ class MutableValueOperations : public Va
     void setObjectOrNull(JSObject *arg) { value()->setObjectOrNull(arg); }
 };
 
 /*
  * Augment the generic Handle<T> interface when T = Value with type-querying
  * and value-extracting operations.
  */
 template <>
-class HandleBase<Value> : public ValueOperations<Handle<Value> >
+class HandleBase<JS::Value> : public ValueOperations<Handle<JS::Value> >
 {
-    friend class ValueOperations<Handle<Value> >;
-    const Value * extract() const {
-        return static_cast<const Handle<Value>*>(this)->address();
+    friend class ValueOperations<Handle<JS::Value> >;
+    const JS::Value * extract() const {
+        return static_cast<const Handle<JS::Value>*>(this)->address();
     }
 };
 
 /*
  * Augment the generic MutableHandle<T> interface when T = Value with
  * type-querying, value-extracting, and mutating operations.
  */
 template <>
-class MutableHandleBase<Value> : public MutableValueOperations<MutableHandle<Value> >
+class MutableHandleBase<JS::Value> : public MutableValueOperations<MutableHandle<JS::Value> >
 {
-    friend class ValueOperations<MutableHandle<Value> >;
-    const Value * extract() const {
-        return static_cast<const MutableHandle<Value>*>(this)->address();
+    friend class ValueOperations<MutableHandle<JS::Value> >;
+    const JS::Value * extract() const {
+        return static_cast<const MutableHandle<JS::Value>*>(this)->address();
     }
 
-    friend class MutableValueOperations<MutableHandle<Value> >;
-    Value * extractMutable() {
-        return static_cast<MutableHandle<Value>*>(this)->address();
+    friend class MutableValueOperations<MutableHandle<JS::Value> >;
+    JS::Value * extractMutable() {
+        return static_cast<MutableHandle<JS::Value>*>(this)->address();
     }
 };
 
 /*
  * Augment the generic Rooted<T> interface when T = Value with type-querying,
  * value-extracting, and mutating operations.
  */
 template <>
-class RootedBase<Value> : public MutableValueOperations<Rooted<Value> >
+class RootedBase<JS::Value> : public MutableValueOperations<Rooted<JS::Value> >
 {
-    friend class ValueOperations<Rooted<Value> >;
-    const Value * extract() const {
-        return static_cast<const Rooted<Value>*>(this)->address();
+    friend class ValueOperations<Rooted<JS::Value> >;
+    const JS::Value * extract() const {
+        return static_cast<const Rooted<JS::Value>*>(this)->address();
     }
 
-    friend class MutableValueOperations<Rooted<Value> >;
-    Value * extractMutable() {
-        return static_cast<Rooted<Value>*>(this)->address();
+    friend class MutableValueOperations<Rooted<JS::Value> >;
+    JS::Value * extractMutable() {
+        return static_cast<Rooted<JS::Value>*>(this)->address();
     }
 };
 
+} /* namespace js */
+
 /************************************************************************/
 
+namespace JS {
+
 #ifndef __GNUC__
 
 /*
  * The default assignment operator for |struct C| has the signature:
  *
  *   C& C::operator=(const C&)
  *
  * And in particular requires implicit conversion of |this| to type |C| for the
@@ -1210,17 +1218,17 @@ class AutoArrayRooter : private AutoGCRo
 
     Value *array;
 
     friend void AutoGCRooter::trace(JSTracer *trc);
 
   private:
     JS_DECL_USE_GUARD_OBJECT_NOTIFIER
 
-    SkipRoot skip;
+    js::SkipRoot skip;
 };
 
 template<class T>
 class AutoVectorRooter : protected AutoGCRooter
 {
   public:
     explicit AutoVectorRooter(JSContext *cx, ptrdiff_t tag
                               JS_GUARD_OBJECT_NOTIFIER_PARAM)
@@ -1293,17 +1301,17 @@ class AutoVectorRooter : protected AutoG
         for (size_t i = oldLength; i < vector.length(); ++i, ++t)
             memset(t, 0, sizeof(T));
     }
 
     typedef js::Vector<T, 8> VectorImpl;
     VectorImpl vector;
 
     /* Prevent overwriting of inline elements in vector. */
-    SkipRoot vectorRoot;
+    js::SkipRoot vectorRoot;
 
     JS_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
 class AutoValueVector : public AutoVectorRooter<Value>
 {
   public:
     explicit AutoValueVector(JSContext *cx
@@ -2637,18 +2645,18 @@ ToBooleanSlow(const JS::Value &v);
 namespace JS {
 
 /* ES5 9.3 ToNumber. */
 JS_ALWAYS_INLINE bool
 ToNumber(JSContext *cx, const Value &v, double *out)
 {
     AssertArgumentsAreSane(cx, v);
     {
-        JS::SkipRoot root(cx, &v);
-        MaybeCheckStackRoots(cx);
+        js::SkipRoot root(cx, &v);
+        js::MaybeCheckStackRoots(cx);
     }
 
     if (v.isNumber()) {
         *out = v.toNumber();
         return true;
     }
     return js::ToNumberSlow(cx, v, out);
 }
@@ -2731,83 +2739,83 @@ ToUint64Slow(JSContext *cx, const JS::Va
 
 namespace JS {
 
 JS_ALWAYS_INLINE bool
 ToUint16(JSContext *cx, const js::Value &v, uint16_t *out)
 {
     AssertArgumentsAreSane(cx, v);
     {
-        SkipRoot skip(cx, &v);
-        MaybeCheckStackRoots(cx);
+        js::SkipRoot skip(cx, &v);
+        js::MaybeCheckStackRoots(cx);
     }
 
     if (v.isInt32()) {
         *out = uint16_t(v.toInt32());
         return true;
     }
     return js::ToUint16Slow(cx, v, out);
 }
 
 JS_ALWAYS_INLINE bool
 ToInt32(JSContext *cx, const js::Value &v, int32_t *out)
 {
     AssertArgumentsAreSane(cx, v);
     {
-        JS::SkipRoot root(cx, &v);
-        MaybeCheckStackRoots(cx);
+        js::SkipRoot root(cx, &v);
+        js::MaybeCheckStackRoots(cx);
     }
 
     if (v.isInt32()) {
         *out = v.toInt32();
         return true;
     }
     return js::ToInt32Slow(cx, v, out);
 }
 
 JS_ALWAYS_INLINE bool
 ToUint32(JSContext *cx, const js::Value &v, uint32_t *out)
 {
     AssertArgumentsAreSane(cx, v);
     {
-        JS::SkipRoot root(cx, &v);
-        MaybeCheckStackRoots(cx);
+        js::SkipRoot root(cx, &v);
+        js::MaybeCheckStackRoots(cx);
     }
 
     if (v.isInt32()) {
         *out = uint32_t(v.toInt32());
         return true;
     }
     return js::ToUint32Slow(cx, v, out);
 }
 
 JS_ALWAYS_INLINE bool
 ToInt64(JSContext *cx, const js::Value &v, int64_t *out)
 {
     AssertArgumentsAreSane(cx, v);
     {
-        JS::SkipRoot skip(cx, &v);
-        MaybeCheckStackRoots(cx);
+        js::SkipRoot skip(cx, &v);
+        js::MaybeCheckStackRoots(cx);
     }
 
     if (v.isInt32()) {
         *out = int64_t(v.toInt32());
         return true;
     }
 
     return js::ToInt64Slow(cx, v, out);
 }
 
 JS_ALWAYS_INLINE bool
 ToUint64(JSContext *cx, const js::Value &v, uint64_t *out)
 {
     AssertArgumentsAreSane(cx, v);
     {
-        SkipRoot skip(cx, &v);
-        MaybeCheckStackRoots(cx);
+        js::SkipRoot skip(cx, &v);
+        js::MaybeCheckStackRoots(cx);
     }
 
     if (v.isInt32()) {
         /* Account for sign extension of negatives into the longer 64bit space. */
         *out = uint64_t(int64_t(v.toInt32()));
         return true;
     }
 
@@ -2921,31 +2929,28 @@ IsPoisonedId(jsid iden)
 {
     if (JSID_IS_STRING(iden))
         return JS::IsPoisonedPtr(JSID_TO_STRING(iden));
     if (JSID_IS_OBJECT(iden))
         return JS::IsPoisonedPtr(JSID_TO_OBJECT(iden));
     return false;
 }
 
-template <> struct RootMethods<const jsid>
-{
-    static jsid initial() { return JSID_VOID; }
-    static ThingRootKind kind() { return THING_ROOT_ID; }
-    static bool poisoned(jsid id) { return IsPoisonedId(id); }
-};
+} /* namespace JS */
+
+namespace js {
 
 template <> struct RootMethods<jsid>
 {
     static jsid initial() { return JSID_VOID; }
     static ThingRootKind kind() { return THING_ROOT_ID; }
     static bool poisoned(jsid id) { return IsPoisonedId(id); }
 };
 
-} /* namespace JS */
+} /* namespace js */
 
 class JSAutoRequest {
   public:
     JSAutoRequest(JSContext *cx JS_GUARD_OBJECT_NOTIFIER_PARAM)
         : mContext(cx) {
         JS_GUARD_OBJECT_NOTIFIER_INIT;
         JS_BeginRequest(mContext);
     }
--- a/js/src/jsclass.h
+++ b/js/src/jsclass.h
@@ -376,32 +376,28 @@ enum ESClassValue {
  */
 inline bool
 ObjectClassIs(JSObject &obj, ESClassValue classValue, JSContext *cx);
 
 /* Just a helper that checks v.isObject before calling ObjectClassIs. */
 inline bool
 IsObjectWithClass(const Value &v, ESClassValue classValue, JSContext *cx);
 
-}  /* namespace js */
-
-namespace JS {
-
 inline bool
 IsPoisonedSpecialId(js::SpecialId iden)
 {
     if (iden.isObject())
         return IsPoisonedPtr(iden.toObject());
     return false;
 }
 
-template <> struct RootMethods<js::SpecialId>
+template <> struct RootMethods<SpecialId>
 {
-    static js::SpecialId initial() { return js::SpecialId(); }
+    static SpecialId initial() { return SpecialId(); }
     static ThingRootKind kind() { return THING_ROOT_ID; }
-    static bool poisoned(js::SpecialId id) { return IsPoisonedSpecialId(id); }
+    static bool poisoned(SpecialId id) { return IsPoisonedSpecialId(id); }
 };
 
-} /* namespace JS */
+}  /* namespace js */
 
 #endif  /* __cplusplus */
 
 #endif  /* jsclass_h__ */
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -107,19 +107,20 @@
 #if JS_TRACE_LOGGING
 #include "TraceLogging.h"
 #endif
 
 using namespace mozilla;
 using namespace js;
 using namespace js::gc;
 
-void * const JS::InternalHandleBase::zeroPointer = NULL;
-
 namespace js {
+
+void * const InternalHandleBase::zeroPointer = NULL;
+
 namespace gc {
 
 /*
  * Lower limit after which we limit the heap growth
  */
 const size_t GC_ALLOCATION_THRESHOLD = 30 * 1024 * 1024;
 
 /* Perform a Full GC every 20 seconds if MaybeGC is called */
--- a/js/src/jsinfer.h
+++ b/js/src/jsinfer.h
@@ -43,78 +43,70 @@ class TaggedProto
 
     bool operator ==(const TaggedProto &other) { return proto == other.proto; }
     bool operator !=(const TaggedProto &other) { return proto != other.proto; }
 
   private:
     JSObject *proto;
 };
 
-} /* namespace js */
-
-namespace JS {
-
 template <>
-struct RootKind<js::TaggedProto>
+struct RootKind<TaggedProto>
 {
     static ThingRootKind rootKind() { return THING_ROOT_OBJECT; };
 };
 
-template <> struct RootMethods<const js::TaggedProto>
+template <> struct RootMethods<const TaggedProto>
 {
-    static js::TaggedProto initial() { return js::TaggedProto(); }
+    static TaggedProto initial() { return TaggedProto(); }
     static ThingRootKind kind() { return THING_ROOT_OBJECT; }
-    static bool poisoned(const js::TaggedProto &v) { return IsPoisonedPtr(v.raw()); }
+    static bool poisoned(const TaggedProto &v) { return IsPoisonedPtr(v.raw()); }
 };
 
-template <> struct RootMethods<js::TaggedProto>
+template <> struct RootMethods<TaggedProto>
 {
-    static js::TaggedProto initial() { return js::TaggedProto(); }
+    static TaggedProto initial() { return TaggedProto(); }
     static ThingRootKind kind() { return THING_ROOT_OBJECT; }
-    static bool poisoned(const js::TaggedProto &v) { return IsPoisonedPtr(v.raw()); }
+    static bool poisoned(const TaggedProto &v) { return IsPoisonedPtr(v.raw()); }
 };
 
 template<class Outer>
 class TaggedProtoOperations
 {
-    const js::TaggedProto *value() const {
+    const TaggedProto *value() const {
         return static_cast<const Outer*>(this)->extract();
     }
 
   public:
     uintptr_t toWord() const { return value()->toWord(); }
     inline bool isLazy() const;
     inline bool isObject() const;
     inline JSObject *toObject() const;
     inline JSObject *toObjectOrNull() const;
     JSObject *raw() const { return value()->raw(); }
 };
 
 template <>
-class HandleBase<js::TaggedProto> : public TaggedProtoOperations<Handle<js::TaggedProto> >
+class HandleBase<TaggedProto> : public TaggedProtoOperations<Handle<TaggedProto> >
 {
-    friend class TaggedProtoOperations<Handle<js::TaggedProto> >;
-    const js::TaggedProto * extract() const {
-        return static_cast<const Handle<js::TaggedProto>*>(this)->address();
+    friend class TaggedProtoOperations<Handle<TaggedProto> >;
+    const TaggedProto * extract() const {
+        return static_cast<const Handle<TaggedProto>*>(this)->address();
     }
 };
 
 template <>
-class RootedBase<js::TaggedProto> : public TaggedProtoOperations<Rooted<js::TaggedProto> >
+class RootedBase<TaggedProto> : public TaggedProtoOperations<Rooted<TaggedProto> >
 {
-    friend class TaggedProtoOperations<Rooted<js::TaggedProto> >;
-    const js::TaggedProto *extract() const {
-        return static_cast<const Rooted<js::TaggedProto> *>(this)->address();
+    friend class TaggedProtoOperations<Rooted<TaggedProto> >;
+    const TaggedProto *extract() const {
+        return static_cast<const Rooted<TaggedProto> *>(this)->address();
     }
 };
 
-} /* namespace JS */
-
-namespace js {
-
 class CallObject;
 
 namespace mjit {
     struct JITScript;
 }
 
 namespace ion {
     struct IonScript;
--- a/js/src/jsinferinlines.h
+++ b/js/src/jsinferinlines.h
@@ -45,38 +45,38 @@ inline JSObject *
 js::TaggedProto::toObjectOrNull() const
 {
     JS_ASSERT(!proto || isObject());
     return proto;
 }
 
 template<class Outer>
 inline bool
-JS::TaggedProtoOperations<Outer>::isLazy() const
+js::TaggedProtoOperations<Outer>::isLazy() const
 {
     return value()->isLazy();
 }
 
 template<class Outer>
 inline bool
-JS::TaggedProtoOperations<Outer>::isObject() const
+js::TaggedProtoOperations<Outer>::isObject() const
 {
     return value()->isObject();
 }
 
 template<class Outer>
 inline JSObject *
-JS::TaggedProtoOperations<Outer>::toObject() const
+js::TaggedProtoOperations<Outer>::toObject() const
 {
     return value()->toObject();
 }
 
 template<class Outer>
 inline JSObject *
-JS::TaggedProtoOperations<Outer>::toObjectOrNull() const
+js::TaggedProtoOperations<Outer>::toObjectOrNull() const
 {
     return value()->toObjectOrNull();
 }
 
 namespace js {
 namespace types {
 
 /////////////////////////////////////////////////////////////////////
@@ -462,17 +462,17 @@ struct AutoEnterCompilation
 
 /*
  * Get the default 'new' object for a given standard class, per the currently
  * active global.
  */
 inline TypeObject *
 GetTypeNewObject(JSContext *cx, JSProtoKey key)
 {
-    RootedObject proto(cx);
+    js::RootedObject proto(cx);
     if (!js_GetClassPrototype(cx, key, &proto))
         return NULL;
     return proto->getNewType(cx);
 }
 
 /* Get a type object for the immediate allocation site within a native. */
 inline TypeObject *
 GetTypeCallerInitObject(JSContext *cx, JSProtoKey key)
@@ -504,21 +504,21 @@ MarkIteratorUnknown(JSContext *cx)
  * from within the interpreter.
  */
 inline bool
 TypeMonitorCall(JSContext *cx, const js::CallArgs &args, bool constructing)
 {
     extern void TypeMonitorCallSlow(JSContext *cx, HandleObject callee,
                                     const CallArgs &args, bool constructing);
 
-    RootedObject callee(cx, &args.callee());
+    js::RootedObject callee(cx, &args.callee());
     if (callee->isFunction()) {
         JSFunction *fun = callee->toFunction();
         if (fun->isInterpreted()) {
-            RootedScript script(cx, fun->script());
+            js::RootedScript script(cx, fun->script());
             if (!script->ensureRanAnalysis(cx))
                 return false;
             if (cx->typeInferenceEnabled())
                 TypeMonitorCallSlow(cx, callee, args, constructing);
         }
     }
 
     return true;
@@ -752,17 +752,17 @@ TypeScript::SlotTypes(JSScript *script, 
     JS_ASSERT(slot < js::analyze::TotalSlots(script));
     TypeSet *types = script->types->typeArray() + script->nTypeSets + slot;
     return types->toStackTypeSet();
 }
 
 /* static */ inline TypeObject *
 TypeScript::StandardType(JSContext *cx, JSScript *script, JSProtoKey key)
 {
-    RootedObject proto(cx);
+    js::RootedObject proto(cx);
     if (!js_GetClassPrototype(cx, key, &proto, NULL))
         return NULL;
     return proto->getNewType(cx);
 }
 
 struct AllocationSiteKey {
     JSScript *script;
 
@@ -1690,17 +1690,17 @@ JSScript::ensureRanAnalysis(JSContext *c
         return false;
     JS_ASSERT(self->analysis()->ranBytecode());
     return true;
 }
 
 inline bool
 JSScript::ensureRanInference(JSContext *cx)
 {
-    JS::RootedScript self(cx, this);
+    js::RootedScript self(cx, this);
     if (!ensureRanAnalysis(cx))
         return false;
     if (!self->analysis()->ranInference()) {
         js::types::AutoEnterTypeInference enter(cx);
         self->analysis()->analyzeTypes(cx);
     }
     return !self->analysis()->OOM() &&
         !cx->compartment->types.pendingNukeTypes;
@@ -1736,38 +1736,39 @@ JSScript::clearPropertyReadTypes()
 inline void
 js::analyze::ScriptAnalysis::addPushedType(JSContext *cx, uint32_t offset, uint32_t which,
                                            js::types::Type type)
 {
     js::types::TypeSet *pushed = pushedTypes(offset, which);
     pushed->addType(cx, type);
 }
 
-
-namespace JS {
-
-template<> class AnchorPermitted<js::types::TypeObject *> { };
+namespace js {
 
 template <>
-struct RootMethods<const js::types::Type>
+struct RootMethods<const types::Type>
 {
-    static js::types::Type initial() { return js::types::Type::UnknownType(); }
+    static types::Type initial() { return types::Type::UnknownType(); }
     static ThingRootKind kind() { return THING_ROOT_TYPE; }
-    static bool poisoned(const js::types::Type &v) {
+    static bool poisoned(const types::Type &v) {
         return (v.isTypeObject() && IsPoisonedPtr(v.typeObject()))
             || (v.isSingleObject() && IsPoisonedPtr(v.singleObject()));
     }
 };
 
 template <>
-struct RootMethods<js::types::Type>
+struct RootMethods<types::Type>
 {
-    static js::types::Type initial() { return js::types::Type::UnknownType(); }
+    static types::Type initial() { return types::Type::UnknownType(); }
     static ThingRootKind kind() { return THING_ROOT_TYPE; }
-    static bool poisoned(const js::types::Type &v) {
+    static bool poisoned(const types::Type &v) {
         return (v.isTypeObject() && IsPoisonedPtr(v.typeObject()))
             || (v.isSingleObject() && IsPoisonedPtr(v.singleObject()));
     }
 };
 
+} // namespace js
+
+namespace JS {
+template<> class AnchorPermitted<js::types::TypeObject *> { };
 }  // namespace JS
 
 #endif // jsinferinlines_h___
--- a/js/src/jsprvtd.h
+++ b/js/src/jsprvtd.h
@@ -214,21 +214,21 @@ typedef JS::Handle<types::TypeObject*> H
 typedef JS::Handle<JSAtom*>            HandleAtom;
 typedef JS::Handle<PropertyName*>      HandlePropertyName;
 
 typedef JS::MutableHandle<Shape*>      MutableHandleShape;
 typedef JS::MutableHandle<JSAtom*>     MutableHandleAtom;
 
 typedef JSAtom *                       RawAtom;
 
-typedef JS::Rooted<Shape*>             RootedShape;
-typedef JS::Rooted<BaseShape*>         RootedBaseShape;
-typedef JS::Rooted<types::TypeObject*> RootedTypeObject;
-typedef JS::Rooted<JSAtom*>            RootedAtom;
-typedef JS::Rooted<PropertyName*>      RootedPropertyName;
+typedef js::Rooted<Shape*>             RootedShape;
+typedef js::Rooted<BaseShape*>         RootedBaseShape;
+typedef js::Rooted<types::TypeObject*> RootedTypeObject;
+typedef js::Rooted<JSAtom*>            RootedAtom;
+typedef js::Rooted<PropertyName*>      RootedPropertyName;
 
 enum XDRMode {
     XDR_ENCODE,
     XDR_DECODE
 };
 
 template <XDRMode mode>
 class XDRState;
--- a/js/src/jspubtd.h
+++ b/js/src/jspubtd.h
@@ -215,17 +215,17 @@ typedef struct PRCallOnceType    JSCallO
 typedef JSBool                   JSCallOnceType;
 #endif
 typedef JSBool                 (*JSInitCallback)(void);
 
 JS_END_EXTERN_C
 
 #ifdef __cplusplus
 
-namespace JS {
+namespace js {
 
 template <typename T>
 class Rooted;
 
 class SkipRoot;
 
 enum ThingRootKind
 {
@@ -257,17 +257,17 @@ struct SpecificRootKind
     static ThingRootKind rootKind() { return Kind; }
 };
 
 template <> struct RootKind<JSObject *> : SpecificRootKind<JSObject *, THING_ROOT_OBJECT> {};
 template <> struct RootKind<JSFunction *> : SpecificRootKind<JSFunction *, THING_ROOT_OBJECT> {};
 template <> struct RootKind<JSString *> : SpecificRootKind<JSString *, THING_ROOT_STRING> {};
 template <> struct RootKind<JSScript *> : SpecificRootKind<JSScript *, THING_ROOT_SCRIPT> {};
 template <> struct RootKind<jsid> : SpecificRootKind<jsid, THING_ROOT_ID> {};
-template <> struct RootKind<Value> : SpecificRootKind<Value, THING_ROOT_VALUE> {};
+template <> struct RootKind<JS::Value> : SpecificRootKind<JS::Value, THING_ROOT_VALUE> {};
 
 struct ContextFriendFields {
     JSRuntime *const    runtime;
 
     ContextFriendFields(JSRuntime *rt)
       : runtime(rt) { }
 
     static const ContextFriendFields *get(const JSContext *cx) {
@@ -321,13 +321,13 @@ struct RuntimeFriendFields {
       : interrupt(0),
         nativeStackLimit(0) { }
 
     static const RuntimeFriendFields *get(const JSRuntime *rt) {
         return reinterpret_cast<const RuntimeFriendFields *>(rt);
     }
 };
 
-} /* namespace JS */
+} /* namespace js */
 
 #endif /* __cplusplus */
 
 #endif /* jspubtd_h___ */
--- a/js/src/jsscope.h
+++ b/js/src/jsscope.h
@@ -1118,26 +1118,24 @@ Shape::searchNoAllocation(Shape *start, 
     }
 
     return NULL;
 }
 
 void
 MarkNonNativePropertyFound(HandleObject obj, MutableHandleShape propp);
 
+template<> struct RootKind<Shape *> : SpecificRootKind<Shape *, THING_ROOT_SHAPE> {};
+template<> struct RootKind<BaseShape *> : SpecificRootKind<BaseShape *, THING_ROOT_BASE_SHAPE> {};
+
 } // namespace js
 
 #ifdef _MSC_VER
 #pragma warning(pop)
 #pragma warning(pop)
 #endif
 
 namespace JS {
-    template<> class AnchorPermitted<js::Shape *> { };
-    template<> class AnchorPermitted<const js::Shape *> { };
-
-    template<>
-    struct RootKind<js::Shape *> : SpecificRootKind<js::Shape *, THING_ROOT_SHAPE> {};
-    template<>
-    struct RootKind<js::BaseShape *> : SpecificRootKind<js::BaseShape *, THING_ROOT_BASE_SHAPE> {};
+template<> class AnchorPermitted<js::Shape *> { };
+template<> class AnchorPermitted<const js::Shape *> { };
 }
 
 #endif /* jsscope_h___ */
--- a/js/src/shell/jsheaptools.cpp
+++ b/js/src/shell/jsheaptools.cpp
@@ -489,17 +489,17 @@ ReferenceFinder::addReferrer(jsval refer
         return false;
 
     char *pathName = path->computeName(context);
     if (!pathName)
         return false;
     AutoReleasePtr releasePathName(pathName);
 
     /* Find the property of the results object named |pathName|. */
-    JS::RootedValue valRoot(context);
+    RootedValue valRoot(context);
     Value &v = valRoot.get();
 
     if (!JS_GetProperty(context, result, pathName, &v))
         return false;
     if (v.isUndefined()) {
         /* Create an array to accumulate referents under this path. */
         JSObject *array = JS_NewArrayObject(context, 1, referrer.address());
         if (!array)
--- a/js/src/vm/ObjectImpl.h
+++ b/js/src/vm/ObjectImpl.h
@@ -1397,20 +1397,18 @@ DefineElement(JSContext *cx, Handle<Obje
 extern bool
 SetElement(JSContext *cx, Handle<ObjectImpl*> obj, Handle<ObjectImpl*> receiver, uint32_t index,
            const Value &v, unsigned resolveFlags, bool *succeeded);
 
 extern bool
 HasElement(JSContext *cx, Handle<ObjectImpl*> obj, uint32_t index, unsigned resolveFlags,
            bool *found);
 
+template <> struct RootMethods<PropertyId>
+{
+    static PropertyId initial() { return PropertyId(); }
+    static ThingRootKind kind() { return THING_ROOT_PROPERTY_ID; }
+    static bool poisoned(PropertyId propid) { return IsPoisonedId(propid.asId()); }
+};
+
 } /* namespace js */
 
-namespace JS {
-template <> struct RootMethods<js::PropertyId>
-{
-    static js::PropertyId initial() { return js::PropertyId(); }
-    static ThingRootKind kind() { return THING_ROOT_PROPERTY_ID; }
-    static bool poisoned(js::PropertyId propid) { return IsPoisonedId(propid.asId()); }
-};
-}
-
 #endif /* ObjectImpl_h__ */
--- a/js/src/vm/String-inl.h
+++ b/js/src/vm/String-inl.h
@@ -159,17 +159,17 @@ JSDependentString::init(JSLinearString *
     d.u1.chars = chars;
     d.s.u2.base = base;
     js::StringWriteBarrierPost(compartment(), reinterpret_cast<JSString **>(&d.s.u2.base));
 }
 
 JS_ALWAYS_INLINE JSLinearString *
 JSDependentString::new_(JSContext *cx, JSLinearString *base_, const jschar *chars, size_t length)
 {
-    JS::Rooted<JSLinearString*> base(cx, base_);
+    js::Rooted<JSLinearString*> base(cx, base_);
 
     /* Try to avoid long chains of dependent strings. */
     while (base->isDependent())
         base = base->asDependent().base();
 
     JS_ASSERT(base->isFlat());
     JS_ASSERT(chars >= base->chars() && chars < base->chars() + base->length());
     JS_ASSERT(length <= base->length() - (chars - base->chars()));
--- a/js/xpconnect/loader/mozJSComponentLoader.cpp
+++ b/js/xpconnect/loader/mozJSComponentLoader.cpp
@@ -726,17 +726,17 @@ mozJSComponentLoader::GlobalForLocation(
         if (exception)
             JS_SetOptions(cx, oldopts | JSOPTION_DONT_REPORT_UNCAUGHT);
         JS::CompileOptions options(cx);
         options.setPrincipals(nsJSPrincipals::get(mSystemPrincipal))
                .setNoScriptRval(true)
                .setVersion(JSVERSION_LATEST)
                .setFileAndLine(nativePath.get(), 1)
                .setSourcePolicy(JS::CompileOptions::LAZY_SOURCE);
-        JS::RootedObject rootedGlobal(cx, global);
+        js::RootedObject rootedGlobal(cx, global);
 
         if (realFile) {
 #ifdef HAVE_PR_MEMMAP
             int64_t fileSize;
             rv = aComponentFile->GetFileSize(&fileSize);
             if (NS_FAILED(rv)) {
                 JS_SetOptions(cx, oldopts);
                 return rv;
--- a/js/xpconnect/loader/mozJSSubScriptLoader.cpp
+++ b/js/xpconnect/loader/mozJSSubScriptLoader.cpp
@@ -107,17 +107,17 @@ mozJSSubScriptLoader::ReadScript(nsIURI 
     /* set our own error reporter so we can report any bad things as catchable
      * exceptions, including the source/line number */
     er = JS_SetErrorReporter(cx, mozJSLoaderErrorReporter);
 
     JS::CompileOptions options(cx);
     options.setPrincipals(nsJSPrincipals::get(principal))
            .setFileAndLine(uriStr, 1)
            .setSourcePolicy(JS::CompileOptions::LAZY_SOURCE);
-    JS::RootedObject target_obj_root(cx, target_obj);
+    js::RootedObject target_obj_root(cx, target_obj);
     if (!charset.IsVoid()) {
         nsString script;
         rv = nsScriptLoader::ConvertToUTF16(nullptr, reinterpret_cast<const uint8_t*>(buf.get()), len,
                                             charset, nullptr, script);
 
         if (NS_FAILED(rv)) {
             return ReportError(cx, LOAD_ERROR_BADCHARSET);
         }
--- a/js/xpconnect/src/XPCComponents.cpp
+++ b/js/xpconnect/src/XPCComponents.cpp
@@ -2698,17 +2698,17 @@ nsXPCComponents_Utils::LookupMethod(cons
                                     JSContext *cx,
                                     JS::Value *retval)
 {
     JSAutoRequest ar(cx);
 
     // first param must be a JSObject
     if (!object.isObject())
         return NS_ERROR_XPC_BAD_CONVERT_JS;
-    JS::RootedObject obj(cx, &object.toObject());
+    js::RootedObject obj(cx, &object.toObject());
 
     // second param must be a string.
     if (!JSVAL_IS_STRING(name))
         return NS_ERROR_XPC_BAD_CONVERT_JS;
     JSString *methodName = name.toString();
     jsid methodId = INTERNED_STRING_TO_JSID(cx, JS_InternJSString(cx, methodName));
 
     // If |obj| is a cross-compartment wrapper, try to puncture it. If this fails,
@@ -3167,18 +3167,18 @@ XPC_WN_Helper_GetProperty(JSContext *cx,
 extern JSBool
 XPC_WN_Helper_SetProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, JSMutableHandleValue vp);
 
 bool
 xpc::SandboxProxyHandler::getPropertyDescriptor(JSContext *cx, JSObject *proxy,
                                                 jsid id_, bool set,
                                                 PropertyDescriptor *desc)
 {
-    JS::RootedObject obj(cx, wrappedObject(proxy));
-    JS::RootedId id(cx, id_);
+    js::RootedObject obj(cx, wrappedObject(proxy));
+    js::RootedId id(cx, id_);
 
     MOZ_ASSERT(js::GetObjectCompartment(obj) == js::GetObjectCompartment(proxy));
     // XXXbz Not sure about the JSRESOLVE_QUALIFIED here, but we have
     // no way to tell for sure whether to use it.
     if (!JS_GetPropertyDescriptorById(cx, obj, id,
                                       (set ? JSRESOLVE_ASSIGNING : 0) | JSRESOLVE_QUALIFIED,
                                       desc))
         return false;
@@ -3923,17 +3923,17 @@ xpc_EvalInSandbox(JSContext *cx, JSObjec
         JSAutoRequest req(sandcx->GetJSContext());
         JSAutoCompartment ac(sandcx->GetJSContext(), sandbox);
 
         jsval v;
         JSString *str = nullptr;
         JS::CompileOptions options(sandcx->GetJSContext());
         options.setPrincipals(nsJSPrincipals::get(prin))
                .setFileAndLine(filename, lineNo);
-        JS::RootedObject rootedSandbox(sandcx->GetJSContext(), sandbox);
+        js::RootedObject rootedSandbox(sandcx->GetJSContext(), sandbox);
         bool ok = JS::Evaluate(sandcx->GetJSContext(), rootedSandbox, options,
                                PromiseFlatString(source).get(), source.Length(), &v);
         if (ok && returnStringOnly && !(JSVAL_IS_VOID(v))) {
             ok = !!(str = JS_ValueToString(sandcx->GetJSContext(), v));
         }
 
         if (!ok) {
             // The sandbox threw an exception, convert it to a string (if
@@ -4157,17 +4157,17 @@ nsXPCComponents_Utils::GetGlobalForObjec
   if (JSVAL_IS_PRIMITIVE(object))
     return NS_ERROR_XPC_BAD_CONVERT_JS;
 
   // Wrappers are parented to their the global in their home compartment. But
   // when getting the global for a cross-compartment wrapper, we really want
   // a wrapper for the foreign global. So we need to unwrap before getting the
   // parent, enter the compartment for the duration of the call, and wrap the
   // result.
-  JS::Rooted<JSObject*> obj(cx, JSVAL_TO_OBJECT(object));
+  js::Rooted<JSObject*> obj(cx, JSVAL_TO_OBJECT(object));
   obj = js::UnwrapObject(obj);
   {
     JSAutoCompartment ac(cx, obj);
     obj = JS_GetGlobalForObject(cx, obj);
   }
   JS_WrapObject(cx, obj.address());
   *retval = OBJECT_TO_JSVAL(obj);
 
--- a/js/xpconnect/src/XPCQuickStubs.h
+++ b/js/xpconnect/src/XPCQuickStubs.h
@@ -609,29 +609,29 @@ PropertyOpForwarder(JSContext *cx, unsig
     // Layout:
     //   this = our this
     //   property op to call = callee reserved slot 0
     //   name of the property = callee reserved slot 1
 
     JS::CallArgs args = CallArgsFromVp(argc, vp);
 
     JSObject *callee = &args.callee();
-    JS::RootedObject obj(cx, JS_THIS_OBJECT(cx, vp));
+    js::RootedObject obj(cx, JS_THIS_OBJECT(cx, vp));
     if (!obj)
         return false;
 
     jsval v = js::GetFunctionNativeReserved(callee, 0);
 
     JSObject *ptrobj = JSVAL_TO_OBJECT(v);
     Op *popp = static_cast<Op *>(JS_GetPrivate(ptrobj));
 
     v = js::GetFunctionNativeReserved(callee, 1);
 
     jsval argval = (argc > 0) ? args[0] : JSVAL_VOID;
-    JS::RootedId id(cx);
+    js::RootedId id(cx);
     if (!JS_ValueToId(cx, v, id.address()))
         return false;
     args.rval().set(argval);
     return ApplyPropertyOp<Op>(cx, *popp, obj, id, args.rval());
 }
 
 extern JSClass PointerHolderClass;
 
--- a/js/xpconnect/src/XPCRuntimeService.cpp
+++ b/js/xpconnect/src/XPCRuntimeService.cpp
@@ -34,33 +34,33 @@ NS_IMPL_THREADSAFE_RELEASE(BackstagePass
 
 /* bool newResolve (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in jsval id, in uint32_t flags, out JSObjectPtr objp); */
 NS_IMETHODIMP
 BackstagePass::NewResolve(nsIXPConnectWrappedNative *wrapper,
                           JSContext * cx, JSObject * obj_,
                           jsid id_, uint32_t flags,
                           JSObject * *objp_, bool *_retval)
 {
-    JS::RootedObject obj(cx, obj_);
-    JS::RootedId id(cx, id_);
+    js::RootedObject obj(cx, obj_);
+    js::RootedId id(cx, id_);
 
     JSBool resolved;
 
     *_retval = !!JS_ResolveStandardClass(cx, obj, id, &resolved);
     if (!*_retval) {
         *objp_ = nullptr;
         return NS_OK;
     }
 
     if (resolved) {
         *objp_ = obj;
         return NS_OK;
     }
 
-    JS::RootedObject objp(cx, *objp_);
+    js::RootedObject objp(cx, *objp_);
     *_retval = !!ResolveWorkerClasses(cx, obj, id, flags, &objp);
     *objp_ = objp;
     return NS_OK;
 }
 
 /***************************************************************************/
 /* void getInterfaces (out uint32_t count, [array, size_is (count), retval]
                        out nsIIDPtr array); */