/* 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/. */
class HttpChannelChild final : public PHttpChannelChild, public HttpBaseChannel, public HttpAsyncAborter<HttpChannelChild>, public nsICacheInfoChannel, public nsIProxiedChannel, public nsIAsyncVerifyRedirectCallback, public nsIChildChannel, public nsIHttpChannelChild, public nsIMultiPartChannel, public nsIThreadRetargetableRequest, public NeckoTargetHolder { virtual ~HttpChannelChild();
// Callback while background channel is ready. void OnBackgroundChildReady(HttpBackgroundChannelChild* aBgChild); // Callback while background channel is destroyed. void OnBackgroundChildDestroyed(HttpBackgroundChannelChild* aBgChild);
nsresult AsyncCall( void (HttpChannelChild::*funcPtr)(),
nsRunnableMethod<HttpChannelChild>** retval = nullptr) override { // Normally, this method would just be implemented directly, but clang // miscompiles the corresponding non-virtual thunk on linux x86. // It however doesn't when going though a non-virtual method. // https://bugs.llvm.org/show_bug.cgi?id=38466 return AsyncCallImpl(funcPtr, retval);
};
// Get event target for processing network events.
already_AddRefed<nsISerialEventTarget> GetNeckoTarget() override;
private: // We want to handle failure result of AsyncOpen, hence AsyncOpen calls the // Internal method
nsresult AsyncOpenInternal(nsIStreamListener* aListener);
// Sets the event target for future IPC messages. Messages will either be // directed to the TabGroup or DocGroup, depending on the LoadInfo associated // with the channel. Should be called when a new channel is being set up, // before the constructor message is sent to the parent. void SetEventTarget();
// Get event target for ODA.
already_AddRefed<nsIEventTarget> GetODATarget();
// Try send DeletingChannel message to parent side. Dispatch an async task to // main thread if invoking on non-main thread. void TrySendDeletingChannel();
// Try invoke Cancel if on main thread, or prepend a CancelEvent in mEventQ to // ensure Cacnel is processed before any other channel events. void CancelOnMainThread(nsresult aRv, const nsACString& aReason);
private: // this section is for main-thread-only object // all the references need to be proxy released on main thread.
nsCOMPtr<nsIChildChannel> mRedirectChannelChild;
// Proxy release all members above on main thread. void ReleaseMainThreadOnlyReferences();
// If we're handling a multi-part response, then this is set to the current // part ID during OnStartRequest.
Maybe<uint32_t> mMultiPartID;
// To ensure only one SendDeletingChannel is triggered.
Atomic<bool> mDeletingChannelSent{false};
Atomic<bool, SequentiallyConsistent> mIsFromCache{false};
Atomic<bool, SequentiallyConsistent> mIsRacing{false}; // Set if we get the result and cache |mNeedToReportBytesRead|
Atomic<bool, SequentiallyConsistent> mCacheNeedToReportBytesReadInitialized{ false}; // True if we need to tell the parent the size of unreported received data
Atomic<bool, SequentiallyConsistent> mNeedToReportBytesRead{true};
Atomic<uint32_t, mozilla::Relaxed> mOnProgressEventSent{false}; // Attached StreamFilterParents // Using raw pointer here since StreamFilterParent owns the channel. // Should be only accessed on the main thread. using StreamFilters = nsTArray<extensions::StreamFilterParent*>;
StreamFilters mStreamFilters;
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED bool mDoDiagnosticAssertWhenOnStopNotCalledOnDestroy = false; bool mAsyncOpenSucceeded = false; bool mSuccesfullyRedirected = false; bool mRemoteChannelExistedAtCancel = false; bool mEverHadBgChildAtAsyncOpen = false; bool mEverHadBgChildAtConnectParent = false; bool mCreateBackgroundChannelFailed = false; bool mBgInitFailCallbackTriggered = false; bool mCanSendAtCancel = false; // State of the HttpBackgroundChannelChild's event queue during destruction. enum BckChildQueueStatus { // BckChild never told us
BCKCHILD_UNKNOWN, // BckChild was empty at the time of destruction
BCKCHILD_EMPTY, // BckChild was keeping events in the queue at the destruction time!
BCKCHILD_NON_EMPTY
};
Atomic<BckChildQueueStatus> mBackgroundChildQueueFinalState{BCKCHILD_UNKNOWN};
Maybe<ActorDestroyReason> mActorDestroyReason; #endif
// If ResumeAt is called before AsyncOpen, we need to send extra data upstream
uint8_t mSendResumeAt : 1;
uint8_t mKeptAlive : 1; // IPC kept open, but only for security info
// Set when ActorDestroy(ActorDestroyReason::Deletion) is called // The channel must ignore any following OnStart/Stop/DataAvailable messages
uint8_t mIPCActorDeleted : 1;
// Set if SendSuspend is called. Determines if SendResume is needed when // diverting callbacks to parent.
uint8_t mSuspendSent : 1;
// True if this channel is a multi-part channel, and the first part // is currently being processed.
uint8_t mIsFirstPartOfMultiPart : 1;
// True if this channel is a multi-part channel, and the last part // is currently being processed.
uint8_t mIsLastPartOfMultiPart : 1;
// True if this channel is suspended by ConnectParent and not resumed by // CompleteRedirectSetup/RecvDeleteSelf.
uint8_t mSuspendForWaitCompleteRedirectSetup : 1;
// True if RecvOnStartRequestSent was received.
uint8_t mRecvOnStartRequestSentCalled : 1;
// True if this channel is for a document and suspended by waiting for // permission or cookie. That is, RecvOnStartRequestSent is received.
uint8_t mSuspendedByWaitingForPermissionCookie : 1;
// HttpChannelChild::Release has some special logic that makes sure // OnStart/OnStop are always called when releasing the channel. // But we have to make sure we only do this once - otherwise we could // get stuck in a loop.
uint8_t mAlreadyReleased : 1;
void CleanupRedirectingChannel(nsresult rv);
// Calls OnStartRequest and/or OnStopRequest on our listener in case we didn't // do that so far. If we already did, it will just release references to // cleanup. void NotifyOrReleaseListeners(nsresult rv);
// true after successful AsyncOpen until OnStopRequest completes. bool RemoteChannelExists() { return CanSend() && !mKeptAlive; }
// Create a a new channel to be used in a redirection, based on the provided // response headers.
[[nodiscard]] nsresult SetupRedirect(nsIURI* uri, const nsHttpResponseHead* responseHead, const uint32_t& redirectFlags,
nsIChannel** outChannel);
// Collect telemetry for mixed content. void CollectMixedContentTelemetry();
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.