зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1640160 - Serialize mRequestContextId with BrowsingContext's IPCInitializer to ensure that we don't try to create a request context with an id of 0. r=nika
This was a bit of pain to track down, because some code was allowing an ID of 0, and creating a request context to match, but other code was treating 0 as invalid. Differential Revision: https://phabricator.services.mozilla.com/D76652
This commit is contained in:
Родитель
236de553f6
Коммит
38ffa87e05
|
@ -2383,6 +2383,7 @@ void IPDLParamTraits<dom::BrowsingContext::IPCInitializer>::Write(
|
|||
WriteIPDLParam(aMessage, aActor, aInit.mUseRemoteTabs);
|
||||
WriteIPDLParam(aMessage, aActor, aInit.mUseRemoteSubframes);
|
||||
WriteIPDLParam(aMessage, aActor, aInit.mOriginAttributes);
|
||||
WriteIPDLParam(aMessage, aActor, aInit.mRequestContextId);
|
||||
WriteIPDLParam(aMessage, aActor, aInit.mFields);
|
||||
}
|
||||
|
||||
|
@ -2397,6 +2398,7 @@ bool IPDLParamTraits<dom::BrowsingContext::IPCInitializer>::Read(
|
|||
!ReadIPDLParam(aMessage, aIterator, aActor,
|
||||
&aInit->mUseRemoteSubframes) ||
|
||||
!ReadIPDLParam(aMessage, aIterator, aActor, &aInit->mOriginAttributes) ||
|
||||
!ReadIPDLParam(aMessage, aIterator, aActor, &aInit->mRequestContextId) ||
|
||||
!ReadIPDLParam(aMessage, aIterator, aActor, &aInit->mFields)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -505,6 +505,10 @@ RequestContextService::GetRequestContext(const uint64_t rcID,
|
|||
return NS_ERROR_ILLEGAL_DURING_SHUTDOWN;
|
||||
}
|
||||
|
||||
if (!rcID) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
if (!mTable.Get(rcID, rc)) {
|
||||
nsCOMPtr<nsIRequestContext> newSC = new RequestContext(rcID);
|
||||
mTable.Put(rcID, newSC);
|
||||
|
|
|
@ -143,6 +143,9 @@ nsresult nsDocLoader::Init() {
|
|||
nsresult nsDocLoader::InitWithBrowsingContext(
|
||||
BrowsingContext* aBrowsingContext) {
|
||||
RefPtr<net::nsLoadGroup> loadGroup = new net::nsLoadGroup();
|
||||
if (!aBrowsingContext->GetRequestContextId()) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
nsresult rv = loadGroup->InitWithRequestContextId(
|
||||
aBrowsingContext->GetRequestContextId());
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
|
Загрузка…
Ссылка в новой задаче