Files
roytam1 5d8f4a0ceb import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1130710 - xre: Use stdint uint*_t instead of nonstandard __uint*_t. r=bsmedberg# Please enter the commit message for your changes. Lines starting (8ee5fbe479)
- partial revert of PM (bcd354aa6b)
- Bug 1158866 - Enable MAR verification on linux via NSS. r=rstrong (d3a4eff858)
- Bug 1159090 - Only append library path for updater if it is a unique value. r=rstrong (5aeece0f47)
- Bug 1168720 - Remove use of test env var MOZ_NO_REPLACE_FALLBACK and associated tests that are covered by other tests. r=spohl (4c8fb7266d)
- more backport (a30d3a5c9d)
- Bug 1158870: Disable mar signing code path in updater for gonk until mar signing is available there. r=bbondy (d08701cdb4)
- Bug 1217985 - Don't depend on Windows crypto DLLs (e313b1d3b7)
- more backports (fa8e0ff050)
- Bug 1168009 - heap-use-after-free (ASAN build) in updater.cpp mstrtok. r=spohl (9ffe217d90)
- Bug 1234033 - Unbreak build --with-system-bz2 using Clang. r=dvander (1109f20b70)
- backports (3f418fc789)
- Bug 1213130 - Make several string function to accept char16ptr_t instead of char16_t*, and remove redundant overloads. rs=froydnj (95a4cb53cd)
- Bug 1210871 - don't use reinterpret_cast in nsTHashtable.h; r=erahm (f742409381)
- Bug 1217125 - remove pointless includes from nsTHashtable.h; r=mccr8 (ad26d04f77)
- Bug 1159081 - Bad PR_SetEnv usage for Gonk. r=dhylands, r=rstrong (855a00ae4b)
- bit of Bug 1237140 - Move DefinesAction (d0d8fffb86)
- Bug 1157212 - Teach clang-analyzer about XPT_ASSERT; r=froydnj (d75e87012c)
- Bug 1208320 - Do not stage some reftest support files before archiving; r=glandium (5a547ca126)
- Bug 1208320 - Do not stage reftest test files before archiving; r=glandium (28944e3a87)
- Bug 1208320 - Print message when done with archiving; r=glandium (27e0b00dcd)
- Bug 1208320 - Decrease compression level of test zip archives; r=glandium (d01f75ea8b)
- Bug 1232887 - "make package MOZ_PKG_PRETTYNAMES=1" is busted. r=glandium (9f978b70f0)
- Bug 1212609 - Add common test package rules for firefox-ui-tests. r=gps (3fa329714a)
- Bug 1239442 - Update common.tests.zip to contain dom/media/test/external-media-sites. r=gps (94e917c5e7)
- Bug 1233774 - fix Leak EventTokenBucket on shutdown r=dragana (37db0e5752)
- Bug 1241295 - Limit time for PR_Close calls during shutdown in nsUDPSocket. r=mcmanus (451f8663b9)
- Bug 1242464 - Call shutdown() before closesocket() and change linger option on windows. r=mcmanus (2b4f7e327c)
- Bug 1240122 - threadsafe fix for getselfaddr() r=dragana (0cdeefb33e)
- Bug 544986 - 64KB rwin for windows xp r=dragana (cbe034ebf5)
- Bug 1239655 - Do not do PR_ConnectContinue during the shutdown. r=mcmanus (2361129b62)
- Bug 1240120 - Move external-media-tests to subdirectory to generate correct packaging; r=maja_zf,whimboo (0742e93414)
- Bug 1235232 - Fix -Wclass-varargs warnings in dom/media/. r=kentuckyfriedtakahe (b13b325846)
- Bug 1231793: Part 1 - Added read functions for Little Endian integers to ByteReader.h. r=jya (6dc6519fe9)
- Bug 1231793: Part 2 - Added conversions to AudioSampleFormat.h. r=jya (59d48c4d82)
- Bug 1231793: Part 3 - Fixed reading of Metadata tags. r=jya (3931a82ce7)
- Bug 1192539 - [2.4] Use MediaCodecList to check for decoder support. r=snorp (35e0427a2b)
- Bug 1231793: Part 4 - Added checks for Wave type in AndroidDecoderModule. r=jya (a80b83691c)
- Bug 1237836 - Add support for MetadataTags to MediaFormatReader. r=jya (9b813ae38c)
- Bug 1231793: Part 5 - Added Wave Data Demuxer and Decoder. r=jya (6f7131a2d8)
- Bug 1231793: Part 6 - Enabled the new Wave Data Decoder in DecoderTraits. r=jya (1574922fc7)
- Bug 1241677: P1. Add MediaDataDecoder::GetDescriptionName() method. r=cpearce (767413678e)
- Bug 1241677: P2. Add media decoder's description to about:media report. r=cpearce (b6d300d864)
- Bug 1231793: Part 7 - Fixed various tests. r=jya (baa4a844c1)
- Bug 1231793: Part 8 - Added checks for various metadata errors. r=jya (53af45d8de)
2023-12-01 16:35:24 +08:00

65 lines
1.8 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/Assertions.h"
#include "ShutdownLayer.h"
#include "prerror.h"
#include "private/pprio.h"
#include "prmem.h"
#include <winsock2.h>
static PRDescIdentity sWinSockShutdownLayerIdentity;
static PRIOMethods sWinSockShutdownLayerMethods;
static PRIOMethods *sWinSockShutdownLayerMethodsPtr = nullptr;
PRStatus
WinSockClose(PRFileDesc *aFd)
{
MOZ_RELEASE_ASSERT(aFd->identity == sWinSockShutdownLayerIdentity,
"Windows shutdown layer not on the top of the stack");
PROsfd osfd = PR_FileDesc2NativeHandle(aFd);
if (osfd != -1) {
shutdown(osfd, SD_BOTH);
}
aFd->identity = PR_INVALID_IO_LAYER;
if (aFd->lower) {
return aFd->lower->methods->close(aFd->lower);
} else {
return PR_SUCCESS;
}
}
nsresult mozilla::net::AttachShutdownLayer(PRFileDesc *aFd)
{
if (!sWinSockShutdownLayerMethodsPtr) {
sWinSockShutdownLayerIdentity =
PR_GetUniqueIdentity("windows shutdown call layer");
sWinSockShutdownLayerMethods = *PR_GetDefaultIOMethods();
sWinSockShutdownLayerMethods.close = WinSockClose;
sWinSockShutdownLayerMethodsPtr = &sWinSockShutdownLayerMethods;
}
PRFileDesc * layer;
PRStatus status;
layer = PR_CreateIOLayerStub(sWinSockShutdownLayerIdentity,
sWinSockShutdownLayerMethodsPtr);
if (!layer) {
return NS_OK;
}
status = PR_PushIOLayer(aFd, PR_NSPR_IO_LAYER, layer);
if (status == PR_FAILURE) {
PR_DELETE(layer);
return NS_ERROR_FAILURE;
}
return NS_OK;
}