From 4d68f1d57dd20bd14bea23f41592b948c925c8a9 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Sun, 5 Jun 2022 20:55:00 +0000 Subject: [PATCH] Bug 1769290 - Part 10: Apply mozilla-js-handle-rooted-typedef against remaining dom directories r=smaug Differential Revision: https://phabricator.services.mozilla.com/D148283 --- dom/promise/Promise.cpp | 10 +++--- dom/promise/PromiseDebugging.cpp | 8 ++--- dom/promise/gtest/NativeThenHandler.cpp | 32 +++++++++---------- .../gtest/ThenWithCycleCollectedArgsJS.cpp | 17 +++++----- .../PrototypeDocumentContentSink.cpp | 2 +- dom/quota/StorageManager.cpp | 4 +-- dom/script/ScriptLoader.cpp | 11 ++++--- dom/security/nsContentSecurityUtils.cpp | 8 ++--- .../gtest/TestUnexpectedPrivilegedLoads.cpp | 8 ++--- dom/simpledb/SDBConnection.cpp | 2 +- dom/simpledb/SDBResults.cpp | 3 +- dom/vr/XRPermissionRequest.cpp | 2 +- dom/vr/XRPermissionRequest.h | 2 +- dom/vr/XRSystem.cpp | 6 ++-- dom/vr/XRSystem.h | 2 +- dom/webscheduling/WebTaskScheduler.cpp | 4 +-- dom/worklet/WorkletThread.cpp | 6 ++-- dom/xul/nsXULElement.cpp | 2 +- 18 files changed, 67 insertions(+), 62 deletions(-) diff --git a/dom/promise/Promise.cpp b/dom/promise/Promise.cpp index b8a6b9313284..48b8ab66f36e 100644 --- a/dom/promise/Promise.cpp +++ b/dom/promise/Promise.cpp @@ -292,7 +292,8 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(PromiseNativeThenHandlerBase) Result, nsresult> Promise::ThenWithoutCycleCollection( const std::function( - JSContext* aCx, JS::HandleValue aValue, ErrorResult& aRv)>& aCallback) { + JSContext* aCx, JS::Handle aValue, ErrorResult& aRv)>& + aCallback) { return ThenWithCycleCollectedArgs(aCallback); } @@ -576,7 +577,8 @@ void Promise::MaybeRejectWithUndefined() { MaybeSomething(JS::UndefinedHandleValue, &Promise::MaybeReject); } -void Promise::ReportRejectedPromise(JSContext* aCx, JS::HandleObject aPromise) { +void Promise::ReportRejectedPromise(JSContext* aCx, + JS::Handle aPromise) { MOZ_ASSERT(!js::IsWrapper(aPromise)); MOZ_ASSERT(JS::GetPromiseState(aPromise) == JS::PromiseState::Rejected); @@ -933,7 +935,7 @@ bool Promise::SetSettledPromiseIsHandled() { AutoAllowLegacyScriptExecution exemption; AutoEntryScript aes(mGlobal, "Set settled promise handled"); JSContext* cx = aes.cx(); - JS::RootedObject promiseObj(cx, mPromiseObj); + JS::Rooted promiseObj(cx, mPromiseObj); return JS::SetSettledPromiseIsHandled(cx, promiseObj); } @@ -941,7 +943,7 @@ bool Promise::SetAnyPromiseIsHandled() { AutoAllowLegacyScriptExecution exemption; AutoEntryScript aes(mGlobal, "Set any promise handled"); JSContext* cx = aes.cx(); - JS::RootedObject promiseObj(cx, mPromiseObj); + JS::Rooted promiseObj(cx, mPromiseObj); return JS::SetAnyPromiseIsHandled(cx, promiseObj); } diff --git a/dom/promise/PromiseDebugging.cpp b/dom/promise/PromiseDebugging.cpp index d181bc9f9581..b27661ef5e60 100644 --- a/dom/promise/PromiseDebugging.cpp +++ b/dom/promise/PromiseDebugging.cpp @@ -211,7 +211,7 @@ bool PromiseDebugging::RemoveUncaughtRejectionObserver( } /* static */ -void PromiseDebugging::AddUncaughtRejection(JS::HandleObject aPromise) { +void PromiseDebugging::AddUncaughtRejection(JS::Handle aPromise) { // This might OOM, but won't set a pending exception, so we'll just ignore it. if (CycleCollectedJSContext::Get()->mUncaughtRejections.append(aPromise)) { FlushRejections::DispatchNeeded(); @@ -219,7 +219,7 @@ void PromiseDebugging::AddUncaughtRejection(JS::HandleObject aPromise) { } /* void */ -void PromiseDebugging::AddConsumedRejection(JS::HandleObject aPromise) { +void PromiseDebugging::AddConsumedRejection(JS::Handle aPromise) { // If the promise is in our list of uncaught rejections, we haven't yet // reported it as unhandled. In that case, just remove it from the list // and don't add it to the list of consumed rejections. @@ -254,7 +254,7 @@ void PromiseDebugging::FlushUncaughtRejectionsInternal() { auto& observers = storage->mUncaughtRejectionObservers; for (size_t i = 0; i < uncaught.length(); i++) { - JS::RootedObject promise(cx, uncaught[i]); + JS::Rooted promise(cx, uncaught[i]); // Filter out nullptrs which might've been added by // PromiseDebugging::AddConsumedRejection. if (!promise) { @@ -281,7 +281,7 @@ void PromiseDebugging::FlushUncaughtRejectionsInternal() { // Notify observers of consumed Promise. for (size_t i = 0; i < consumed.length(); i++) { - JS::RootedObject promise(cx, consumed[i]); + JS::Rooted promise(cx, consumed[i]); for (size_t j = 0; j < observers.Length(); ++j) { RefPtr obs = diff --git a/dom/promise/gtest/NativeThenHandler.cpp b/dom/promise/gtest/NativeThenHandler.cpp index 25f7da067853..13ed6d2c11f7 100644 --- a/dom/promise/gtest/NativeThenHandler.cpp +++ b/dom/promise/gtest/NativeThenHandler.cpp @@ -65,12 +65,12 @@ struct DummyCallbacks final : public TraceCallbacks { TEST(NativeThenHandler, TraceValue) { - auto onResolve = [](JSContext*, JS::HandleValue, ErrorResult&, - JS::HandleValue) -> already_AddRefed { + auto onResolve = [](JSContext*, JS::Handle, ErrorResult&, + JS::Handle) -> already_AddRefed { return nullptr; }; - auto onReject = [](JSContext*, JS::HandleValue, ErrorResult&, - JS::HandleValue) -> already_AddRefed { + auto onReject = [](JSContext*, JS::Handle, ErrorResult&, + JS::Handle) -> already_AddRefed { return nullptr; }; @@ -91,19 +91,19 @@ TEST(NativeThenHandler, TraceValue) TEST(NativeThenHandler, TraceObject) { - auto onResolve = [](JSContext*, JS::HandleValue, ErrorResult&, - JS::HandleObject) -> already_AddRefed { + auto onResolve = [](JSContext*, JS::Handle, ErrorResult&, + JS::Handle) -> already_AddRefed { return nullptr; }; - auto onReject = [](JSContext*, JS::HandleValue, ErrorResult&, - JS::HandleObject) -> already_AddRefed { + auto onReject = [](JSContext*, JS::Handle, ErrorResult&, + JS::Handle) -> already_AddRefed { return nullptr; }; AutoJSAPI jsapi; MOZ_ALWAYS_TRUE(jsapi.Init(xpc::PrivilegedJunkScope())); JSContext* cx = jsapi.cx(); - JS::RootedObject obj(cx, JS_NewPlainObject(cx)); + JS::Rooted obj(cx, JS_NewPlainObject(cx)); // Explicit type for backward compatibility with clang<7 / gcc<8 using HandlerType = @@ -122,14 +122,14 @@ TEST(NativeThenHandler, TraceObject) TEST(NativeThenHandler, TraceMixed) { - auto onResolve = [](JSContext*, JS::HandleValue, ErrorResult&, - nsIGlobalObject*, Promise*, JS::HandleValue, - JS::HandleObject) -> already_AddRefed { + auto onResolve = [](JSContext*, JS::Handle, ErrorResult&, + nsIGlobalObject*, Promise*, JS::Handle, + JS::Handle) -> already_AddRefed { return nullptr; }; - auto onReject = [](JSContext*, JS::HandleValue, ErrorResult&, - nsIGlobalObject*, Promise*, JS::HandleValue, - JS::HandleObject) -> already_AddRefed { + auto onReject = [](JSContext*, JS::Handle, ErrorResult&, + nsIGlobalObject*, Promise*, JS::Handle, + JS::Handle) -> already_AddRefed { return nullptr; }; @@ -137,7 +137,7 @@ TEST(NativeThenHandler, TraceMixed) MOZ_ALWAYS_TRUE(jsapi.Init(xpc::PrivilegedJunkScope())); JSContext* cx = jsapi.cx(); nsCOMPtr global = xpc::CurrentNativeGlobal(cx); - JS::RootedObject obj(cx, JS_NewPlainObject(cx)); + JS::Rooted obj(cx, JS_NewPlainObject(cx)); RefPtr promise = Promise::Create(global, IgnoreErrors()); diff --git a/dom/promise/gtest/ThenWithCycleCollectedArgsJS.cpp b/dom/promise/gtest/ThenWithCycleCollectedArgsJS.cpp index 3483b8e809b1..b97de65d093a 100644 --- a/dom/promise/gtest/ThenWithCycleCollectedArgsJS.cpp +++ b/dom/promise/gtest/ThenWithCycleCollectedArgsJS.cpp @@ -20,7 +20,7 @@ TEST(ThenWithCycleCollectedArgsJS, Empty) RefPtr promise = Promise::Create(global, IgnoreErrors()); auto result = promise->ThenWithCycleCollectedArgsJS( - [](JSContext*, JS::HandleValue, ErrorResult&) { return nullptr; }, + [](JSContext*, JS::Handle, ErrorResult&) { return nullptr; }, std::make_tuple(), std::make_tuple()); } @@ -31,7 +31,7 @@ TEST(ThenWithCycleCollectedArgsJS, nsCOMPtr) RefPtr promise = Promise::Create(global, IgnoreErrors()); auto result = promise->ThenWithCycleCollectedArgsJS( - [](JSContext*, JS::HandleValue, ErrorResult&, nsIGlobalObject*) { + [](JSContext*, JS::Handle, ErrorResult&, nsIGlobalObject*) { return nullptr; }, std::make_tuple(global), std::make_tuple()); @@ -44,7 +44,7 @@ TEST(ThenWithCycleCollectedArgsJS, RefPtr) RefPtr promise = Promise::Create(global, IgnoreErrors()); auto result = promise->ThenWithCycleCollectedArgsJS( - [](JSContext*, JS::HandleValue, ErrorResult&, Promise*) { + [](JSContext*, JS::Handle, ErrorResult&, Promise*) { return nullptr; }, std::make_tuple(promise), std::make_tuple()); @@ -57,8 +57,8 @@ TEST(ThenWithCycleCollectedArgsJS, RefPtrAndJSHandle) RefPtr promise = Promise::Create(global, IgnoreErrors()); auto result = promise->ThenWithCycleCollectedArgsJS( - [](JSContext*, JS::HandleValue v, ErrorResult&, Promise*, - JS::HandleValue) { return nullptr; }, + [](JSContext*, JS::Handle v, ErrorResult&, Promise*, + JS::Handle) { return nullptr; }, std::make_tuple(promise), std::make_tuple(JS::UndefinedHandleValue)); } @@ -68,12 +68,13 @@ TEST(ThenWithCycleCollectedArgsJS, Mixed) MOZ_ALWAYS_TRUE(jsapi.Init(xpc::PrivilegedJunkScope())); JSContext* cx = jsapi.cx(); nsCOMPtr global = xpc::CurrentNativeGlobal(cx); - JS::RootedObject obj(cx, JS_NewPlainObject(cx)); + JS::Rooted obj(cx, JS_NewPlainObject(cx)); RefPtr promise = Promise::Create(global, IgnoreErrors()); auto result = promise->ThenWithCycleCollectedArgsJS( - [](JSContext*, JS::HandleValue, ErrorResult&, nsIGlobalObject*, Promise*, - JS::HandleValue, JS::HandleObject) { return nullptr; }, + [](JSContext*, JS::Handle, ErrorResult&, nsIGlobalObject*, + Promise*, JS::Handle, + JS::Handle) { return nullptr; }, std::make_tuple(global, promise), std::make_tuple(JS::UndefinedHandleValue, JS::HandleObject(obj))); } diff --git a/dom/prototype/PrototypeDocumentContentSink.cpp b/dom/prototype/PrototypeDocumentContentSink.cpp index e52efb9eeae3..4c82d61f9aa5 100644 --- a/dom/prototype/PrototypeDocumentContentSink.cpp +++ b/dom/prototype/PrototypeDocumentContentSink.cpp @@ -1026,7 +1026,7 @@ nsresult PrototypeDocumentContentSink::ExecuteScript( // On failure, ~AutoScriptEntry will handle exceptions, so // there is no need to manually check the return value. - JS::RootedValue rval(cx); + JS::Rooted rval(cx); Unused << JS_ExecuteScript(cx, scriptObject, &rval); return NS_OK; diff --git a/dom/quota/StorageManager.cpp b/dom/quota/StorageManager.cpp index a2b464c70d59..5ac3f43724ea 100644 --- a/dom/quota/StorageManager.cpp +++ b/dom/quota/StorageManager.cpp @@ -193,7 +193,7 @@ class PersistentStoragePermissionRequest final // nsIContentPermissionRequest NS_IMETHOD Cancel(void) override; - NS_IMETHOD Allow(JS::HandleValue choices) override; + NS_IMETHOD Allow(JS::Handle choices) override; private: ~PersistentStoragePermissionRequest() = default; @@ -695,7 +695,7 @@ PersistentStoragePermissionRequest::Cancel() { } NS_IMETHODIMP -PersistentStoragePermissionRequest::Allow(JS::HandleValue aChoices) { +PersistentStoragePermissionRequest::Allow(JS::Handle aChoices) { MOZ_ASSERT(NS_IsMainThread()); RefPtr resolver = diff --git a/dom/script/ScriptLoader.cpp b/dom/script/ScriptLoader.cpp index f859fea0b540..a554d9d8e89f 100644 --- a/dom/script/ScriptLoader.cpp +++ b/dom/script/ScriptLoader.cpp @@ -1603,7 +1603,7 @@ nsresult ScriptLoader::AttemptAsyncScriptCompile(ScriptLoadRequest* aRequest, // Introduction script will actually be computed and set when the script is // collected from offthread - JS::RootedScript dummyIntroductionScript(cx); + JS::Rooted dummyIntroductionScript(cx); nsresult rv = FillCompileOptionsForRequest(cx, aRequest, &options, &dummyIntroductionScript); if (NS_WARN_IF(NS_FAILED(rv))) { @@ -2353,10 +2353,10 @@ nsresult ScriptLoader::EvaluateScript(nsIGlobalObject* aGlobalObject, // Create a ClassicScript object and associate it with the JSScript. RefPtr classicScript = new ClassicScript(aRequest->mFetchOptions, aRequest->mBaseURL); - JS::RootedValue classicScriptValue(cx, JS::PrivateValue(classicScript)); + JS::Rooted classicScriptValue(cx, JS::PrivateValue(classicScript)); JS::CompileOptions options(cx); - JS::RootedScript introductionScript(cx); + JS::Rooted introductionScript(cx); nsresult rv = FillCompileOptionsForRequest(cx, aRequest, &options, &introductionScript); @@ -2541,7 +2541,7 @@ void ScriptLoader::EncodeRequestBytecode(JSContext* aCx, result = JS::FinishIncrementalEncoding(aCx, module, aRequest->mScriptBytecode); } else { - JS::RootedScript script(aCx, aRequest->mScriptForBytecodeEncoding); + JS::Rooted script(aCx, aRequest->mScriptForBytecodeEncoding); result = JS::FinishIncrementalEncoding(aCx, script, aRequest->mScriptBytecode); } @@ -2645,7 +2645,8 @@ void ScriptLoader::GiveUpBytecodeEncoding() { result = JS::FinishIncrementalEncoding(aes->cx(), module, request->mScriptBytecode); } else { - JS::RootedScript script(aes->cx(), request->mScriptForBytecodeEncoding); + JS::Rooted script(aes->cx(), + request->mScriptForBytecodeEncoding); result = JS::FinishIncrementalEncoding(aes->cx(), script, request->mScriptBytecode); } diff --git a/dom/security/nsContentSecurityUtils.cpp b/dom/security/nsContentSecurityUtils.cpp index 75a64d9d5100..8130f0a37efd 100644 --- a/dom/security/nsContentSecurityUtils.cpp +++ b/dom/security/nsContentSecurityUtils.cpp @@ -149,14 +149,14 @@ nsresult RegexEval(const nsAString& aPattern, const nsAString& aString, // evaluation does not interact with the execution global. JSAutoRealm ar(cx, xpc::PrivilegedJunkScope()); - JS::RootedObject regexp( + JS::Rooted regexp( cx, JS::NewUCRegExpObject(cx, aPattern.BeginReading(), aPattern.Length(), JS::RegExpFlag::Unicode)); if (!regexp) { return NS_ERROR_ILLEGAL_VALUE; } - JS::RootedValue regexResult(cx, JS::NullValue()); + JS::Rooted regexResult(cx, JS::NullValue()); size_t index = 0; if (!JS::ExecuteRegExpNoStatics(cx, regexp, aString.BeginReading(), @@ -182,14 +182,14 @@ nsresult RegexEval(const nsAString& aPattern, const nsAString& aString, // Now we know we have a result, and we need to extract it so we can read it. uint32_t length; - JS::RootedObject regexResultObj(cx, ®exResult.toObject()); + JS::Rooted regexResultObj(cx, ®exResult.toObject()); if (!JS::GetArrayLength(cx, regexResultObj, &length)) { return NS_ERROR_NOT_AVAILABLE; } MOZ_LOG(sCSMLog, LogLevel::Verbose, ("Regex Matched %i strings", length)); for (uint32_t i = 0; i < length; i++) { - JS::RootedValue element(cx); + JS::Rooted element(cx); if (!JS_GetElement(cx, regexResultObj, i, &element)) { return NS_ERROR_NO_CONTENT; } diff --git a/dom/security/test/gtest/TestUnexpectedPrivilegedLoads.cpp b/dom/security/test/gtest/TestUnexpectedPrivilegedLoads.cpp index 271ba50a8201..772e4bd353d5 100644 --- a/dom/security/test/gtest/TestUnexpectedPrivilegedLoads.cpp +++ b/dom/security/test/gtest/TestUnexpectedPrivilegedLoads.cpp @@ -201,7 +201,7 @@ TEST_F(TelemetryTestFixture, UnexpectedPrivilegedLoadsTelemetryTest) { // let's inspect the recorded events - JS::RootedValue eventsSnapshot(cx.GetJSContext()); + JS::Rooted eventsSnapshot(cx.GetJSContext()); GetEventSnapshot(cx.GetJSContext(), &eventsSnapshot); ASSERT_TRUE(EventPresent(cx.GetJSContext(), eventsSnapshot, category, @@ -210,7 +210,7 @@ TEST_F(TelemetryTestFixture, UnexpectedPrivilegedLoadsTelemetryTest) { // Convert eventsSnapshot into array/object JSContext* aCx = cx.GetJSContext(); - JS::RootedObject arrayObj(aCx, &eventsSnapshot.toObject()); + JS::Rooted arrayObj(aCx, &eventsSnapshot.toObject()); JS::Rooted eventRecord(aCx); ASSERT_TRUE(JS_GetElement(aCx, arrayObj, i++, &eventRecord)) @@ -219,7 +219,7 @@ TEST_F(TelemetryTestFixture, UnexpectedPrivilegedLoadsTelemetryTest) { ASSERT_TRUE(!eventRecord.isUndefined()) << "eventRecord should not be undefined"; - JS::RootedObject recordArray(aCx, &eventRecord.toObject()); + JS::Rooted recordArray(aCx, &eventRecord.toObject()); uint32_t recordLength; ASSERT_TRUE(JS::GetArrayLength(aCx, recordArray, &recordLength)) << "Event record array must have length."; @@ -243,7 +243,7 @@ TEST_F(TelemetryTestFixture, UnexpectedPrivilegedLoadsTelemetryTest) { JS::Rooted obj(aCx); ASSERT_TRUE(JS_GetElement(aCx, recordArray, 5, &obj)) << "Must be able to get extra data"; - JS::RootedObject extraObj(aCx, &obj.toObject()); + JS::Rooted extraObj(aCx, &obj.toObject()); // looking at remotetype extra for content type JS::Rooted extraValC(aCx); ASSERT_TRUE( diff --git a/dom/simpledb/SDBConnection.cpp b/dom/simpledb/SDBConnection.cpp index a035d1631ece..25d3273c5524 100644 --- a/dom/simpledb/SDBConnection.cpp +++ b/dom/simpledb/SDBConnection.cpp @@ -352,7 +352,7 @@ SDBConnection::Read(uint64_t aSize, nsISDBRequest** _retval) { } NS_IMETHODIMP -SDBConnection::Write(JS::HandleValue aValue, JSContext* aCx, +SDBConnection::Write(JS::Handle aValue, JSContext* aCx, nsISDBRequest** _retval) { AssertIsOnOwningThread(); diff --git a/dom/simpledb/SDBResults.cpp b/dom/simpledb/SDBResults.cpp index 6bf28f35313f..e17f43798889 100644 --- a/dom/simpledb/SDBResults.cpp +++ b/dom/simpledb/SDBResults.cpp @@ -40,7 +40,8 @@ SDBResult::GetAsArray(nsTArray& aData) { } NS_IMETHODIMP -SDBResult::GetAsArrayBuffer(JSContext* aCx, JS::MutableHandleValue _retval) { +SDBResult::GetAsArrayBuffer(JSContext* aCx, + JS::MutableHandle _retval) { JS::Rooted arrayBuffer(aCx); nsresult rv = nsContentUtils::CreateArrayBuffer(aCx, mData, arrayBuffer.address()); diff --git a/dom/vr/XRPermissionRequest.cpp b/dom/vr/XRPermissionRequest.cpp index 5cfe1b1749af..2661f246cd47 100644 --- a/dom/vr/XRPermissionRequest.cpp +++ b/dom/vr/XRPermissionRequest.cpp @@ -45,7 +45,7 @@ XRPermissionRequest::Cancel() { } NS_IMETHODIMP -XRPermissionRequest::Allow(JS::HandleValue aChoices) { +XRPermissionRequest::Allow(JS::Handle aChoices) { MOZ_ASSERT(aChoices.isUndefined()); nsGlobalWindowInner* window = nsGlobalWindowInner::GetInnerWindowWithId(mWindowId); diff --git a/dom/vr/XRPermissionRequest.h b/dom/vr/XRPermissionRequest.h index f988765fe277..93a6c310b3f0 100644 --- a/dom/vr/XRPermissionRequest.h +++ b/dom/vr/XRPermissionRequest.h @@ -25,7 +25,7 @@ class XRPermissionRequest final : public ContentPermissionRequestBase { ContentPermissionRequestBase) // nsIContentPermissionRequest NS_IMETHOD Cancel(void) override; - NS_IMETHOD Allow(JS::HandleValue choices) override; + NS_IMETHOD Allow(JS::Handle choices) override; nsresult Start(); private: diff --git a/dom/vr/XRSystem.cpp b/dom/vr/XRSystem.cpp index 64b57a208149..2970fa68d4e2 100644 --- a/dom/vr/XRSystem.cpp +++ b/dom/vr/XRSystem.cpp @@ -173,7 +173,7 @@ already_AddRefed XRSystem::RequestSession( for (const JS::Value& val : arr) { if (!val.isNull() && !val.isUndefined()) { bool bFound = false; - JS::RootedValue v(aCx, val); + JS::Rooted v(aCx, val); int index = 0; if (FindEnumStringIndex( callCx, v, XRReferenceSpaceTypeValues::strings, @@ -198,7 +198,7 @@ already_AddRefed XRSystem::RequestSession( const Sequence& arr = (aOptions.mOptionalFeatures.Value()); for (const JS::Value& val : arr) { if (!val.isNull() && !val.isUndefined()) { - JS::RootedValue v(aCx, val); + JS::Rooted v(aCx, val); int index = 0; if (FindEnumStringIndex( callCx, v, XRReferenceSpaceTypeValues::strings, @@ -657,7 +657,7 @@ XRRequestSessionPermissionRequest::Cancel() { } NS_IMETHODIMP -XRRequestSessionPermissionRequest::Allow(JS::HandleValue aChoices) { +XRRequestSessionPermissionRequest::Allow(JS::Handle aChoices) { nsTArray choices; nsresult rv = TranslateChoices(aChoices, mPermissionRequests, choices); if (NS_FAILED(rv)) { diff --git a/dom/vr/XRSystem.h b/dom/vr/XRSystem.h index 2f388e6c99b2..2a49dfb68f88 100644 --- a/dom/vr/XRSystem.h +++ b/dom/vr/XRSystem.h @@ -70,7 +70,7 @@ class XRRequestSessionPermissionRequest final // nsIContentPermissionRequest NS_IMETHOD Cancel(void) override; - NS_IMETHOD Allow(JS::HandleValue choices) override; + NS_IMETHOD Allow(JS::Handle choices) override; using AllowCallback = std::function; using AllowAnySiteCallback = std::function; diff --git a/dom/webscheduling/WebTaskScheduler.cpp b/dom/webscheduling/WebTaskScheduler.cpp index 311fe2c2ea87..528393abc9d6 100644 --- a/dom/webscheduling/WebTaskScheduler.cpp +++ b/dom/webscheduling/WebTaskScheduler.cpp @@ -68,7 +68,7 @@ void WebTask::RunAbortAlgorithm() { mPromise->MaybeReject(NS_ERROR_UNEXPECTED); } else { JSContext* cx = jsapi.cx(); - JS::RootedValue reason(cx); + JS::Rooted reason(cx); Signal()->GetReason(cx, &reason); mPromise->MaybeReject(reason); } @@ -187,7 +187,7 @@ already_AddRefed WebTaskScheduler::PostTask( } JSContext* cx = jsapi.cx(); - JS::RootedValue reason(cx); + JS::Rooted reason(cx); signalValue.GetReason(cx, &reason); promise->MaybeReject(reason); return promise.forget(); diff --git a/dom/worklet/WorkletThread.cpp b/dom/worklet/WorkletThread.cpp index 8464c9422725..a9268f05dfcc 100644 --- a/dom/worklet/WorkletThread.cpp +++ b/dom/worklet/WorkletThread.cpp @@ -37,15 +37,15 @@ const uint32_t kWorkletStackSize = 256 * sizeof(size_t) * 1024; // Helper functions -bool PreserveWrapper(JSContext* aCx, JS::HandleObject aObj) { +bool PreserveWrapper(JSContext* aCx, JS::Handle aObj) { MOZ_ASSERT(aCx); MOZ_ASSERT(aObj); MOZ_ASSERT(mozilla::dom::IsDOMObject(aObj)); return mozilla::dom::TryPreserveWrapper(aObj); } -JSObject* Wrap(JSContext* aCx, JS::HandleObject aExisting, - JS::HandleObject aObj) { +JSObject* Wrap(JSContext* aCx, JS::Handle aExisting, + JS::Handle aObj) { if (aExisting) { js::Wrapper::Renew(aExisting, aObj, &js::OpaqueCrossCompartmentWrapper::singleton); diff --git a/dom/xul/nsXULElement.cpp b/dom/xul/nsXULElement.cpp index 05306107f151..d28e574fd170 100644 --- a/dom/xul/nsXULElement.cpp +++ b/dom/xul/nsXULElement.cpp @@ -1925,7 +1925,7 @@ nsresult nsXULPrototypeScript::Compile( } nsresult nsXULPrototypeScript::InstantiateScript( - JSContext* aCx, JS::MutableHandleScript aScript) { + JSContext* aCx, JS::MutableHandle aScript) { MOZ_ASSERT(mStencil); JS::CompileOptions options(aCx);