Skip to content

Commit 938a694

Browse files
committed
Backed out changeset 6e00f8bd2acc (bug 1714307) for causing hazard bustage. CLOSED TREE
1 parent 7ddfca4 commit 938a694

File tree

170 files changed

+2138
-1219
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

170 files changed

+2138
-1219
lines changed

netwerk/base/ArrayBufferInputStream.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ using mozilla::dom::RootingCx;
1717
NS_IMPL_ISUPPORTS(ArrayBufferInputStream, nsIArrayBufferInputStream,
1818
nsIInputStream);
1919

20+
ArrayBufferInputStream::ArrayBufferInputStream()
21+
: mBufferLength(0), mPos(0), mClosed(false) {}
22+
2023
NS_IMETHODIMP
2124
ArrayBufferInputStream::SetData(JS::Handle<JS::Value> aBuffer,
2225
uint64_t aByteOffset, uint64_t aLength) {

netwerk/base/ArrayBufferInputStream.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
class ArrayBufferInputStream : public nsIArrayBufferInputStream {
2525
public:
26-
ArrayBufferInputStream() = default;
26+
ArrayBufferInputStream();
2727

2828
NS_DECL_THREADSAFE_ISUPPORTS
2929
NS_DECL_NSIARRAYBUFFERINPUTSTREAM
@@ -32,9 +32,9 @@ class ArrayBufferInputStream : public nsIArrayBufferInputStream {
3232
private:
3333
virtual ~ArrayBufferInputStream() = default;
3434
mozilla::UniquePtr<char[]> mArrayBuffer;
35-
uint32_t mBufferLength{0};
36-
uint32_t mPos{0};
37-
bool mClosed{false};
35+
uint32_t mBufferLength;
36+
uint32_t mPos;
37+
bool mClosed;
3838
};
3939

4040
#endif // ArrayBufferInputStream_h

netwerk/base/BackgroundFileSaver.cpp

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,27 @@ class NotifyTargetChangeRunnable final : public Runnable {
8282
uint32_t BackgroundFileSaver::sThreadCount = 0;
8383
uint32_t BackgroundFileSaver::sTelemetryMaxThreadCount = 0;
8484

85-
BackgroundFileSaver::BackgroundFileSaver() {
85+
BackgroundFileSaver::BackgroundFileSaver()
86+
: mControlEventTarget(nullptr),
87+
mBackgroundET(nullptr),
88+
mPipeOutputStream(nullptr),
89+
mPipeInputStream(nullptr),
90+
mObserver(nullptr),
91+
mLock("BackgroundFileSaver.mLock"),
92+
mWorkerThreadAttentionRequested(false),
93+
mFinishRequested(false),
94+
mComplete(false),
95+
mStatus(NS_OK),
96+
mAppend(false),
97+
mInitialTarget(nullptr),
98+
mInitialTargetKeepPartial(false),
99+
mRenamedTarget(nullptr),
100+
mRenamedTargetKeepPartial(false),
101+
mAsyncCopyContext(nullptr),
102+
mSha256Enabled(false),
103+
mSignatureInfoEnabled(false),
104+
mActualTarget(nullptr),
105+
mActualTargetKeepPartial(false) {
86106
LOG(("Created BackgroundFileSaver [this = %p]", this));
87107
}
88108

@@ -911,6 +931,13 @@ BackgroundFileSaverOutputStream::OnOutputStreamReady(
911931
NS_IMPL_ISUPPORTS(BackgroundFileSaverStreamListener, nsIBackgroundFileSaver,
912932
nsIRequestObserver, nsIStreamListener)
913933

934+
BackgroundFileSaverStreamListener::BackgroundFileSaverStreamListener()
935+
: BackgroundFileSaver(),
936+
mSuspensionLock("BackgroundFileSaverStreamListener.mSuspensionLock"),
937+
mReceivedTooMuchData(false),
938+
mRequest(nullptr),
939+
mRequestSuspended(false) {}
940+
914941
bool BackgroundFileSaverStreamListener::HasInfiniteBuffer() { return true; }
915942

916943
nsAsyncCopyProgressFun

netwerk/base/BackgroundFileSaver.h

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -117,36 +117,36 @@ class BackgroundFileSaver : public nsIBackgroundFileSaver {
117117
* Protects the shared state between control and worker threads. This mutex
118118
* is always locked for a very short time, never during input/output.
119119
*/
120-
mozilla::Mutex mLock{"BackgroundFileSaver.mLock"};
120+
mozilla::Mutex mLock;
121121

122122
/**
123123
* True if the worker thread is already waiting to process a change in state.
124124
*/
125-
bool mWorkerThreadAttentionRequested{false};
125+
bool mWorkerThreadAttentionRequested;
126126

127127
/**
128128
* True if the operation should finish as soon as possibile.
129129
*/
130-
bool mFinishRequested{false};
130+
bool mFinishRequested;
131131

132132
/**
133133
* True if the operation completed, with either success or failure.
134134
*/
135-
bool mComplete{false};
135+
bool mComplete;
136136

137137
/**
138138
* Holds the current file saver status. This is a success status while the
139139
* object is working correctly, and remains such if the operation completes
140140
* successfully. This becomes an error status when an error occurs on the
141141
* worker thread, or when the operation is canceled.
142142
*/
143-
nsresult mStatus{NS_OK};
143+
nsresult mStatus;
144144

145145
/**
146146
* True if we should append data to the initial target file, instead of
147147
* overwriting it.
148148
*/
149-
bool mAppend{false};
149+
bool mAppend;
150150

151151
/**
152152
* This is set by the first SetTarget call on the control thread, and contains
@@ -161,7 +161,7 @@ class BackgroundFileSaver : public nsIBackgroundFileSaver {
161161
* indicates whether mInitialTarget should be kept as partially completed,
162162
* rather than deleted, if the operation fails or is canceled.
163163
*/
164-
bool mInitialTargetKeepPartial{false};
164+
bool mInitialTargetKeepPartial;
165165

166166
/**
167167
* This is set by subsequent SetTarget calls on the control thread, and
@@ -179,7 +179,7 @@ class BackgroundFileSaver : public nsIBackgroundFileSaver {
179179
* indicates whether mRenamedTarget should be kept as partially completed,
180180
* rather than deleted, if the operation fails or is canceled.
181181
*/
182-
bool mRenamedTargetKeepPartial{false};
182+
bool mRenamedTargetKeepPartial;
183183

184184
/**
185185
* While NS_AsyncCopy is in progress, allows canceling it. Null otherwise.
@@ -197,7 +197,7 @@ class BackgroundFileSaver : public nsIBackgroundFileSaver {
197197
* Whether or not to compute the hash. Must be set on the main thread before
198198
* setTarget is called.
199199
*/
200-
bool mSha256Enabled{false};
200+
bool mSha256Enabled;
201201

202202
/**
203203
* Store the signature info.
@@ -208,7 +208,7 @@ class BackgroundFileSaver : public nsIBackgroundFileSaver {
208208
* Whether or not to extract the signature. Must be set on the main thread
209209
* before setTarget is called.
210210
*/
211-
bool mSignatureInfoEnabled{false};
211+
bool mSignatureInfoEnabled;
212212

213213
//////////////////////////////////////////////////////////////////////////////
214214
//// State handled exclusively by the worker thread
@@ -222,7 +222,7 @@ class BackgroundFileSaver : public nsIBackgroundFileSaver {
222222
* Indicates whether mActualTarget should be kept as partially completed,
223223
* rather than deleted, if the operation fails or is canceled.
224224
*/
225-
bool mActualTargetKeepPartial{false};
225+
bool mActualTargetKeepPartial;
226226

227227
/**
228228
* Used to calculate the file hash. This keeps state across file renames and
@@ -327,7 +327,7 @@ class BackgroundFileSaverStreamListener final : public BackgroundFileSaver,
327327
NS_DECL_NSIREQUESTOBSERVER
328328
NS_DECL_NSISTREAMLISTENER
329329

330-
BackgroundFileSaverStreamListener() = default;
330+
BackgroundFileSaverStreamListener();
331331

332332
protected:
333333
virtual bool HasInfiniteBuffer() override;
@@ -339,13 +339,12 @@ class BackgroundFileSaverStreamListener final : public BackgroundFileSaver,
339339
/**
340340
* Protects the state related to whether the request should be suspended.
341341
*/
342-
mozilla::Mutex mSuspensionLock{
343-
"BackgroundFileSaverStreamListener.mSuspensionLock"};
342+
mozilla::Mutex mSuspensionLock;
344343

345344
/**
346345
* Whether we should suspend the request because we received too much data.
347346
*/
348-
bool mReceivedTooMuchData{false};
347+
bool mReceivedTooMuchData;
349348

350349
/**
351350
* Request for which we received too much data. This is populated when
@@ -356,7 +355,7 @@ class BackgroundFileSaverStreamListener final : public BackgroundFileSaver,
356355
/**
357356
* Whether mRequest is currently suspended.
358357
*/
359-
bool mRequestSuspended{false};
358+
bool mRequestSuspended;
360359

361360
/**
362361
* Called while NS_AsyncCopy is copying data.

netwerk/base/Dashboard.cpp

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,17 @@ class SocketData : public nsISupports {
3838
public:
3939
NS_DECL_THREADSAFE_ISUPPORTS
4040

41-
SocketData() = default;
41+
SocketData() {
42+
mTotalSent = 0;
43+
mTotalRecv = 0;
44+
mEventTarget = nullptr;
45+
}
4246

43-
uint64_t mTotalSent{0};
44-
uint64_t mTotalRecv{0};
47+
uint64_t mTotalSent;
48+
uint64_t mTotalRecv;
4549
nsTArray<SocketInfo> mData;
4650
nsMainThreadPtrHandle<nsINetDashboardCallback> mCallback;
47-
nsIEventTarget* mEventTarget{nullptr};
51+
nsIEventTarget* mEventTarget;
4852

4953
private:
5054
virtual ~SocketData() = default;
@@ -60,11 +64,11 @@ class HttpData : public nsISupports {
6064
public:
6165
NS_DECL_THREADSAFE_ISUPPORTS
6266

63-
HttpData() = default;
67+
HttpData() { mEventTarget = nullptr; }
6468

6569
nsTArray<HttpRetParams> mData;
6670
nsMainThreadPtrHandle<nsINetDashboardCallback> mCallback;
67-
nsIEventTarget* mEventTarget{nullptr};
71+
nsIEventTarget* mEventTarget;
6872
};
6973

7074
NS_IMPL_ISUPPORTS0(HttpData)
@@ -75,10 +79,10 @@ class WebSocketRequest : public nsISupports {
7579
public:
7680
NS_DECL_THREADSAFE_ISUPPORTS
7781

78-
WebSocketRequest() = default;
82+
WebSocketRequest() { mEventTarget = nullptr; }
7983

8084
nsMainThreadPtrHandle<nsINetDashboardCallback> mCallback;
81-
nsIEventTarget* mEventTarget{nullptr};
85+
nsIEventTarget* mEventTarget;
8286
};
8387

8488
NS_IMPL_ISUPPORTS0(WebSocketRequest)
@@ -89,11 +93,11 @@ class DnsData : public nsISupports {
8993
public:
9094
NS_DECL_THREADSAFE_ISUPPORTS
9195

92-
DnsData() = default;
96+
DnsData() { mEventTarget = nullptr; }
9397

9498
nsTArray<DNSCacheEntries> mData;
9599
nsMainThreadPtrHandle<nsINetDashboardCallback> mCallback;
96-
nsIEventTarget* mEventTarget{nullptr};
100+
nsIEventTarget* mEventTarget;
97101
};
98102

99103
NS_IMPL_ISUPPORTS0(DnsData)
@@ -120,19 +124,22 @@ class ConnectionData : public nsITransportEventSink,
120124
void StartTimer(uint32_t aTimeout);
121125
void StopTimer();
122126

123-
explicit ConnectionData(Dashboard* target) { mDashboard = target; }
127+
explicit ConnectionData(Dashboard* target) : mPort(0), mTimeout(0) {
128+
mEventTarget = nullptr;
129+
mDashboard = target;
130+
}
124131

125132
nsCOMPtr<nsISocketTransport> mSocket;
126133
nsCOMPtr<nsIInputStream> mStreamIn;
127134
nsCOMPtr<nsITimer> mTimer;
128135
nsMainThreadPtrHandle<nsINetDashboardCallback> mCallback;
129-
nsIEventTarget* mEventTarget{nullptr};
136+
nsIEventTarget* mEventTarget;
130137
Dashboard* mDashboard;
131138

132139
nsCString mHost;
133-
uint32_t mPort{0};
140+
uint32_t mPort;
134141
nsCString mProtocol;
135-
uint32_t mTimeout{0};
142+
uint32_t mTimeout;
136143

137144
nsString mStatus;
138145
};
@@ -146,10 +153,10 @@ class RcwnData : public nsISupports {
146153
public:
147154
NS_DECL_THREADSAFE_ISUPPORTS
148155

149-
RcwnData() = default;
156+
RcwnData() { mEventTarget = nullptr; }
150157

151158
nsMainThreadPtrHandle<nsINetDashboardCallback> mCallback;
152-
nsIEventTarget* mEventTarget{nullptr};
159+
nsIEventTarget* mEventTarget;
153160
};
154161

155162
NS_IMPL_ISUPPORTS0(RcwnData)
@@ -236,16 +243,16 @@ class LookupHelper final : public nsIDNSListener {
236243
NS_DECL_THREADSAFE_ISUPPORTS
237244
NS_DECL_NSIDNSLISTENER
238245

239-
LookupHelper() = default;
246+
LookupHelper() : mEventTarget{nullptr}, mStatus{NS_ERROR_NOT_INITIALIZED} {}
240247

241248
nsresult ConstructAnswer(LookupArgument* aArgument);
242249
nsresult ConstructHTTPSRRAnswer(LookupArgument* aArgument);
243250

244251
public:
245252
nsCOMPtr<nsICancelable> mCancel;
246253
nsMainThreadPtrHandle<nsINetDashboardCallback> mCallback;
247-
nsIEventTarget* mEventTarget{nullptr};
248-
nsresult mStatus{NS_ERROR_NOT_INITIALIZED};
254+
nsIEventTarget* mEventTarget;
255+
nsresult mStatus;
249256
};
250257

251258
NS_IMPL_ISUPPORTS(LookupHelper, nsIDNSListener)

netwerk/base/LoadInfo.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ LoadInfo::LoadInfo(
104104
mLoadingContext(do_GetWeakReference(aLoadingContext)),
105105
mSecurityFlags(aSecurityFlags),
106106
mSandboxFlags(aSandboxFlags),
107-
107+
mTriggeringSandboxFlags(0),
108108
mInternalContentPolicyType(aContentPolicyType) {
109109
MOZ_ASSERT(mLoadingPrincipal);
110110
MOZ_ASSERT(mTriggeringPrincipal);
@@ -320,7 +320,7 @@ LoadInfo::LoadInfo(nsPIDOMWindowOuter* aOuterWindow,
320320
mContextForTopLevelLoad(do_GetWeakReference(aContextForTopLevelLoad)),
321321
mSecurityFlags(aSecurityFlags),
322322
mSandboxFlags(aSandboxFlags),
323-
323+
mTriggeringSandboxFlags(0),
324324
mInternalContentPolicyType(nsIContentPolicy::TYPE_DOCUMENT) {
325325
// Top-level loads are never third-party
326326
// Grab the information we can out of the window.
@@ -379,7 +379,7 @@ LoadInfo::LoadInfo(dom::CanonicalBrowsingContext* aBrowsingContext,
379379
: mTriggeringPrincipal(aTriggeringPrincipal),
380380
mSecurityFlags(aSecurityFlags),
381381
mSandboxFlags(aSandboxFlags),
382-
382+
mTriggeringSandboxFlags(0),
383383
mInternalContentPolicyType(nsIContentPolicy::TYPE_DOCUMENT) {
384384
// Top-level loads are never third-party
385385
// Grab the information we can out of the window.
@@ -575,7 +575,9 @@ LoadInfo::LoadInfo(const LoadInfo& rhs)
575575
mForcePreflight(rhs.mForcePreflight),
576576
mIsPreflight(rhs.mIsPreflight),
577577
mLoadTriggeredFromExternal(rhs.mLoadTriggeredFromExternal),
578-
578+
// mServiceWorkerTaintingSynthesized must be handled specially during
579+
// redirect
580+
mServiceWorkerTaintingSynthesized(false),
579581
mDocumentHasUserInteracted(rhs.mDocumentHasUserInteracted),
580582
mAllowListFutureDocumentsCreatedFromThisRedirectChain(
581583
rhs.mAllowListFutureDocumentsCreatedFromThisRedirectChain),
@@ -700,7 +702,9 @@ LoadInfo::LoadInfo(
700702
mParserCreatedScript(aParserCreatedScript),
701703
mHasStoragePermission(aHasStoragePermission),
702704
mIsMetaRefresh(aIsMetaRefresh),
703-
705+
mIsFromProcessingFrameAttributes(false),
706+
mIsMediaRequest(false),
707+
mIsMediaInitialRequest(false),
704708
mLoadingEmbedderPolicy(aLoadingEmbedderPolicy),
705709
mUnstrippedURI(aUnstrippedURI) {
706710
// Only top level TYPE_DOCUMENT loads can have a null loadingPrincipal

netwerk/base/PollableEvent.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,11 @@ static bool NewTCPSocketPair(PRFileDesc* fd[], bool aSetRecvBuff) {
138138
#endif
139139

140140
PollableEvent::PollableEvent()
141-
142-
{
141+
: mWriteFD(nullptr),
142+
mReadFD(nullptr),
143+
mSignaled(false),
144+
mWriteFailed(false),
145+
mSignalTimestampAdjusted(false) {
143146
MOZ_COUNT_CTOR(PollableEvent);
144147
MOZ_ASSERT(OnSocketThread(), "not on socket thread");
145148
// create pair of prfiledesc that can be used as a poll()ble

0 commit comments

Comments
 (0)