Bug 1769290 - Part 16: Apply mozilla-js-handle-rooted-typedef against netwerk r=andi

Differential Revision: https://phabricator.services.mozilla.com/D151783
This commit is contained in:
Kagami Sascha Rosylight 2022-07-14 17:00:21 +00:00
Родитель 80eef33ca3
Коммит d0b83eb89d
14 изменённых файлов: 45 добавлений и 43 удалений

Просмотреть файл

@ -306,7 +306,7 @@ nsresult LookupHelper::ConstructAnswer(LookupArgument* aArgument) {
GetErrorString(mStatus, dict.mError);
}
JS::RootedValue val(cx);
JS::Rooted<JS::Value> val(cx);
if (!ToJSValue(cx, dict, &val)) {
return NS_ERROR_FAILURE;
}
@ -470,7 +470,7 @@ nsresult LookupHelper::ConstructHTTPSRRAnswer(LookupArgument* aArgument) {
GetErrorString(mStatus, dict.mError);
}
JS::RootedValue val(cx);
JS::Rooted<JS::Value> val(cx);
if (!ToJSValue(cx, dict, &val)) {
return NS_ERROR_FAILURE;
}
@ -567,7 +567,7 @@ nsresult Dashboard::GetSockets(SocketData* aSocketData) {
dict.mSent += socketData->mTotalSent;
dict.mReceived += socketData->mTotalRecv;
JS::RootedValue val(cx);
JS::Rooted<JS::Value> val(cx);
if (!ToJSValue(cx, dict, &val)) return NS_ERROR_FAILURE;
socketData->mCallback->OnDashboardDataAvailable(val);
@ -682,7 +682,7 @@ nsresult Dashboard::GetHttpConnections(HttpData* aHttpData) {
}
}
JS::RootedValue val(cx);
JS::Rooted<JS::Value> val(cx);
if (!ToJSValue(cx, dict, &val)) {
return NS_ERROR_FAILURE;
}
@ -801,7 +801,7 @@ nsresult Dashboard::GetWebSocketConnections(WebSocketRequest* aWsRequest) {
websocket.mEncrypted = mWs.data[i].mEncrypted;
}
JS::RootedValue val(cx);
JS::Rooted<JS::Value> val(cx);
if (!ToJSValue(cx, dict, &val)) {
return NS_ERROR_FAILURE;
}
@ -916,7 +916,7 @@ nsresult Dashboard::GetDNSCacheEntries(DnsData* dnsData) {
entry.mFlags = NS_ConvertUTF8toUTF16(dnsData->mData[i].flags);
}
JS::RootedValue val(cx);
JS::Rooted<JS::Value> val(cx);
if (!ToJSValue(cx, dict, &val)) {
return NS_ERROR_FAILURE;
}
@ -1016,7 +1016,7 @@ nsresult Dashboard::GetRcwnData(RcwnData* aData) {
CacheFileUtils::CachePerfStats::GetStdDev(perfType, true);
}
JS::RootedValue val(cx);
JS::Rooted<JS::Value> val(cx);
if (!ToJSValue(cx, dict, &val)) {
return NS_ERROR_FAILURE;
}
@ -1093,7 +1093,7 @@ nsresult Dashboard::GetConnectionStatus(ConnectionData* aConnectionData) {
mozilla::dom::ConnStatusDict dict;
dict.mStatus = connectionData->mStatus;
JS::RootedValue val(cx);
JS::Rooted<JS::Value> val(cx);
if (!ToJSValue(cx, dict, &val)) return NS_ERROR_FAILURE;
connectionData->mCallback->OnDashboardDataAvailable(val);

Просмотреть файл

@ -76,10 +76,9 @@ NS_IMETHODIMP LoadContextInfoFactory::GetAnonymous(
return NS_OK;
}
NS_IMETHODIMP LoadContextInfoFactory::Custom(bool aAnonymous,
JS::HandleValue aOriginAttributes,
JSContext* cx,
nsILoadContextInfo** _retval) {
NS_IMETHODIMP LoadContextInfoFactory::Custom(
bool aAnonymous, JS::Handle<JS::Value> aOriginAttributes, JSContext* cx,
nsILoadContextInfo** _retval) {
OriginAttributes attrs;
bool status = attrs.Init(cx, aOriginAttributes);
NS_ENSURE_TRUE(status, NS_ERROR_FAILURE);

Просмотреть файл

@ -1537,7 +1537,7 @@ LoadInfo::GetRedirects(JSContext* aCx, JS::MutableHandle<JS::Value> aRedirects,
nsCOMPtr<nsIXPConnect> xpc = nsIXPConnect::XPConnect();
for (size_t idx = 0; idx < aArray.Length(); idx++) {
JS::RootedObject jsobj(aCx);
JS::Rooted<JSObject*> jsobj(aCx);
nsresult rv =
xpc->WrapNative(aCx, global, aArray[idx],
NS_GET_IID(nsIRedirectHistoryEntry), jsobj.address());

Просмотреть файл

@ -466,7 +466,7 @@ nsresult Predictor::Create(const nsIID& aIID, void** aResult) {
NS_IMETHODIMP
Predictor::Predict(nsIURI* targetURI, nsIURI* sourceURI,
PredictorPredictReason reason,
JS::HandleValue originAttributes,
JS::Handle<JS::Value> originAttributes,
nsINetworkPredictorVerifier* verifier, JSContext* aCx) {
OriginAttributes attrs;
@ -1217,8 +1217,8 @@ bool Predictor::WouldRedirect(nsICacheEntry* entry, uint32_t loadCount,
NS_IMETHODIMP
Predictor::Learn(nsIURI* targetURI, nsIURI* sourceURI,
PredictorLearnReason reason, JS::HandleValue originAttributes,
JSContext* aCx) {
PredictorLearnReason reason,
JS::Handle<JS::Value> originAttributes, JSContext* aCx) {
OriginAttributes attrs;
if (!originAttributes.isObject() || !attrs.Init(aCx, originAttributes)) {

Просмотреть файл

@ -315,7 +315,7 @@ static bool PACDnsResolve(JSContext* cx, unsigned int argc, JS::Value* vp) {
return true;
}
JS::RootedString arg1(cx);
JS::Rooted<JSString*> arg1(cx);
arg1 = args[0].toString();
nsAutoJSString hostName;
@ -661,8 +661,8 @@ nsresult ProxyAutoConfig::GetProxyForURI(const nsCString& aTestURI,
}
}
JS::RootedString uriString(cx, JS_NewStringCopyZ(cx, clensedURI.get()));
JS::RootedString hostString(cx, JS_NewStringCopyZ(cx, aTestHost.get()));
JS::Rooted<JSString*> uriString(cx, JS_NewStringCopyZ(cx, clensedURI.get()));
JS::Rooted<JSString*> hostString(cx, JS_NewStringCopyZ(cx, aTestHost.get()));
if (uriString && hostString) {
JS::RootedValueArray<2> args(cx);
@ -778,7 +778,7 @@ bool ProxyAutoConfig::MyIPAddress(const JS::CallArgs& aArgs) {
nsAutoCString remoteDottedDecimal;
nsAutoCString localDottedDecimal;
JSContext* cx = mJSContext->Context();
JS::RootedValue v(cx);
JS::Rooted<JS::Value> v(cx);
JS::Rooted<JSObject*> global(cx, mJSContext->Global());
bool useMultihomedDNS =

Просмотреть файл

@ -216,7 +216,7 @@ nsUDPMessage::GetOutputStream(nsIOutputStream** aOutputStream) {
}
NS_IMETHODIMP
nsUDPMessage::GetRawData(JSContext* cx, JS::MutableHandleValue aRawData) {
nsUDPMessage::GetRawData(JSContext* cx, JS::MutableHandle<JS::Value> aRawData) {
if (!mJsobj) {
mJsobj =
dom::Uint8Array::Create(cx, nullptr, mData.Length(), mData.Elements());
@ -368,7 +368,8 @@ UDPMessageProxy::GetData(nsACString& aData) {
FallibleTArray<uint8_t>& UDPMessageProxy::GetDataAsTArray() { return mData; }
NS_IMETHODIMP
UDPMessageProxy::GetRawData(JSContext* cx, JS::MutableHandleValue aRawData) {
UDPMessageProxy::GetRawData(JSContext* cx,
JS::MutableHandle<JS::Value> aRawData) {
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -792,7 +792,7 @@ NS_IMETHODIMP
CookieService::Add(const nsACString& aHost, const nsACString& aPath,
const nsACString& aName, const nsACString& aValue,
bool aIsSecure, bool aIsHttpOnly, bool aIsSession,
int64_t aExpiry, JS::HandleValue aOriginAttributes,
int64_t aExpiry, JS::Handle<JS::Value> aOriginAttributes,
int32_t aSameSite, nsICookie::schemeType aSchemeMap,
JSContext* aCx) {
OriginAttributes attrs;
@ -877,7 +877,7 @@ nsresult CookieService::Remove(const nsACString& aHost,
NS_IMETHODIMP
CookieService::Remove(const nsACString& aHost, const nsACString& aName,
const nsACString& aPath,
JS::HandleValue aOriginAttributes, JSContext* aCx) {
JS::Handle<JS::Value> aOriginAttributes, JSContext* aCx) {
OriginAttributes attrs;
if (!aOriginAttributes.isObject() || !attrs.Init(aCx, aOriginAttributes)) {
@ -2062,8 +2062,8 @@ bool CookieService::GetExpiry(CookieStruct& aCookieData,
NS_IMETHODIMP
CookieService::CookieExists(const nsACString& aHost, const nsACString& aPath,
const nsACString& aName,
JS::HandleValue aOriginAttributes, JSContext* aCx,
bool* aFoundCookie) {
JS::Handle<JS::Value> aOriginAttributes,
JSContext* aCx, bool* aFoundCookie) {
NS_ENSURE_ARG_POINTER(aCx);
NS_ENSURE_ARG_POINTER(aFoundCookie);
@ -2128,7 +2128,7 @@ CookieService::CountCookiesFromHost(const nsACString& aHost,
// the nsICookieManager interface.
NS_IMETHODIMP
CookieService::GetCookiesFromHost(const nsACString& aHost,
JS::HandleValue aOriginAttributes,
JS::Handle<JS::Value> aOriginAttributes,
JSContext* aCx,
nsTArray<RefPtr<nsICookie>>& aResult) {
// first, normalize the hostname, and fail if it contains illegal characters.

Просмотреть файл

@ -187,8 +187,9 @@ ChildDNSService::AsyncResolve(const nsACString& hostname,
nsIDNSService::ResolveType aType, uint32_t flags,
nsIDNSAdditionalInfo* aInfo,
nsIDNSListener* listener, nsIEventTarget* target_,
JS::HandleValue aOriginAttributes, JSContext* aCx,
uint8_t aArgc, nsICancelable** result) {
JS::Handle<JS::Value> aOriginAttributes,
JSContext* aCx, uint8_t aArgc,
nsICancelable** result) {
OriginAttributes attrs;
if (aArgc == 1) {
@ -227,7 +228,7 @@ ChildDNSService::CancelAsyncResolve(const nsACString& aHostname,
uint32_t aFlags,
nsIDNSAdditionalInfo* aInfo,
nsIDNSListener* aListener, nsresult aReason,
JS::HandleValue aOriginAttributes,
JS::Handle<JS::Value> aOriginAttributes,
JSContext* aCx, uint8_t aArgc) {
OriginAttributes attrs;
@ -252,8 +253,8 @@ ChildDNSService::CancelAsyncResolveNative(
NS_IMETHODIMP
ChildDNSService::Resolve(const nsACString& hostname, uint32_t flags,
JS::HandleValue aOriginAttributes, JSContext* aCx,
uint8_t aArgc, nsIDNSRecord** result) {
JS::Handle<JS::Value> aOriginAttributes,
JSContext* aCx, uint8_t aArgc, nsIDNSRecord** result) {
// not planning to ever support this, since sync IPDL is evil.
return NS_ERROR_NOT_AVAILABLE;
}

Просмотреть файл

@ -1101,8 +1101,9 @@ nsDNSService::AsyncResolve(const nsACString& aHostname,
nsIDNSService::ResolveType aType, uint32_t flags,
nsIDNSAdditionalInfo* aInfo,
nsIDNSListener* listener, nsIEventTarget* target_,
JS::HandleValue aOriginAttributes, JSContext* aCx,
uint8_t aArgc, nsICancelable** result) {
JS::Handle<JS::Value> aOriginAttributes,
JSContext* aCx, uint8_t aArgc,
nsICancelable** result) {
OriginAttributes attrs;
if (aArgc == 1) {
@ -1140,7 +1141,7 @@ nsDNSService::CancelAsyncResolve(const nsACString& aHostname,
nsIDNSService::ResolveType aType,
uint32_t aFlags, nsIDNSAdditionalInfo* aInfo,
nsIDNSListener* aListener, nsresult aReason,
JS::HandleValue aOriginAttributes,
JS::Handle<JS::Value> aOriginAttributes,
JSContext* aCx, uint8_t aArgc) {
OriginAttributes attrs;
@ -1165,7 +1166,7 @@ nsDNSService::CancelAsyncResolveNative(
NS_IMETHODIMP
nsDNSService::Resolve(const nsACString& aHostname, uint32_t flags,
JS::HandleValue aOriginAttributes, JSContext* aCx,
JS::Handle<JS::Value> aOriginAttributes, JSContext* aCx,
uint8_t aArgc, nsIDNSRecord** result) {
OriginAttributes attrs;

Просмотреть файл

@ -508,7 +508,7 @@ void OpenWhenReady(
Unused << aPromise->ThenWithCycleCollectedArgs(
[channel, aCallback](
JSContext* aCx, JS::HandleValue aValue, ErrorResult& aRv,
JSContext* aCx, JS::Handle<JS::Value> aValue, ErrorResult& aRv,
nsIStreamListener* aListener) -> already_AddRefed<Promise> {
nsresult rv = aCallback(aListener, channel);
if (NS_FAILED(rv)) {

Просмотреть файл

@ -3344,7 +3344,7 @@ WebSocketChannel::GetSecurityInfo(nsISupports** aSecurityInfo) {
NS_IMETHODIMP
WebSocketChannel::AsyncOpen(nsIURI* aURI, const nsACString& aOrigin,
JS::HandleValue aOriginAttributes,
JS::Handle<JS::Value> aOriginAttributes,
uint64_t aInnerWindowID,
nsIWebSocketListener* aListener,
nsISupports* aContext, JSContext* aCx) {

Просмотреть файл

@ -95,9 +95,9 @@ class WebSocketChannel : public BaseWebSocketChannel,
// nsIWebSocketChannel methods BaseWebSocketChannel didn't implement for us
//
NS_IMETHOD AsyncOpen(nsIURI* aURI, const nsACString& aOrigin,
JS::HandleValue aOriginAttributes, uint64_t aWindowID,
nsIWebSocketListener* aListener, nsISupports* aContext,
JSContext* aCx) override;
JS::Handle<JS::Value> aOriginAttributes,
uint64_t aWindowID, nsIWebSocketListener* aListener,
nsISupports* aContext, JSContext* aCx) override;
NS_IMETHOD AsyncOpenNative(nsIURI* aURI, const nsACString& aOrigin,
const OriginAttributes& aOriginAttributes,
uint64_t aWindowID,

Просмотреть файл

@ -450,7 +450,7 @@ void WebSocketChannelChild::SetupNeckoTarget() {
NS_IMETHODIMP
WebSocketChannelChild::AsyncOpen(nsIURI* aURI, const nsACString& aOrigin,
JS::HandleValue aOriginAttributes,
JS::Handle<JS::Value> aOriginAttributes,
uint64_t aInnerWindowID,
nsIWebSocketListener* aListener,
nsISupports* aContext, JSContext* aCx) {

Просмотреть файл

@ -33,7 +33,7 @@ class WebSocketChannelChild final : public BaseWebSocketChannel,
// nsIWebSocketChannel methods BaseWebSocketChannel didn't implement for us
//
NS_IMETHOD AsyncOpen(nsIURI* aURI, const nsACString& aOrigin,
JS::HandleValue aOriginAttributes,
JS::Handle<JS::Value> aOriginAttributes,
uint64_t aInnerWindowID, nsIWebSocketListener* aListener,
nsISupports* aContext, JSContext* aCx) override;
NS_IMETHOD AsyncOpenNative(nsIURI* aURI, const nsACString& aOrigin,