michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim: set sw=2 ts=8 et tw=80 ft=cpp : */ michael@0: michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: include protocol PNecko; michael@0: include InputStreamParams; michael@0: include URIParams; michael@0: michael@0: include protocol PBlob; //FIXME: bug #792908 michael@0: michael@0: include "mozilla/net/NeckoMessageUtils.h"; michael@0: michael@0: using RequestHeaderTuples from "mozilla/net/PHttpChannelParams.h"; michael@0: using class nsHttpHeaderArray from "nsHttpHeaderArray.h"; michael@0: using class nsHttpResponseHead from "nsHttpResponseHead.h"; michael@0: using struct nsHttpAtom from "nsHttp.h"; michael@0: using mozilla::net::NetAddr from "mozilla/net/DNS.h"; michael@0: michael@0: namespace mozilla { michael@0: namespace net { michael@0: michael@0: //------------------------------------------------------------------- michael@0: protocol PHttpChannel michael@0: { michael@0: manager PNecko; michael@0: michael@0: parent: michael@0: // Note: channels are opened during construction, so no open method here: michael@0: // see PNecko.ipdl michael@0: michael@0: SetPriority(uint16_t priority); michael@0: michael@0: SetCacheTokenCachedCharset(nsCString charset); michael@0: michael@0: UpdateAssociatedContentSecurity(int32_t broken, michael@0: int32_t no); michael@0: Suspend(); michael@0: Resume(); michael@0: michael@0: Cancel(nsresult status); michael@0: michael@0: // Reports approval/veto of redirect by child process redirect observers michael@0: Redirect2Verify(nsresult result, RequestHeaderTuples changedHeaders, michael@0: OptionalURIParams apiRedirectTo); michael@0: michael@0: // For document loads we keep this protocol open after child's michael@0: // OnStopRequest, and send this msg (instead of __delete__) to allow michael@0: // partial cleanup on parent. michael@0: DocumentChannelCleanup(); michael@0: michael@0: // This might have to be sync. If this fails we must fail the document load michael@0: // to avoid endless loop. michael@0: // michael@0: // Explanation: the document loaded was loaded from the offline cache. But michael@0: // the cache group id (the manifest URL) of the cache group it was loaded michael@0: // from is different then the manifest the document refers to in the html michael@0: // tag. If we detect this during the cache selection algorithm, we must not michael@0: // load this document from the offline cache group it was just loaded from. michael@0: // Marking the cache entry as foreign in its cache group will prevent michael@0: // the document to load from the bad offline cache group. After it is marked, michael@0: // we reload the document to take the effect. If we fail to mark the entry michael@0: // as foreign, we will end up in the same situation and reload again and michael@0: // again, indefinitely. michael@0: MarkOfflineCacheEntryAsForeign(); michael@0: michael@0: // Divert OnDataAvailable to the parent. michael@0: DivertOnDataAvailable(nsCString data, michael@0: uint64_t offset, michael@0: uint32_t count); michael@0: michael@0: // Divert OnStopRequest to the parent. michael@0: DivertOnStopRequest(nsresult statusCode); michael@0: michael@0: // Child has no more events/messages to divert to the parent. michael@0: DivertComplete(); michael@0: michael@0: __delete__(); michael@0: michael@0: child: michael@0: OnStartRequest(nsresult channelStatus, michael@0: nsHttpResponseHead responseHead, michael@0: bool useResponseHead, michael@0: nsHttpHeaderArray requestHeaders, michael@0: bool isFromCache, michael@0: bool cacheEntryAvailable, michael@0: uint32_t cacheExpirationTime, michael@0: nsCString cachedCharset, michael@0: nsCString securityInfoSerialization, michael@0: NetAddr selfAddr, michael@0: NetAddr peerAddr, michael@0: int16_t redirectCount); michael@0: michael@0: // Combines a single OnDataAvailable and its associated OnProgress & michael@0: // OnStatus calls into one IPDL message michael@0: OnTransportAndData(nsresult channelStatus, michael@0: nsresult transportStatus, michael@0: uint64_t progress, michael@0: uint64_t progressMax, michael@0: nsCString data, michael@0: uint64_t offset, michael@0: uint32_t count); michael@0: michael@0: OnStopRequest(nsresult channelStatus); michael@0: michael@0: OnProgress(uint64_t progress, uint64_t progressMax); michael@0: michael@0: OnStatus(nsresult status); michael@0: michael@0: // Used to cancel child channel if we hit errors during creating and michael@0: // AsyncOpen of nsHttpChannel on the parent. michael@0: FailedAsyncOpen(nsresult status); michael@0: michael@0: // Called to initiate content channel redirect, starts talking to sinks michael@0: // on the content process and reports result via Redirect2Verify above michael@0: Redirect1Begin(uint32_t newChannelId, michael@0: URIParams newUri, michael@0: uint32_t redirectFlags, michael@0: nsHttpResponseHead responseHead); michael@0: michael@0: // Called if redirect successful so that child can complete setup. michael@0: Redirect3Complete(); michael@0: michael@0: // Associte the child with an application ids michael@0: AssociateApplicationCache(nsCString groupID, michael@0: nsCString clientID); michael@0: michael@0: // Parent has been suspended for diversion; no more events to be enqueued. michael@0: FlushedForDiversion(); michael@0: michael@0: // Child should resume processing the ChannelEventQueue, i.e. diverting any michael@0: // OnDataAvailable and OnStopRequest messages in the queue back to the parent. michael@0: DivertMessages(); michael@0: michael@0: // Tell child to delete channel (all IPDL deletes must be done from child to michael@0: // avoid races: see bug 591708). michael@0: DeleteSelf(); michael@0: }; michael@0: michael@0: michael@0: } // namespace net michael@0: } // namespace mozilla michael@0: