No bug - Fix some style issues in DOM code.
authorMs2ger <ms2ger@gmail.com>
Mon, 11 Nov 2013 09:04:41 +0100
changeset 154330 bc8c1eb0f2ba50d74e72ff4ce68fb8dc5b0ee920
parent 154329 bc5821acc807c0036585ea1089fd18b6ca4984b5
child 154343 cdfd2bcbae95a0d12e8dd766749495067ab0779f
child 156034 c31c950dbf9a2a6c87d9203e8da929ef82085944
push id36051
push useremorley@mozilla.com
push dateMon, 11 Nov 2013 13:20:35 +0000
treeherdermozilla-inbound@340bd4a68cc9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone28.0a1
first release with
nightly linux32
bc8c1eb0f2ba / 28.0a1 / 20131111030205 / files
nightly linux64
bc8c1eb0f2ba / 28.0a1 / 20131111030205 / files
nightly mac
bc8c1eb0f2ba / 28.0a1 / 20131111030205 / files
nightly win32
bc8c1eb0f2ba / 28.0a1 / 20131111030205 / files
nightly win64
bc8c1eb0f2ba / 28.0a1 / 20131111030205 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
No bug - Fix some style issues in DOM code.
content/base/public/nsContentUtils.h
content/base/src/WebSocket.cpp
content/base/src/nsContentUtils.cpp
content/base/src/nsFrameMessageManager.cpp
content/base/src/nsFrameMessageManager.h
content/html/content/src/HTMLMediaElement.cpp
content/html/content/src/HTMLPropertiesCollection.cpp
content/html/document/src/nsHTMLDocument.cpp
content/media/webaudio/AudioBuffer.cpp
content/xbl/src/nsXBLBinding.cpp
content/xbl/src/nsXBLBinding.h
content/xbl/src/nsXBLProtoImpl.cpp
content/xbl/src/nsXBLProtoImpl.h
content/xbl/src/nsXBLProtoImplMethod.cpp
content/xbl/src/nsXBLProtoImplProperty.cpp
content/xbl/src/nsXBLPrototypeHandler.cpp
content/xslt/src/xslt/txMozillaXSLTProcessor.cpp
content/xul/content/src/nsXULElement.cpp
dom/audiochannel/AudioChannelService.cpp
dom/base/nsDOMClassInfo.cpp
dom/base/nsGlobalWindow.cpp
dom/base/nsJSEnvironment.cpp
dom/base/nsJSUtils.cpp
dom/base/nsJSUtils.h
dom/base/nsScreen.cpp
dom/bindings/BindingDeclarations.h
dom/bindings/Codegen.py
dom/bindings/DOMJSProxyHandler.cpp
dom/bindings/Exceptions.cpp
dom/bindings/TypedArray.h
dom/bluetooth/BluetoothUtils.cpp
dom/indexedDB/IDBKeyRange.cpp
dom/indexedDB/IDBKeyRange.h
dom/indexedDB/IDBObjectStore.cpp
dom/indexedDB/IDBObjectStore.h
dom/indexedDB/IndexedDatabaseManager.cpp
dom/indexedDB/IndexedDatabaseManager.h
dom/indexedDB/KeyPath.cpp
dom/plugins/base/nsJSNPRuntime.cpp
dom/plugins/ipc/PluginIdentifierParent.cpp
dom/plugins/ipc/PluginScriptableObjectParent.cpp
dom/src/json/nsJSON.cpp
dom/src/notification/DesktopNotification.cpp
dom/src/notification/Notification.cpp
dom/system/gonk/AudioManager.cpp
dom/wifi/WifiProxyService.cpp
dom/workers/FileReaderSync.cpp
dom/workers/FileReaderSync.h
dom/workers/MessagePort.cpp
dom/workers/MessagePort.h
dom/workers/RuntimeService.cpp
dom/workers/ScriptLoader.cpp
dom/workers/SharedWorker.cpp
dom/workers/SharedWorker.h
dom/workers/WorkerPrivate.cpp
dom/workers/WorkerPrivate.h
dom/workers/WorkerScope.cpp
dom/workers/WorkerScope.h
--- a/content/base/public/nsContentUtils.h
+++ b/content/base/public/nsContentUtils.h
@@ -185,17 +185,18 @@ public:
 
   static bool     IsCallerChrome();
   static bool     ThreadsafeIsCallerChrome();
   static bool     IsCallerXBL();
 
   static bool     IsImageSrcSetDisabled();
 
   static bool LookupBindingMember(JSContext* aCx, nsIContent *aContent,
-                                  JS::HandleId aId, JS::MutableHandle<JSPropertyDescriptor> aDesc);
+                                  JS::Handle<jsid> aId,
+                                  JS::MutableHandle<JSPropertyDescriptor> aDesc);
 
   /**
    * Returns the parent node of aChild crossing document boundaries.
    */
   static nsINode* GetCrossDocParentNode(nsINode* aChild);
 
   /**
    * Do not ever pass null pointers to this method.  If one of your
--- a/content/base/src/WebSocket.cpp
+++ b/content/base/src/WebSocket.cpp
@@ -666,17 +666,17 @@ WebSocket::Init(JSContext* aCx,
   nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
   NS_ENSURE_STATE(os);
   rv = os->AddObserver(this, DOM_WINDOW_DESTROYED_TOPIC, true);
   NS_ENSURE_SUCCESS(rv, rv);
   rv = os->AddObserver(this, DOM_WINDOW_FROZEN_TOPIC, true);
   NS_ENSURE_SUCCESS(rv, rv);
 
   unsigned lineno;
-  JS::RootedScript script(aCx);
+  JS::Rooted<JSScript*> script(aCx);
   if (JS_DescribeScriptedCaller(aCx, &script, &lineno)) {
     mScriptFile = JS_GetScriptFilename(aCx, script);
     mScriptLine = lineno;
   }
 
   // Get WindowID
   mInnerWindowID = nsJSUtils::GetCurrentlyRunningCodeInnerWindowID(aCx);
 
--- a/content/base/src/nsContentUtils.cpp
+++ b/content/base/src/nsContentUtils.cpp
@@ -1821,17 +1821,18 @@ nsContentUtils::IsImageSrcSetDisabled()
 {
   return Preferences::GetBool("dom.disable_image_src_set") &&
          !IsCallerChrome();
 }
 
 // static
 bool
 nsContentUtils::LookupBindingMember(JSContext* aCx, nsIContent *aContent,
-                                    JS::HandleId aId, JS::MutableHandle<JSPropertyDescriptor> aDesc)
+                                    JS::Handle<jsid> aId,
+                                    JS::MutableHandle<JSPropertyDescriptor> aDesc)
 {
   nsXBLBinding* binding = aContent->GetXBLBinding();
   if (!binding)
     return true;
   return binding->LookupMember(aCx, aId, aDesc);
 }
 
 // static
@@ -5668,17 +5669,17 @@ nsContentUtils::DispatchXULCommand(nsICo
   bool dummy;
   return target->DispatchEvent(event, &dummy);
 }
 
 // static
 nsresult
 nsContentUtils::WrapNative(JSContext *cx, JS::Handle<JSObject*> scope,
                            nsISupports *native, nsWrapperCache *cache,
-                           const nsIID* aIID, JS::MutableHandleValue vp,
+                           const nsIID* aIID, JS::MutableHandle<JS::Value> vp,
                            nsIXPConnectJSObjectHolder **aHolder,
                            bool aAllowWrapping)
 {
   if (!native) {
     NS_ASSERTION(!aHolder || !*aHolder, "*aHolder should be null!");
 
     vp.setNull();
 
@@ -6150,19 +6151,20 @@ nsContentUtils::IsPatternMatching(nsAStr
 
   AutoPushJSContext cx(sgo->GetContext()->GetNativeContext());
   NS_ENSURE_TRUE(cx, true);
 
   // The pattern has to match the entire value.
   aPattern.Insert(NS_LITERAL_STRING("^(?:"), 0);
   aPattern.Append(NS_LITERAL_STRING(")$"));
 
-  JS::RootedObject re(cx, JS_NewUCRegExpObjectNoStatics(cx, static_cast<jschar*>
-                                                        (aPattern.BeginWriting()),
-                                                        aPattern.Length(), 0));
+  JS::Rooted<JSObject*> re(cx,
+    JS_NewUCRegExpObjectNoStatics(cx,
+                                  static_cast<jschar*>(aPattern.BeginWriting()),
+                                  aPattern.Length(), 0));
   if (!re) {
     JS_ClearPendingException(cx);
     return true;
   }
 
   JS::Rooted<JS::Value> rval(cx, JS::NullValue());
   size_t idx = 0;
   if (!JS_ExecuteRegExpNoStatics(cx, re,
--- a/content/base/src/nsFrameMessageManager.cpp
+++ b/content/base/src/nsFrameMessageManager.cpp
@@ -237,17 +237,18 @@ mozilla::dom::ipc::UnpackClonedMessageDa
 
 StructuredCloneData
 mozilla::dom::ipc::UnpackClonedMessageDataForChild(const ClonedMessageData& aData)
 {
   return UnpackClonedMessageData<Child>(aData);
 }
 
 bool
-SameProcessCpowHolder::ToObject(JSContext* aCx, JS::MutableHandleObject aObjp)
+SameProcessCpowHolder::ToObject(JSContext* aCx,
+                                JS::MutableHandle<JSObject*> aObjp)
 {
   if (!mObj) {
     return true;
   }
 
   aObjp.set(mObj);
   return JS_WrapObject(aCx, aObjp);
 }
@@ -548,17 +549,17 @@ nsFrameMessageManager::SendMessage(const
   JSAutoStructuredCloneBuffer buffer;
   if (aArgc >= 2 &&
       !GetParamsForMessage(aCx, aJSON, buffer, data.mClosure)) {
     return NS_ERROR_DOM_DATA_CLONE_ERR;
   }
   data.mData = buffer.data();
   data.mDataLength = buffer.nbytes();
 
-  JS::RootedObject objects(aCx);
+  JS::Rooted<JSObject*> objects(aCx);
   if (aArgc >= 3 && aObjects.isObject()) {
     objects = &aObjects.toObject();
   }
 
   InfallibleTArray<nsString> retval;
 
   sSendingSyncMessage |= aIsSync;
   bool rv = mCallback->DoSendBlockingMessage(aCx, aMessageName, data, objects,
@@ -627,17 +628,17 @@ nsFrameMessageManager::DispatchAsyncMess
   StructuredCloneData data;
   JSAutoStructuredCloneBuffer buffer;
 
   if (aArgc >= 2 &&
       !GetParamsForMessage(aCx, aJSON, buffer, data.mClosure)) {
     return NS_ERROR_DOM_DATA_CLONE_ERR;
   }
 
-  JS::RootedObject objects(aCx);
+  JS::Rooted<JSObject*> objects(aCx);
   if (aArgc >= 3 && aObjects.isObject()) {
     objects = &aObjects.toObject();
   }
 
   data.mData = buffer.data();
   data.mDataLength = buffer.nbytes();
 
   return DispatchAsyncMessageInternal(aCx, aMessageName, data, objects,
@@ -898,31 +899,31 @@ nsFrameMessageManager::ReceiveMessage(ns
         JS_NewObject(ctx, nullptr, nullptr, nullptr));
       NS_ENSURE_TRUE(param, NS_ERROR_OUT_OF_MEMORY);
 
       JS::Rooted<JS::Value> targetv(ctx);
       JS::Rooted<JSObject*> global(ctx, JS_GetGlobalForObject(ctx, object));
       nsContentUtils::WrapNative(ctx, global, aTarget, &targetv,
                                  nullptr, true);
 
-      JS::RootedObject cpows(ctx);
+      JS::Rooted<JSObject*> cpows(ctx);
       if (aCpows) {
         if (!aCpows->ToObject(ctx, &cpows)) {
           return NS_ERROR_UNEXPECTED;
         }
       }
 
       if (!cpows) {
         cpows = JS_NewObject(ctx, nullptr, nullptr, nullptr);
         if (!cpows) {
           return NS_ERROR_UNEXPECTED;
         }
       }
 
-      JS::RootedValue cpowsv(ctx, JS::ObjectValue(*cpows));
+      JS::Rooted<JS::Value> cpowsv(ctx, JS::ObjectValue(*cpows));
 
       JS::Rooted<JS::Value> json(ctx, JS::NullValue());
       if (aCloneData && aCloneData->mDataLength &&
           !ReadStructuredClone(ctx, *aCloneData, &json)) {
         JS_ClearPendingException(ctx);
         return NS_OK;
       }
       JS::Rooted<JSString*> jsMessage(ctx,
@@ -966,17 +967,17 @@ nsFrameMessageManager::ReceiveMessage(ns
 
         bool browser;
         rv = aPrincipal->GetIsInBrowserElement(&browser);
         NS_ENSURE_SUCCESS(rv, rv);
 
         JS::Rooted<JS::Value> browserValue(ctx, BOOLEAN_TO_JSVAL(browser));
         JS_DefineProperty(ctx, principalObj, "isInBrowserElement", browserValue, nullptr, nullptr, JSPROP_ENUMERATE);
 
-        JS::RootedValue principalValue(ctx, JS::ObjectValue(*principalObj));
+        JS::Rooted<JS::Value> principalValue(ctx, JS::ObjectValue(*principalObj));
         JS_DefineProperty(ctx, param, "principal", principalValue, nullptr, nullptr, JSPROP_ENUMERATE);
       }
 
       JS::Rooted<JS::Value> thisValue(ctx, JS::UndefinedValue());
 
       JS::Rooted<JS::Value> funval(ctx);
       if (JS_ObjectIsCallable(ctx, object)) {
         // If the listener is a JS function:
@@ -1419,19 +1420,18 @@ nsFrameScriptExecutor::TryCacheLoadAndCo
     AutoSafeJSContext cx;
     JS::Rooted<JSObject*> global(cx, mGlobal->GetJSObject());
     if (global) {
       JSAutoCompartment ac(cx, global);
       JS::CompileOptions options(cx);
       options.setNoScriptRval(true)
              .setFileAndLine(url.get(), 1)
              .setPrincipals(nsJSPrincipals::get(mPrincipal));
-      JS::RootedObject empty(cx, nullptr);
       JS::Rooted<JSScript*> script(cx,
-        JS::Compile(cx, empty, options, dataString.get(),
+        JS::Compile(cx, JS::NullPtr(), options, dataString.get(),
                     dataString.Length()));
 
       if (script) {
         nsAutoCString scheme;
         uri->GetScheme(scheme);
         // We don't cache data: scripts!
         if (!scheme.EqualsLiteral("data")) {
           nsFrameJSScriptExecutorHolder* holder =
--- a/content/base/src/nsFrameMessageManager.h
+++ b/content/base/src/nsFrameMessageManager.h
@@ -1,13 +1,14 @@
-/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=4 sw=4 tw=99 et: */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
+
 #ifndef nsFrameMessageManager_h__
 #define nsFrameMessageManager_h__
 
 #include "nsIMessageManager.h"
 #include "nsIObserver.h"
 #include "nsCOMPtr.h"
 #include "nsAutoPtr.h"
 #include "nsCOMArray.h"
