зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1652189 - SendOnStartRequestSent only for main document, r=mayhemer,necko-reviewers
Even if loadflag contains LOAD_DOCUMENT_NEEDS_COOKIE, we update cookie only for the main documen https://searchfox.org/mozilla-central/rev/9b282b34b5aa0f836beb735656c55efb2cc4c617/dom/ipc/ContentParent.cpp#5704 Hence, we don't need to wait for main thread IPC to proceed HttpChannelChild::OnStartRequest Differential Revision: https://phabricator.services.mozilla.com/D84275
This commit is contained in:
Родитель
d2c028c682
Коммит
ddaa9f30b2
|
@ -5667,9 +5667,13 @@ void ContentParent::UpdateCookieStatus(nsIChannel* aChannel) {
|
|||
}
|
||||
|
||||
nsresult ContentParent::AboutToLoadHttpFtpDocumentForChild(
|
||||
nsIChannel* aChannel) {
|
||||
nsIChannel* aChannel, bool* aShouldWaitForPermissionCookieUpdate) {
|
||||
MOZ_ASSERT(aChannel);
|
||||
|
||||
if (aShouldWaitForPermissionCookieUpdate) {
|
||||
*aShouldWaitForPermissionCookieUpdate = false;
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
bool isDocument = aChannel->IsDocument();
|
||||
if (!isDocument) {
|
||||
|
@ -5696,6 +5700,12 @@ nsresult ContentParent::AboutToLoadHttpFtpDocumentForChild(
|
|||
rv = ssm->GetChannelResultPrincipal(aChannel, getter_AddRefs(principal));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Let the caller know we're going to send main thread IPC for updating
|
||||
// permisssions/cookies.
|
||||
if (aShouldWaitForPermissionCookieUpdate) {
|
||||
*aShouldWaitForPermissionCookieUpdate = true;
|
||||
}
|
||||
|
||||
TransmitBlobURLsForPrincipal(principal);
|
||||
|
||||
rv = TransmitPermissionsForPrincipal(principal);
|
||||
|
|
|
@ -614,7 +614,11 @@ class ContentParent final
|
|||
// HTTP(S) or FTP channel for a content process. It is a useful place
|
||||
// to start to kick off work as early as possible in response to such
|
||||
// document loads.
|
||||
nsresult AboutToLoadHttpFtpDocumentForChild(nsIChannel* aChannel);
|
||||
// aShouldWaitForPermissionCookieUpdate is set to true if main thread IPCs for
|
||||
// updating permissions/cookies are sent.
|
||||
nsresult AboutToLoadHttpFtpDocumentForChild(
|
||||
nsIChannel* aChannel,
|
||||
bool* aShouldWaitForPermissionCookieUpdate = nullptr);
|
||||
|
||||
// Send Blob URLs for this aPrincipal if they are not already known to this
|
||||
// content process and mark the process to receive any new/revoked Blob URLs
|
||||
|
|
|
@ -480,8 +480,8 @@ class HttpChannelChild final : public PHttpChannelChild,
|
|||
// True if RecvOnStartRequestSent was received.
|
||||
uint8_t mRecvOnStartRequestSentCalled : 1;
|
||||
|
||||
// True if this channel is suspened by waiting for permission or cookie.
|
||||
// That is, RecvOnStartRequestSent is received.
|
||||
// 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;
|
||||
|
||||
void FinishInterceptedRedirect();
|
||||
|
|
|
@ -1408,18 +1408,19 @@ HttpChannelParent::OnStartRequest(nsIRequest* aRequest) {
|
|||
"HttpChannelParent getting OnStartRequest from a different "
|
||||
"HttpBaseChannel instance");*/
|
||||
|
||||
// Send down any permissions which are relevant to this URL if we are
|
||||
HttpChannelOnStartRequestArgs args;
|
||||
|
||||
// Send down any permissions/cookies which are relevant to this URL if we are
|
||||
// performing a document load. We can't do that if mIPCClosed is set.
|
||||
if (!mIPCClosed) {
|
||||
PContentParent* pcp = Manager()->Manager();
|
||||
MOZ_ASSERT(pcp, "We should have a manager if our IPC isn't closed");
|
||||
DebugOnly<nsresult> rv =
|
||||
static_cast<ContentParent*>(pcp)->AboutToLoadHttpFtpDocumentForChild(
|
||||
chan);
|
||||
chan, &args.shouldWaitForOnStartRequestSent());
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
}
|
||||
|
||||
HttpChannelOnStartRequestArgs args;
|
||||
args.multiPartID() = multiPartID;
|
||||
args.isLastPartOfMultiPart() = isLastPartOfMultiPart;
|
||||
|
||||
|
@ -1537,18 +1538,6 @@ HttpChannelParent::OnStartRequest(nsIRequest* aRequest) {
|
|||
cleanedUpRequest = true;
|
||||
}
|
||||
|
||||
bool isDocument = chan->IsDocument();
|
||||
if (!isDocument) {
|
||||
rv = chan->GetIsMainDocumentChannel(&isDocument);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
nsLoadFlags loadflags;
|
||||
chan->GetLoadFlags(&loadflags);
|
||||
bool documentNeedsCookie = loadflags & nsIRequest::LOAD_DOCUMENT_NEEDS_COOKIE;
|
||||
|
||||
args.shouldWaitForOnStartRequestSent() = isDocument || documentNeedsCookie;
|
||||
|
||||
rv = NS_OK;
|
||||
|
||||
if (mIPCClosed ||
|
||||
|
|
Загрузка…
Ссылка в новой задаче