From 0fdc697b63f91b920a1e21639663a7e41d8d75fc Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 11 Nov 2013 09:04:41 +0100 Subject: [PATCH] No bug - Fix some style issues in DOM code. --- content/base/public/nsContentUtils.h | 3 +- content/base/src/WebSocket.cpp | 2 +- content/base/src/nsContentUtils.cpp | 12 ++++--- content/base/src/nsFrameMessageManager.cpp | 16 ++++----- content/base/src/nsFrameMessageManager.h | 35 ++++++++++--------- content/html/content/src/HTMLMediaElement.cpp | 2 +- .../content/src/HTMLPropertiesCollection.cpp | 2 +- content/html/document/src/nsHTMLDocument.cpp | 2 +- content/media/webaudio/AudioBuffer.cpp | 9 +++-- content/xbl/src/nsXBLBinding.cpp | 8 ++--- content/xbl/src/nsXBLBinding.h | 6 ++-- content/xbl/src/nsXBLProtoImpl.cpp | 4 +-- content/xbl/src/nsXBLProtoImpl.h | 5 +-- content/xbl/src/nsXBLProtoImplMethod.cpp | 5 ++- content/xbl/src/nsXBLProtoImplProperty.cpp | 15 ++++---- content/xbl/src/nsXBLPrototypeHandler.cpp | 6 ++-- .../xslt/src/xslt/txMozillaXSLTProcessor.cpp | 5 +-- content/xul/content/src/nsXULElement.cpp | 2 +- dom/audiochannel/AudioChannelService.cpp | 2 +- dom/base/nsDOMClassInfo.cpp | 4 +-- dom/base/nsGlobalWindow.cpp | 2 +- dom/base/nsJSEnvironment.cpp | 2 +- dom/base/nsJSUtils.cpp | 8 ++--- dom/base/nsJSUtils.h | 2 +- dom/base/nsScreen.cpp | 4 +-- dom/bindings/BindingDeclarations.h | 2 +- dom/bindings/Codegen.py | 12 +++---- dom/bindings/DOMJSProxyHandler.cpp | 2 +- dom/bindings/Exceptions.cpp | 2 +- dom/bindings/TypedArray.h | 3 +- dom/bluetooth/BluetoothUtils.cpp | 2 +- dom/indexedDB/IDBKeyRange.cpp | 14 ++++---- dom/indexedDB/IDBKeyRange.h | 16 ++++----- dom/indexedDB/IDBObjectStore.cpp | 21 ++++++----- dom/indexedDB/IDBObjectStore.h | 4 +-- dom/indexedDB/IndexedDatabaseManager.cpp | 33 ++++++++--------- dom/indexedDB/IndexedDatabaseManager.h | 10 +++--- dom/indexedDB/KeyPath.cpp | 4 +-- dom/plugins/base/nsJSNPRuntime.cpp | 2 +- dom/plugins/ipc/PluginIdentifierParent.cpp | 2 +- .../ipc/PluginScriptableObjectParent.cpp | 2 +- dom/src/json/nsJSON.cpp | 2 +- dom/src/notification/DesktopNotification.cpp | 2 +- dom/src/notification/Notification.cpp | 9 ++--- dom/system/gonk/AudioManager.cpp | 2 +- dom/wifi/WifiProxyService.cpp | 2 +- dom/workers/FileReaderSync.cpp | 2 +- dom/workers/FileReaderSync.h | 2 +- dom/workers/MessagePort.cpp | 4 +-- dom/workers/MessagePort.h | 4 +-- dom/workers/RuntimeService.cpp | 2 +- dom/workers/ScriptLoader.cpp | 2 +- dom/workers/SharedWorker.cpp | 4 +-- dom/workers/SharedWorker.h | 4 +-- dom/workers/WorkerPrivate.cpp | 6 ++-- dom/workers/WorkerPrivate.h | 3 +- dom/workers/WorkerScope.cpp | 2 +- dom/workers/WorkerScope.h | 2 +- 58 files changed, 182 insertions(+), 166 deletions(-) diff --git a/content/base/public/nsContentUtils.h b/content/base/public/nsContentUtils.h index 321b41b0b3f0..1e8b5825fe0f 100644 --- a/content/base/public/nsContentUtils.h +++ b/content/base/public/nsContentUtils.h @@ -190,7 +190,8 @@ public: static bool IsImageSrcSetDisabled(); static bool LookupBindingMember(JSContext* aCx, nsIContent *aContent, - JS::HandleId aId, JS::MutableHandle aDesc); + JS::Handle aId, + JS::MutableHandle aDesc); /** * Returns the parent node of aChild crossing document boundaries. diff --git a/content/base/src/WebSocket.cpp b/content/base/src/WebSocket.cpp index e166d1bed831..f82200903f93 100644 --- a/content/base/src/WebSocket.cpp +++ b/content/base/src/WebSocket.cpp @@ -671,7 +671,7 @@ WebSocket::Init(JSContext* aCx, NS_ENSURE_SUCCESS(rv, rv); unsigned lineno; - JS::RootedScript script(aCx); + JS::Rooted script(aCx); if (JS_DescribeScriptedCaller(aCx, &script, &lineno)) { mScriptFile = JS_GetScriptFilename(aCx, script); mScriptLine = lineno; diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index c7f58ff1b55b..b01b60594690 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -1826,7 +1826,8 @@ nsContentUtils::IsImageSrcSetDisabled() // static bool nsContentUtils::LookupBindingMember(JSContext* aCx, nsIContent *aContent, - JS::HandleId aId, JS::MutableHandle aDesc) + JS::Handle aId, + JS::MutableHandle aDesc) { nsXBLBinding* binding = aContent->GetXBLBinding(); if (!binding) @@ -5673,7 +5674,7 @@ nsContentUtils::DispatchXULCommand(nsIContent* aTarget, nsresult nsContentUtils::WrapNative(JSContext *cx, JS::Handle scope, nsISupports *native, nsWrapperCache *cache, - const nsIID* aIID, JS::MutableHandleValue vp, + const nsIID* aIID, JS::MutableHandle vp, nsIXPConnectJSObjectHolder **aHolder, bool aAllowWrapping) { @@ -6155,9 +6156,10 @@ nsContentUtils::IsPatternMatching(nsAString& aValue, nsAString& aPattern, aPattern.Insert(NS_LITERAL_STRING("^(?:"), 0); aPattern.Append(NS_LITERAL_STRING(")$")); - JS::RootedObject re(cx, JS_NewUCRegExpObjectNoStatics(cx, static_cast - (aPattern.BeginWriting()), - aPattern.Length(), 0)); + JS::Rooted re(cx, + JS_NewUCRegExpObjectNoStatics(cx, + static_cast(aPattern.BeginWriting()), + aPattern.Length(), 0)); if (!re) { JS_ClearPendingException(cx); return true; diff --git a/content/base/src/nsFrameMessageManager.cpp b/content/base/src/nsFrameMessageManager.cpp index e038283aa215..c007f9e468ef 100644 --- a/content/base/src/nsFrameMessageManager.cpp +++ b/content/base/src/nsFrameMessageManager.cpp @@ -242,7 +242,8 @@ mozilla::dom::ipc::UnpackClonedMessageDataForChild(const ClonedMessageData& aDat } bool -SameProcessCpowHolder::ToObject(JSContext* aCx, JS::MutableHandleObject aObjp) +SameProcessCpowHolder::ToObject(JSContext* aCx, + JS::MutableHandle aObjp) { if (!mObj) { return true; @@ -553,7 +554,7 @@ nsFrameMessageManager::SendMessage(const nsAString& aMessageName, data.mData = buffer.data(); data.mDataLength = buffer.nbytes(); - JS::RootedObject objects(aCx); + JS::Rooted objects(aCx); if (aArgc >= 3 && aObjects.isObject()) { objects = &aObjects.toObject(); } @@ -632,7 +633,7 @@ nsFrameMessageManager::DispatchAsyncMessage(const nsAString& aMessageName, return NS_ERROR_DOM_DATA_CLONE_ERR; } - JS::RootedObject objects(aCx); + JS::Rooted objects(aCx); if (aArgc >= 3 && aObjects.isObject()) { objects = &aObjects.toObject(); } @@ -903,7 +904,7 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget, nsContentUtils::WrapNative(ctx, global, aTarget, &targetv, nullptr, true); - JS::RootedObject cpows(ctx); + JS::Rooted cpows(ctx); if (aCpows) { if (!aCpows->ToObject(ctx, &cpows)) { return NS_ERROR_UNEXPECTED; @@ -917,7 +918,7 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget, } } - JS::RootedValue cpowsv(ctx, JS::ObjectValue(*cpows)); + JS::Rooted cpowsv(ctx, JS::ObjectValue(*cpows)); JS::Rooted json(ctx, JS::NullValue()); if (aCloneData && aCloneData->mDataLength && @@ -971,7 +972,7 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget, JS::Rooted 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 principalValue(ctx, JS::ObjectValue(*principalObj)); JS_DefineProperty(ctx, param, "principal", principalValue, nullptr, nullptr, JSPROP_ENUMERATE); } @@ -1424,9 +1425,8 @@ nsFrameScriptExecutor::TryCacheLoadAndCompileScript(const nsAString& aURL, options.setNoScriptRval(true) .setFileAndLine(url.get(), 1) .setPrincipals(nsJSPrincipals::get(mPrincipal)); - JS::RootedObject empty(cx, nullptr); JS::Rooted script(cx, - JS::Compile(cx, empty, options, dataString.get(), + JS::Compile(cx, JS::NullPtr(), options, dataString.get(), dataString.Length())); if (script) { diff --git a/content/base/src/nsFrameMessageManager.h b/content/base/src/nsFrameMessageManager.h index b18dc838e18c..4bda656e3b93 100644 --- a/content/base/src/nsFrameMessageManager.h +++ b/content/base/src/nsFrameMessageManager.h @@ -1,8 +1,9 @@ -/* -*- 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__ @@ -59,8 +60,8 @@ public: virtual bool DoSendBlockingMessage(JSContext* aCx, const nsAString& aMessage, - const mozilla::dom::StructuredCloneData& aData, - JS::Handle aCpows, + const StructuredCloneData& aData, + JS::Handle aCpows, nsIPrincipal* aPrincipal, InfallibleTArray* aJSONRetVal, bool aIsSync) @@ -70,8 +71,8 @@ public: virtual bool DoSendAsyncMessage(JSContext* aCx, const nsAString& aMessage, - const mozilla::dom::StructuredCloneData& aData, - JS::Handle aCpows, + const StructuredCloneData& aData, + JS::Handle aCpows, nsIPrincipal* aPrincipal) { return true; @@ -129,22 +130,22 @@ struct nsMessageListenerInfo class CpowHolder { - public: - virtual bool ToObject(JSContext* cx, JS::MutableHandleObject objp) = 0; +public: + virtual bool ToObject(JSContext* cx, JS::MutableHandle objp) = 0; }; class MOZ_STACK_CLASS SameProcessCpowHolder : public CpowHolder { - public: - SameProcessCpowHolder(JSRuntime *aRuntime, JS::Handle aObj) - : mObj(aRuntime, aObj) - { - } +public: + SameProcessCpowHolder(JSRuntime *aRuntime, JS::Handle aObj) + : mObj(aRuntime, aObj) + { + } - bool ToObject(JSContext* aCx, JS::MutableHandleObject aObjp); + bool ToObject(JSContext* aCx, JS::MutableHandle aObjp); - private: - JS::Rooted mObj; +private: + JS::Rooted mObj; }; class nsFrameMessageManager MOZ_FINAL : public nsIContentFrameMessageManager, @@ -247,7 +248,7 @@ public: nsresult DispatchAsyncMessageInternal(JSContext* aCx, const nsAString& aMessage, const StructuredCloneData& aData, - JS::Handle aCpows, + JS::Handle aCpows, nsIPrincipal* aPrincipal); void RemoveFromParent(); nsFrameMessageManager* GetParentManager() { return mParentManager; } diff --git a/content/html/content/src/HTMLMediaElement.cpp b/content/html/content/src/HTMLMediaElement.cpp index 760003704d46..07402436df30 100644 --- a/content/html/content/src/HTMLMediaElement.cpp +++ b/content/html/content/src/HTMLMediaElement.cpp @@ -1591,7 +1591,7 @@ HTMLMediaElement::GetMozSampleRate(uint32_t* aMozSampleRate) // Helper struct with arguments for our hash iterator. typedef struct MOZ_STACK_CLASS { JSContext* cx; - JS::HandleObject tags; + JS::Handle tags; bool error; } MetadataIterCx; diff --git a/content/html/content/src/HTMLPropertiesCollection.cpp b/content/html/content/src/HTMLPropertiesCollection.cpp index 78ddcf055c2a..5df1dc4c011d 100644 --- a/content/html/content/src/HTMLPropertiesCollection.cpp +++ b/content/html/content/src/HTMLPropertiesCollection.cpp @@ -436,7 +436,7 @@ PropertyNodeList::GetValues(JSContext* aCx, nsTArray& aResult, { EnsureFresh(); - JS::RootedObject wrapper(aCx, GetWrapper()); + JS::Rooted wrapper(aCx, GetWrapper()); JSAutoCompartment ac(aCx, wrapper); uint32_t length = mElements.Length(); for (uint32_t i = 0; i < length; ++i) { diff --git a/content/html/document/src/nsHTMLDocument.cpp b/content/html/document/src/nsHTMLDocument.cpp index 23f7876a23e4..e8bb44c9e895 100644 --- a/content/html/document/src/nsHTMLDocument.cpp +++ b/content/html/document/src/nsHTMLDocument.cpp @@ -1547,7 +1547,7 @@ nsHTMLDocument::Open(JSContext* cx, SetIsInitialDocument(false); nsCOMPtr newScope(do_QueryReferent(mScopeObject)); - JS::RootedObject wrapper(cx, GetWrapper()); + JS::Rooted wrapper(cx, GetWrapper()); if (oldScope && newScope != oldScope && wrapper) { rv = mozilla::dom::ReparentWrapper(cx, wrapper); if (rv.Failed()) { diff --git a/content/media/webaudio/AudioBuffer.cpp b/content/media/webaudio/AudioBuffer.cpp index 0083feae1fd0..8d2c8396b59b 100644 --- a/content/media/webaudio/AudioBuffer.cpp +++ b/content/media/webaudio/AudioBuffer.cpp @@ -70,7 +70,8 @@ AudioBuffer::InitializeBuffers(uint32_t aNumberOfChannels, JSContext* aJSContext return false; } for (uint32_t i = 0; i < aNumberOfChannels; ++i) { - JS::RootedObject array(aJSContext, JS_NewFloat32Array(aJSContext, mLength)); + JS::Rooted array(aJSContext, + JS_NewFloat32Array(aJSContext, mLength)); if (!array) { return false; } @@ -95,7 +96,8 @@ AudioBuffer::RestoreJSChannelData(JSContext* aJSContext) // 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 array(aJSContext, + JS_NewFloat32Array(aJSContext, mLength)); if (!array) { return false; } @@ -194,7 +196,8 @@ StealJSArrayDataIntoThreadSharedFloatArrayBufferList(JSContext* aJSContext, nsRefPtr result = new ThreadSharedFloatArrayBufferList(aJSArrays.Length()); for (uint32_t i = 0; i < aJSArrays.Length(); ++i) { - JS::RootedObject arrayBuffer(aJSContext, JS_GetArrayBufferViewBuffer(aJSArrays[i])); + JS::Rooted arrayBuffer(aJSContext, + JS_GetArrayBufferViewBuffer(aJSArrays[i])); void* dataToFree = nullptr; uint8_t* stolenData = nullptr; if (arrayBuffer && diff --git a/content/xbl/src/nsXBLBinding.cpp b/content/xbl/src/nsXBLBinding.cpp index 09bf68e186c6..aad07d57853d 100644 --- a/content/xbl/src/nsXBLBinding.cpp +++ b/content/xbl/src/nsXBLBinding.cpp @@ -1124,7 +1124,7 @@ nsXBLBinding::ResolveAllFields(JSContext *cx, JS::Handle obj) const } bool -nsXBLBinding::LookupMember(JSContext* aCx, JS::HandleId aId, +nsXBLBinding::LookupMember(JSContext* aCx, JS::Handle aId, JS::MutableHandle aDesc) { // We should never enter this function with a pre-filled property descriptor. @@ -1153,7 +1153,7 @@ nsXBLBinding::LookupMember(JSContext* aCx, JS::HandleId aId, // Enter the xbl scope and invoke the internal version. { JSAutoCompartment ac(aCx, xblScope); - JS::RootedId id(aCx, aId); + JS::Rooted id(aCx, aId); if (!JS_WrapId(aCx, id.address()) || !LookupMemberInternal(aCx, name, id, aDesc, xblScope)) { @@ -1167,7 +1167,7 @@ nsXBLBinding::LookupMember(JSContext* aCx, JS::HandleId aId, bool nsXBLBinding::LookupMemberInternal(JSContext* aCx, nsString& aName, - JS::HandleId aNameAsId, + JS::Handle aNameAsId, JS::MutableHandle aDesc, JS::Handle aXBLScope) { @@ -1183,7 +1183,7 @@ nsXBLBinding::LookupMemberInternal(JSContext* aCx, nsString& aName, // 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 classObject(aCx); if (!JS_GetProperty(aCx, aXBLScope, mJSClass->name, &classObject)) { return false; } diff --git a/content/xbl/src/nsXBLBinding.h b/content/xbl/src/nsXBLBinding.h index 5724801dcde2..34838ee33661 100644 --- a/content/xbl/src/nsXBLBinding.h +++ b/content/xbl/src/nsXBLBinding.h @@ -79,7 +79,8 @@ public: * 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 aDesc); + bool LookupMember(JSContext* aCx, JS::Handle aId, + JS::MutableHandle aDesc); /* * Determines whether the binding has a field with the given name. @@ -91,7 +92,8 @@ 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 aNameAsId, JS::MutableHandle aDesc, JS::Handle aXBLScope); diff --git a/content/xbl/src/nsXBLProtoImpl.cpp b/content/xbl/src/nsXBLProtoImpl.cpp index c413f0c32812..e5fd08492da5 100644 --- a/content/xbl/src/nsXBLProtoImpl.cpp +++ b/content/xbl/src/nsXBLProtoImpl.cpp @@ -88,7 +88,7 @@ nsXBLProtoImpl::InstallImplementation(nsXBLPrototypeBinding* aPrototypeBinding, JSAutoCompartment ac(cx, scopeObject); // If they're different, create our safe holder object in the XBL scope. - JS::RootedObject propertyHolder(cx); + JS::Rooted propertyHolder(cx); if (scopeObject != globalObject) { // This is just a property holder, so it doesn't need any special JSClass. @@ -247,7 +247,7 @@ nsXBLProtoImpl::CompilePrototypeMembers(nsXBLPrototypeBinding* aBinding) bool nsXBLProtoImpl::LookupMember(JSContext* aCx, nsString& aName, - JS::HandleId aNameAsId, + JS::Handle aNameAsId, JS::MutableHandle aDesc, JSObject* aClassObject) { diff --git a/content/xbl/src/nsXBLProtoImpl.h b/content/xbl/src/nsXBLProtoImpl.h index 52dc799427ea..bd383dd3a70e 100644 --- a/content/xbl/src/nsXBLProtoImpl.h +++ b/content/xbl/src/nsXBLProtoImpl.h @@ -45,8 +45,9 @@ public: bool* aTargetIsNew); nsresult CompilePrototypeMembers(nsXBLPrototypeBinding* aBinding); - bool LookupMember(JSContext* aCx, nsString& aName, JS::HandleId aNameAsId, - JS::MutableHandle aDesc, JSObject* aClassObject); + bool LookupMember(JSContext* aCx, nsString& aName, JS::Handle aNameAsId, + JS::MutableHandle aDesc, + JSObject* aClassObject); void SetMemberList(nsXBLProtoImplMember* aMemberList) { diff --git a/content/xbl/src/nsXBLProtoImplMethod.cpp b/content/xbl/src/nsXBLProtoImplMethod.cpp index 091a48f417b2..3ededdd8ec48 100644 --- a/content/xbl/src/nsXBLProtoImplMethod.cpp +++ b/content/xbl/src/nsXBLProtoImplMethod.cpp @@ -195,9 +195,8 @@ nsXBLProtoImplMethod::CompileMember(const nsCString& aClassStr, 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 methodObject(cx); + nsresult rv = nsJSUtils::CompileFunction(cx, JS::NullPtr(), options, cname, paramCount, const_cast(args), body, methodObject.address()); diff --git a/content/xbl/src/nsXBLProtoImplProperty.cpp b/content/xbl/src/nsXBLProtoImplProperty.cpp index cc4328e9bbb1..9aa0c9af761c 100644 --- a/content/xbl/src/nsXBLProtoImplProperty.cpp +++ b/content/xbl/src/nsXBLProtoImplProperty.cpp @@ -194,10 +194,9 @@ nsXBLProtoImplProperty::CompileMember(const nsCString& aClassStr, 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 getterObject(cx); + rv = nsJSUtils::CompileFunction(cx, JS::NullPtr(), options, name, 0, + nullptr, getter, getterObject.address()); delete getterText; deletedGetter = true; @@ -241,10 +240,10 @@ nsXBLProtoImplProperty::CompileMember(const nsCString& aClassStr, 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 setterObject(cx); + rv = nsJSUtils::CompileFunction(cx, JS::NullPtr(), options, name, 1, + gPropertyArgs, setter, + setterObject.address()); delete setterText; deletedSetter = true; diff --git a/content/xbl/src/nsXBLPrototypeHandler.cpp b/content/xbl/src/nsXBLPrototypeHandler.cpp index 59106100e797..b730e60e0214 100644 --- a/content/xbl/src/nsXBLPrototypeHandler.cpp +++ b/content/xbl/src/nsXBLPrototypeHandler.cpp @@ -382,11 +382,11 @@ nsXBLPrototypeHandler::EnsureEventHandler(nsIScriptGlobalObject* aGlobal, options.setFileAndLine(bindingURI.get(), mLineNumber) .setVersion(JSVERSION_LATEST); - JS::Rooted rootedNull(cx); // See bug 781070. JS::Rooted 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); diff --git a/content/xslt/src/xslt/txMozillaXSLTProcessor.cpp b/content/xslt/src/xslt/txMozillaXSLTProcessor.cpp index 361c8b0b5a99..491d7ca29695 100644 --- a/content/xslt/src/xslt/txMozillaXSLTProcessor.cpp +++ b/content/xslt/src/xslt/txMozillaXSLTProcessor.cpp @@ -1441,10 +1441,11 @@ txVariable::Convert(nsIVariant *aValue, txAExprResult** aResult) JSContext* cx = nsContentUtils::GetCurrentJSContext(); NS_ENSURE_TRUE(cx, NS_ERROR_NOT_AVAILABLE); - JS::RootedObject jsobj(cx, holder->GetJSObject()); + JS::Rooted jsobj(cx, holder->GetJSObject()); NS_ENSURE_STATE(jsobj); - JS::RootedString str(cx, JS_ValueToString(cx, OBJECT_TO_JSVAL(jsobj))); + JS::Rooted str(cx, + JS_ValueToString(cx, OBJECT_TO_JSVAL(jsobj))); NS_ENSURE_TRUE(str, NS_ERROR_FAILURE); nsDependentJSString value; diff --git a/content/xul/content/src/nsXULElement.cpp b/content/xul/content/src/nsXULElement.cpp index b1f6f85e83d9..edb0e1cd3331 100644 --- a/content/xul/content/src/nsXULElement.cpp +++ b/content/xul/content/src/nsXULElement.cpp @@ -2633,7 +2633,7 @@ nsXULPrototypeScript::Compile(const PRUnichar* aText, // 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 scope(cx, JS::CurrentGlobalOrNull(cx)); if (scope) { JS::ExposeObjectToActiveJS(scope); } diff --git a/dom/audiochannel/AudioChannelService.cpp b/dom/audiochannel/AudioChannelService.cpp index d121e589a147..c326222f0200 100644 --- a/dom/audiochannel/AudioChannelService.cpp +++ b/dom/audiochannel/AudioChannelService.cpp @@ -677,7 +677,7 @@ AudioChannelService::Observe(nsISupports* aSubject, const char* aTopic, const PR return NS_OK; } - JS::RootedString jsKey(cx, JS_ValueToString(cx, key)); + JS::Rooted jsKey(cx, JS_ValueToString(cx, key)); if (!jsKey) { return NS_OK; } diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index 28f3eb04e18f..d3125951ff7a 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -1381,7 +1381,7 @@ nsDOMClassInfo::GetArrayIndexFromId(JSContext *cx, JS::Handle id, bool *aI if (JSID_IS_INT(id)) { i = JSID_TO_INT(id); } else { - JS::RootedValue idval(cx); + JS::Rooted idval(cx); double array_index; if (!::JS_IdToValue(cx, id, idval.address()) || !JS::ToNumber(cx, idval, &array_index) || @@ -3438,7 +3438,7 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx, JSObject **objp, bool *_retval) { JS::Rooted obj(cx, obj_); - JS::RootedId id(cx, id_); + JS::Rooted id(cx, id_); if (!JSID_IS_STRING(id)) { return NS_OK; diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index b6721c8916ec..1ffb868d0df6 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -10396,7 +10396,7 @@ nsGlobalWindow::ShowSlowScriptDialog() NS_ENSURE_TRUE(prompt, KillSlowScript); // Check if we should offer the option to debug - JS::RootedScript script(cx); + JS::Rooted script(cx); unsigned lineno; bool hasFrame = JS_DescribeScriptedCaller(cx, &script, &lineno); diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index bcff242366f1..bb22d83ab532 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -509,7 +509,7 @@ NS_ScriptErrorReporter(JSContext *cx, // 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 script(cx); if (JS_DescribeScriptedCaller(cx, &script, nullptr)) { xpc->MarkErrorUnreported(cx); return; diff --git a/dom/base/nsJSUtils.cpp b/dom/base/nsJSUtils.cpp index 8c47841c935d..6e946afd1a32 100644 --- a/dom/base/nsJSUtils.cpp +++ b/dom/base/nsJSUtils.cpp @@ -31,7 +31,7 @@ bool nsJSUtils::GetCallingLocation(JSContext* aContext, const char* *aFilename, uint32_t* aLineno) { - JS::RootedScript script(aContext); + JS::Rooted script(aContext); unsigned lineno = 0; if (!JS_DescribeScriptedCaller(aContext, &script, &lineno)) { @@ -156,7 +156,7 @@ nsJSUtils::ReportPendingException(JSContext *aContext) nsresult nsJSUtils::CompileFunction(JSContext* aCx, - JS::HandleObject aTarget, + JS::Handle aTarget, JS::CompileOptions& aOptions, const nsACString& aName, uint32_t aArgCount, @@ -263,7 +263,7 @@ nsJSUtils::EvaluateString(JSContext* aCx, { JSAutoCompartment ac(aCx, aScopeObject); - JS::RootedObject rootedScope(aCx, aScopeObject); + JS::Rooted rootedScope(aCx, aScopeObject); if (aOffThreadToken) { JSScript *script = JS::FinishOffThreadScript(aCx, JS_GetRuntime(aCx), *aOffThreadToken); *aOffThreadToken = nullptr; // Mark the token as having been finished. @@ -294,7 +294,7 @@ nsJSUtils::EvaluateString(JSContext* aCx, } else { rv = JS_IsExceptionPending(aCx) ? NS_ERROR_FAILURE : NS_ERROR_OUT_OF_MEMORY; - JS::RootedValue exn(aCx); + JS::Rooted exn(aCx); JS_GetPendingException(aCx, &exn); if (aRetValue) { *aRetValue = exn; diff --git a/dom/base/nsJSUtils.h b/dom/base/nsJSUtils.h index 65c1c5b8cd0b..e7c63ca25d68 100644 --- a/dom/base/nsJSUtils.h +++ b/dom/base/nsJSUtils.h @@ -53,7 +53,7 @@ public: static void ReportPendingException(JSContext *aContext); static nsresult CompileFunction(JSContext* aCx, - JS::HandleObject aTarget, + JS::Handle aTarget, JS::CompileOptions& aOptions, const nsACString& aName, uint32_t aArgCount, diff --git a/dom/base/nsScreen.cpp b/dom/base/nsScreen.cpp index 66398982bb12..7fccd19220ec 100644 --- a/dom/base/nsScreen.cpp +++ b/dom/base/nsScreen.cpp @@ -264,7 +264,7 @@ nsScreen::MozLockOrientation(const JS::Value& aOrientation, JSContext* aCx, return NS_ERROR_FAILURE; } - JS::RootedString jsString(aCx, JS_ValueToString(aCx, temp)); + JS::Rooted jsString(aCx, JS_ValueToString(aCx, temp)); if (!jsString) { return NS_ERROR_FAILURE; } @@ -283,7 +283,7 @@ nsScreen::MozLockOrientation(const JS::Value& aOrientation, JSContext* aCx, } } - JS::RootedString jsString(aCx, JS_ValueToString(aCx, aOrientation)); + JS::Rooted jsString(aCx, JS_ValueToString(aCx, aOrientation)); if (!jsString) { return NS_ERROR_FAILURE; } diff --git a/dom/bindings/BindingDeclarations.h b/dom/bindings/BindingDeclarations.h index 482aebf7a71d..3e069114ff46 100644 --- a/dom/bindings/BindingDeclarations.h +++ b/dom/bindings/BindingDeclarations.h @@ -83,7 +83,7 @@ public: } protected: - JS::RootedObject mGlobalJSObject; + JS::Rooted mGlobalJSObject; JSContext* mCx; mutable nsISupports* mGlobalObject; mutable nsCOMPtr mGlobalObjectRef; diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 23455ce7f504..7a4238a92246 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -3729,7 +3729,7 @@ for (uint32_t i = 0; i < length; ++i) { notDate = failureCode conversion = ( - "JS::RootedObject possibleDateObject(cx, &${val}.toObject());\n" + "JS::Rooted possibleDateObject(cx, &${val}.toObject());\n" "if (!JS_ObjectIsDate(cx, possibleDateObject) ||\n" " !%s.SetTimeStamp(cx, possibleDateObject)) {\n" "%s\n" @@ -4713,7 +4713,7 @@ def wrapTypeIntoCurrentCompartment(type, value, isMember=True): if type.isAny(): assert not type.nullable() if isMember: - value = "JS::MutableHandleValue::fromMarkedLocation(&%s)" % value + value = "JS::MutableHandle::fromMarkedLocation(&%s)" % value else: value = "&" + value return CGGeneric("if (!JS_WrapValue(cx, %s)) {\n" @@ -4722,7 +4722,7 @@ def wrapTypeIntoCurrentCompartment(type, value, isMember=True): if type.isObject(): if isMember: - value = "JS::MutableHandleObject::fromMarkedLocation(&%s)" % value + value = "JS::MutableHandle::fromMarkedLocation(&%s)" % value else: value = "&" + value return CGGeneric("if (!JS_WrapObject(cx, %s)) {\n" @@ -5535,7 +5535,7 @@ class CGAbstractBindingMethod(CGAbstractStaticMethod): ensureThisObj = None self.getThisObj = CGList( [ensureThisObj, - CGGeneric("JS::RootedObject obj(cx, %s);\n" % + CGGeneric("JS::Rooted obj(cx, %s);\n" % getThisObj)], "\n") self.callArgs = callArgs @@ -5575,7 +5575,7 @@ class CGAbstractStaticBindingMethod(CGAbstractStaticMethod): def definition_body(self): unwrap = CGGeneric("""JS::CallArgs args = JS::CallArgsFromVp(argc, vp); -JS::RootedObject obj(cx, args.computeThis(cx).toObjectOrNull()); +JS::Rooted obj(cx, args.computeThis(cx).toObjectOrNull()); if (!obj) { return false; }""") @@ -5956,7 +5956,7 @@ class CGSpecializedForwardingSetter(CGSpecializedSetter): # 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 v(cx); if (!JS_GetProperty(cx, obj, "%s", &v)) { return false; } diff --git a/dom/bindings/DOMJSProxyHandler.cpp b/dom/bindings/DOMJSProxyHandler.cpp index 495d11abee3c..edcf55a9b584 100644 --- a/dom/bindings/DOMJSProxyHandler.cpp +++ b/dom/bindings/DOMJSProxyHandler.cpp @@ -280,7 +280,7 @@ DOMProxyHandler::has(JSContext* cx, JS::Handle proxy, JS::Handle id) { - JS::RootedValue idval(cx); + JS::Rooted idval(cx); double array_index; int32_t i; if (!::JS_IdToValue(cx, id, idval.address()) || diff --git a/dom/bindings/Exceptions.cpp b/dom/bindings/Exceptions.cpp index e0e259fbead7..f6663b9814c6 100644 --- a/dom/bindings/Exceptions.cpp +++ b/dom/bindings/Exceptions.cpp @@ -370,7 +370,7 @@ JSStackFrame::CreateStack(JSContext* cx) JSFunction* fun = desc->frames[i].fun; if (fun) { - JS::RootedString funid(cx, JS_GetFunctionDisplayId(fun)); + JS::Rooted funid(cx, JS_GetFunctionDisplayId(fun)); if (funid) { size_t length = JS_GetStringEncodingLength(cx, funid); if (length != size_t(-1)) { diff --git a/dom/bindings/TypedArray.h b/dom/bindings/TypedArray.h index 1db626ac8d0b..f84435a4e109 100644 --- a/dom/bindings/TypedArray.h +++ b/dom/bindings/TypedArray.h @@ -94,7 +94,8 @@ public: inline bool WrapIntoNewCompartment(JSContext* cx) { - return JS_WrapObject(cx, JS::MutableHandleObject::fromMarkedLocation(&mObj)); + return JS_WrapObject(cx, + JS::MutableHandle::fromMarkedLocation(&mObj)); } protected: diff --git a/dom/bluetooth/BluetoothUtils.cpp b/dom/bluetooth/BluetoothUtils.cpp index 17a39642a9e9..fb03577d766c 100644 --- a/dom/bluetooth/BluetoothUtils.cpp +++ b/dom/bluetooth/BluetoothUtils.cpp @@ -111,7 +111,7 @@ BroadcastSystemMessage(const nsAString& aType, 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 obj(cx, JS_NewObject(cx, nullptr, nullptr, nullptr)); if (!obj) { BT_WARNING("Failed to new JSObject for system message!"); return false; diff --git a/dom/indexedDB/IDBKeyRange.cpp b/dom/indexedDB/IDBKeyRange.cpp index 91448317b105..221525641f11 100644 --- a/dom/indexedDB/IDBKeyRange.cpp +++ b/dom/indexedDB/IDBKeyRange.cpp @@ -63,7 +63,7 @@ IDBKeyRange::FromJSVal(JSContext* aCx, return NS_OK; } - JS::RootedObject obj(aCx, aVal.isObject() ? &aVal.toObject() : nullptr); + JS::Rooted 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. @@ -159,7 +159,7 @@ IDBKeyRange::~IDBKeyRange() } JSObject* -IDBKeyRange::WrapObject(JSContext* aCx, JS::HandleObject aScope) +IDBKeyRange::WrapObject(JSContext* aCx, JS::Handle aScope) { return IDBKeyRangeBinding::Wrap(aCx, aScope, this); } @@ -211,7 +211,7 @@ IDBKeyRange::GetUpper(JSContext* aCx, ErrorResult& aRv) // static already_AddRefed IDBKeyRange::Only(const GlobalObject& aGlobal, JSContext* aCx, - JS::HandleValue aValue, ErrorResult& aRv) + JS::Handle aValue, ErrorResult& aRv) { MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!"); @@ -229,7 +229,8 @@ IDBKeyRange::Only(const GlobalObject& aGlobal, JSContext* aCx, // static already_AddRefed IDBKeyRange::LowerBound(const GlobalObject& aGlobal, JSContext* aCx, - JS::HandleValue aValue, bool aOpen, ErrorResult& aRv) + JS::Handle aValue, bool aOpen, + ErrorResult& aRv) { MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!"); @@ -247,7 +248,8 @@ IDBKeyRange::LowerBound(const GlobalObject& aGlobal, JSContext* aCx, // static already_AddRefed IDBKeyRange::UpperBound(const GlobalObject& aGlobal, JSContext* aCx, - JS::HandleValue aValue, bool aOpen, ErrorResult& aRv) + JS::Handle aValue, bool aOpen, + ErrorResult& aRv) { MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!"); @@ -265,7 +267,7 @@ IDBKeyRange::UpperBound(const GlobalObject& aGlobal, JSContext* aCx, // static already_AddRefed IDBKeyRange::Bound(const GlobalObject& aGlobal, JSContext* aCx, - JS::HandleValue aLower, JS::HandleValue aUpper, + JS::Handle aLower, JS::Handle aUpper, bool aLowerOpen, bool aUpperOpen, ErrorResult& aRv) { MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!"); diff --git a/dom/indexedDB/IDBKeyRange.h b/dom/indexedDB/IDBKeyRange.h index 01790aae0935..f22c721705ae 100644 --- a/dom/indexedDB/IDBKeyRange.h +++ b/dom/indexedDB/IDBKeyRange.h @@ -148,7 +148,7 @@ public: // WebIDL JSObject* - WrapObject(JSContext* aCx, JS::HandleObject aScope); + WrapObject(JSContext* aCx, JS::Handle aScope); nsISupports* GetParentObject() const @@ -175,21 +175,21 @@ public: } static already_AddRefed - Only(const GlobalObject& aGlobal, JSContext* aCx, JS::HandleValue aValue, - ErrorResult& aRv); + Only(const GlobalObject& aGlobal, JSContext* aCx, + JS::Handle aValue, ErrorResult& aRv); static already_AddRefed LowerBound(const GlobalObject& aGlobal, JSContext* aCx, - JS::HandleValue aValue, bool aOpen, ErrorResult& aRv); + JS::Handle aValue, bool aOpen, ErrorResult& aRv); static already_AddRefed UpperBound(const GlobalObject& aGlobal, JSContext* aCx, - JS::HandleValue aValue, bool aOpen, ErrorResult& aRv); + JS::Handle aValue, bool aOpen, ErrorResult& aRv); static already_AddRefed - 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 aLower, JS::Handle aUpper, + bool aLowerOpen, bool aUpperOpen, ErrorResult& aRv); private: IDBKeyRange(nsISupports* aGlobal, diff --git a/dom/indexedDB/IDBObjectStore.cpp b/dom/indexedDB/IDBObjectStore.cpp index 3748d7b73779..6acdc5b299d7 100644 --- a/dom/indexedDB/IDBObjectStore.cpp +++ b/dom/indexedDB/IDBObjectStore.cpp @@ -361,7 +361,8 @@ public: DoDatabaseWork(mozIStorageConnection* aConnection) MOZ_OVERRIDE; virtual nsresult - GetSuccessResult(JSContext* aCx, JS::MutableHandleValue aVal) MOZ_OVERRIDE; + GetSuccessResult(JSContext* aCx, JS::MutableHandle aVal) + MOZ_OVERRIDE; virtual void ReleaseMainThreadObjects() MOZ_OVERRIDE; @@ -509,7 +510,8 @@ public: DoDatabaseWork(mozIStorageConnection* aConnection) MOZ_OVERRIDE; virtual nsresult - GetSuccessResult(JSContext* aCx, JS::MutableHandleValue aVal) MOZ_OVERRIDE; + GetSuccessResult(JSContext* aCx, JS::MutableHandle aVal) + MOZ_OVERRIDE; virtual void ReleaseMainThreadObjects() MOZ_OVERRIDE; @@ -2965,7 +2967,7 @@ IDBObjectStore::Count(JSContext* aCx, already_AddRefed IDBObjectStore::GetAllKeys(JSContext* aCx, - const Optional& aKey, + const Optional>& aKey, const Optional& aLimit, ErrorResult& aRv) { MOZ_ASSERT(NS_IsMainThread()); @@ -2991,8 +2993,8 @@ IDBObjectStore::GetAllKeys(JSContext* aCx, already_AddRefed IDBObjectStore::OpenKeyCursor(JSContext* aCx, - const Optional& aRange, - IDBCursorDirection aDirection, ErrorResult& aRv) + const Optional>& aRange, + IDBCursorDirection aDirection, ErrorResult& aRv) { MOZ_ASSERT(NS_IsMainThread()); @@ -4246,7 +4248,7 @@ OpenKeyCursorHelper::EnsureCursor() nsresult OpenKeyCursorHelper::GetSuccessResult(JSContext* aCx, - JS::MutableHandleValue aVal) + JS::MutableHandle aVal) { MOZ_ASSERT(NS_IsMainThread()); @@ -4911,7 +4913,8 @@ GetAllKeysHelper::DoDatabaseWork(mozIStorageConnection* /* aConnection */) } nsresult -GetAllKeysHelper::GetSuccessResult(JSContext* aCx, JS::MutableHandleValue aVal) +GetAllKeysHelper::GetSuccessResult(JSContext* aCx, + JS::MutableHandle aVal) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(mKeys.Length() <= mLimit); @@ -4923,7 +4926,7 @@ GetAllKeysHelper::GetSuccessResult(JSContext* aCx, JS::MutableHandleValue aVal) nsTArray keys; mKeys.SwapElements(keys); - JS::RootedObject array(aCx, JS_NewArrayObject(aCx, 0, NULL)); + JS::Rooted array(aCx, JS_NewArrayObject(aCx, 0, NULL)); if (!array) { NS_WARNING("Failed to make array!"); return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR; @@ -4939,7 +4942,7 @@ GetAllKeysHelper::GetSuccessResult(JSContext* aCx, JS::MutableHandleValue aVal) const Key& key = keys[index]; MOZ_ASSERT(!key.IsUnset()); - JS::RootedValue value(aCx); + JS::Rooted value(aCx); nsresult rv = key.ToJSVal(aCx, &value); if (NS_FAILED(rv)) { NS_WARNING("Failed to get jsval for key!"); diff --git a/dom/indexedDB/IDBObjectStore.h b/dom/indexedDB/IDBObjectStore.h index d5ff96aa9126..1e46967cc9f0 100644 --- a/dom/indexedDB/IDBObjectStore.h +++ b/dom/indexedDB/IDBObjectStore.h @@ -355,11 +355,11 @@ public: const Optional& aLimit, ErrorResult& aRv); already_AddRefed - GetAllKeys(JSContext* aCx, const Optional& aKey, + GetAllKeys(JSContext* aCx, const Optional>& aKey, const Optional& aLimit, ErrorResult& aRv); already_AddRefed - OpenKeyCursor(JSContext* aCx, const Optional& aRange, + OpenKeyCursor(JSContext* aCx, const Optional>& aRange, IDBCursorDirection aDirection, ErrorResult& aRv); protected: diff --git a/dom/indexedDB/IndexedDatabaseManager.cpp b/dom/indexedDB/IndexedDatabaseManager.cpp index ed2a78446833..67fb0b19cbc2 100644 --- a/dom/indexedDB/IndexedDatabaseManager.cpp +++ b/dom/indexedDB/IndexedDatabaseManager.cpp @@ -208,8 +208,8 @@ struct MOZ_STACK_CLASS InvalidateInfo }; bool -GetIndexedDB(JSContext* aCx, JS::HandleObject aGlobal, - JS::MutableHandleValue aResult) +GetIndexedDB(JSContext* aCx, JS::Handle aGlobal, + JS::MutableHandle aResult) { MOZ_ASSERT(nsContentUtils::IsCallerChrome(), "Only for chrome!"); MOZ_ASSERT(js::GetObjectClass(aGlobal)->flags & JSCLASS_DOM_GLOBAL, @@ -227,20 +227,20 @@ GetIndexedDB(JSContext* aCx, JS::HandleObject aGlobal, } bool -IndexedDBLazyGetter(JSContext* aCx, JS::HandleObject aGlobal, - JS::HandleId aId, JS::MutableHandleValue aVp) +IndexedDBLazyGetter(JSContext* aCx, JS::Handle aGlobal, + JS::Handle aId, JS::MutableHandle 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 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 indexedDB(aCx); if (!GetIndexedDB(aCx, global, &indexedDB)) { return false; } @@ -483,7 +483,7 @@ IndexedDatabaseManager::TabContextMayAccessOrigin(const TabContext& aContext, // static bool IndexedDatabaseManager::DefineConstructors(JSContext* aCx, - JS::HandleObject aGlobal) + JS::Handle aGlobal) { MOZ_ASSERT(NS_IsMainThread()); @@ -499,14 +499,14 @@ IndexedDatabaseManager::DefineConstructors(JSContext* aCx, // static bool IndexedDatabaseManager::DefineIndexedDBGetter(JSContext* aCx, - JS::HandleObject aGlobal) + JS::Handle 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 indexedDB(aCx); if (!GetIndexedDB(aCx, aGlobal, &indexedDB)) { return false; } @@ -518,7 +518,7 @@ IndexedDatabaseManager::DefineIndexedDBGetter(JSContext* aCx, // static bool IndexedDatabaseManager::DefineIndexedDBLazyGetter(JSContext* aCx, - JS::HandleObject aGlobal) + JS::Handle aGlobal) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(nsContentUtils::IsCallerChrome(), "Only for chrome!"); @@ -733,7 +733,7 @@ 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 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; @@ -1005,8 +1005,8 @@ GetFileReferencesHelper::Run() BEGIN_INDEXEDDB_NAMESPACE bool -ResolveConstructors(JSContext* aCx, JS::HandleObject aObj, JS::HandleId aId, - JS::MutableHandleObject aObjp) +ResolveConstructors(JSContext* aCx, JS::Handle aObj, + JS::Handle aId, JS::MutableHandle aObjp) { MOZ_ASSERT(NS_IsMainThread()); @@ -1014,7 +1014,8 @@ ResolveConstructors(JSContext* aCx, JS::HandleObject aObj, JS::HandleId aId, // 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 str(aCx, + JS_InternString(aCx, gConstructorInfo[i].name)); if (!str) { NS_WARNING("Failed to intern string!"); while (i) { @@ -1029,7 +1030,7 @@ ResolveConstructors(JSContext* aCx, JS::HandleObject aObj, JS::HandleId aId, // Now resolve. for (uint32_t i = 0; i < mozilla::ArrayLength(gConstructorInfo); i++) { if (gConstructorInfo[i].id == aId) { - JS::RootedObject constructor(aCx, + JS::Rooted constructor(aCx, gConstructorInfo[i].resolve(aCx, aObj, true)); if (!constructor) { return false; diff --git a/dom/indexedDB/IndexedDatabaseManager.h b/dom/indexedDB/IndexedDatabaseManager.h index 2bf07882773b..e81236fbc7bb 100644 --- a/dom/indexedDB/IndexedDatabaseManager.h +++ b/dom/indexedDB/IndexedDatabaseManager.h @@ -140,13 +140,13 @@ public: const nsACString& aOrigin); static bool - DefineConstructors(JSContext* aCx, JS::HandleObject aGlobal); + DefineConstructors(JSContext* aCx, JS::Handle aGlobal); static bool - DefineIndexedDBGetter(JSContext* aCx, JS::HandleObject aGlobal); + DefineIndexedDBGetter(JSContext* aCx, JS::Handle aGlobal); static bool - DefineIndexedDBLazyGetter(JSContext* aCx, JS::HandleObject aGlobal); + DefineIndexedDBLazyGetter(JSContext* aCx, JS::Handle aGlobal); private: IndexedDatabaseManager(); @@ -177,8 +177,8 @@ private: }; bool -ResolveConstructors(JSContext* aCx, JS::HandleObject aObj, JS::HandleId aId, - JS::MutableHandleObject aObjp); +ResolveConstructors(JSContext* aCx, JS::Handle aObj, + JS::Handle aId, JS::MutableHandle aObjp); END_INDEXEDDB_NAMESPACE diff --git a/dom/indexedDB/KeyPath.cpp b/dom/indexedDB/KeyPath.cpp index ec7ec0231c0b..a733480f2150 100644 --- a/dom/indexedDB/KeyPath.cpp +++ b/dom/indexedDB/KeyPath.cpp @@ -47,7 +47,7 @@ IsValidKeyPathString(JSContext* aCx, const nsAString& aKeyPath) } NS_ASSERTION(stringVal.toString(), "This should never happen"); - JS::RootedString str(aCx, stringVal.toString()); + JS::Rooted str(aCx, stringVal.toString()); bool isIdentifier = false; if (!JS_IsIdentifier(aCx, str, &isIdentifier) || !isIdentifier) { @@ -382,7 +382,7 @@ KeyPath::ExtractKeyAsJSVal(JSContext* aCx, const JS::Value& aValue, } const uint32_t len = mStrings.Length(); - JS::RootedObject arrayObj(aCx, JS_NewArrayObject(aCx, len, nullptr)); + JS::Rooted arrayObj(aCx, JS_NewArrayObject(aCx, len, nullptr)); if (!arrayObj) { return NS_ERROR_OUT_OF_MEMORY; } diff --git a/dom/plugins/base/nsJSNPRuntime.cpp b/dom/plugins/base/nsJSNPRuntime.cpp index a26514affff4..d3ca0781ca76 100644 --- a/dom/plugins/base/nsJSNPRuntime.cpp +++ b/dom/plugins/base/nsJSNPRuntime.cpp @@ -456,7 +456,7 @@ ThrowJSException(JSContext *cx, const char *message) ucex.Length()); if (str) { - JS::RootedValue exn(cx, JS::StringValue(str)); + JS::Rooted exn(cx, JS::StringValue(str)); ::JS_SetPendingException(cx, exn); } diff --git a/dom/plugins/ipc/PluginIdentifierParent.cpp b/dom/plugins/ipc/PluginIdentifierParent.cpp index 045eebda371e..3b4f399301d2 100644 --- a/dom/plugins/ipc/PluginIdentifierParent.cpp +++ b/dom/plugins/ipc/PluginIdentifierParent.cpp @@ -31,7 +31,7 @@ PluginIdentifierParent::RecvRetain() // 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 str(cx, JSID_TO_STRING(id)); JSString* str2 = JS_InternJSString(cx, str); if (!str2) { return false; diff --git a/dom/plugins/ipc/PluginScriptableObjectParent.cpp b/dom/plugins/ipc/PluginScriptableObjectParent.cpp index 69c405cf5119..469c1ec04a6b 100644 --- a/dom/plugins/ipc/PluginScriptableObjectParent.cpp +++ b/dom/plugins/ipc/PluginScriptableObjectParent.cpp @@ -1046,7 +1046,7 @@ PluginScriptableObjectParent::AnswerEnumerate(InfallibleTArray str(cx, NPIdentifierToString(ids[index])); if (!JS_StringHasBeenInterned(cx, str)) { DebugOnly str2 = JS_InternJSString(cx, str); NS_ASSERTION(str2 == str, "Interning a JS string which is currently an ID should return itself."); diff --git a/dom/src/json/nsJSON.cpp b/dom/src/json/nsJSON.cpp index 1b4d6bbb30b6..f45ba9c8fa52 100644 --- a/dom/src/json/nsJSON.cpp +++ b/dom/src/json/nsJSON.cpp @@ -524,7 +524,7 @@ nsJSONListener::OnStopRequest(nsIRequest *aRequest, nsISupports *aContext, NS_ENSURE_SUCCESS(rv, rv); } - JS::RootedValue reviver(mCx, JS::NullValue()), value(mCx); + JS::Rooted reviver(mCx, JS::NullValue()), value(mCx); JS::StableCharPtr chars(reinterpret_cast(mBufferedChars.Elements()), mBufferedChars.Length()); diff --git a/dom/src/notification/DesktopNotification.cpp b/dom/src/notification/DesktopNotification.cpp index 15fe3be9c34b..e3840f7aa39c 100644 --- a/dom/src/notification/DesktopNotification.cpp +++ b/dom/src/notification/DesktopNotification.cpp @@ -93,7 +93,7 @@ DesktopNotification::PostDesktopNotification() nsString manifestUrl = EmptyString(); appsService->GetManifestURLByLocalId(appId, manifestUrl); mozilla::AutoSafeJSContext cx; - JS::RootedValue val(cx); + JS::Rooted val(cx); AppNotificationServiceOptions ops; ops.mTextClickable = true; ops.mManifestURL = manifestUrl; diff --git a/dom/src/notification/Notification.cpp b/dom/src/notification/Notification.cpp index 7f4de6d609aa..e63761ef59af 100644 --- a/dom/src/notification/Notification.cpp +++ b/dom/src/notification/Notification.cpp @@ -73,8 +73,8 @@ public: aTitle, options); JSAutoCompartment ac(aCx, mGlobal); - JS::RootedObject scope(aCx, mGlobal); - JS::RootedObject element(aCx, notification->WrapObject(aCx, scope)); + JS::Rooted scope(aCx, mGlobal); + JS::Rooted element(aCx, notification->WrapObject(aCx, scope)); NS_ENSURE_TRUE(element, NS_ERROR_FAILURE); if (!JS_DefineElement(aCx, mNotifications, mCount++, @@ -87,7 +87,8 @@ public: NS_IMETHOD Done(JSContext* aCx) { JSAutoCompartment ac(aCx, mGlobal); - Optional result(aCx, JS::ObjectValue(*mNotifications)); + Optional> result(aCx, + JS::ObjectValue(*mNotifications)); mPromise->MaybeResolve(aCx, result); return NS_OK; } @@ -553,7 +554,7 @@ Notification::ShowInternal() rv = appsService->GetManifestURLByLocalId(appId, manifestUrl); if (NS_SUCCEEDED(rv)) { mozilla::AutoSafeJSContext cx; - JS::RootedValue val(cx); + JS::Rooted val(cx); AppNotificationServiceOptions ops; ops.mTextClickable = true; ops.mManifestURL = manifestUrl; diff --git a/dom/system/gonk/AudioManager.cpp b/dom/system/gonk/AudioManager.cpp index 2b6a9d416b47..8667801c026c 100644 --- a/dom/system/gonk/AudioManager.cpp +++ b/dom/system/gonk/AudioManager.cpp @@ -310,7 +310,7 @@ AudioManager::Observe(nsISupports* aSubject, return NS_OK; } - JS::RootedString jsKey(cx, JS_ValueToString(cx, key)); + JS::Rooted jsKey(cx, JS_ValueToString(cx, key)); if (!jsKey) { return NS_OK; } diff --git a/dom/wifi/WifiProxyService.cpp b/dom/wifi/WifiProxyService.cpp index bd135d555f31..b22b91a855fb 100644 --- a/dom/wifi/WifiProxyService.cpp +++ b/dom/wifi/WifiProxyService.cpp @@ -279,7 +279,7 @@ WifiProxyService::DispatchWifiResult(const WifiResultOptions& aOptions, const ns MOZ_ASSERT(NS_IsMainThread()); mozilla::AutoSafeJSContext cx; - JS::RootedValue val(cx); + JS::Rooted val(cx); if (!aOptions.ToObject(cx, JS::NullPtr(), &val)) { return; diff --git a/dom/workers/FileReaderSync.cpp b/dom/workers/FileReaderSync.cpp index 91aecc9220d9..208c86a072c4 100644 --- a/dom/workers/FileReaderSync.cpp +++ b/dom/workers/FileReaderSync.cpp @@ -51,7 +51,7 @@ FileReaderSync::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv) } JSObject* -FileReaderSync::WrapObject(JSContext* aCx, JS::HandleObject aScope) +FileReaderSync::WrapObject(JSContext* aCx, JS::Handle aScope) { return FileReaderSyncBinding_workers::Wrap(aCx, aScope, this); } diff --git a/dom/workers/FileReaderSync.h b/dom/workers/FileReaderSync.h index 3174068ab485..096781c833e0 100644 --- a/dom/workers/FileReaderSync.h +++ b/dom/workers/FileReaderSync.h @@ -36,7 +36,7 @@ public: static already_AddRefed Constructor(const GlobalObject& aGlobal, ErrorResult& aRv); - JSObject* WrapObject(JSContext* aCx, JS::HandleObject aScope); + JSObject* WrapObject(JSContext* aCx, JS::Handle aScope); NS_DECL_ISUPPORTS diff --git a/dom/workers/MessagePort.cpp b/dom/workers/MessagePort.cpp index 9188919aa33a..bf8012d0e0b9 100644 --- a/dom/workers/MessagePort.cpp +++ b/dom/workers/MessagePort.cpp @@ -72,7 +72,7 @@ MessagePort::~MessagePort() } void -MessagePort::PostMessageMoz(JSContext* aCx, JS::HandleValue aMessage, +MessagePort::PostMessageMoz(JSContext* aCx, JS::Handle aMessage, const Optional>& aTransferable, ErrorResult& aRv) { @@ -232,7 +232,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(MessagePort, NS_IMPL_CYCLE_COLLECTION_UNLINK_END JSObject* -MessagePort::WrapObject(JSContext* aCx, JS::HandleObject aScope) +MessagePort::WrapObject(JSContext* aCx, JS::Handle aScope) { AssertCorrectThread(); diff --git a/dom/workers/MessagePort.h b/dom/workers/MessagePort.h index 1ab598f5e756..c07cdcf3b4f6 100644 --- a/dom/workers/MessagePort.h +++ b/dom/workers/MessagePort.h @@ -38,7 +38,7 @@ public: PrefEnabled(); virtual void - PostMessageMoz(JSContext* aCx, JS::HandleValue aMessage, + PostMessageMoz(JSContext* aCx, JS::Handle aMessage, const Optional>& aTransferable, ErrorResult& aRv) MOZ_OVERRIDE; @@ -76,7 +76,7 @@ public: } virtual JSObject* - WrapObject(JSContext* aCx, JS::HandleObject aScope) MOZ_OVERRIDE; + WrapObject(JSContext* aCx, JS::Handle aScope) MOZ_OVERRIDE; virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor) MOZ_OVERRIDE; diff --git a/dom/workers/RuntimeService.cpp b/dom/workers/RuntimeService.cpp index df477c6af9a0..382037ffba8a 100644 --- a/dom/workers/RuntimeService.cpp +++ b/dom/workers/RuntimeService.cpp @@ -731,7 +731,7 @@ ContentSecurityPolicyAllows(JSContext* aCx) nsString fileName; uint32_t lineNum = 0; - JS::RootedScript script(aCx); + JS::Rooted script(aCx); const char* file; if (JS_DescribeScriptedCaller(aCx, &script, &lineNum) && (file = JS_GetScriptFilename(aCx, script))) { diff --git a/dom/workers/ScriptLoader.cpp b/dom/workers/ScriptLoader.cpp index 31bc87ebe64f..edee86a8eada 100644 --- a/dom/workers/ScriptLoader.cpp +++ b/dom/workers/ScriptLoader.cpp @@ -707,7 +707,7 @@ ScriptExecutorRunnable::WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) } } - JS::RootedObject global(aCx, JS::CurrentGlobalOrNull(aCx)); + JS::Rooted global(aCx, JS::CurrentGlobalOrNull(aCx)); NS_ASSERTION(global, "Must have a global by now!"); JSPrincipals* principal = GetWorkerPrincipal(); diff --git a/dom/workers/SharedWorker.cpp b/dom/workers/SharedWorker.cpp index f6103a899a4c..92248b3c03ce 100644 --- a/dom/workers/SharedWorker.cpp +++ b/dom/workers/SharedWorker.cpp @@ -161,7 +161,7 @@ SharedWorker::Close() } void -SharedWorker::PostMessage(JSContext* aCx, JS::HandleValue aMessage, +SharedWorker::PostMessage(JSContext* aCx, JS::Handle aMessage, const Optional>& aTransferable, ErrorResult& aRv) { @@ -205,7 +205,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(SharedWorker, NS_IMPL_CYCLE_COLLECTION_UNLINK_END JSObject* -SharedWorker::WrapObject(JSContext* aCx, JS::HandleObject aScope) +SharedWorker::WrapObject(JSContext* aCx, JS::Handle aScope) { AssertIsOnMainThread(); diff --git a/dom/workers/SharedWorker.h b/dom/workers/SharedWorker.h index aa73b029ad0e..ff6dbe97550a 100644 --- a/dom/workers/SharedWorker.h +++ b/dom/workers/SharedWorker.h @@ -77,7 +77,7 @@ public: IMPL_EVENT_HANDLER(error) virtual JSObject* - WrapObject(JSContext* aCx, JS::HandleObject aScope) MOZ_OVERRIDE; + WrapObject(JSContext* aCx, JS::Handle aScope) MOZ_OVERRIDE; virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor) MOZ_OVERRIDE; @@ -98,7 +98,7 @@ private: // Only called by MessagePort. void - PostMessage(JSContext* aCx, JS::HandleValue aMessage, + PostMessage(JSContext* aCx, JS::Handle aMessage, const Optional>& aTransferable, ErrorResult& aRv); diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp index dc8c9723bc15..9a4d2297d6bf 100644 --- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -3582,7 +3582,7 @@ WorkerPrivate::GetLoadInfo(JSContext* aCx, nsPIDOMWindow* aWindow, // 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 script(aCx); if (JS_DescribeScriptedCaller(aCx, &script, nullptr)) { const char* fileName = JS_GetScriptFilename(aCx, script); @@ -4539,7 +4539,7 @@ void WorkerPrivate::PostMessageToParentMessagePort( JSContext* aCx, uint64_t aMessagePortSerial, - JS::HandleValue aMessage, + JS::Handle aMessage, const Optional>& aTransferable, ErrorResult& aRv) { @@ -4923,7 +4923,7 @@ WorkerPrivate::RunExpiredTimeouts(JSContext* aCx) bool retval = true; AutoPtrComparator comparator = GetAutoPtrComparator(mTimeouts); - JS::RootedObject global(aCx, JS::CurrentGlobalOrNull(aCx)); + JS::Rooted global(aCx, JS::CurrentGlobalOrNull(aCx)); JSPrincipals* principal = GetWorkerPrincipal(); // We want to make sure to run *something*, even if the timer fired a little diff --git a/dom/workers/WorkerPrivate.h b/dom/workers/WorkerPrivate.h index 2126ddcbef7c..d3d35d31b878 100644 --- a/dom/workers/WorkerPrivate.h +++ b/dom/workers/WorkerPrivate.h @@ -824,7 +824,6 @@ public: ErrorResult& aRv); static already_AddRefed - Constructor(const GlobalObject& aGlobal, const nsAString& aScriptURL, bool aIsChromeWorker, WorkerType aWorkerType, const nsAString& aSharedWorkerName, @@ -932,7 +931,7 @@ public: PostMessageToParentMessagePort( JSContext* aCx, uint64_t aMessagePortSerial, - JS::HandleValue aMessage, + JS::Handle aMessage, const Optional>& aTransferable, ErrorResult& aRv); diff --git a/dom/workers/WorkerScope.cpp b/dom/workers/WorkerScope.cpp index 2a4d2ae00c7c..ecc5e7459cd1 100644 --- a/dom/workers/WorkerScope.cpp +++ b/dom/workers/WorkerScope.cpp @@ -70,7 +70,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WorkerGlobalScope) NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper) JSObject* -WorkerGlobalScope::WrapObject(JSContext* aCx, JS::HandleObject aScope) +WorkerGlobalScope::WrapObject(JSContext* aCx, JS::Handle aScope) { MOZ_CRASH("We should never get here!"); } diff --git a/dom/workers/WorkerScope.h b/dom/workers/WorkerScope.h index 4340229452ce..506f1dbc5350 100644 --- a/dom/workers/WorkerScope.h +++ b/dom/workers/WorkerScope.h @@ -37,7 +37,7 @@ protected: public: virtual JSObject* - WrapObject(JSContext* aCx, JS::HandleObject aScope) MOZ_OVERRIDE; + WrapObject(JSContext* aCx, JS::Handle aScope) MOZ_OVERRIDE; virtual JSObject* WrapGlobalObject(JSContext* aCx, JS::CompartmentOptions& aOptions,