@@ -54,29 +55,29 @@ public:
 
   virtual bool DoLoadFrameScript(const nsAString& aURL)
   {
     return true;
   }
 
   virtual bool DoSendBlockingMessage(JSContext* aCx,
                                      const nsAString& aMessage,
-                                     const mozilla::dom::StructuredCloneData& aData,
-                                     JS::Handle<JSObject *> aCpows,
+                                     const StructuredCloneData& aData,
+                                     JS::Handle<JSObject*> aCpows,
                                      nsIPrincipal* aPrincipal,
                                      InfallibleTArray<nsString>* aJSONRetVal,
                                      bool aIsSync)
   {
     return true;
   }
 
   virtual bool DoSendAsyncMessage(JSContext* aCx,
                                   const nsAString& aMessage,
-                                  const mozilla::dom::StructuredCloneData& aData,
-                                  JS::Handle<JSObject *> aCpows,
+                                  const StructuredCloneData& aData,
+                                  JS::Handle<JSObject*> aCpows,
                                   nsIPrincipal* aPrincipal)
   {
     return true;
   }
 
   virtual bool CheckPermission(const nsAString& aPermission)
   {
     return false;
@@ -124,32 +125,32 @@ struct nsMessageListenerInfo
 
   // Exactly one of mStrongListener and mWeakListener must be non-null.
   nsCOMPtr<nsIMessageListener> mStrongListener;
   nsWeakPtr mWeakListener;
 };
 
 class CpowHolder
 {
-  public:
-    virtual bool ToObject(JSContext* cx, JS::MutableHandleObject objp) = 0;
+public:
+  virtual bool ToObject(JSContext* cx, JS::MutableHandle<JSObject*> objp) = 0;
 };
 
 class MOZ_STACK_CLASS SameProcessCpowHolder : public CpowHolder
 {
-  public:
-    SameProcessCpowHolder(JSRuntime *aRuntime, JS::Handle<JSObject *> aObj)
-      : mObj(aRuntime, aObj)
-    {
-    }
+public:
+  SameProcessCpowHolder(JSRuntime *aRuntime, JS::Handle<JSObject*> aObj)
+    : mObj(aRuntime, aObj)
+  {
+  }
 
-    bool ToObject(JSContext* aCx, JS::MutableHandleObject aObjp);
+  bool ToObject(JSContext* aCx, JS::MutableHandle<JSObject*> aObjp);
 
-  private:
-    JS::Rooted<JSObject*> mObj;
+private:
+  JS::Rooted<JSObject*> mObj;
 };
 
 class nsFrameMessageManager MOZ_FINAL : public nsIContentFrameMessageManager,
                                         public nsIMessageBroadcaster,
                                         public nsIFrameScriptLoader,
                                         public nsIProcessChecker
 {
   friend class mozilla::dom::MessageManagerReporter;
@@ -242,17 +243,17 @@ public:
                                 const JS::Value& aJSON,
                                 const JS::Value& aObjects,
                                 nsIPrincipal* aPrincipal,
                                 JSContext* aCx,
                                 uint8_t aArgc);
   nsresult DispatchAsyncMessageInternal(JSContext* aCx,
                                         const nsAString& aMessage,
                                         const StructuredCloneData& aData,
-                                        JS::Handle<JSObject *> aCpows,
+                                        JS::Handle<JSObject*> aCpows,
                                         nsIPrincipal* aPrincipal);
   void RemoveFromParent();
   nsFrameMessageManager* GetParentManager() { return mParentManager; }
   void SetParentManager(nsFrameMessageManager* aParent)
   {
     NS_ASSERTION(!mParentManager, "We have parent manager already!");
     NS_ASSERTION(mChrome, "Should not set parent manager!");
     mParentManager = aParent;
--- a/content/html/content/src/HTMLMediaElement.cpp
+++ b/content/html/content/src/HTMLMediaElement.cpp
@@ -1586,17 +1586,17 @@ HTMLMediaElement::GetMozSampleRate(uint3
   ErrorResult rv;
   *aMozSampleRate = GetMozSampleRate(rv);
   return rv.ErrorCode();
 }
 
 // Helper struct with arguments for our hash iterator.
 typedef struct MOZ_STACK_CLASS {
   JSContext* cx;
-  JS::HandleObject  tags;
+  JS::Handle<JSObject*> tags;
   bool error;
 } MetadataIterCx;
 
 PLDHashOperator
 HTMLMediaElement::BuildObjectFromTags(nsCStringHashKey::KeyType aKey,
                                       nsCString aValue,
                                       void* aUserArg)
 {
--- a/content/html/content/src/HTMLPropertiesCollection.cpp
+++ b/content/html/content/src/HTMLPropertiesCollection.cpp
@@ -431,17 +431,17 @@ NS_INTERFACE_TABLE_HEAD(PropertyNodeList
 NS_INTERFACE_MAP_END
 
 void
 PropertyNodeList::GetValues(JSContext* aCx, nsTArray<JS::Value >& aResult,
                             ErrorResult& aError)
 {
   EnsureFresh();
 
-  JS::RootedObject wrapper(aCx, GetWrapper());
+  JS::Rooted<JSObject*> wrapper(aCx, GetWrapper());
   JSAutoCompartment ac(aCx, wrapper);
   uint32_t length = mElements.Length();
   for (uint32_t i = 0; i < length; ++i) {
     JS::Value v = mElements.ElementAt(i)->GetItemValue(aCx, wrapper, aError);
     if (aError.Failed()) {
       return;
     }
     aResult.AppendElement(v);
--- a/content/html/document/src/nsHTMLDocument.cpp
+++ b/content/html/document/src/nsHTMLDocument.cpp
@@ -1542,17 +1542,17 @@ nsHTMLDocument::Open(JSContext* cx,
 #endif
 
     // Now make sure we're not flagged as the initial document anymore, now
     // that we've had stuff done to us.  From now on, if anyone tries to
     // document.open() us, they get a new inner window.
     SetIsInitialDocument(false);
 
     nsCOMPtr<nsIScriptGlobalObject> newScope(do_QueryReferent(mScopeObject));
-    JS::RootedObject wrapper(cx, GetWrapper());
+    JS::Rooted<JSObject*> wrapper(cx, GetWrapper());
     if (oldScope && newScope != oldScope && wrapper) {
       rv = mozilla::dom::ReparentWrapper(cx, wrapper);
       if (rv.Failed()) {
         return nullptr;
       }
       nsIXPConnect *xpc = nsContentUtils::XPConnect();
       rv = xpc->RescueOrphansInScope(cx, oldScope->GetGlobalJSObject());
       if (rv.Failed()) {
--- a/content/media/webaudio/AudioBuffer.cpp
+++ b/content/media/webaudio/AudioBuffer.cpp
@@ -65,17 +65,18 @@ AudioBuffer::ClearJSChannels()
 
 bool
 AudioBuffer::InitializeBuffers(uint32_t aNumberOfChannels, JSContext* aJSContext)
 {
   if (!mJSChannels.SetCapacity(aNumberOfChannels)) {
     return false;
   }
   for (uint32_t i = 0; i < aNumberOfChannels; ++i) {
-    JS::RootedObject array(aJSContext, JS_NewFloat32Array(aJSContext, mLength));
+    JS::Rooted<JSObject*> array(aJSContext,
+                                JS_NewFloat32Array(aJSContext, mLength));
     if (!array) {
       return false;
     }
     mJSChannels.AppendElement(array.get());
   }
 
   return true;
 }
@@ -90,17 +91,18 @@ bool
 AudioBuffer::RestoreJSChannelData(JSContext* aJSContext)
 {
   if (mSharedChannels) {
     for (uint32_t i = 0; i < mJSChannels.Length(); ++i) {
       const float* data = mSharedChannels->GetData(i);
       // The following code first zeroes the array and then copies our data
       // into it. We could avoid this with additional JS APIs to construct
       // an array (or ArrayBuffer) containing initial data.
-      JS::RootedObject array(aJSContext, JS_NewFloat32Array(aJSContext, mLength));
+      JS::Rooted<JSObject*> array(aJSContext,
+                                  JS_NewFloat32Array(aJSContext, mLength));
       if (!array) {
         return false;
       }
       memcpy(JS_GetFloat32ArrayData(array), data, sizeof(float)*mLength);
       mJSChannels[i] = array;
     }
 
     mSharedChannels = nullptr;
@@ -189,17 +191,18 @@ AudioBuffer::GetChannelData(JSContext* a
 
 static already_AddRefed<ThreadSharedFloatArrayBufferList>
 StealJSArrayDataIntoThreadSharedFloatArrayBufferList(JSContext* aJSContext,
                                                      const nsTArray<JSObject*>& aJSArrays)
 {
   nsRefPtr<ThreadSharedFloatArrayBufferList> result =
     new ThreadSharedFloatArrayBufferList(aJSArrays.Length());
   for (uint32_t i = 0; i < aJSArrays.Length(); ++i) {
-    JS::RootedObject arrayBuffer(aJSContext, JS_GetArrayBufferViewBuffer(aJSArrays[i]));
+    JS::Rooted<JSObject*> arrayBuffer(aJSContext,
+                                      JS_GetArrayBufferViewBuffer(aJSArrays[i]));
     void* dataToFree = nullptr;
     uint8_t* stolenData = nullptr;
     if (arrayBuffer &&
         JS_StealArrayBufferContents(aJSContext, arrayBuffer, &dataToFree,
                                     &stolenData)) {
       result->SetData(i, dataToFree, reinterpret_cast<float*>(stolenData));
     } else {
       return nullptr;
--- a/content/xbl/src/nsXBLBinding.cpp
+++ b/content/xbl/src/nsXBLBinding.cpp
@@ -1119,17 +1119,17 @@ nsXBLBinding::ResolveAllFields(JSContext
   if (mNextBinding) {
     return mNextBinding->ResolveAllFields(cx, obj);
   }
 
   return true;
 }
 
 bool
-nsXBLBinding::LookupMember(JSContext* aCx, JS::HandleId aId,
+nsXBLBinding::LookupMember(JSContext* aCx, JS::Handle<jsid> aId,
                            JS::MutableHandle<JSPropertyDescriptor> aDesc)
 {
   // We should never enter this function with a pre-filled property descriptor.
   MOZ_ASSERT(!aDesc.object());
 
   // Get the string as an nsString before doing anything, so we can make
   // convenient comparisons during our search.
   if (!JSID_IS_STRING(aId)) {
@@ -1148,47 +1148,47 @@ nsXBLBinding::LookupMember(JSContext* aC
     js::GetGlobalForObjectCrossCompartment(mBoundElement->GetWrapper()));
   JS::Rooted<JSObject*> xblScope(aCx, xpc::GetXBLScope(aCx, boundScope));
   NS_ENSURE_TRUE(xblScope, false);
   MOZ_ASSERT(boundScope != xblScope);
 
   // Enter the xbl scope and invoke the internal version.
   {
     JSAutoCompartment ac(aCx, xblScope);
-    JS::RootedId id(aCx, aId);
+    JS::Rooted<jsid> id(aCx, aId);
     if (!JS_WrapId(aCx, id.address()) ||
         !LookupMemberInternal(aCx, name, id, aDesc, xblScope))
     {
       return false;
     }
   }
 
   // Wrap into the caller's scope.
   return JS_WrapPropertyDescriptor(aCx, aDesc);
 }
 
 bool
 nsXBLBinding::LookupMemberInternal(JSContext* aCx, nsString& aName,
-                                   JS::HandleId aNameAsId,
+                                   JS::Handle<jsid> aNameAsId,
                                    JS::MutableHandle<JSPropertyDescriptor> aDesc,
                                    JS::Handle<JSObject*> aXBLScope)
 {
   // First, see if we have a JSClass. If we don't, it means that this binding
   // doesn't have a class object, and thus doesn't have any members. Skip it.
   if (!mJSClass) {
     if (!mNextBinding) {
       return true;
     }
     return mNextBinding->LookupMemberInternal(aCx, aName, aNameAsId,
                                               aDesc, aXBLScope);
   }
 
   // Find our class object. It's in a protected scope and permanent just in case,
   // so should be there no matter what.
-  JS::RootedValue classObject(aCx);
+  JS::Rooted<JS::Value> classObject(aCx);
   if (!JS_GetProperty(aCx, aXBLScope, mJSClass->name, &classObject)) {
     return false;
   }
 
   // The bound element may have been adoped by a document and have a different
   // wrapper (and different xbl scope) than when the binding was applied, in
   // this case getting the class object will fail. Behave as if the class
   // object did not exist.
--- a/content/xbl/src/nsXBLBinding.h
+++ b/content/xbl/src/nsXBLBinding.h
@@ -74,29 +74,31 @@ public:
   /*
    * Does a lookup for a method or attribute provided by one of the bindings'
    * prototype implementation. If found, |desc| will be set up appropriately,
    * and wrapped into cx->compartment.
    *
    * May only be called when XBL code is being run in a separate scope, because
    * otherwise we don't have untainted data with which to do a proper lookup.
    */
-  bool LookupMember(JSContext* aCx, JS::HandleId aId, JS::MutableHandle<JSPropertyDescriptor> aDesc);
+  bool LookupMember(JSContext* aCx, JS::Handle<jsid> aId,
+                    JS::MutableHandle<JSPropertyDescriptor> aDesc);
 
   /*
    * Determines whether the binding has a field with the given name.
    */
   bool HasField(nsString& aName);
 
 protected:
 
   /*
    * Internal version. Requires that aCx is in appropriate xbl scope.
    */
-  bool LookupMemberInternal(JSContext* aCx, nsString& aName, JS::HandleId aNameAsId,
+  bool LookupMemberInternal(JSContext* aCx, nsString& aName,
+                            JS::Handle<jsid> aNameAsId,
                             JS::MutableHandle<JSPropertyDescriptor> aDesc,
                             JS::Handle<JSObject*> aXBLScope);
 
 public:
 
   void MarkForDeath();
   bool MarkedForDeath() const { return mMarkedForDeath; }
 
--- a/content/xbl/src/nsXBLProtoImpl.cpp
+++ b/content/xbl/src/nsXBLProtoImpl.cpp
@@ -83,17 +83,17 @@ nsXBLProtoImpl::InstallImplementation(ns
   // not be the same compartment as globalObject.
   JS::Rooted<JSObject*> globalObject(cx,
     GetGlobalForObjectCrossCompartment(targetClassObject));
   JS::Rooted<JSObject*> scopeObject(cx, xpc::GetXBLScope(cx, globalObject));
   NS_ENSURE_TRUE(scopeObject, NS_ERROR_OUT_OF_MEMORY);
   JSAutoCompartment ac(cx, scopeObject);
 
   // If they're different, create our safe holder object in the XBL scope.
-  JS::RootedObject propertyHolder(cx);
+  JS::Rooted<JSObject*> propertyHolder(cx);
   if (scopeObject != globalObject) {
 
     // This is just a property holder, so it doesn't need any special JSClass.
     propertyHolder = JS_NewObjectWithGivenProto(cx, nullptr, nullptr, scopeObject);
     NS_ENSURE_TRUE(propertyHolder, NS_ERROR_OUT_OF_MEMORY);
 
     // Define it as a property on the scopeObject, using the same name used on
     // the content side.
@@ -242,17 +242,17 @@ nsXBLProtoImpl::CompilePrototypeMembers(
     }
   }
 
   return NS_OK;
 }
 
 bool
 nsXBLProtoImpl::LookupMember(JSContext* aCx, nsString& aName,
-                             JS::HandleId aNameAsId,
+                             JS::Handle<jsid> aNameAsId,
                              JS::MutableHandle<JSPropertyDescriptor> aDesc,
                              JSObject* aClassObject)
 {
   for (nsXBLProtoImplMember* m = mMembers; m; m = m->GetNext()) {
     if (aName.Equals(m->GetName())) {
       return JS_GetPropertyDescriptorById(aCx, aClassObject, aNameAsId, 0, aDesc);
     }
   }
--- a/content/xbl/src/nsXBLProtoImpl.h
+++ b/content/xbl/src/nsXBLProtoImpl.h
@@ -40,18 +40,19 @@ public:
   nsresult InstallImplementation(nsXBLPrototypeBinding* aPrototypeBinding, nsXBLBinding* aBinding);
   nsresult InitTargetObjects(nsXBLPrototypeBinding* aBinding,
                              nsIContent* aBoundElement,
                              nsIXPConnectJSObjectHolder** aScriptObjectHolder,
                              JS::MutableHandle<JSObject*> aTargetClassObject,
                              bool* aTargetIsNew);
   nsresult CompilePrototypeMembers(nsXBLPrototypeBinding* aBinding);
 
-  bool LookupMember(JSContext* aCx, nsString& aName, JS::HandleId aNameAsId,
-                    JS::MutableHandle<JSPropertyDescriptor> aDesc, JSObject* aClassObject);
+  bool LookupMember(JSContext* aCx, nsString& aName, JS::Handle<jsid> aNameAsId,
+                    JS::MutableHandle<JSPropertyDescriptor> aDesc,
+                    JSObject* aClassObject);
 
   void SetMemberList(nsXBLProtoImplMember* aMemberList)
   {
     delete mMembers;
     mMembers = aMemberList;
   }
 
   void SetFieldList(nsXBLProtoImplField* aFieldList)
--- a/content/xbl/src/nsXBLProtoImplMethod.cpp
+++ b/content/xbl/src/nsXBLProtoImplMethod.cpp
@@ -190,19 +190,18 @@ nsXBLProtoImplMethod::CompileMember(cons
   }
 
   AutoJSContext cx;
   JSAutoCompartment ac(cx, aClassObject);
   JS::CompileOptions options(cx);
   options.setFileAndLine(functionUri.get(),
                          uncompiledMethod->mBodyText.GetLineNumber())
          .setVersion(JSVERSION_LATEST);
-  JS::RootedObject rootedNull(cx, nullptr); // See bug 781070.
-  JS::RootedObject methodObject(cx);
-  nsresult rv = nsJSUtils::CompileFunction(cx, rootedNull, options, cname,
+  JS::Rooted<JSObject*> methodObject(cx);
+  nsresult rv = nsJSUtils::CompileFunction(cx, JS::NullPtr(), options, cname,
                                            paramCount,
                                            const_cast<const char**>(args),
                                            body, methodObject.address());
 
   // Destroy our uncompiled method and delete our arg list.
   delete uncompiledMethod;
   delete [] args;
   if (NS_FAILED(rv)) {
--- a/content/xbl/src/nsXBLProtoImplProperty.cpp
+++ b/content/xbl/src/nsXBLProtoImplProperty.cpp
@@ -189,20 +189,19 @@ nsXBLProtoImplProperty::CompileMember(co
     nsDependentString getter(getterText->GetText());
     if (!getter.IsEmpty()) {
       AutoJSContext cx;
       JSAutoCompartment ac(cx, aClassObject);
       JS::CompileOptions options(cx);
       options.setFileAndLine(functionUri.get(), getterText->GetLineNumber())
              .setVersion(JSVERSION_LATEST);
       nsCString name = NS_LITERAL_CSTRING("get_") + NS_ConvertUTF16toUTF8(mName);
-      JS::RootedObject rootedNull(cx, nullptr); // See bug 781070.
-      JS::RootedObject getterObject(cx);
-      rv = nsJSUtils::CompileFunction(cx, rootedNull, options, name, 0, nullptr,
-                                      getter, getterObject.address());
+      JS::Rooted<JSObject*> getterObject(cx);
+      rv = nsJSUtils::CompileFunction(cx, JS::NullPtr(), options, name, 0,
+                                      nullptr, getter, getterObject.address());
 
       delete getterText;
       deletedGetter = true;
 
       mGetter.SetJSFunction(getterObject);
     
       if (mGetter.GetJSFunction() && NS_SUCCEEDED(rv)) {
         mJSAttributes |= JSPROP_GETTER | JSPROP_SHARED;
@@ -236,20 +235,20 @@ nsXBLProtoImplProperty::CompileMember(co
     nsDependentString setter(setterText->GetText());
     if (!setter.IsEmpty()) {
       AutoJSContext cx;
       JSAutoCompartment ac(cx, aClassObject);
       JS::CompileOptions options(cx);
       options.setFileAndLine(functionUri.get(), setterText->GetLineNumber())
              .setVersion(JSVERSION_LATEST);
       nsCString name = NS_LITERAL_CSTRING("set_") + NS_ConvertUTF16toUTF8(mName);
-      JS::RootedObject rootedNull(cx, nullptr); // See bug 781070.
-      JS::RootedObject setterObject(cx);
-      rv = nsJSUtils::CompileFunction(cx, rootedNull, options, name, 1,
-                                      gPropertyArgs, setter, setterObject.address());
+      JS::Rooted<JSObject*> setterObject(cx);
+      rv = nsJSUtils::CompileFunction(cx, JS::NullPtr(), options, name, 1,
+                                      gPropertyArgs, setter,
+                                      setterObject.address());
 
       delete setterText;
       deletedSetter = true;
       mSetter.SetJSFunction(setterObject);
 
       if (mSetter.GetJSFunction() && NS_SUCCEEDED(rv)) {
         mJSAttributes |= JSPROP_SETTER | JSPROP_SHARED;
       }
--- a/content/xbl/src/nsXBLPrototypeHandler.cpp
+++ b/content/xbl/src/nsXBLPrototypeHandler.cpp
@@ -377,21 +377,21 @@ nsXBLPrototypeHandler::EnsureEventHandle
                                    &argNames);
 
   // Compile the event handler in the xbl scope.
   JSAutoCompartment ac(cx, scopeObject);
   JS::CompileOptions options(cx);
   options.setFileAndLine(bindingURI.get(), mLineNumber)
          .setVersion(JSVERSION_LATEST);
 
-  JS::Rooted<JSObject*> rootedNull(cx); // See bug 781070.
   JS::Rooted<JSObject*> handlerFun(cx);
-  nsresult rv = nsJSUtils::CompileFunction(cx, rootedNull, options,
+  nsresult rv = nsJSUtils::CompileFunction(cx, JS::NullPtr(), options,
                                            nsAtomCString(aName), argCount,
-                                           argNames, handlerText, handlerFun.address());
+                                           argNames, handlerText,
+                                           handlerFun.address());
   NS_ENSURE_SUCCESS(rv, rv);
   NS_ENSURE_TRUE(handlerFun, NS_ERROR_FAILURE);
 
   // Wrap the handler into the content scope, since we're about to stash it
   // on the DOM window and such.
   JSAutoCompartment ac2(cx, globalObject);
   bool ok = JS_WrapObject(cx, &handlerFun);
   NS_ENSURE_TRUE(ok, NS_ERROR_OUT_OF_MEMORY);
--- a/content/xslt/src/xslt/txMozillaXSLTProcessor.cpp
+++ b/content/xslt/src/xslt/txMozillaXSLTProcessor.cpp
@@ -1436,20 +1436,21 @@ txVariable::Convert(nsIVariant *aValue, 
 
             // Convert random JS Objects to a string.
             nsCOMPtr<nsIXPConnectJSObjectHolder> holder =
                 do_QueryInterface(supports);
             if (holder) {
                 JSContext* cx = nsContentUtils::GetCurrentJSContext();
                 NS_ENSURE_TRUE(cx, NS_ERROR_NOT_AVAILABLE);
 
-                JS::RootedObject jsobj(cx, holder->GetJSObject());
+                JS::Rooted<JSObject*> jsobj(cx, holder->GetJSObject());
                 NS_ENSURE_STATE(jsobj);
 
-                JS::RootedString str(cx, JS_ValueToString(cx, OBJECT_TO_JSVAL(jsobj)));
+                JS::Rooted<JSString*> str(cx,
+                    JS_ValueToString(cx, OBJECT_TO_JSVAL(jsobj)));
                 NS_ENSURE_TRUE(str, NS_ERROR_FAILURE);
 
                 nsDependentJSString value;
                 NS_ENSURE_TRUE(value.init(cx, str), NS_ERROR_FAILURE);
 
                 *aResult = new StringResult(value, nullptr);
                 if (!*aResult) {
                     return NS_ERROR_OUT_OF_MEMORY;
--- a/content/xul/content/src/nsXULElement.cpp
+++ b/content/xul/content/src/nsXULElement.cpp
@@ -2628,17 +2628,17 @@ nsXULPrototypeScript::Compile(const PRUn
     options.setPrincipals(nsJSPrincipals::get(aDocument->NodePrincipal()))
            .setFileAndLine(urlspec.get(), aLineNo)
            .setVersion(JSVersion(mLangVersion));
     // If the script was inline, tell the JS parser to save source for
     // Function.prototype.toSource(). If it's out of line, we retrieve the
     // source from the files on demand.
     options.setSourcePolicy(mOutOfLine ? JS::CompileOptions::LAZY_SOURCE
                                        : JS::CompileOptions::SAVE_SOURCE);
-    JS::RootedObject scope(cx, JS::CurrentGlobalOrNull(cx));
+    JS::Rooted<JSObject*> scope(cx, JS::CurrentGlobalOrNull(cx));
     if (scope) {
       JS::ExposeObjectToActiveJS(scope);
     }
 
     if (aOffThreadReceiver && JS::CanCompileOffThread(cx, options)) {
         if (!JS::CompileOffThread(cx, scope, options,
                                   static_cast<const jschar*>(aText), aTextLength,
                                   OffThreadScriptReceiverCallback,
--- a/dom/audiochannel/AudioChannelService.cpp
+++ b/dom/audiochannel/AudioChannelService.cpp
@@ -672,17 +672,17 @@ AudioChannelService::Observe(nsISupports
 
     JS::Rooted<JSObject*> obj(cx, &val.toObject());
     JS::Rooted<JS::Value> key(cx);
     if (!JS_GetProperty(cx, obj, "key", &key) ||
         !key.isString()) {
       return NS_OK;
     }
 
-    JS::RootedString jsKey(cx, JS_ValueToString(cx, key));
+    JS::Rooted<JSString*> jsKey(cx, JS_ValueToString(cx, key));
     if (!jsKey) {
       return NS_OK;
     }
     nsDependentJSString keyStr;
     if (!keyStr.init(cx, jsKey) || keyStr.Find("audio.volume.", 0, false)) {
       return NS_OK;
     }
 
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -1376,17 +1376,17 @@ nsDOMClassInfo::GetArrayIndexFromId(JSCo
   if (aIsNumber) {
     *aIsNumber = false;
   }
 
   int i;
   if (JSID_IS_INT(id)) {
       i = JSID_TO_INT(id);
   } else {
-      JS::RootedValue idval(cx);
+      JS::Rooted<JS::Value> idval(cx);
       double array_index;
       if (!::JS_IdToValue(cx, id, idval.address()) ||
           !JS::ToNumber(cx, idval, &array_index) ||
           !::JS_DoubleIsInt32(array_index, &i)) {
         return -1;
       }
   }
 
@@ -3433,17 +3433,17 @@ DefineComponentsShim(JSContext *cx, JS::
 }
 
 NS_IMETHODIMP
 nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
                        JSObject *obj_, jsid id_, uint32_t flags,
                        JSObject **objp, bool *_retval)
 {
   JS::Rooted<JSObject*> obj(cx, obj_);
-  JS::RootedId id(cx, id_);
+  JS::Rooted<jsid> id(cx, id_);
 
   if (!JSID_IS_STRING(id)) {
     return NS_OK;
   }
 
   MOZ_ASSERT(*_retval == true); // guaranteed by XPC_WN_Helper_NewResolve
 
   nsGlobalWindow *win = nsGlobalWindow::FromWrapper(wrapper);
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -10391,17 +10391,17 @@ nsGlobalWindow::ShowSlowScriptDialog()
 
   // Get the nsIPrompt interface from the docshell
   nsCOMPtr<nsIDocShell> ds = GetDocShell();
   NS_ENSURE_TRUE(ds, KillSlowScript);
   nsCOMPtr<nsIPrompt> prompt = do_GetInterface(ds);
   NS_ENSURE_TRUE(prompt, KillSlowScript);
 
   // Check if we should offer the option to debug
-  JS::RootedScript script(cx);
+  JS::Rooted<JSScript*> script(cx);
   unsigned lineno;
   bool hasFrame = JS_DescribeScriptedCaller(cx, &script, &lineno);
 
   bool debugPossible = hasFrame && js::CanCallContextDebugHandler(cx);
 #ifdef MOZ_JSDEBUGGER
   // Get the debugger service if necessary.
   if (debugPossible) {
     bool jsds_IsOn = false;
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -504,17 +504,17 @@ void
 NS_ScriptErrorReporter(JSContext *cx,
                        const char *message,
                        JSErrorReport *report)
 {
   // We don't want to report exceptions too eagerly, but warnings in the
   // absence of werror are swallowed whole, so report those now.
   if (!JSREPORT_IS_WARNING(report->flags)) {
     nsIXPConnect* xpc = nsContentUtils::XPConnect();
-    JS::RootedScript script(cx);
+    JS::Rooted<JSScript*> script(cx);
     if (JS_DescribeScriptedCaller(cx, &script, nullptr)) {
       xpc->MarkErrorUnreported(cx);
       return;
     }
 
     if (xpc) {
       nsAXPCNativeCallContext *cc = nullptr;
       xpc->GetCurrentNativeCallContext(&cc);
--- a/dom/base/nsJSUtils.cpp
+++ b/dom/base/nsJSUtils.cpp
@@ -26,17 +26,17 @@
 #include "nsJSPrincipals.h"
 #include "xpcpublic.h"
 #include "nsContentUtils.h"
 
 bool
 nsJSUtils::GetCallingLocation(JSContext* aContext, const char* *aFilename,
                               uint32_t* aLineno)
 {
-  JS::RootedScript script(aContext);
+  JS::Rooted<JSScript*> script(aContext);
   unsigned lineno = 0;
 
   if (!JS_DescribeScriptedCaller(aContext, &script, &lineno)) {
     return false;
   }
 
   *aFilename = ::JS_GetScriptFilename(aContext, script);
   *aLineno = lineno;
@@ -151,17 +151,17 @@ nsJSUtils::ReportPendingException(JSCont
     if (saved) {
       JS_RestoreFrameChain(aContext);
     }
   }
 }
 
 nsresult
 nsJSUtils::CompileFunction(JSContext* aCx,
-                           JS::HandleObject aTarget,
+                           JS::Handle<JSObject*> aTarget,
                            JS::CompileOptions& aOptions,
                            const nsACString& aName,
                            uint32_t aArgCount,
                            const char** aArgArray,
                            const nsAString& aBody,
                            JSObject** aFunctionObject)
 {
   MOZ_ASSERT(js::GetEnterCompartmentDepth(aCx) > 0);
@@ -258,17 +258,17 @@ nsJSUtils::EvaluateString(JSContext* aCx
     dontReport.construct(aCx);
   }
 
   // Scope the JSAutoCompartment so that we can later wrap the return value
   // into the caller's cx.
   {
     JSAutoCompartment ac(aCx, aScopeObject);
 
-    JS::RootedObject rootedScope(aCx, aScopeObject);
+    JS::Rooted<JSObject*> rootedScope(aCx, aScopeObject);
     if (aOffThreadToken) {
       JSScript *script = JS::FinishOffThreadScript(aCx, JS_GetRuntime(aCx), *aOffThreadToken);
       *aOffThreadToken = nullptr; // Mark the token as having been finished.
       if (script) {
         ok = JS_ExecuteScript(aCx, rootedScope, script, aRetValue);
       } else {
         ok = false;
       }
@@ -289,17 +289,17 @@ nsJSUtils::EvaluateString(JSContext* aCx
     if (aEvaluateOptions.reportUncaught) {
       ReportPendingException(aCx);
       if (aRetValue) {
         *aRetValue = JS::UndefinedValue();
       }
     } else {
       rv = JS_IsExceptionPending(aCx) ? NS_ERROR_FAILURE
                                       : NS_ERROR_OUT_OF_MEMORY;
-      JS::RootedValue exn(aCx);
+      JS::Rooted<JS::Value> exn(aCx);
       JS_GetPendingException(aCx, &exn);
       if (aRetValue) {
         *aRetValue = exn;
       }
       JS_ClearPendingException(aCx);
     }
   }
 
--- a/dom/base/nsJSUtils.h
+++ b/dom/base/nsJSUtils.h
@@ -48,17 +48,17 @@ public:
   /**
    * Report a pending exception on aContext, if any.  Note that this
    * can be called when the context has a JS stack.  If that's the
    * case, the stack will be set aside before reporting the exception.
    */
   static void ReportPendingException(JSContext *aContext);
 
   static nsresult CompileFunction(JSContext* aCx,
-                                  JS::HandleObject aTarget,
+                                  JS::Handle<JSObject*> aTarget,
                                   JS::CompileOptions& aOptions,
                                   const nsACString& aName,
                                   uint32_t aArgCount,
                                   const char** aArgArray,
                                   const nsAString& aBody,
                                   JSObject** aFunctionObject);
 
   struct EvaluateOptions {
--- a/dom/base/nsScreen.cpp
+++ b/dom/base/nsScreen.cpp
@@ -259,17 +259,17 @@ nsScreen::MozLockOrientation(const JS::V
       }
 
       for (uint32_t i = 0; i < length; ++i) {
         JS::Rooted<JS::Value> temp(aCx);
         if (!JS_GetElement(aCx, seq, i, &temp)) {
           return NS_ERROR_FAILURE;
         }
 
-        JS::RootedString jsString(aCx, JS_ValueToString(aCx, temp));
+        JS::Rooted<JSString*> jsString(aCx, JS_ValueToString(aCx, temp));
         if (!jsString) {
           return NS_ERROR_FAILURE;
         }
 
         nsDependentJSString str;
         if (!str.init(aCx, jsString)) {
           return NS_ERROR_FAILURE;
         }
@@ -278,17 +278,17 @@ nsScreen::MozLockOrientation(const JS::V
       }
 
       ErrorResult rv;
       *aReturn = MozLockOrientation(orientations, rv);
       return rv.ErrorCode();
     }
   }
 
-  JS::RootedString jsString(aCx, JS_ValueToString(aCx, aOrientation));
+  JS::Rooted<JSString*> jsString(aCx, JS_ValueToString(aCx, aOrientation));
   if (!jsString) {
     return NS_ERROR_FAILURE;
   }
 
   nsDependentJSString orientation;
   if (!orientation.init(aCx, jsString)) {
     return NS_ERROR_FAILURE;
   }
--- a/dom/bindings/BindingDeclarations.h
+++ b/dom/bindings/BindingDeclarations.h
@@ -78,17 +78,17 @@ public:
   }
 
   bool Failed() const
   {
     return !Get();
   }
 
 protected:
-  JS::RootedObject mGlobalJSObject;
+  JS::Rooted<JSObject*> mGlobalJSObject;
   JSContext* mCx;
   mutable nsISupports* mGlobalObject;
   mutable nsCOMPtr<nsISupports> mGlobalObjectRef;
 };
 
 // Class for representing optional arguments.
 template<typename T, typename InternalType>
 class Optional_base
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -3724,17 +3724,17 @@ for (uint32_t i = 0; i < length; ++i) {
 
         if failureCode is None:
             notDate = ('ThrowErrorMessage(cx, MSG_NOT_DATE, "%s");\n'
                        "%s" % (firstCap(sourceDescription), exceptionCode))
         else:
             notDate = failureCode
 
         conversion = (
-            "JS::RootedObject possibleDateObject(cx, &${val}.toObject());\n"
+            "JS::Rooted<JSObject*> possibleDateObject(cx, &${val}.toObject());\n"
             "if (!JS_ObjectIsDate(cx, possibleDateObject) ||\n"
             "    !%s.SetTimeStamp(cx, possibleDateObject)) {\n"
             "%s\n"
             "}" %
             (dateVal, CGIndenter(CGGeneric(notDate)).define()))
 
         conversion = wrapObjectTemplate(conversion, type,
                                         "${declName}.SetNull()", notDate)
@@ -4708,26 +4708,26 @@ def wrapTypeIntoCurrentCompartment(type,
     """
     Take the thing named by "value" and if it contains "any",
     "object", or spidermonkey-interface types inside return a CGThing
     that will wrap them into the current compartment.
     """
     if type.isAny():
         assert not type.nullable()
         if isMember:
-            value = "JS::MutableHandleValue::fromMarkedLocation(&%s)" % value
+            value = "JS::MutableHandle<JS::Value>::fromMarkedLocation(&%s)" % value
         else:
             value = "&" + value
         return CGGeneric("if (!JS_WrapValue(cx, %s)) {\n"
                          "  return false;\n"
                          "}" % value)
 
     if type.isObject():
         if isMember:
-            value = "JS::MutableHandleObject::fromMarkedLocation(&%s)" % value
+            value = "JS::MutableHandle<JSObject*>::fromMarkedLocation(&%s)" % value
         else:
             value = "&" + value
         return CGGeneric("if (!JS_WrapObject(cx, %s)) {\n"
                          "  return false;\n"
                          "}" % value)
 
     if type.isSpiderMonkeyInterface():
         origValue = value
@@ -5530,17 +5530,17 @@ class CGAbstractBindingMethod(CGAbstract
                     getThisObj = "&args.thisv().toObject()"
                 unwrapFailureCode = self.unwrapFailureCode % {'securityError': 'false'}
                 ensureThisObj = CGIfWrapper(CGGeneric(unwrapFailureCode),
                                             ensureCondition)
             else:
                 ensureThisObj = None
             self.getThisObj = CGList(
                 [ensureThisObj,
-                 CGGeneric("JS::RootedObject obj(cx, %s);\n" %
+                 CGGeneric("JS::Rooted<JSObject*> obj(cx, %s);\n" %
                            getThisObj)],
                 "\n")
         self.callArgs = callArgs
 
     def definition_body(self):
         # Our descriptor might claim that we're not castable, simply because
         # we're someone's consequential interface.  But for this-unwrapping, we
         # know that we're the real deal.  So fake a descriptor here for
@@ -5570,17 +5570,17 @@ class CGAbstractStaticBindingMethod(CGAb
     """
     def __init__(self, descriptor, name):
         args = [Argument('JSContext*', 'cx'), Argument('unsigned', 'argc'),
                 Argument('JS::Value*', 'vp')]
         CGAbstractStaticMethod.__init__(self, descriptor, name, "bool", args)
 
     def definition_body(self):
         unwrap = CGGeneric("""JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
-JS::RootedObject obj(cx, args.computeThis(cx).toObjectOrNull());
+JS::Rooted<JSObject*> obj(cx, args.computeThis(cx).toObjectOrNull());
 if (!obj) {
   return false;
 }""")
         return CGList([ CGIndenter(unwrap),
                         self.generate_code() ], "\n\n").define()
 
     def generate_code(self):
         assert(False) # Override me
@@ -5951,17 +5951,17 @@ class CGSpecializedForwardingSetter(CGSp
         CGSpecializedSetter.__init__(self, descriptor, attr)
 
     def definition_body(self):
         attrName = self.attr.identifier.name
         forwardToAttrName = self.attr.getExtendedAttribute("PutForwards")[0]
         # JS_GetProperty and JS_SetProperty can only deal with ASCII
         assert all(ord(c) < 128 for c in attrName)
         assert all(ord(c) < 128 for c in forwardToAttrName)
-        return CGIndenter(CGGeneric("""JS::RootedValue v(cx);
+        return CGIndenter(CGGeneric("""JS::Rooted<JS::Value> v(cx);
 if (!JS_GetProperty(cx, obj, "%s", &v)) {
   return false;
 }
 
 if (!v.isObject()) {
   return ThrowErrorMessage(cx, MSG_NOT_OBJECT, "%s.%s");
 }
 
--- a/dom/bindings/DOMJSProxyHandler.cpp
+++ b/dom/bindings/DOMJSProxyHandler.cpp
@@ -275,17 +275,17 @@ DOMProxyHandler::has(JSContext* cx, JS::
     *bp = protoHasProp;
   }
   return ok;
 }
 
 int32_t
 IdToInt32(JSContext* cx, JS::Handle<jsid> id)
 {
-  JS::RootedValue idval(cx);
+  JS::Rooted<JS::Value> idval(cx);
   double array_index;
   int32_t i;
   if (!::JS_IdToValue(cx, id, idval.address()) ||
       !JS::ToNumber(cx, idval, &array_index) ||
       !::JS_DoubleIsInt32(array_index, &i)) {
     return -1;
   }
 
--- a/dom/bindings/Exceptions.cpp
+++ b/dom/bindings/Exceptions.cpp
@@ -365,17 +365,17 @@ JSStackFrame::CreateStack(JSContext* cx)
       self->mFilename =
         (char*)nsMemory::Clone(filename, sizeof(char)*(strlen(filename)+1));
     }
 
     self->mLineno = desc->frames[i].lineno;
 
     JSFunction* fun = desc->frames[i].fun;
     if (fun) {
-      JS::RootedString funid(cx, JS_GetFunctionDisplayId(fun));
+      JS::Rooted<JSString*> funid(cx, JS_GetFunctionDisplayId(fun));
       if (funid) {
         size_t length = JS_GetStringEncodingLength(cx, funid);
         if (length != size_t(-1)) {
           self->mFunname = static_cast<char *>(nsMemory::Alloc(length + 1));
           if (self->mFunname) {
             JS_EncodeStringToBuffer(cx, funid, self->mFunname, length);
             self->mFunname[length] = '\0';
           }
--- a/dom/bindings/TypedArray.h
+++ b/dom/bindings/TypedArray.h
@@ -89,17 +89,18 @@ public:
 
   inline JSObject *Obj() const {
     MOZ_ASSERT(inited());
     return mObj;
   }
 
   inline bool WrapIntoNewCompartment(JSContext* cx)
   {
-    return JS_WrapObject(cx, JS::MutableHandleObject::fromMarkedLocation(&mObj));
+    return JS_WrapObject(cx,
+      JS::MutableHandle<JSObject*>::fromMarkedLocation(&mObj));
   }
 
 protected:
   inline void DoInit(JSObject* obj)
   {
     mObj = UnboxArray(obj, &mLength, &mData);
   }
 
--- a/dom/bluetooth/BluetoothUtils.cpp
+++ b/dom/bluetooth/BluetoothUtils.cpp
@@ -106,17 +106,17 @@ GetAddressFromObjectPath(const nsAString
 bool
 BroadcastSystemMessage(const nsAString& aType,
                        const InfallibleTArray<BluetoothNamedValue>& aData)
 {
   mozilla::AutoSafeJSContext cx;
   NS_ASSERTION(!::JS_IsExceptionPending(cx),
       "Shouldn't get here when an exception is pending!");
 
-  JS::RootedObject obj(cx, JS_NewObject(cx, nullptr, nullptr, nullptr));
+  JS::Rooted<JSObject*> obj(cx, JS_NewObject(cx, nullptr, nullptr, nullptr));
   if (!obj) {
     BT_WARNING("Failed to new JSObject for system message!");
     return false;
   }
 
   if (!SetJsObject(cx, aData, obj)) {
     BT_WARNING("Failed to set properties of system message!");
     return false;
--- a/dom/indexedDB/IDBKeyRange.cpp
+++ b/dom/indexedDB/IDBKeyRange.cpp
@@ -58,17 +58,17 @@ IDBKeyRange::FromJSVal(JSContext* aCx,
   nsRefPtr<IDBKeyRange> keyRange;
 
   if (aVal.isNullOrUndefined()) {
     // undefined and null returns no IDBKeyRange.
     keyRange.forget(aKeyRange);
     return NS_OK;
   }
 
-  JS::RootedObject obj(aCx, aVal.isObject() ? &aVal.toObject() : nullptr);
+  JS::Rooted<JSObject*> obj(aCx, aVal.isObject() ? &aVal.toObject() : nullptr);
   if (aVal.isPrimitive() || JS_IsArrayObject(aCx, obj) ||
       JS_ObjectIsDate(aCx, obj)) {
     // A valid key returns an 'only' IDBKeyRange.
     keyRange = new IDBKeyRange(nullptr, false, false, true);
 
     nsresult rv = GetKeyFromJSVal(aCx, aVal, keyRange->Lower());
     if (NS_FAILED(rv)) {
       return rv;
@@ -154,17 +154,17 @@ IDBKeyRange::DropJSObjects()
 }
 
 IDBKeyRange::~IDBKeyRange()
 {
   DropJSObjects();
 }
 
 JSObject*
-IDBKeyRange::WrapObject(JSContext* aCx, JS::HandleObject aScope)
+IDBKeyRange::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
 {
   return IDBKeyRangeBinding::Wrap(aCx, aScope, this);
 }
 
 JS::Value
 IDBKeyRange::GetLower(JSContext* aCx, ErrorResult& aRv)
 {
   MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");
@@ -206,17 +206,17 @@ IDBKeyRange::GetUpper(JSContext* aCx, Er
   }
 
   return mCachedUpperVal;
 }
 
 // static
 already_AddRefed<IDBKeyRange>
 IDBKeyRange::Only(const GlobalObject& aGlobal, JSContext* aCx,
-                  JS::HandleValue aValue, ErrorResult& aRv)
+                  JS::Handle<JS::Value> aValue, ErrorResult& aRv)
 {
   MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");
 
   nsRefPtr<IDBKeyRange> keyRange =
     new IDBKeyRange(aGlobal.GetAsSupports(), false, false, true);
 
   aRv = GetKeyFromJSVal(aCx, aValue, keyRange->Lower());
   if (aRv.Failed()) {
@@ -224,17 +224,18 @@ IDBKeyRange::Only(const GlobalObject& aG
   }
 
   return keyRange.forget();
 }
 
 // static
 already_AddRefed<IDBKeyRange>
 IDBKeyRange::LowerBound(const GlobalObject& aGlobal, JSContext* aCx,
-                        JS::HandleValue aValue, bool aOpen, ErrorResult& aRv)
+                        JS::Handle<JS::Value> aValue, bool aOpen,
+                        ErrorResult& aRv)
 {
   MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");
 
   nsRefPtr<IDBKeyRange> keyRange =
     new IDBKeyRange(aGlobal.GetAsSupports(), aOpen, true, false);
 
   aRv = GetKeyFromJSVal(aCx, aValue, keyRange->Lower());
   if (aRv.Failed()) {
@@ -242,17 +243,18 @@ IDBKeyRange::LowerBound(const GlobalObje
   }
 
   return keyRange.forget();
 }
 
 // static
 already_AddRefed<IDBKeyRange>
 IDBKeyRange::UpperBound(const GlobalObject& aGlobal, JSContext* aCx,
-                        JS::HandleValue aValue, bool aOpen, ErrorResult& aRv)
+                        JS::Handle<JS::Value> aValue, bool aOpen,
+                        ErrorResult& aRv)
 {
   MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");
 
   nsRefPtr<IDBKeyRange> keyRange =
     new IDBKeyRange(aGlobal.GetAsSupports(), true, aOpen, false);
 
   aRv = GetKeyFromJSVal(aCx, aValue, keyRange->Upper());
   if (aRv.Failed()) {
@@ -260,17 +262,17 @@ IDBKeyRange::UpperBound(const GlobalObje
   }
 
   return keyRange.forget();
 }
 
 // static
 already_AddRefed<IDBKeyRange>
 IDBKeyRange::Bound(const GlobalObject& aGlobal, JSContext* aCx,
-                   JS::HandleValue aLower, JS::HandleValue aUpper,
+                   JS::Handle<JS::Value> aLower, JS::Handle<JS::Value> aUpper,
                    bool aLowerOpen, bool aUpperOpen, ErrorResult& aRv)
 {
   MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");
 
   nsRefPtr<IDBKeyRange> keyRange =
     new IDBKeyRange(aGlobal.GetAsSupports(), aLowerOpen, aUpperOpen, false);
 
   aRv = GetKeyFromJSVal(aCx, aLower, keyRange->Lower());
--- a/dom/indexedDB/IDBKeyRange.h
+++ b/dom/indexedDB/IDBKeyRange.h
@@ -143,17 +143,17 @@ public:
 
   template <class T>
   void ToSerializedKeyRange(T& aKeyRange);
 
   void DropJSObjects();
 
   // WebIDL
   JSObject*
-  WrapObject(JSContext* aCx, JS::HandleObject aScope);
+  WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope);
 
   nsISupports*
   GetParentObject() const
   {
     return mGlobal;
   }
 
   JS::Value
@@ -170,31 +170,31 @@ public:
 
   bool
   UpperOpen() const
   {
     return mUpperOpen;
   }
 
   static already_AddRefed<IDBKeyRange>
-  Only(const GlobalObject& aGlobal, JSContext* aCx, JS::HandleValue aValue,
-       ErrorResult& aRv);
+  Only(const GlobalObject& aGlobal, JSContext* aCx,
+       JS::Handle<JS::Value> aValue, ErrorResult& aRv);
 
   static already_AddRefed<IDBKeyRange>
   LowerBound(const GlobalObject& aGlobal, JSContext* aCx,
-             JS::HandleValue aValue, bool aOpen, ErrorResult& aRv);
+             JS::Handle<JS::Value> aValue, bool aOpen, ErrorResult& aRv);
 
   static already_AddRefed<IDBKeyRange>
   UpperBound(const GlobalObject& aGlobal, JSContext* aCx,
-             JS::HandleValue aValue, bool aOpen, ErrorResult& aRv);
+             JS::Handle<JS::Value> aValue, bool aOpen, ErrorResult& aRv);
 
   static already_AddRefed<IDBKeyRange>
-  Bound(const GlobalObject& aGlobal, JSContext* aCx, JS::HandleValue aLower,
-        JS::HandleValue aUpper, bool aLowerOpen, bool aUpperOpen,
-        ErrorResult& aRv);
+  Bound(const GlobalObject& aGlobal, JSContext* aCx,
+        JS::Handle<JS::Value> aLower, JS::Handle<JS::Value> aUpper,
+        bool aLowerOpen, bool aUpperOpen, ErrorResult& aRv);
 
 private:
   IDBKeyRange(nsISupports* aGlobal,
               bool aLowerOpen,
               bool aUpperOpen,
               bool aIsOnly)
   : mGlobal(aGlobal), mCachedLowerVal(JSVAL_VOID), mCachedUpperVal(JSVAL_VOID),
     mLowerOpen(aLowerOpen), mUpperOpen(aUpperOpen), mIsOnly(aIsOnly),
--- a/dom/indexedDB/IDBObjectStore.cpp
+++ b/dom/indexedDB/IDBObjectStore.cpp
@@ -356,17 +356,18 @@ public:
   : ObjectStoreHelper(aTransaction, aRequest, aObjectStore),
     mKeyRange(aKeyRange), mDirection(aDirection)
   { }
 
   virtual nsresult
   DoDatabaseWork(mozIStorageConnection* aConnection) MOZ_OVERRIDE;
 
   virtual nsresult
-  GetSuccessResult(JSContext* aCx, JS::MutableHandleValue aVal) MOZ_OVERRIDE;
+  GetSuccessResult(JSContext* aCx, JS::MutableHandle<JS::Value> aVal)
+                   MOZ_OVERRIDE;
 
   virtual void
   ReleaseMainThreadObjects() MOZ_OVERRIDE;
 
   virtual nsresult
   PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams) MOZ_OVERRIDE;
 
   virtual ChildProcessSendResult
@@ -504,17 +505,18 @@ public:
   : ObjectStoreHelper(aTransaction, aRequest, aObjectStore),
     mKeyRange(aKeyRange), mLimit(aLimit)
   { }
 
   virtual nsresult
   DoDatabaseWork(mozIStorageConnection* aConnection) MOZ_OVERRIDE;
 
   virtual nsresult
-  GetSuccessResult(JSContext* aCx, JS::MutableHandleValue aVal) MOZ_OVERRIDE;
+  GetSuccessResult(JSContext* aCx, JS::MutableHandle<JS::Value> aVal)
+                   MOZ_OVERRIDE;
 
   virtual void
   ReleaseMainThreadObjects() MOZ_OVERRIDE;
 
   virtual nsresult
   PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams) MOZ_OVERRIDE;
 
   virtual ChildProcessSendResult
@@ -2960,17 +2962,17 @@ IDBObjectStore::Count(JSContext* aCx,
     ENSURE_SUCCESS(aRv, nullptr);
   }
 
   return CountInternal(keyRange, aRv);
 }
 
 already_AddRefed<IDBRequest>
 IDBObjectStore::GetAllKeys(JSContext* aCx,
-                           const Optional<JS::HandleValue>& aKey,
+                           const Optional<JS::Handle<JS::Value>>& aKey,
                            const Optional<uint32_t>& aLimit, ErrorResult& aRv)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   if (!mTransaction->IsOpen()) {
     aRv.Throw(NS_ERROR_DOM_INDEXEDDB_TRANSACTION_INACTIVE_ERR);
     return nullptr;
   }
@@ -2986,18 +2988,18 @@ IDBObjectStore::GetAllKeys(JSContext* aC
     limit = aLimit.Value();
   }
 
   return GetAllKeysInternal(keyRange, limit, aRv);
 }
 
 already_AddRefed<IDBRequest>
 IDBObjectStore::OpenKeyCursor(JSContext* aCx,
-                              const Optional<JS::HandleValue>& aRange,
-                              IDBCursorDirection aDirection,  ErrorResult& aRv)
+                              const Optional<JS::Handle<JS::Value>>& aRange,
+                              IDBCursorDirection aDirection, ErrorResult& aRv)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   if (!mTransaction->IsOpen()) {
     aRv.Throw(NS_ERROR_DOM_INDEXEDDB_TRANSACTION_INACTIVE_ERR);
     return nullptr;
   }
 
@@ -4241,17 +4243,17 @@ OpenKeyCursorHelper::EnsureCursor()
                               mKey);
   NS_ENSURE_TRUE(mCursor, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
 
   return NS_OK;
 }
 
 nsresult
 OpenKeyCursorHelper::GetSuccessResult(JSContext* aCx,
-                                      JS::MutableHandleValue aVal)
+                                      JS::MutableHandle<JS::Value> aVal)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   PROFILER_MAIN_THREAD_LABEL("IndexedDB",
                              "OpenKeyCursorHelper::GetSuccessResult "
                              "[IDBObjectStore.cpp]");
 
   nsresult rv = EnsureCursor();
@@ -4906,45 +4908,46 @@ GetAllKeysHelper::DoDatabaseWork(mozISto
     NS_ENSURE_SUCCESS(rv, rv);
   }
   NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
 
   return NS_OK;
 }
 
 nsresult
-GetAllKeysHelper::GetSuccessResult(JSContext* aCx, JS::MutableHandleValue aVal)
+GetAllKeysHelper::GetSuccessResult(JSContext* aCx,
+                                   JS::MutableHandle<JS::Value> aVal)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(mKeys.Length() <= mLimit);
 
   PROFILER_MAIN_THREAD_LABEL("IndexedDB",
                              "GetAllKeysHelper::GetSuccessResult "
                              "[IDBObjectStore.cpp]");
 
   nsTArray<Key> keys;
   mKeys.SwapElements(keys);
 
-  JS::RootedObject array(aCx, JS_NewArrayObject(aCx, 0, NULL));
+  JS::Rooted<JSObject*> array(aCx, JS_NewArrayObject(aCx, 0, NULL));
   if (!array) {
     NS_WARNING("Failed to make array!");
     return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
   }
 
   if (!keys.IsEmpty()) {
     if (!JS_SetArrayLength(aCx, array, keys.Length())) {
       NS_WARNING("Failed to set array length!");
       return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
     }
 
     for (uint32_t index = 0, count = keys.Length(); index < count; index++) {
       const Key& key = keys[index];
       MOZ_ASSERT(!key.IsUnset());
 
-      JS::RootedValue value(aCx);
+      JS::Rooted<JS::Value> value(aCx);
       nsresult rv = key.ToJSVal(aCx, &value);
       if (NS_FAILED(rv)) {
         NS_WARNING("Failed to get jsval for key!");
         return rv;
       }
 
       if (!JS_SetElement(aCx, array, index, &value)) {
         NS_WARNING("Failed to set array element!");
--- a/dom/indexedDB/IDBObjectStore.h
+++ b/dom/indexedDB/IDBObjectStore.h
@@ -350,21 +350,21 @@ public:
   Count(JSContext* aCx, const Optional<JS::Handle<JS::Value> >& aKey,
         ErrorResult& aRv);
 
   already_AddRefed<IDBRequest>
   GetAll(JSContext* aCx, const Optional<JS::Handle<JS::Value> >& aKey,
          const Optional<uint32_t>& aLimit, ErrorResult& aRv);
 
   already_AddRefed<IDBRequest>
-  GetAllKeys(JSContext* aCx, const Optional<JS::HandleValue>& aKey,
+  GetAllKeys(JSContext* aCx, const Optional<JS::Handle<JS::Value>>& aKey,
              const Optional<uint32_t>& aLimit, ErrorResult& aRv);
 
   already_AddRefed<IDBRequest>
-  OpenKeyCursor(JSContext* aCx, const Optional<JS::HandleValue>& aRange,
+  OpenKeyCursor(JSContext* aCx, const Optional<JS::Handle<JS::Value>>& aRange,
                 IDBCursorDirection aDirection, ErrorResult& aRv);
 
 protected:
   IDBObjectStore();
   ~IDBObjectStore();
 
   nsresult GetAddInfo(JSContext* aCx,
                       JS::Handle<JS::Value> aValue,
--- a/dom/indexedDB/IndexedDatabaseManager.cpp
+++ b/dom/indexedDB/IndexedDatabaseManager.cpp
@@ -203,18 +203,18 @@ struct MOZ_STACK_CLASS InvalidateInfo
   : persistenceType(aPersistenceType), pattern(aPattern)
   { }
 
   PersistenceType persistenceType;
   const nsACString& pattern;
 };
 
 bool
-GetIndexedDB(JSContext* aCx, JS::HandleObject aGlobal,
-             JS::MutableHandleValue aResult)
+GetIndexedDB(JSContext* aCx, JS::Handle<JSObject*> aGlobal,
+             JS::MutableHandle<JS::Value> aResult)
 {
   MOZ_ASSERT(nsContentUtils::IsCallerChrome(), "Only for chrome!");
   MOZ_ASSERT(js::GetObjectClass(aGlobal)->flags & JSCLASS_DOM_GLOBAL,
              "Not a global object!");
 
   nsRefPtr<IDBFactory> factory;
   if (NS_FAILED(IDBFactory::Create(aCx, aGlobal, nullptr,
                                    getter_AddRefs(factory)))) {
@@ -222,30 +222,30 @@ GetIndexedDB(JSContext* aCx, JS::HandleO
   }
 
   MOZ_ASSERT(factory, "This should never fail for chrome!");
 
   return !!WrapNewBindingObject(aCx, aGlobal, factory, aResult);
 }
 
 bool
-IndexedDBLazyGetter(JSContext* aCx, JS::HandleObject aGlobal,
-                    JS::HandleId aId, JS::MutableHandleValue aVp)
+IndexedDBLazyGetter(JSContext* aCx, JS::Handle<JSObject*> aGlobal,
+                    JS::Handle<jsid> aId, JS::MutableHandle<JS::Value> aVp)
 {
   MOZ_ASSERT(nsContentUtils::IsCallerChrome(), "Only for chrome!");
   MOZ_ASSERT(JSID_IS_STRING(aId), "Bad id!");
   MOZ_ASSERT(JS_FlatStringEqualsAscii(JSID_TO_FLAT_STRING(aId), IDB_STR),
              "Bad id!");
 
-  JS::RootedObject global(aCx, CheckedUnwrap(aGlobal,
-                                             /* stopAtOuter = */ false));
+  JS::Rooted<JSObject*> global(aCx, CheckedUnwrap(aGlobal,
+                                                  /* stopAtOuter = */ false));
   NS_ENSURE_TRUE(global, false);
   NS_ENSURE_TRUE(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL, false);
 
-  JS::RootedValue indexedDB(aCx);
+  JS::Rooted<JS::Value> indexedDB(aCx);
   if (!GetIndexedDB(aCx, global, &indexedDB)) {
     return false;
   }
 
   if (!JS_DefinePropertyById(aCx, global, aId, indexedDB, nullptr, nullptr,
                              JSPROP_ENUMERATE)) {
     return false;
   }
@@ -478,52 +478,52 @@ IndexedDatabaseManager::TabContextMayAcc
                                                 pattern);
 
   return PatternMatchesOrigin(pattern, aOrigin);
 }
 
 // static
 bool
 IndexedDatabaseManager::DefineConstructors(JSContext* aCx,
-                                           JS::HandleObject aGlobal)
+                                           JS::Handle<JSObject*> aGlobal)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   for (uint32_t i = 0; i < mozilla::ArrayLength(gConstructorInfo); i++) {
     if (!gConstructorInfo[i].resolve(aCx, aGlobal, true)) {
       return false;
     }
   }
 
   return true;
 }
 
 // static
 bool
 IndexedDatabaseManager::DefineIndexedDBGetter(JSContext* aCx,
-                                              JS::HandleObject aGlobal)
+                                              JS::Handle<JSObject*> aGlobal)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(nsContentUtils::IsCallerChrome(), "Only for chrome!");
   MOZ_ASSERT(js::GetObjectClass(aGlobal)->flags & JSCLASS_DOM_GLOBAL,
              "Passed object is not a global object!");
 
-  JS::RootedValue indexedDB(aCx);
+  JS::Rooted<JS::Value> indexedDB(aCx);
   if (!GetIndexedDB(aCx, aGlobal, &indexedDB)) {
     return false;
   }
 
   return JS_DefineProperty(aCx, aGlobal, IDB_STR, indexedDB, nullptr, nullptr,
                            JSPROP_ENUMERATE);
 }
 
 // static
 bool
 IndexedDatabaseManager::DefineIndexedDBLazyGetter(JSContext* aCx,
-                                                  JS::HandleObject aGlobal)
+                                                  JS::Handle<JSObject*> aGlobal)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(nsContentUtils::IsCallerChrome(), "Only for chrome!");
   MOZ_ASSERT(js::GetObjectClass(aGlobal)->flags & JSCLASS_DOM_GLOBAL,
              "Passed object is not a global object!");
 
   return JS_DefineProperty(aCx, aGlobal, IDB_STR, JSVAL_VOID,
                            IndexedDBLazyGetter, nullptr, 0);
@@ -728,17 +728,17 @@ NS_IMPL_RELEASE_WITH_DESTROY(IndexedData
 NS_IMPL_QUERY_INTERFACE2(IndexedDatabaseManager, nsIIndexedDatabaseManager,
                                                  nsIObserver)
 
 NS_IMETHODIMP
 IndexedDatabaseManager::InitWindowless(const jsval& aGlobal, JSContext* aCx)
 {
   NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_NOT_AVAILABLE);
 
-  JS::RootedObject global(aCx, JSVAL_TO_OBJECT(aGlobal));
+  JS::Rooted<JSObject*> global(aCx, JSVAL_TO_OBJECT(aGlobal));
   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     NS_WARNING("Passed object is not a global object!");
     return NS_ERROR_FAILURE;
   }
 
   bool hasIndexedDB;
   if (!JS_HasProperty(aCx, global, IDB_STR, &hasIndexedDB)) {
     return NS_ERROR_FAILURE;
@@ -1000,41 +1000,42 @@ GetFileReferencesHelper::Run()
   mCondVar.Notify();
 
   return NS_OK;
 }
 
 BEGIN_INDEXEDDB_NAMESPACE
 
 bool
-ResolveConstructors(JSContext* aCx, JS::HandleObject aObj, JS::HandleId aId,
-                    JS::MutableHandleObject aObjp)
+ResolveConstructors(JSContext* aCx, JS::Handle<JSObject*> aObj,
+                    JS::Handle<jsid> aId, JS::MutableHandle<JSObject*> aObjp)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   // The first time this function is called we need to intern all the strings we
   // care about.
   if (JSID_IS_VOID(gConstructorInfo[0].id)) {
     for (uint32_t i = 0; i < mozilla::ArrayLength(gConstructorInfo); i++) {
-      JS::RootedString str(aCx, JS_InternString(aCx, gConstructorInfo[i].name));
+      JS::Rooted<JSString*> str(aCx,
+                                JS_InternString(aCx, gConstructorInfo[i].name));
       if (!str) {
         NS_WARNING("Failed to intern string!");
         while (i) {
           gConstructorInfo[--i].id = JSID_VOID;
         }
         return false;
       }
       gConstructorInfo[i].id = INTERNED_STRING_TO_JSID(aCx, str);
     }
   }
 
   // Now resolve.
   for (uint32_t i = 0; i < mozilla::ArrayLength(gConstructorInfo); i++) {
     if (gConstructorInfo[i].id == aId) {
-      JS::RootedObject constructor(aCx,
+      JS::Rooted<JSObject*> constructor(aCx,
         gConstructorInfo[i].resolve(aCx, aObj, true));
       if (!constructor) {
         return false;
       }
 
       aObjp.set(aObj);
       return true;
     }
--- a/dom/indexedDB/IndexedDatabaseManager.h
+++ b/dom/indexedDB/IndexedDatabaseManager.h
@@ -135,23 +135,23 @@ public:
   FireWindowOnError(nsPIDOMWindow* aOwner,
                     nsEventChainPostVisitor& aVisitor);
 
   static bool
   TabContextMayAccessOrigin(const mozilla::dom::TabContext& aContext,
                             const nsACString& aOrigin);
 
   static bool
-  DefineConstructors(JSContext* aCx, JS::HandleObject aGlobal);
+  DefineConstructors(JSContext* aCx, JS::Handle<JSObject*> aGlobal);
 
   static bool
-  DefineIndexedDBGetter(JSContext* aCx, JS::HandleObject aGlobal);
+  DefineIndexedDBGetter(JSContext* aCx, JS::Handle<JSObject*> aGlobal);
 
   static bool
-  DefineIndexedDBLazyGetter(JSContext* aCx, JS::HandleObject aGlobal);
+  DefineIndexedDBLazyGetter(JSContext* aCx, JS::Handle<JSObject*> aGlobal);
 
 private:
   IndexedDatabaseManager();
   ~IndexedDatabaseManager();
 
   nsresult
   Init();
 
@@ -172,14 +172,14 @@ private:
   // and FileInfo.mSliceRefCnt
   mozilla::Mutex mFileMutex;
 
   static bool sIsMainProcess;
   static mozilla::Atomic<int32_t> sLowDiskSpaceMode;
 };
 
 bool
-ResolveConstructors(JSContext* aCx, JS::HandleObject aObj, JS::HandleId aId,
-                    JS::MutableHandleObject aObjp);
+ResolveConstructors(JSContext* aCx, JS::Handle<JSObject*> aObj,
+                    JS::Handle<jsid> aId, JS::MutableHandle<JSObject*> aObjp);
 
 END_INDEXEDDB_NAMESPACE
 
 #endif /* mozilla_dom_indexeddb_indexeddatabasemanager_h__ */
--- a/dom/indexedDB/KeyPath.cpp
+++ b/dom/indexedDB/KeyPath.cpp
@@ -42,17 +42,17 @@ IsValidKeyPathString(JSContext* aCx, con
     }
 
     JS::Rooted<JS::Value> stringVal(aCx);
     if (!xpc::StringToJsval(aCx, token, &stringVal)) {
       return false;
     }
 
     NS_ASSERTION(stringVal.toString(), "This should never happen");
-    JS::RootedString str(aCx, stringVal.toString());
+    JS::Rooted<JSString*> str(aCx, stringVal.toString());
 
     bool isIdentifier = false;
     if (!JS_IsIdentifier(aCx, str, &isIdentifier) || !isIdentifier) {
       return false;
     }
   }
 
   // If the very last character was a '.', the tokenizer won't give us an empty
@@ -377,17 +377,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::Rooted<JSObject*> arrayObj(aCx, JS_NewArrayObject(aCx, len, nullptr));
   if (!arrayObj) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   JS::Rooted<JS::Value> value(aCx);
   for (uint32_t i = 0; i < len; ++i) {
     nsresult rv = GetJSValFromKeyPathString(aCx, aValue, mStrings[i],
                                             value.address(),
--- a/dom/plugins/base/nsJSNPRuntime.cpp
+++ b/dom/plugins/base/nsJSNPRuntime.cpp
@@ -451,17 +451,17 @@ ThrowJSException(JSContext *cx, const ch
     if (message) {
       AppendASCIItoUTF16("].", ucex);
     }
 
     JSString *str = ::JS_NewUCStringCopyN(cx, (jschar *)ucex.get(),
                                           ucex.Length());
 
     if (str) {
-      JS::RootedValue exn(cx, JS::StringValue(str));
+      JS::Rooted<JS::Value> exn(cx, JS::StringValue(str));
       ::JS_SetPendingException(cx, exn);
     }
 
     PopException();
   } else {
     ::JS_ReportError(cx, message);
   }
 }
--- a/dom/plugins/ipc/PluginIdentifierParent.cpp
+++ b/dom/plugins/ipc/PluginIdentifierParent.cpp
@@ -26,17 +26,17 @@ PluginIdentifierParent::RecvRetain()
   AutoSafeJSContext cx;
   JS::Rooted<jsid> id(cx, NPIdentifierToJSId(mIdentifier));
   if (JSID_IS_INT(id)) {
     return true;
   }
 
   // The following is what nsNPAPIPlugin.cpp does. Gross, but the API doesn't
   // give you a NPP to play with.
-  JS::RootedString str(cx, JSID_TO_STRING(id));
+  JS::Rooted<JSString*> str(cx, JSID_TO_STRING(id));
   JSString* str2 = JS_InternJSString(cx, str);
   if (!str2) {
     return false;
   }
 
   NS_ASSERTION(str == str2, "Interning a string in a JSID should always return the same string.");
 
   return true;
--- a/dom/plugins/ipc/PluginScriptableObjectParent.cpp
+++ b/dom/plugins/ipc/PluginScriptableObjectParent.cpp
@@ -1041,17 +1041,17 @@ PluginScriptableObjectParent::AnswerEnum
 
   aProperties->SetCapacity(idCount);
 
   mozilla::AutoSafeJSContext cx;
   for (uint32_t index = 0; index < idCount; index++) {
     // Because of GC hazards, all identifiers returned from enumerate
     // must be made permanent.
     if (_identifierisstring(ids[index])) {
-      JS::RootedString str(cx, NPIdentifierToString(ids[index]));
+      JS::Rooted<JSString*> str(cx, NPIdentifierToString(ids[index]));
       if (!JS_StringHasBeenInterned(cx, str)) {
         DebugOnly<JSString*> str2 = JS_InternJSString(cx, str);
         NS_ASSERTION(str2 == str, "Interning a JS string which is currently an ID should return itself.");
       }
     }
     PluginIdentifierParent* id =
       instance->Module()->GetIdentifierForNPIdentifier(instance->GetNPP(), ids[index]);
     aProperties->AppendElement(id);
--- a/dom/src/json/nsJSON.cpp
+++ b/dom/src/json/nsJSON.cpp
@@ -519,17 +519,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::Rooted<JS::Value> reviver(mCx, JS::NullValue()), value(mCx);
 
   JS::StableCharPtr chars(reinterpret_cast<const jschar*>(mBufferedChars.Elements()),
                           mBufferedChars.Length());
   bool ok = JS_ParseJSONWithReviver(mCx, chars.get(),
                                       uint32_t(mBufferedChars.Length()),
                                       reviver, &value);
 
   *mRootVal = value;
--- a/dom/src/notification/DesktopNotification.cpp
+++ b/dom/src/notification/DesktopNotification.cpp
@@ -88,17 +88,17 @@ DesktopNotification::PostDesktopNotifica
     nsCOMPtr<nsPIDOMWindow> window = GetOwner();
     uint32_t appId = (window.get())->GetDoc()->NodePrincipal()->GetAppId();
 
     if (appId != nsIScriptSecurityManager::UNKNOWN_APP_ID) {
       nsCOMPtr<nsIAppsService> appsService = do_GetService("@mozilla.org/AppsService;1");
       nsString manifestUrl = EmptyString();
       appsService->GetManifestURLByLocalId(appId, manifestUrl);
       mozilla::AutoSafeJSContext cx;
-      JS::RootedValue val(cx);
+      JS::Rooted<JS::Value> val(cx);
       AppNotificationServiceOptions ops;
       ops.mTextClickable = true;
       ops.mManifestURL = manifestUrl;
 
       if (!ops.ToObject(cx, JS::NullPtr(), &val)) {
         return NS_ERROR_FAILURE;
       }
 
--- a/dom/src/notification/Notification.cpp
+++ b/dom/src/notification/Notification.cpp
@@ -68,31 +68,32 @@ public:
     options.mBody = aBody;
     options.mTag = aTag;
     options.mIcon = aIcon;
     nsRefPtr<Notification> notification = Notification::CreateInternal(mWindow,
                                                                        aID,
                                                                        aTitle,
                                                                        options);
     JSAutoCompartment ac(aCx, mGlobal);
-    JS::RootedObject scope(aCx, mGlobal);
-    JS::RootedObject element(aCx, notification->WrapObject(aCx, scope));
+    JS::Rooted<JSObject*> scope(aCx, mGlobal);
+    JS::Rooted<JSObject*> element(aCx, notification->WrapObject(aCx, scope));
     NS_ENSURE_TRUE(element, NS_ERROR_FAILURE);
 
     if (!JS_DefineElement(aCx, mNotifications, mCount++,
                           JS::ObjectValue(*element), nullptr, nullptr, 0)) {
       return NS_ERROR_FAILURE;
     }
     return NS_OK;
   }
 
   NS_IMETHOD Done(JSContext* aCx)
   {
     JSAutoCompartment ac(aCx, mGlobal);
-    Optional<JS::HandleValue> result(aCx, JS::ObjectValue(*mNotifications));
+    Optional<JS::Handle<JS::Value>> result(aCx,
+                                           JS::ObjectValue(*mNotifications));
     mPromise->MaybeResolve(aCx, result);
     return NS_OK;
   }
 
 private:
   ~NotificationStorageCallback()
   {
     DropData();
@@ -548,17 +549,17 @@ Notification::ShowInternal()
     uint32_t appId = (window.get())->GetDoc()->NodePrincipal()->GetAppId();
 
     if (appId != nsIScriptSecurityManager::UNKNOWN_APP_ID) {
       nsCOMPtr<nsIAppsService> appsService = do_GetService("@mozilla.org/AppsService;1");
       nsString manifestUrl = EmptyString();
       rv = appsService->GetManifestURLByLocalId(appId, manifestUrl);
       if (NS_SUCCEEDED(rv)) {
         mozilla::AutoSafeJSContext cx;
-        JS::RootedValue val(cx);
+        JS::Rooted<JS::Value> val(cx);
         AppNotificationServiceOptions ops;
         ops.mTextClickable = true;
         ops.mManifestURL = manifestUrl;
         ops.mId = alertName;
         ops.mDir = DirectionToString(mDir);
         ops.mLang = mLang;
 
         if (!ops.ToObject(cx, JS::NullPtr(), &val)) {
--- a/dom/system/gonk/AudioManager.cpp
+++ b/dom/system/gonk/AudioManager.cpp
@@ -305,17 +305,17 @@ AudioManager::Observe(nsISupports* aSubj
 
     JS::Rooted<JSObject*> obj(cx, &val.toObject());
     JS::Rooted<JS::Value> key(cx);
     if (!JS_GetProperty(cx, obj, "key", &key) ||
         !key.isString()) {
       return NS_OK;
     }
 
-    JS::RootedString jsKey(cx, JS_ValueToString(cx, key));
+    JS::Rooted<JSString*> jsKey(cx, JS_ValueToString(cx, key));
     if (!jsKey) {
       return NS_OK;
     }
     nsDependentJSString keyStr;
     if (!keyStr.init(cx, jsKey) || !keyStr.EqualsLiteral("audio.volume.bt_sco")) {
       return NS_OK;
     }
 
--- a/dom/wifi/WifiProxyService.cpp
+++ b/dom/wifi/WifiProxyService.cpp
@@ -274,17 +274,17 @@ WifiProxyService::WaitForEvent(const nsA
 }
 
 void
 WifiProxyService::DispatchWifiResult(const WifiResultOptions& aOptions, const nsACString& aInterface)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   mozilla::AutoSafeJSContext cx;
-  JS::RootedValue val(cx);
+  JS::Rooted<JS::Value> val(cx);
 
   if (!aOptions.ToObject(cx, JS::NullPtr(), &val)) {
     return;
   }
 
   // Call the listener with a JS value.
   mListener->OnCommand(val, aInterface);
 }
--- a/dom/workers/FileReaderSync.cpp
+++ b/dom/workers/FileReaderSync.cpp
@@ -46,17 +46,17 @@ already_AddRefed<FileReaderSync>
 FileReaderSync::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv)
 {
   nsRefPtr<FileReaderSync> frs = new FileReaderSync();
 
   return frs.forget();
 }
 
 JSObject*
-FileReaderSync::WrapObject(JSContext* aCx, JS::HandleObject aScope)
+FileReaderSync::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
 {
   return FileReaderSyncBinding_workers::Wrap(aCx, aScope, this);
 }
 
 JSObject*
 FileReaderSync::ReadAsArrayBuffer(JSContext* aCx,
                                   JS::Handle<JSObject*> aScopeObj,
                                   JS::Handle<JSObject*> aBlob,
--- a/dom/workers/FileReaderSync.h
+++ b/dom/workers/FileReaderSync.h
@@ -31,17 +31,17 @@ class FileReaderSync MOZ_FINAL : public 
   nsresult ConvertStream(nsIInputStream *aStream, const char *aCharset,
                          nsAString &aResult);
   nsresult GuessCharset(nsIInputStream *aStream, nsACString &aCharset);
 
 public:
   static already_AddRefed<FileReaderSync>
   Constructor(const GlobalObject& aGlobal, ErrorResult& aRv);
 
-  JSObject* WrapObject(JSContext* aCx, JS::HandleObject aScope);
+  JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope);
 
   NS_DECL_ISUPPORTS
 
   JSObject* ReadAsArrayBuffer(JSContext* aCx, JS::Handle<JSObject*> aScopeObj,
                               JS::Handle<JSObject*> aBlob,
                               ErrorResult& aRv);
   void ReadAsBinaryString(JS::Handle<JSObject*> aBlob, nsAString& aResult,
                           ErrorResult& aRv);
--- a/dom/workers/MessagePort.cpp
+++ b/dom/workers/MessagePort.cpp
@@ -67,17 +67,17 @@ MessagePort::MessagePort(WorkerPrivate* 
 }
 
 MessagePort::~MessagePort()
 {
   Close();
 }
 
 void
-MessagePort::PostMessageMoz(JSContext* aCx, JS::HandleValue aMessage,
+MessagePort::PostMessageMoz(JSContext* aCx, JS::Handle<JS::Value> aMessage,
                             const Optional<Sequence<JS::Value>>& aTransferable,
                             ErrorResult& aRv)
 {
   AssertCorrectThread();
 
   if (IsClosed()) {
     aRv = NS_ERROR_DOM_INVALID_STATE_ERR;
     return;
@@ -227,17 +227,17 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(MessagePort,
                                                 nsDOMEventTargetHelper)
   tmp->Close();
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
 JSObject*
-MessagePort::WrapObject(JSContext* aCx, JS::HandleObject aScope)
+MessagePort::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
 {
   AssertCorrectThread();
 
   return MessagePortBinding::Wrap(aCx, aScope, this);
 }
 
 nsresult
 MessagePort::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
--- a/dom/workers/MessagePort.h
+++ b/dom/workers/MessagePort.h
@@ -33,17 +33,17 @@ class MessagePort MOZ_FINAL : public moz
   uint64_t mSerial;
   bool mStarted;
 
 public:
   static bool
   PrefEnabled();
 
   virtual void
-  PostMessageMoz(JSContext* aCx, JS::HandleValue aMessage,
+  PostMessageMoz(JSContext* aCx, JS::Handle<JS::Value> aMessage,
                  const Optional<Sequence<JS::Value>>& aTransferable,
                  ErrorResult& aRv) MOZ_OVERRIDE;
 
   virtual void
   Start() MOZ_OVERRIDE;
 
   virtual void
   Close() MOZ_OVERRIDE;
@@ -71,17 +71,17 @@ public:
 
   bool
   IsClosed() const
   {
     return !mSharedWorker && !mWorkerPrivate;
   }
 
   virtual JSObject*
-  WrapObject(JSContext* aCx, JS::HandleObject aScope) MOZ_OVERRIDE;
+  WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
 
   virtual nsresult
   PreHandleEvent(nsEventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
 
 #ifdef DEBUG
   void
   AssertCorrectThread() const;
 #else
--- a/dom/workers/RuntimeService.cpp
+++ b/dom/workers/RuntimeService.cpp
@@ -726,17 +726,17 @@ ContentSecurityPolicyAllows(JSContext* a
 {
   WorkerPrivate* worker = GetWorkerPrivateFromContext(aCx);
   worker->AssertIsOnWorkerThread();
 
   if (worker->GetReportCSPViolations()) {
     nsString fileName;
     uint32_t lineNum = 0;
 
-    JS::RootedScript script(aCx);
+    JS::Rooted<JSScript*> script(aCx);
     const char* file;
     if (JS_DescribeScriptedCaller(aCx, &script, &lineNum) &&
         (file = JS_GetScriptFilename(aCx, script))) {
       fileName.AssignASCII(file);
     } else {
       JS_ReportPendingException(aCx);
     }
 
--- a/dom/workers/ScriptLoader.cpp
+++ b/dom/workers/ScriptLoader.cpp
@@ -702,17 +702,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::CurrentGlobalOrNull(aCx));
+  JS::Rooted<JSObject*> global(aCx, JS::CurrentGlobalOrNull(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/SharedWorker.cpp
+++ b/dom/workers/SharedWorker.cpp
@@ -156,17 +156,17 @@ SharedWorker::Close()
 
   if (mWorkerPrivate) {
     AutoSafeJSContext cx;
     NoteDeadWorker(cx);
   }
 }
 
 void
-SharedWorker::PostMessage(JSContext* aCx, JS::HandleValue aMessage,
+SharedWorker::PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
                           const Optional<Sequence<JS::Value>>& aTransferable,
                           ErrorResult& aRv)
 {
   AssertIsOnMainThread();
   MOZ_ASSERT(mWorkerPrivate);
   MOZ_ASSERT(mMessagePort);
 
   mWorkerPrivate->PostMessageToMessagePort(aCx, mMessagePort->Serial(),
@@ -200,17 +200,17 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(SharedWorker,
                                                 nsDOMEventTargetHelper)
   tmp->Close();
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mMessagePort)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mSuspendedEvents)
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
 JSObject*
-SharedWorker::WrapObject(JSContext* aCx, JS::HandleObject aScope)
+SharedWorker::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
 {
   AssertIsOnMainThread();
 
   return SharedWorkerBinding::Wrap(aCx, aScope, this);
 }
 
 nsresult
 SharedWorker::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
--- a/dom/workers/SharedWorker.h
+++ b/dom/workers/SharedWorker.h
@@ -72,17 +72,17 @@ public:
   Close();
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SharedWorker, nsDOMEventTargetHelper)
 
   IMPL_EVENT_HANDLER(error)
 
   virtual JSObject*
-  WrapObject(JSContext* aCx, JS::HandleObject aScope) MOZ_OVERRIDE;
+  WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
 
   virtual nsresult
   PreHandleEvent(nsEventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
 
   WorkerPrivate*
   GetWorkerPrivate() const
   {
     return mWorkerPrivate;
@@ -93,17 +93,17 @@ private:
   SharedWorker(nsPIDOMWindow* aWindow,
                WorkerPrivate* aWorkerPrivate);
 
   // This class is reference-counted and will be destroyed from Release().
   ~SharedWorker();
 
   // Only called by MessagePort.
   void
-  PostMessage(JSContext* aCx, JS::HandleValue aMessage,
+  PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
               const Optional<Sequence<JS::Value>>& aTransferable,
               ErrorResult& aRv);
 
   // Only called by RuntimeService.
   void
   NoteDeadWorker(JSContext* aCx);
 };
 
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -3577,17 +3577,17 @@ WorkerPrivate::GetLoadInfo(JSContext* aC
 
       loadInfo.mXHRParamsAllowed = perm == nsIPermissionManager::ALLOW_ACTION;
     } else {
       // Not a window
       MOZ_ASSERT(isChrome);
 
       // We're being created outside of a window. Need to figure out the script
       // that is creating us in order for us to use relative URIs later on.
-      JS::RootedScript script(aCx);
+      JS::Rooted<JSScript*> script(aCx);
       if (JS_DescribeScriptedCaller(aCx, &script, nullptr)) {
         const char* fileName = JS_GetScriptFilename(aCx, script);
 
         // In most cases, fileName is URI. In a few other cases
         // (e.g. xpcshell), fileName is a file path. Ideally, we would
         // prefer testing whether fileName parses as an URI and fallback
         // to file path in case of error, but Windows file paths have
         // the interesting property that they can be parsed as bogus
@@ -4534,17 +4534,17 @@ WorkerPrivate::PostMessageToParentIntern
     aRv = NS_ERROR_FAILURE;
   }
 }
 
 void
 WorkerPrivate::PostMessageToParentMessagePort(
                              JSContext* aCx,
                              uint64_t aMessagePortSerial,
-                             JS::HandleValue aMessage,
+                             JS::Handle<JS::Value> aMessage,
                              const Optional<Sequence<JS::Value>>& aTransferable,
                              ErrorResult& aRv)
 {
   AssertIsOnWorkerThread();
 
   if (!mWorkerPorts.GetWeak(aMessagePortSerial)) {
     // This port has been closed from the main thread. There's no point in
     // sending this message so just bail.
@@ -4918,17 +4918,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::CurrentGlobalOrNull(aCx));
+  JS::Rooted<JSObject*> global(aCx, JS::CurrentGlobalOrNull(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 = std::max(TimeStamp::Now(), mTimeouts[0]->mTargetTime);
 
   nsAutoTArray<TimeoutInfo*, 10> expiredTimeouts;
   for (uint32_t index = 0; index < mTimeouts.Length(); index++) {
--- a/dom/workers/WorkerPrivate.h
+++ b/dom/workers/WorkerPrivate.h
@@ -819,17 +819,16 @@ protected:
   ~WorkerPrivate();
 
 public:
   static already_AddRefed<WorkerPrivate>
   Constructor(const GlobalObject& aGlobal, const nsAString& aScriptURL,
               ErrorResult& aRv);
 
   static already_AddRefed<WorkerPrivate>
-
   Constructor(const GlobalObject& aGlobal, const nsAString& aScriptURL,
               bool aIsChromeWorker, WorkerType aWorkerType,
               const nsAString& aSharedWorkerName,
               LoadInfo* aLoadInfo, ErrorResult& aRv);
 
   static bool
   WorkerAvailable(JSContext* /* unused */, JSObject* /* unused */);
 
@@ -927,17 +926,17 @@ public:
   {
     PostMessageToParentInternal(aCx, aMessage, aTransferable, false, 0, aRv);
   }
 
   void
   PostMessageToParentMessagePort(
                              JSContext* aCx,
                              uint64_t aMessagePortSerial,
-                             JS::HandleValue aMessage,
+                             JS::Handle<JS::Value> aMessage,
                              const Optional<Sequence<JS::Value>>& aTransferable,
                              ErrorResult& aRv);
 
   bool
   NotifyInternal(JSContext* aCx, Status aStatus);
 
   void
   ReportError(JSContext* aCx, const char* aMessage, JSErrorReport* aReport);
--- a/dom/workers/WorkerScope.cpp
+++ b/dom/workers/WorkerScope.cpp
@@ -65,17 +65,17 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_END
 NS_IMPL_ADDREF_INHERITED(WorkerGlobalScope, nsDOMEventTargetHelper)
 NS_IMPL_RELEASE_INHERITED(WorkerGlobalScope, nsDOMEventTargetHelper)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WorkerGlobalScope)
   NS_INTERFACE_MAP_ENTRY(nsIGlobalObject)
 NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
 
 JSObject*
-WorkerGlobalScope::WrapObject(JSContext* aCx, JS::HandleObject aScope)
+WorkerGlobalScope::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
 {
   MOZ_CRASH("We should never get here!");
 }
 
 already_AddRefed<WorkerLocation>
 WorkerGlobalScope::Location()
 {
   mWorkerPrivate->AssertIsOnWorkerThread();
--- a/dom/workers/WorkerScope.h
+++ b/dom/workers/WorkerScope.h
@@ -32,17 +32,17 @@ class WorkerGlobalScope : public nsDOMEv
 protected:
   WorkerPrivate* mWorkerPrivate;
 
   WorkerGlobalScope(WorkerPrivate* aWorkerPrivate);
   virtual ~WorkerGlobalScope();
 
 public:
   virtual JSObject*
-  WrapObject(JSContext* aCx, JS::HandleObject aScope) MOZ_OVERRIDE;
+  WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
 
   virtual JSObject*
   WrapGlobalObject(JSContext* aCx, JS::CompartmentOptions& aOptions,
                    JSPrincipals* aPrincipal) = 0;
 
   virtual JSObject*
   GetGlobalJSObject(void) MOZ_OVERRIDE
   {